net.sf.jzeno.echo.components
Class DynaTree

java.lang.Object
  extended by nextapp.echo.AbstractComponent
      extended by net.sf.jzeno.echo.components.CustomComponent
          extended by net.sf.jzeno.echo.components.DynaTree
All Implemented Interfaces:
java.io.Serializable, BindingTarget, PropertyComponent, RebindableComponent, EventPropagator, EventSink, EventSource, Precreation, Component, FastComponent, FastComponentContainer

public class DynaTree
extends CustomComponent
implements EventPropagator, Precreation

A simplified tree implementation, that allows full flexibility over the rendered nodes in the tree, and over retrieval of child nodes.

By default a DynaTree can be created to visualize any javabean, as long as that javabean contains 2 method :

No special interfaces, etc.. need to be implemented. Nodes containing child nodes will be represented as folders, and nodes containing no children will be represented as a document. This provides you with very simple way to create a tree control.

More control can be obtained over the tree retrieval, and it's representation on the screen by implementing a custom DynaTreeModel. Here again simplicity was our goal, and implementing your custom model only required 4 methods to be implemented.

In terms of data binding a DynaTree binds to the node that is currently selected in the tree.

See Also:
Serialized Form

Nested Class Summary
 class DynaTree.EventListener
           
 
Field Summary
 
Fields inherited from interface nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, SELECTABLE_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
DynaTree()
           
DynaTree(java.lang.Class beanClass, java.lang.String propertyPath, java.lang.String constructionHints)
           
 
Method Summary
 void applyContext()
           
 void collapse(java.lang.Object node)
           Close the given node.
 void collapseAll()
           Close all nodes in the tree.
 void expand(java.util.List expandedNodes)
           
 void expand(java.lang.Object node)
           Expand the tree to make the given node visible to the user.
 void expandAll()
           Ecpand all the nodes in the tree.
 java.util.List findExpandedNodes()
           
 DynaTreeModel getModel()
           Retrieve the tree's model.
 java.lang.Object getRootNode()
           Retrieve the root node of the tree.
 boolean isRootVisible()
           
 void propagateEvent(ActionEvent event)
           
 void rebind()
           This operation causes the component to reset it's content to that of the domain model.
 void refresh()
           Force the tree to redraw.
 void select(java.lang.Object node)
           Change the tree's selection to the given node.
 void setModel(DynaTreeModel model)
           Replace the tree's node (with your own implementation).
 void setRootNode(java.lang.Object rootNode)
           Set the root node of the tree.
 void setRootVisible(boolean b)
           Should the root of the tree be represented ?
 
Methods inherited from class net.sf.jzeno.echo.components.CustomComponent
addValidator, fireActionEvent, fireActionEvent, fireActionEvent, getActionCommand, getBean, getBeanClass, getDecorator, getNullObject, getProperty, getValidationErrors, getValidators, getValue, isBound, isMarkedInvalid, isReadOnly, isRequired, isValid, markInvalid, markValid, preRender, removeValidator, setActionCommand, setBean, setBeanClass, setDecorator, setNullObject, setProperty, setReadOnly, setRequired, setValue, traceValue, validate
 
Methods inherited from class nextapp.echo.AbstractComponent
add, add, addHierarchyListener, addPropertyChangeListener, applyStyle, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getClientId, getComponent, getComponentCount, getComponents, getEchoInstance, getFont, getForeground, getIdentifier, getListenerList, getLocale, getParent, indexOf, init, isAncestorOf, isDifferent, isEnabled, isFocused, isRecursivelyVisible, isRegistered, isSelectableForScriptRecorder, isShowing, isVisible, processHierarchyEvent, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setBackground, setClientId, setEnabled, setFocused, setFont, setForeground, setIdentifier, setLocale, setParent, setRegistered, setSelectableForScriptRecorder, setVisible, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynaTree

public DynaTree()

DynaTree

public DynaTree(java.lang.Class beanClass,
                java.lang.String propertyPath,
                java.lang.String constructionHints)
Method Detail

setRootVisible

public void setRootVisible(boolean b)

Should the root of the tree be represented ? Setting this to false will allow you to create a tree, that appear to have multiple roots.


isRootVisible

public boolean isRootVisible()

rebind

public void rebind()
Description copied from interface: RebindableComponent

This operation causes the component to reset it's content to that of the domain model.

Specified by:
rebind in interface RebindableComponent
Overrides:
rebind in class CustomComponent

select

public void select(java.lang.Object node)

Change the tree's selection to the given node.


collapseAll

public void collapseAll()

Close all nodes in the tree. (Don't use this if the root node is not visible !)


expandAll

public void expandAll()

Ecpand all the nodes in the tree. Be carefull if you have a large tree !


expand

public void expand(java.lang.Object node)

Expand the tree to make the given node visible to the user.


collapse

public void collapse(java.lang.Object node)

Close the given node.


getModel

public DynaTreeModel getModel()

Retrieve the tree's model.


setModel

public void setModel(DynaTreeModel model)

Replace the tree's node (with your own implementation).


refresh

public void refresh()

Force the tree to redraw. This is useful if the structure of your tree was changed. A DynaTree will not automatically detect changes to the tree !


expand

public void expand(java.util.List expandedNodes)

findExpandedNodes

public java.util.List findExpandedNodes()

propagateEvent

public void propagateEvent(ActionEvent event)
Specified by:
propagateEvent in interface EventPropagator

getRootNode

public java.lang.Object getRootNode()

Retrieve the root node of the tree.


setRootNode

public void setRootNode(java.lang.Object rootNode)

Set the root node of the tree.


applyContext

public void applyContext()
Specified by:
applyContext in interface Precreation