org.formaria.swing.tree
Class TreePojoModelAdapter

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by org.formaria.swing.tree.TreeModelAdapter
          extended by org.formaria.swing.tree.TreePojoModelAdapter
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode, ModelAdapter, ModelAdapterConfigurable

public class TreePojoModelAdapter
extends TreeModelAdapter
implements ModelAdapterConfigurable

An adapter to allow the PojoModel to be used with tree controls.

See Also:
Serialized Form

Field Summary
protected  java.lang.String children
          The name of the property defining child nodes
protected  java.util.Hashtable configuration
          Configuration of this adapter
protected  java.lang.String dispAttr
          The name of the property whose value will appear as the tree node
protected  PojoModel model
          The model node
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
TreePojoModelAdapter()
          Constructs a new adapter
 
Method Summary
 void configure(java.util.Hashtable bindingConfiguration, java.util.Hashtable instanceConfiguration)
          Configures this adapter
 java.lang.Object get(int i)
          Gets the individual list item value
 DataModel getDataModel()
          Get the model being used by this adapter
 int getNumChildren()
          Get the number of children belong to the model node that this object adapts
 java.lang.Object getSelected()
          Gets the value of the selected item from the list.
 java.lang.String getTagName()
          Gets the name of the model node
protected  void populateTreeModel()
          Add the children of this node to the tree model
 void set(java.lang.Object o)
          Set the value of the listitem
 void setDataModel(DataModel src)
          Set the adapter source
 java.lang.String toString()
          Returns the String representation of this tree node
 
Methods inherited from class org.formaria.swing.tree.TreeModelAdapter
populateTreeModel
 
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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

model

protected PojoModel model
The model node


children

protected java.lang.String children
The name of the property defining child nodes


dispAttr

protected java.lang.String dispAttr
The name of the property whose value will appear as the tree node


configuration

protected java.util.Hashtable configuration
Configuration of this adapter

Constructor Detail

TreePojoModelAdapter

public TreePojoModelAdapter()
Constructs a new adapter

Method Detail

configure

public void configure(java.util.Hashtable bindingConfiguration,
                      java.util.Hashtable instanceConfiguration)
Configures this adapter

Specified by:
configure in interface ModelAdapterConfigurable
Parameters:
instanceConfiguratin - Hashtable containing configuration details.

getNumChildren

public int getNumChildren()
Get the number of children belong to the model node that this object adapts

Specified by:
getNumChildren in interface ModelAdapter
Overrides:
getNumChildren in class TreeModelAdapter
Returns:
the number of children

get

public java.lang.Object get(int i)
Gets the individual list item value

Specified by:
get in interface ModelAdapter
Overrides:
get in class TreeModelAdapter
Parameters:
i - The index of the listitem
Returns:
The value of the listitem

set

public void set(java.lang.Object o)
Set the value of the listitem

Specified by:
set in interface ModelAdapter
Overrides:
set in class TreeModelAdapter
Parameters:
o - The new value

getSelected

public java.lang.Object getSelected()
Gets the value of the selected item from the list.

Specified by:
getSelected in interface ModelAdapter
Overrides:
getSelected in class TreeModelAdapter
Returns:
the selected list item/node

setDataModel

public void setDataModel(DataModel src)
Set the adapter source

Specified by:
setDataModel in interface ModelAdapter
Overrides:
setDataModel in class TreeModelAdapter
Parameters:
src - the model

getDataModel

public DataModel getDataModel()
Get the model being used by this adapter

Specified by:
getDataModel in interface ModelAdapter
Overrides:
getDataModel in class TreeModelAdapter
Returns:
the model node

getTagName

public java.lang.String getTagName()
Gets the name of the model node

Overrides:
getTagName in class TreeModelAdapter
Returns:
the name

populateTreeModel

protected void populateTreeModel()
Add the children of this node to the tree model

Parameters:
src - the source model node

toString

public java.lang.String toString()
Returns the String representation of this tree node

Overrides:
toString in class javax.swing.tree.DefaultMutableTreeNode