org.objectweb.jac.aspects.gui
Class ObjectNode

java.lang.Object
  extended byjavax.swing.tree.DefaultMutableTreeNode
      extended byorg.objectweb.jac.aspects.gui.AbstractNode
          extended byorg.objectweb.jac.aspects.gui.ObjectNode
All Implemented Interfaces:
Cloneable, CollectionUpdate, FieldUpdate, MutableTreeNode, ObjectUpdate, Serializable, TreeNode

public class ObjectNode
extends AbstractNode
implements ObjectUpdate, FieldUpdate, CollectionUpdate

This class represents a tree node for an object.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
ObjectNode(TreeView model, Object value, Object substance, FieldItem relation, boolean showRelations)
          Constructor.
 
Method Summary
 int addNode(ObjectNode node)
          Insert a node at the correct place (considering sorting)
 void fieldUpdated(Object substance, FieldItem collection, Object value, Object param)
          Upcalled when a field was modified.
protected  ObjectNode findNode(FieldItem relation, Object userObject)
          Find a node in the children.
 FieldItem getRelation()
          Returns the relation (reference or collection) the substance of the node belongs to.
 Object getSubstance()
          Returns the substance of this node.
 void objectUpdated(Object substance, Object param)
          The callback method.
 void onAdd(Object substance, CollectionItem collection, Object value, Object added, Object param)
          Upcalled when an item is added in a collection.
 void onChange(Object substance, CollectionItem collection, Object value, Object param)
          Upcalled when the collection is changed (with a set or other methods such as clear, removeAll, addAll, ...).
 void onRemove(Object substance, CollectionItem collection, Object value, Object removed, Object param)
          Upcalled when an item is removed from a collection.
protected  void rebuildData()
          Rebuild the data of this node again.
 void removeAllChildren()
           
 String toString()
           
 void unregisterEvents()
          Unregisters from the events this node is notified.
 void updateChildren()
           
 
Methods inherited from class org.objectweb.jac.aspects.gui.AbstractNode
areChildrenUptodate, getIcon, getText, getToolTip, isLeaf, setChildrenUptodate, setLeaf, setModel, setParent
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectNode

public ObjectNode(TreeView model,
                  Object value,
                  Object substance,
                  FieldItem relation,
                  boolean showRelations)
Constructor.

Parameters:
model - the tree modelto notify when changes occur
value - the value that the node represents
substance - the owner of the relation
relation - the relation the value is part of
Method Detail

addNode

public int addNode(ObjectNode node)
Insert a node at the correct place (considering sorting)

Parameters:
node - the node to insert
Returns:
the position the node was inserted at

removeAllChildren

public void removeAllChildren()

getRelation

public FieldItem getRelation()
Returns the relation (reference or collection) the substance of the node belongs to.


getSubstance

public Object getSubstance()
Returns the substance of this node.


rebuildData

protected void rebuildData()
Rebuild the data of this node again.


unregisterEvents

public void unregisterEvents()
Unregisters from the events this node is notified.

Specified by:
unregisterEvents in class AbstractNode

findNode

protected ObjectNode findNode(FieldItem relation,
                              Object userObject)
Find a node in the children.

Parameters:
relation - the relation the requested node must be part of
userObject - the userObject value the requested node must have
Returns:
an ObjectNode with the requested features, or null if no such node can be found.

objectUpdated

public void objectUpdated(Object substance,
                          Object param)
Description copied from interface: ObjectUpdate
The callback method.

Specified by:
objectUpdated in interface ObjectUpdate
Parameters:
substance - the updated object
param - extra data
See Also:
ViewControlWrapper.registerObject(Wrappee,ObjectUpdate,Object)

fieldUpdated

public void fieldUpdated(Object substance,
                         FieldItem collection,
                         Object value,
                         Object param)
Description copied from interface: FieldUpdate
Upcalled when a field was modified.

Specified by:
fieldUpdated in interface FieldUpdate
Parameters:
substance - the object of which a field was updated
collection - the updated field
value - new value of the vield
param - extra infos (unused)
See Also:
ViewControlWrapper.registerField(Wrappee,FieldItem,FieldUpdate,Object)

onChange

public void onChange(Object substance,
                     CollectionItem collection,
                     Object value,
                     Object param)
Description copied from interface: CollectionUpdate
Upcalled when the collection is changed (with a set or other methods such as clear, removeAll, addAll, ...).

Specified by:
onChange in interface CollectionUpdate
Parameters:
substance - the object of which a field was updated
collection - the updated collection
value - the new collection
param - extra data
See Also:
ViewControlWrapper.registerCollection(Wrappee,CollectionItem,CollectionUpdate,Object)

onAdd

public void onAdd(Object substance,
                  CollectionItem collection,
                  Object value,
                  Object added,
                  Object param)
Description copied from interface: CollectionUpdate
Upcalled when an item is added in a collection.

Specified by:
onAdd in interface CollectionUpdate
Parameters:
substance - the object of which a collection was updated
collection - the updated collection
value - the collection's value
added - the value added to the collection
param - extra data (e.g. index)
See Also:
ViewControlWrapper.registerCollection(Wrappee,CollectionItem,CollectionUpdate,Object)

onRemove

public void onRemove(Object substance,
                     CollectionItem collection,
                     Object value,
                     Object removed,
                     Object param)
Description copied from interface: CollectionUpdate
Upcalled when an item is removed from a collection.

Specified by:
onRemove in interface CollectionUpdate
Parameters:
substance - the object of which a collection was updated
collection - the updated collection
value - the collection's value
removed - the removed item
param - extra data (e.g. index)
See Also:
ViewControlWrapper.registerCollection(Wrappee,CollectionItem,CollectionUpdate,Object)

updateChildren

public void updateChildren()

toString

public String toString()