net.xoetrope.swing.tree
Class XTreePojoModelAdapter

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by net.xoetrope.swing.tree.XTreeModelAdapter
          extended by net.xoetrope.swing.tree.XTreePojoModelAdapter
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode, XModelAdapter, XModelAdapterConfigurable

public class XTreePojoModelAdapter
extends XTreeModelAdapter
implements XModelAdapterConfigurable

An adapter to allow the XPojoModel 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  XPojoModel model
          The model node
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
XTreePojoModelAdapter()
          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
 XModel getModel()
          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 setModel(XModel src)
          Set the adapter source
 java.lang.String toString()
          Returns the String representation of this tree node
 
Methods inherited from class net.xoetrope.swing.tree.XTreeModelAdapter
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 XPojoModel 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

XTreePojoModelAdapter

public XTreePojoModelAdapter()
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 XModelAdapterConfigurable
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 XModelAdapter
Overrides:
getNumChildren in class XTreeModelAdapter
Returns:
the number of children

get

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

Specified by:
get in interface XModelAdapter
Overrides:
get in class XTreeModelAdapter
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 XModelAdapter
Overrides:
set in class XTreeModelAdapter
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 XModelAdapter
Overrides:
getSelected in class XTreeModelAdapter
Returns:
the selected list item/node

setModel

public void setModel(XModel src)
Set the adapter source

Specified by:
setModel in interface XModelAdapter
Overrides:
setModel in class XTreeModelAdapter
Parameters:
src - the model

getModel

public XModel getModel()
Get the model being used by this adapter

Specified by:
getModel in interface XModelAdapter
Overrides:
getModel in class XTreeModelAdapter
Returns:
the model node

getTagName

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

Overrides:
getTagName in class XTreeModelAdapter
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