ConForM.CoopnTools.Constraint
Class ConstraintNode

java.lang.Object
  |
  +--ConForM.CoopnTools.Constraint.ConstraintNode
All Implemented Interfaces:
javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
Direct Known Subclasses:
ConstraintNodeAxiom, ConstraintNodeBody, ConstraintNodeCons, ConstraintNodeConstraintSet, ConstraintNodeField, ConstraintNodeInterface, ConstraintNodeVariable

public abstract class ConstraintNode
extends java.lang.Object
implements javax.swing.tree.MutableTreeNode

This class symbolizes a node in the constraint tree of the constraints editor. All nodes of the tree have to extends this class in order to inherit the functionalities of a node.


Field Summary
protected  boolean allowsChildren
           
protected  java.lang.String[] arg
           
protected  java.util.List childNodeList
           
protected  ConstraintsMgr consMgr
           
protected  java.lang.String consTitle
           
protected  ConsEnv env
           
protected  java.text.MessageFormat fmt
           
protected  ConstraintNode parent
           
protected  javax.swing.JPopupMenu popup
           
protected  boolean readOnly
           
protected  java.lang.String removeText
           
protected  java.lang.String removeTitle
           
static java.lang.String ResourceFile
           
protected  java.lang.String title
           
protected  ConstraintTree tree
           
 
Constructor Summary
ConstraintNode(ConstraintTree tree, ConstraintNode parent, ConstraintsMgr consMgr, ConsEnv env)
           
 
Method Summary
protected  void acceptEditions(ConsPanel consPanel)
          This method is called each time the contents of the edit panel must be used to set the values of the node's elements.
protected  void buildTexts(java.util.ResourceBundle texts)
          This routine is called at the creation of the node, by "super".
 java.util.Enumeration children()
           
 java.lang.Object clone()
           
protected  ConsPanel createConsPanel()
          This method is called each time the edit panel is about to be displayed.
protected abstract  ConstraintNode createNodeFromElement(ConstraintsElement element)
          Create a node from an element, if possible.
protected  void createPopup()
          This method must be called by the sub-classed to create the popup, after the creation of the edit panel.
protected  boolean editable()
          Return true iff the node accept editions with an edit panel.
 boolean getAllowsChildren()
           
 javax.swing.tree.TreeNode getChildAt(int childIndex)
           
 int getChildCount()
           
 ConstraintNode getConsNodeAt(int childIndex)
           
 int getIndex(javax.swing.tree.TreeNode node)
           
protected abstract  java.lang.String getLabel()
          This routine must return the label of the node, as a String.
 javax.swing.tree.TreeNode getParent()
           
 ConstraintNode getParentConsNode()
           
 javax.swing.JPopupMenu getPopupMenu()
           
protected abstract  ConstraintsElement getTextElement()
          This routine must deliver the coopn text element corresponing to this node.
protected  javax.swing.tree.TreePath getTreePath()
          This method return a treePath from root to node
 void insert(ConstraintNode child)
          Insert a node, at its standard position.
 void insert(ConstraintsElement child)
          Insert an element, at its standard position.
 void insert(ConstraintsElement child, int index)
          Insert an element, at a specified position.
 void insert(javax.swing.tree.MutableTreeNode child, int index)
           
 boolean insertAble(ConstraintNode child, int index)
          Return true if the node can be inserted at the given location, or merged to the current node at the given location.
 boolean insertAble(ConstraintsElement child, int index)
          Return true if the element can be inserted at the given location, or merged to the current node at the given location.
protected  boolean insertAbleObject(java.lang.Object child, int index)
          Return true if the object can be inserted at the given location, or merged to the current node at the given location.
 boolean isLeaf()
           
 boolean mergeAble(ConstraintNode child, int index)
          Return true if the node can be merged to the current node, at the given location.
 boolean mergeAble(ConstraintsElement child, int index)
          Return true if the element can be merged to the current node, at the given location.
protected  boolean mergeAbleObject(java.lang.Object child, int index)
          Return true if the object can be merged to the current node, at the given location.
protected abstract  void notifyInsertRemove()
          This method is called each time children are inserted or removed.
protected  void openAll()
          This method is called when all the child node need to be expanded
 void remove()
          Remove the current node, as well as its childs, iff the user confirm the command.
 void remove(int index)
           
 void remove(javax.swing.tree.MutableTreeNode node)
           
 void removeFromParent()
           
 void setParent(javax.swing.tree.MutableTreeNode newParent)
           
 void setUserObject(java.lang.Object object)
           
 void showConsPanel()
           
 int standardInsertIndex(ConstraintNode child)
          Return the standard location of a node to insert.
 int standardInsertIndex(ConstraintsElement child)
          Return the standard location of an element to insert.
protected abstract  int standardInsertIndexObject(java.lang.Object child)
          Return the standard location of an object to insert.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ResourceFile

public static final java.lang.String ResourceFile

allowsChildren

protected boolean allowsChildren

parent

protected ConstraintNode parent

tree

protected ConstraintTree tree

childNodeList

protected java.util.List childNodeList

fmt

protected java.text.MessageFormat fmt

arg

protected java.lang.String[] arg

title

protected java.lang.String title

consTitle

protected java.lang.String consTitle

removeTitle

protected java.lang.String removeTitle

removeText

protected java.lang.String removeText

readOnly

protected boolean readOnly

env

protected ConsEnv env

consMgr

protected ConstraintsMgr consMgr

popup

protected javax.swing.JPopupMenu popup
Constructor Detail

ConstraintNode

public ConstraintNode(ConstraintTree tree,
                      ConstraintNode parent,
                      ConstraintsMgr consMgr,
                      ConsEnv env)
Method Detail

toString

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

showConsPanel

public void showConsPanel()

getPopupMenu

public javax.swing.JPopupMenu getPopupMenu()

createNodeFromElement

protected abstract ConstraintNode createNodeFromElement(ConstraintsElement element)
Create a node from an element, if possible.
Parameters:
element - a textual element
Returns:
a node corresponding to the element, or null if no nodes are corresponding to the element. Must be consistent with mergeAble, insertAble, and so on.

mergeAble

public boolean mergeAble(ConstraintNode child,
                         int index)
Return true if the node can be merged to the current node, at the given location.

mergeAble

public boolean mergeAble(ConstraintsElement child,
                         int index)
Return true if the element can be merged to the current node, at the given location.

mergeAbleObject

protected boolean mergeAbleObject(java.lang.Object child,
                                  int index)
Return true if the object can be merged to the current node, at the given location.

insertAble

public boolean insertAble(ConstraintNode child,
                          int index)
Return true if the node can be inserted at the given location, or merged to the current node at the given location.

insertAble

public boolean insertAble(ConstraintsElement child,
                          int index)
Return true if the element can be inserted at the given location, or merged to the current node at the given location.

insertAbleObject

protected boolean insertAbleObject(java.lang.Object child,
                                   int index)
Return true if the object can be inserted at the given location, or merged to the current node at the given location.

standardInsertIndex

public int standardInsertIndex(ConstraintNode child)
Return the standard location of a node to insert.

standardInsertIndex

public int standardInsertIndex(ConstraintsElement child)
Return the standard location of an element to insert.

standardInsertIndexObject

protected abstract int standardInsertIndexObject(java.lang.Object child)
Return the standard location of an object to insert.

notifyInsertRemove

protected abstract void notifyInsertRemove()
This method is called each time children are inserted or removed. This gives a chance to the node to update the status of various items, such as menu items.

getConsNodeAt

public ConstraintNode getConsNodeAt(int childIndex)

getParentConsNode

public ConstraintNode getParentConsNode()

insert

public void insert(ConstraintNode child)
Insert a node, at its standard position.
Throws:
java.lang.IllegalArgumentException - the child cannot be inserted in this node.

insert

public void insert(ConstraintsElement child)
Insert an element, at its standard position.
Throws:
java.lang.IllegalArgumentException - the child cannot be inserted in this node.

insert

public void insert(ConstraintsElement child,
                   int index)
            throws java.lang.IllegalArgumentException
Insert an element, at a specified position.
Throws:
java.lang.IllegalArgumentException - the child cannot be inserted in this node.

remove

public void remove()
Remove the current node, as well as its childs, iff the user confirm the command.

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 childIndex)
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

insert

public void insert(javax.swing.tree.MutableTreeNode child,
                   int index)
            throws java.lang.IllegalArgumentException
Specified by:
insert in interface javax.swing.tree.MutableTreeNode

remove

public void remove(int index)
Specified by:
remove in interface javax.swing.tree.MutableTreeNode

remove

public void remove(javax.swing.tree.MutableTreeNode node)
Specified by:
remove in interface javax.swing.tree.MutableTreeNode

removeFromParent

public void removeFromParent()
Specified by:
removeFromParent in interface javax.swing.tree.MutableTreeNode

setParent

public void setParent(javax.swing.tree.MutableTreeNode newParent)
Specified by:
setParent in interface javax.swing.tree.MutableTreeNode

setUserObject

public void setUserObject(java.lang.Object object)
Specified by:
setUserObject in interface javax.swing.tree.MutableTreeNode

buildTexts

protected void buildTexts(java.util.ResourceBundle texts)
This routine is called at the creation of the node, by "super".

getLabel

protected abstract java.lang.String getLabel()
This routine must return the label of the node, as a String.

getTextElement

protected abstract ConstraintsElement getTextElement()
This routine must deliver the coopn text element corresponing to this node.

createPopup

protected void createPopup()
This method must be called by the sub-classed to create the popup, after the creation of the edit panel.

editable

protected boolean editable()
Return true iff the node accept editions with an edit panel.

createConsPanel

protected ConsPanel createConsPanel()
This method is called each time the edit panel is about to be displayed.

getTreePath

protected javax.swing.tree.TreePath getTreePath()
This method return a treePath from root to node

openAll

protected void openAll()
This method is called when all the child node need to be expanded

acceptEditions

protected void acceptEditions(ConsPanel consPanel)
This method is called each time the contents of the edit panel must be used to set the values of the node's elements.

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object