ix.iview.domain
Class UIRefinement

java.lang.Object
  |
  +--ix.iview.domain.UIRefinement
All Implemented Interfaces:
Named, SchemaTerms, javax.swing.tree.TreeNode, UIObject

public class UIRefinement
extends java.lang.Object
implements UIObject, Named, SchemaTerms, javax.swing.tree.TreeNode

Mirrors the domain's Refinement and adds UI, Graph, and TreeNode things


Inner Class Summary
 class UIRefinement.ConstraintTypeException
           
 class UIRefinement.NodeTypeException
           
 
Field Summary
protected  Refinement baseObject
           
protected  java.lang.String baseReference
           
 java.lang.String comments
           
 java.util.List constraints
           
protected  IGraph graph
          name of the original refinement
 java.util.List issues
           
 java.lang.String name
           
 java.util.List nodes
           
 java.util.List orderings
           
 LList pattern
           
protected  UIDomain uiDomain
           
 java.util.List variableDeclarations
           
 
Fields inherited from interface ix.icore.domain.SchemaTerms
O_NONE, O_OTHER, O_PARALLEL, O_SEQUENCE
 
Constructor Summary
UIRefinement(UIDomain uiDomain)
           
UIRefinement(UIDomain uiDomain, Refinement original)
           
 
Method Summary
 void addConstraint(java.lang.Object newValue)
           
 void addIssue(Issue issue)
           
 void addNode(NodeSpec node)
           
 void addOrdering(Constraint newValue)
           
 void addOrdering(Ordering newValue)
           
 void addToDomain()
           
 void addToDomain(Domain domain)
          Adds the contents of this UIObject to the domain (part of publish).
 java.util.Enumeration children()
           
 void clearConstraints()
           
 void clearIssues()
           
 void clearNodes()
           
 void clearOrderings()
           
 void clearPattern()
           
 UIRefinement cloneThis()
           
static boolean constraintMentionsNode(Constraint c, Name nodeId)
           
static boolean constraintMentionsNode(Ordering o, Name nodeId)
           
 void deleteIssue(Issue issue)
           
 void deleteNode(NodeSpec node)
           
protected  void deleteNodeConstraints(NodeSpec node)
           
 NodeSpec findNode(Name id)
           
 boolean getAllowsChildren()
           
 java.lang.Class getBaseClass()
          Gets the class of objects that can represent this one in the domain.
 IXObject getBaseObject()
          Gets the object that corresponds to this one in the domain.
 java.lang.Object getBaseReference()
          Gets the Id that can be used to identify the base object in the domain.
 javax.swing.tree.TreeNode getChildAt(int index)
           
 int getChildCount()
           
 java.lang.String getComments()
           
 java.util.List getConditions()
           
 java.util.List getConstraints()
           
 Domain getDomain()
          Gets the base domain.
 IGraph getGraph()
           
 Name getHighestNodeId()
           
static Name getHighestNodeId(java.util.List nodes)
           
 int getIndex(javax.swing.tree.TreeNode node)
           
 java.util.List getIssues()
           
 java.lang.String getName()
           
 Name getNewNodeId()
           
 java.util.List getNodes()
           
 java.util.List getOrderings()
           
 java.lang.String getOrderingType()
          Gets the refinement's ordering type (none, parallel, sequence, other).
 java.util.List getOtherConstraints()
           
 javax.swing.tree.TreeNode getParent()
           
 LList getPattern()
           
 UIDomain getUIDomain()
          Gets the ui domain of which this object is part.
 boolean hasAnonConstraints()
           
 boolean hasChanged()
          Finds out whether the refinement has changed from the base-object (i.e.
 boolean hasChanged(Refinement original)
          Finds out whether the refinement has changed from the given object.
 boolean hasChangedFromOriginal()
          Finds out whether the refinement has changed from the original.
 boolean hasChangedNoDebug(Refinement original)
          Finds out whether the refinement has changed from the given object.
 boolean hasConditions()
           
 boolean hasOrderings()
           
 boolean hasOriginal()
          Determines whether the object has an original in the base domain.
 boolean isEmpty()
          A refinement is empty if all its data fields are empty.
 boolean isEmpty(Refinement refinement)
          A refinement is empty if all its data fields are empty.
 boolean isLeaf()
           
static boolean isRef(NodeSpec node, java.lang.Object o)
          Check whether the given object is a reference to the given node.
 void loadFromDomain()
          Loads this object from its baseObject.
 void loadFromDomain(java.lang.Object domainObject)
          Loads the contents of this object from the given object.
 void loadFromOriginal()
          Loads this object from its original in the domain if it has one, otherwise clear the object.
 IXObject makeBaseObject()
          Makes an empty object of the right class that can represent this UIObject in the domain.
 java.util.List makeSequence()
           
 boolean matchesPattern(LList pattern)
           
 void moveToUIDomain(UIDomain uiDomain)
          Move the object from its current UIDomain to the given one.
 boolean nameHasChanged(java.lang.Object nameThing)
          Determines whether the object's identifying fields have changed
 void noteChange()
          Get the UIDomain to note the change of this object
 boolean orderingsAreSequential()
          Checks whether the orderings are a sequence of the nodes.
static java.util.List parseIssues(UIDomain uiDomain, java.lang.String sIssues)
          Builds a LList of nodes from a string that contains node descriptions.
static java.util.List parseNodes(UIDomain uiDomain, java.lang.String expansion)
          Builds a LList of nodes from a string that contains node descriptions.
 java.lang.String print()
           
 void removeFromDomain()
           
 void removeFromDomain(Domain domain)
          Removes the object's corresponding base object from the domain.
 void removeGraph(IGraph g)
           
 void saveToDomain()
          Saves this object into a suitable baseObject.
 void saveToDomain(java.lang.Object domainObject)
          Saves the contents of this object into the given object.
 void setBaseObject(IXObject object)
          Sets the object that will represent this one in the domain.
 void setBaseReference(java.lang.Object ref)
          Sets the Id that can be used to identify the base object in the domain.
 void setComments(java.lang.String comments)
           
 void setConditions(java.util.List conditions)
           
 void setConstraints(java.util.List cs)
           
 void setGraph(IGraph g)
           
 void setIssues(java.util.List issues)
           
 void setName(java.lang.String name)
           
 void setNodes(java.util.List nodes)
           
 void setOrderings(java.util.List orderings)
           
 void setOtherConstraints(java.util.List constraints)
           
 void setPattern(LList pattern)
           
 java.lang.String toString()
           
 void updateInDomain()
           
 void updateInDomain(Domain domain)
          Updates the base object in the domain with the contents of this object.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public java.lang.String name

pattern

public LList pattern

nodes

public java.util.List nodes

orderings

public java.util.List orderings

constraints

public java.util.List constraints

issues

public java.util.List issues

comments

public java.lang.String comments

variableDeclarations

public java.util.List variableDeclarations

uiDomain

protected UIDomain uiDomain

baseObject

protected Refinement baseObject

baseReference

protected java.lang.String baseReference

graph

protected IGraph graph
name of the original refinement
Constructor Detail

UIRefinement

public UIRefinement(UIDomain uiDomain)

UIRefinement

public UIRefinement(UIDomain uiDomain,
                    Refinement original)
Method Detail

cloneThis

public UIRefinement cloneThis()

getName

public java.lang.String getName()
Specified by:
getName in interface Named

setName

public void setName(java.lang.String name)
Specified by:
setName in interface UIObject

getPattern

public LList getPattern()

setPattern

public void setPattern(LList pattern)

clearPattern

public void clearPattern()

getNodes

public java.util.List getNodes()

setNodes

public void setNodes(java.util.List nodes)

clearNodes

public void clearNodes()

getOrderings

public java.util.List getOrderings()

setOrderings

public void setOrderings(java.util.List orderings)

clearOrderings

public void clearOrderings()

getConstraints

public java.util.List getConstraints()

setConstraints

public void setConstraints(java.util.List cs)

clearConstraints

public void clearConstraints()

getConditions

public java.util.List getConditions()

setConditions

public void setConditions(java.util.List conditions)

getOtherConstraints

public java.util.List getOtherConstraints()

setOtherConstraints

public void setOtherConstraints(java.util.List constraints)

hasOrderings

public boolean hasOrderings()

hasConditions

public boolean hasConditions()

hasAnonConstraints

public boolean hasAnonConstraints()

getIssues

public java.util.List getIssues()

setIssues

public void setIssues(java.util.List issues)

deleteIssue

public void deleteIssue(Issue issue)

clearIssues

public void clearIssues()

getComments

public java.lang.String getComments()

setComments

public void setComments(java.lang.String comments)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDomain

public Domain getDomain()
Description copied from interface: UIObject
Gets the base domain.
Specified by:
getDomain in interface UIObject

getUIDomain

public UIDomain getUIDomain()
Description copied from interface: UIObject
Gets the ui domain of which this object is part.
Specified by:
getUIDomain in interface UIObject

moveToUIDomain

public void moveToUIDomain(UIDomain uiDomain)
Description copied from interface: UIObject
Move the object from its current UIDomain to the given one.
Specified by:
moveToUIDomain in interface UIObject

getBaseReference

public java.lang.Object getBaseReference()
Description copied from interface: UIObject
Gets the Id that can be used to identify the base object in the domain.
Specified by:
getBaseReference in interface UIObject

setBaseReference

public void setBaseReference(java.lang.Object ref)
Description copied from interface: UIObject
Sets the Id that can be used to identify the base object in the domain.
Specified by:
setBaseReference in interface UIObject

getBaseObject

public IXObject getBaseObject()
Description copied from interface: UIObject
Gets the object that corresponds to this one in the domain.
Specified by:
getBaseObject in interface UIObject

makeBaseObject

public IXObject makeBaseObject()
Description copied from interface: UIObject
Makes an empty object of the right class that can represent this UIObject in the domain.
Specified by:
makeBaseObject in interface UIObject

setBaseObject

public void setBaseObject(IXObject object)
Description copied from interface: UIObject
Sets the object that will represent this one in the domain.
Specified by:
setBaseObject in interface UIObject

getBaseClass

public java.lang.Class getBaseClass()
Description copied from interface: UIObject
Gets the class of objects that can represent this one in the domain.
Specified by:
getBaseClass in interface UIObject

hasOriginal

public boolean hasOriginal()
Description copied from interface: UIObject
Determines whether the object has an original in the base domain.
Specified by:
hasOriginal in interface UIObject

saveToDomain

public void saveToDomain()
Saves this object into a suitable baseObject. Does not add the base object to the domain.
Specified by:
saveToDomain in interface UIObject

saveToDomain

public void saveToDomain(java.lang.Object domainObject)
Description copied from interface: UIObject
Saves the contents of this object into the given object.
Specified by:
saveToDomain in interface UIObject

loadFromDomain

public void loadFromDomain()
Loads this object from its baseObject.
Specified by:
loadFromDomain in interface UIObject

loadFromDomain

public void loadFromDomain(java.lang.Object domainObject)
Description copied from interface: UIObject
Loads the contents of this object from the given object. The given object should be of the right class (same as the result of getBaseClass()).
Specified by:
loadFromDomain in interface UIObject

loadFromOriginal

public void loadFromOriginal()
Loads this object from its original in the domain if it has one, otherwise clear the object. Replaces the base-object with a fresh clone of the original or with a new base-object.
Specified by:
loadFromOriginal in interface UIObject

addToDomain

public void addToDomain()

addToDomain

public void addToDomain(Domain domain)
Description copied from interface: UIObject
Adds the contents of this UIObject to the domain (part of publish).
Specified by:
addToDomain in interface UIObject

updateInDomain

public void updateInDomain()

updateInDomain

public void updateInDomain(Domain domain)
Description copied from interface: UIObject
Updates the base object in the domain with the contents of this object.
Specified by:
updateInDomain in interface UIObject

removeFromDomain

public void removeFromDomain()

removeFromDomain

public void removeFromDomain(Domain domain)
Description copied from interface: UIObject
Removes the object's corresponding base object from the domain.
Specified by:
removeFromDomain in interface UIObject

noteChange

public void noteChange()
Get the UIDomain to note the change of this object
Specified by:
noteChange in interface UIObject

isEmpty

public boolean isEmpty()
A refinement is empty if all its data fields are empty. Note: the refinement may not have started out as empty - check whether it has a base-object for full emptiness.
Specified by:
isEmpty in interface UIObject

isEmpty

public boolean isEmpty(Refinement refinement)
A refinement is empty if all its data fields are empty. Note: the refinement may not have started out as empty - check whether it has a base-object for full emptiness.

hasChanged

public boolean hasChanged()
Finds out whether the refinement has changed from the base-object (i.e. since the object was last saved to draft).
Specified by:
hasChanged in interface UIObject

hasChangedNoDebug

public boolean hasChangedNoDebug(Refinement original)
Finds out whether the refinement has changed from the given object. The refinement has not changed if the fields have not changed. The refinement's fields are: name, pattern, nodes, orderings, constraints, issues, comments The refinement has also not changed if the original is null and it is empty.

hasChanged

public boolean hasChanged(Refinement original)
Finds out whether the refinement has changed from the given object. The refinement has not changed if the fields have not changed. The refinement's fields are: name, pattern, nodes, orderings, constraints, issues, comments The refinement has also not changed if the original is null and it is empty.

hasChangedFromOriginal

public boolean hasChangedFromOriginal()
Finds out whether the refinement has changed from the original. The refinement has not changed if there is an original (baseReference) and the refinement's fields have not changed. The refinement's fields are: name, pattern, nodes, orderings, constraints, issues, annotations
Specified by:
hasChangedFromOriginal in interface UIObject

nameHasChanged

public boolean nameHasChanged(java.lang.Object nameThing)
Description copied from interface: UIObject
Determines whether the object's identifying fields have changed
Specified by:
nameHasChanged in interface UIObject

parseNodes

public static java.util.List parseNodes(UIDomain uiDomain,
                                        java.lang.String expansion)
Builds a LList of nodes from a string that contains node descriptions.
Parameters:
expansion - a string containing node descriptions (patterns) seperated by new lines.
Returns:
a LList of Nodes.

parseIssues

public static java.util.List parseIssues(UIDomain uiDomain,
                                         java.lang.String sIssues)
Builds a LList of nodes from a string that contains node descriptions.
Parameters:
expansion - a string containing node descriptions (patterns) seperated by new lines.
Returns:
a LList of Nodes.

deleteNode

public void deleteNode(NodeSpec node)

deleteNodeConstraints

protected void deleteNodeConstraints(NodeSpec node)

matchesPattern

public boolean matchesPattern(LList pattern)

findNode

public NodeSpec findNode(Name id)

constraintMentionsNode

public static boolean constraintMentionsNode(Constraint c,
                                             Name nodeId)

constraintMentionsNode

public static boolean constraintMentionsNode(Ordering o,
                                             Name nodeId)

getNewNodeId

public Name getNewNodeId()

getHighestNodeId

public Name getHighestNodeId()

getHighestNodeId

public static Name getHighestNodeId(java.util.List nodes)

addNode

public void addNode(NodeSpec node)

addIssue

public void addIssue(Issue issue)

addConstraint

public void addConstraint(java.lang.Object newValue)
                   throws UIRefinement.ConstraintTypeException

addOrdering

public void addOrdering(Constraint newValue)

addOrdering

public void addOrdering(Ordering newValue)

getOrderingType

public java.lang.String getOrderingType()
Gets the refinement's ordering type (none, parallel, sequence, other).
Returns:
  • none (undecided) if there are less than two nodes
  • parallel if there are no orderings an 2 or more nodes
  • sequence if there are 2 or more nodes and they are in sequence
  • other otherwise.

orderingsAreSequential

public boolean orderingsAreSequential()
Checks whether the orderings are a sequence of the nodes.

makeSequence

public java.util.List makeSequence()

isRef

public static boolean isRef(NodeSpec node,
                            java.lang.Object o)
Check whether the given object is a reference to the given node. checks equals on node, node's toString, node's pattern for NodeSpec refs checks node/ref's id, node/ref's pattern for NodeEndRef checks isRef on ref's node

print

public java.lang.String print()
Specified by:
print in interface UIObject

setGraph

public void setGraph(IGraph g)

getGraph

public IGraph getGraph()

removeGraph

public void removeGraph(IGraph g)

children

public java.util.Enumeration children()
Specified by:
children in interface javax.swing.tree.TreeNode

getAllowsChildren

public boolean getAllowsChildren()
Specified by:
getAllowsChildren in interface javax.swing.tree.TreeNode

getChildAt

public javax.swing.tree.TreeNode getChildAt(int index)
Specified by:
getChildAt in interface javax.swing.tree.TreeNode

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface javax.swing.tree.TreeNode

getIndex

public int getIndex(javax.swing.tree.TreeNode node)
Specified by:
getIndex in interface javax.swing.tree.TreeNode

getParent

public javax.swing.tree.TreeNode getParent()
Specified by:
getParent in interface javax.swing.tree.TreeNode

isLeaf

public boolean isLeaf()
Specified by:
isLeaf in interface javax.swing.tree.TreeNode