net.xoetrope.swing.tree
Class XTreeModelAdapter

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

public class XTreeModelAdapter
extends javax.swing.tree.DefaultMutableTreeNode
implements XModelAdapter

An adapter to allow the XModel to be used with tree controls

Copyright (c) Xoetrope Ltd., 2001-2006

See Also:
Serialized Form

Field Summary
protected  XModel model
          The model node
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
XTreeModelAdapter()
          Constructs a new adapter
 
Method Summary
 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(XModel src)
          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
 
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
 

Field Detail

model

protected XModel model
The model node

Constructor Detail

XTreeModelAdapter

public XTreeModelAdapter()
Constructs a new adapter

Method Detail

getNumChildren

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

Specified by:
getNumChildren in interface XModelAdapter
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
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
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
Returns:
the selected list item/node

setModel

public void setModel(XModel src)
Set the adapter source

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

getModel

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

Specified by:
getModel in interface XModelAdapter
Returns:
the model node

getTagName

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

Returns:
the name

populateTreeModel

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

Parameters:
src - the source model node