net.sf.doolin.gui.field.tree.model
Class GUITreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by net.sf.doolin.gui.field.tree.model.GUITreeNode
All Implemented Interfaces:
Serializable, Cloneable, MutableTreeNode, TreeNode

public class GUITreeNode
extends DefaultMutableTreeNode

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
GUITreeNode(SubscriberValidator validator, GUITreeModel model, Node def, Object bean)
          Constructor for a node.
 
Method Summary
protected  GUITreeNode createChildTreeNode(SubscriberValidator validator, GUITreeModel model, Node childNode, Object childBean)
          Creates a node for a child.
protected  void fill(SubscriberValidator validator, GUITreeModel model, Object bean)
          Initializes a node
protected  void fillNodeFromList(SubscriberValidator validator, GUITreeModel model, Node childNode, Collection<?> childBeanList)
           
protected  Collection<?> getChildBeanList(Object bean, Children children)
          Gets the list of beans which are associated to a children definition
 Node getDefinition()
           
 LabelInfo getLabelInfo()
          Get the label information for this node.
 TreePath getTreePath()
           
 GUITreeNode lookForNode(boolean onlyImmediates, com.google.common.base.Predicate<GUITreeNode> predicate)
          Looks for a child node that complies with the given predicate.
 
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, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GUITreeNode

public GUITreeNode(SubscriberValidator validator,
                   GUITreeModel model,
                   Node def,
                   Object bean)
Constructor for a node.

Parameters:
validator - Validator to be used for the bus subscriptions
model - Owner
def - Node definition
bean - Associated user object
Method Detail

createChildTreeNode

protected GUITreeNode createChildTreeNode(SubscriberValidator validator,
                                          GUITreeModel model,
                                          Node childNode,
                                          Object childBean)
Creates a node for a child.

Parameters:
validator - Validator to be used for the bus subscriptions
model - Owner
childNode - Definition for the child node
childBean - Bean associated to the child node
Returns:
Node for the child

fill

protected void fill(SubscriberValidator validator,
                    GUITreeModel model,
                    Object bean)
Initializes a node

Parameters:
validator - Validator to be used for the bus subscriptions
model - Owner
bean - Associated bean

fillNodeFromList

protected void fillNodeFromList(SubscriberValidator validator,
                                GUITreeModel model,
                                Node childNode,
                                Collection<?> childBeanList)

getChildBeanList

protected Collection<?> getChildBeanList(Object bean,
                                         Children children)
Gets the list of beans which are associated to a children definition

Parameters:
bean - Object associated to the parent node
children - Children definition
Returns:
List of objects that define the children

getDefinition

public Node getDefinition()

getLabelInfo

public LabelInfo getLabelInfo()
Get the label information for this node.

Returns:
Label information for this node.
See Also:
Node.getLabelProvider(), LabelInfoProvider.getLabelIcon(Object)

getTreePath

public TreePath getTreePath()

lookForNode

public GUITreeNode lookForNode(boolean onlyImmediates,
                               com.google.common.base.Predicate<GUITreeNode> predicate)
Looks for a child node that complies with the given predicate.

Parameters:
onlyImmediates - true if only immediate children must be looked for. It false, the whole tree of descendants is looked for.
predicate - The predicate used to identify the node
Returns:
Node that complies with the predicate or null if none has been found.


Copyright © 2011. All Rights Reserved.