com.tonbeller.wcf.tree
Class EnumBoundedTreeModelDecorator

java.lang.Object
  extended bycom.tonbeller.wcf.tree.TreeModelDecorator
      extended bycom.tonbeller.wcf.tree.EnumBoundedTreeModelDecorator
All Implemented Interfaces:
DecoratedTreeModel, java.util.EventListener, TreeBounding, TreeModel, TreeModelChangeListener

public class EnumBoundedTreeModelDecorator
extends TreeModelDecorator
implements TreeBounding, TreeModelChangeListener

A TreeModelDecorator that limits the initial visible children to a enumerated set of nodes. When the user clicks on the refresh button, all children are displayed from the underlying TreeModel.

Since:
May 2, 2006
Author:
av

Field Summary
 
Fields inherited from interface com.tonbeller.wcf.tree.TreeModel
EMPTY_MODEL
 
Constructor Summary
EnumBoundedTreeModelDecorator(TreeModel decoree)
           
EnumBoundedTreeModelDecorator(TreeModel decoree, java.util.Comparator nodeComparator)
           
 
Method Summary
 void addTreeModelChangeListener(TreeModelChangeListener l)
           
 void fireModelChanged(boolean identityChanged)
          fires a TreeModelChangeEvent.
 java.lang.Object[] getChildren(java.lang.Object node)
           
 boolean hasChildren(java.lang.Object node)
           
 boolean isBounded(java.lang.Object parent)
          if true, instead of (+) or (-) a refresh symbol (o) is displayed to allow the user to refresh the children of the parent node.
 void removeTreeModelChangeListener(TreeModelChangeListener l)
           
 void setDecoree(TreeModel model)
           
 void setVisible(java.util.Collection nodes)
          sets the visible nodes.
 void setVisible(TreeModel model, java.util.Collection nodes)
          sets the visible nodes.
 void treeModelChanged(TreeModelChangeEvent event)
           
 void unbound(java.lang.Object parent)
          called when the user presses the refresh symbol.
 
Methods inherited from class com.tonbeller.wcf.tree.TreeModelDecorator
getDecoree, getParent, getRoots
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumBoundedTreeModelDecorator

public EnumBoundedTreeModelDecorator(TreeModel decoree)

EnumBoundedTreeModelDecorator

public EnumBoundedTreeModelDecorator(TreeModel decoree,
                                     java.util.Comparator nodeComparator)
Method Detail

setDecoree

public void setDecoree(TreeModel model)
Overrides:
setDecoree in class TreeModelDecorator

isBounded

public boolean isBounded(java.lang.Object parent)
Description copied from interface: TreeBounding
if true, instead of (+) or (-) a refresh symbol (o) is displayed to allow the user to refresh the children of the parent node.

Specified by:
isBounded in interface TreeBounding

unbound

public void unbound(java.lang.Object parent)
Description copied from interface: TreeBounding
called when the user presses the refresh symbol.

Specified by:
unbound in interface TreeBounding

hasChildren

public boolean hasChildren(java.lang.Object node)
Specified by:
hasChildren in interface TreeModel
Overrides:
hasChildren in class TreeModelDecorator

getChildren

public java.lang.Object[] getChildren(java.lang.Object node)
Specified by:
getChildren in interface TreeModel
Overrides:
getChildren in class TreeModelDecorator

setVisible

public void setVisible(java.util.Collection nodes)
sets the visible nodes.

Parameters:
nodes - the collection of visible nodes. These nodes (and their parents) will be visible before refresh.

setVisible

public void setVisible(TreeModel model,
                       java.util.Collection nodes)
sets the visible nodes.

Parameters:
model - the tree model used to comupte the parents of the visible nodes.
nodes - the collection of visible nodes. These nodes (and their parents) will be visible before refresh.

addTreeModelChangeListener

public void addTreeModelChangeListener(TreeModelChangeListener l)
Specified by:
addTreeModelChangeListener in interface TreeModel
Overrides:
addTreeModelChangeListener in class TreeModelDecorator

fireModelChanged

public void fireModelChanged(boolean identityChanged)
Description copied from interface: TreeModel
fires a TreeModelChangeEvent.

Specified by:
fireModelChanged in interface TreeModel
Overrides:
fireModelChanged in class TreeModelDecorator

removeTreeModelChangeListener

public void removeTreeModelChangeListener(TreeModelChangeListener l)
Specified by:
removeTreeModelChangeListener in interface TreeModel
Overrides:
removeTreeModelChangeListener in class TreeModelDecorator

treeModelChanged

public void treeModelChanged(TreeModelChangeEvent event)
Specified by:
treeModelChanged in interface TreeModelChangeListener