org.freehep.jas.plugin.tree
Interface FTreeNode


public interface FTreeNode

An FTreeNode is a node of an FTree. It has a type and it can contain multiple objects. Its appearence and behavior are defined by FTreeNodeAdapters that are selected based on the FTreeNode's type. Each FTreeNode contains an Hashtable that can be used to store objects in the node. This Hashtable should be primarily used by FTreeNodeObjectProviders to store objects that can be then accesed via the objectForClass() method. Objects are stored in key-value pairs. Changes to the FTreeNode are propagated to the node's liteners via FTreeNodeEvents.

Author:
The FreeHEP team @ SLAC.

Method Summary
 void addFTreeNodeListener(FTreeNodeListener listener)
          Add an FTreeNodeListener to this node.
 void addKey(Object key, Object value)
          Add a key-value pair to this node.
 List childNodes()
          Get the list of children in this node.
 Object objectForClass(Class clazz)
          Get the object for a given class contained in this node.
 FTreeNode parent()
          Get the parent for this node.
 FTreePath path()
          Get the FTreePath that leads to this node.
 void removeFTreeNodeListener(FTreeNodeListener listener)
          Remove an FTreeNodeListener from this node.
 void removeKey(Object key)
          Remove a key, and the corresponding value, from this node.
 FTree tree()
          Get the FTree to which this node belongs.
 Class type()
          Get the node's type.
 Object value(Object key)
          Get the value contained in the node for a given key.
 

Method Detail

objectForClass

Object objectForClass(Class clazz)
Get the object for a given class contained in this node.

Parameters:
clazz - The type of object to be returned.
Returns:
The node's object for the given class. If no object for the given class is present, null is returned.

type

Class type()
Get the node's type. This is the type of the node as it was assigned when the node was added to the tree. The type is used to select the FTreeNodeAdapters that provide the appearence and behavior for the given node.

Returns:
The node's type

path

FTreePath path()
Get the FTreePath that leads to this node.

Returns:
The node's FTreePath.

tree

FTree tree()
Get the FTree to which this node belongs.

Returns:
The FTree to which this node belongs.

childNodes

List childNodes()
Get the list of children in this node. The list is ordered as the nodes are currently displayed in the tree. If the node has no children an empty list is returned.

Returns:
The ordered list of this node's children.

parent

FTreeNode parent()
Get the parent for this node.

Returns:
The node's parent.

addKey

void addKey(Object key,
            Object value)
Add a key-value pair to this node. If the key already exists, its value is overritten.

Parameters:
key - The key for the given value.
value - The corresponding value.

removeKey

void removeKey(Object key)
Remove a key, and the corresponding value, from this node.

Parameters:
key - The key to be removed.

value

Object value(Object key)
Get the value contained in the node for a given key.

Parameters:
key - The key.
Returns:
The corresponding object.

addFTreeNodeListener

void addFTreeNodeListener(FTreeNodeListener listener)
Add an FTreeNodeListener to this node. All the listeners registered with this node will be notified of any changed to the FTreeNode.

Parameters:
listener - The FTreeNodeListener to be added.

removeFTreeNodeListener

void removeFTreeNodeListener(FTreeNodeListener listener)
Remove an FTreeNodeListener from this node.

Parameters:
listener - The FTreeNodeListener to be removed.


Copyright © 2013. All Rights Reserved.