## org.apache.myfaces.custom.tree
Class HtmlTree

    java.lang.Object
      javax.faces.component.UIComponent
          javax.faces.component.UIComponentBase
              javax.faces.component.UIPanel
                  javax.faces.component.html.HtmlPanelGroup
                      org.apache.myfaces.custom.tree.HtmlTree

All Implemented Interfaces:
  javax.faces.component.StateHolder, TreeModelListener

public class HtmlTree
extends javax.faces.component.html.HtmlPanelGroup
implements TreeModelListener

Tree implementation based on javax.swing.JTree.

The tree model is assigned by using a value binding named `model` and is not stored in view state.

A hierarchy of `HtmlTreeNode`objects is used to represent the current expanded state of the tree. The root node is held as a faces named `rootNode`.

Version:
  $Revision: 169651 $ $Date: 2005-05-11 12:14:23 -0400 (Wed, 11 May 2005) $
Author:
  Oliver Rossmueller

Field Summary
`static int` `DEFAULT_EXPIRE_LISTENERS`

Fields inherited from class javax.faces.component.html.HtmlPanelGroup
`COMPONENT_TYPE`

Fields inherited from class javax.faces.component.UIPanel
`COMPONENT_FAMILY`

Constructor Summary
`HtmlTree()` Default constructor.

Method Summary
`void` `addToModelListeners()`
`void` `addTreeSelectionListener(TreeSelectionListener listener)`
`void` `collapseAll()`
`void` `collapsePath(TreePath path, javax.faces.context.FacesContext context)` Ensures that the node identified by the specified path is collapsed and viewable.
`java.lang.String` `createUniqueId(javax.faces.context.FacesContext context)`
`void` `decode(javax.faces.context.FacesContext context)`
`void` `encodeBegin(javax.faces.context.FacesContext context)`
`void` `encodeEnd(javax.faces.context.FacesContext context)`
`boolean` `equals(java.lang.Object obj)`
`void` `expandAll()`
`void` `expandPath(TreePath path, javax.faces.context.FacesContext context)` Ensures that the node identified by the specified path is expanded and viewable.
`java.lang.String` `getColumnClasses()`
`static java.lang.String` `getDefaultImagePath(java.lang.String relativePathInResourceFolder)`
`long` `getExpireListeners()`
`java.lang.String` `getFamily()`
`java.lang.String` `getIconChildFirst()`
`java.lang.String` `getIconChildLast()`
`java.lang.String` `getIconChildMiddle()`
`java.lang.String` `getIconClass()`
`java.lang.String` `getIconLine()`
`java.lang.String` `getIconNodeClose()`
`java.lang.String` `getIconNodeCloseFirst()`
`java.lang.String` `getIconNodeCloseLast()`
`java.lang.String` `getIconNodeCloseMiddle()`
`java.lang.String` `getIconNodeOpen()`
`java.lang.String` `getIconNodeOpenFirst()`
`java.lang.String` `getIconNodeOpenLast()`
`java.lang.String` `getIconNodeOpenMiddle()`
`java.lang.String` `getIconNoline()`
`IconProvider` `getIconProvider()`
`TreeModel` `getModel(javax.faces.context.FacesContext context)`
`java.lang.String` `getNodeClass()`
`HtmlTreeNode` `getRootNode()`
`java.lang.String` `getRowClasses()`
`java.lang.String` `getSelectedNodeClass()`
`TreePath` `getSelectionPath()`
`java.lang.String` `getStyleClass()`
`java.lang.String` `getVar()`
`int` `hashCode()`
`boolean` `isExpanded(TreePath path, javax.faces.context.FacesContext context)`
`void` `processDecodes(javax.faces.context.FacesContext context)`
`void` `processUpdates(javax.faces.context.FacesContext context)`
`void` `processValidators(javax.faces.context.FacesContext context)`
`void` `restoreItemStates(javax.faces.context.FacesContext facesContext, javax.faces.component.UIViewRoot previousRoot)`
`void` `restoreState(javax.faces.context.FacesContext context, java.lang.Object state)`
`java.lang.Object` `saveState(javax.faces.context.FacesContext context)`
`void` `selectionChanged(HtmlTreeNode node)`
`void` `setColumnClasses(java.lang.String columnClasses)`
`void` `setExpireListeners(long expireListeners)`
`void` `setIconChildFirst(java.lang.String iconChildFirst)`
`void` `setIconChildLast(java.lang.String iconChildLast)`
`void` `setIconChildMiddle(java.lang.String iconChildMiddle)`
`void` `setIconClass(java.lang.String iconClass)`
`void` `setIconLine(java.lang.String iconLine)`
`void` `setIconNodeClose(java.lang.String iconNodeClose)`
`void` `setIconNodeCloseFirst(java.lang.String iconNodeCloseFirst)`
`void` `setIconNodeCloseLast(java.lang.String iconNodeCloseLast)`
`void` `setIconNodeCloseMiddle(java.lang.String iconNodeCloseMiddle)`
`void` `setIconNodeOpen(java.lang.String iconNodeOpen)`
`void` `setIconNodeOpenFirst(java.lang.String iconNodeOpenFirst)`
`void` `setIconNodeOpenLast(java.lang.String iconNodeOpenLast)`
`void` `setIconNodeOpenMiddle(java.lang.String iconNodeOpenMiddle)`
`void` `setIconNoline(java.lang.String iconNoline)`
`void` `setIconProvider(IconProvider iconProvider)`
`void` `setNodeClass(java.lang.String nodeClass)`
`void` `setRowClasses(java.lang.String rowClasses)`
`void` `setSelectedNodeClass(java.lang.String selectedNodeClass)`
`void` `setStyleClass(java.lang.String styleClass)`
`void` `setVar(java.lang.String var)`
`void` `treeNodesChanged(TreeModelEvent e)` Invoked after a node (or a set of siblings) has changed in some way.
`void` `treeNodesInserted(TreeModelEvent e)` Invoked after nodes have been inserted into the tree.
`void` `treeNodesRemoved(TreeModelEvent e)` Invoked after nodes have been removed from the tree.
`void` `treeStructureChanged(TreeModelEvent e)` Invoked after the tree has drastically changed structure from a given node down.

Methods inherited from class javax.faces.component.html.HtmlPanelGroup
`getStyle, setStyle`

Methods inherited from class javax.faces.component.UIComponentBase

`addFacesListener, broadcast, encodeChildren, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isRendered, isTransient, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_EXPIRE_LISTENERS

    public static final int DEFAULT_EXPIRE_LISTENERS

See Also:
  Constant Field Values

Constructor Detail

### HtmlTree

    public HtmlTree()

  Default constructor.

Method Detail

### getModel

    public TreeModel getModel(javax.faces.context.FacesContext context)

### createUniqueId

    public java.lang.String createUniqueId(javax.faces.context.FacesContext context)

### addTreeSelectionListener

    public void addTreeSelectionListener(TreeSelectionListener listener)

### getIconProvider

    public IconProvider getIconProvider()

### setIconProvider

    public void setIconProvider(IconProvider iconProvider)

### getVar

    public java.lang.String getVar()

  Returns:
    Returns the var.

### setVar

    public void setVar(java.lang.String var)

  Parameters:
    `var` - The var to set.

### getIconLine

    public java.lang.String getIconLine()

### setIconLine

    public void setIconLine(java.lang.String iconLine)

### getIconNoline

    public java.lang.String getIconNoline()

### setIconNoline

    public void setIconNoline(java.lang.String iconNoline)

### getIconChildFirst

    public java.lang.String getIconChildFirst()

### setIconChildFirst

    public void setIconChildFirst(java.lang.String iconChildFirst)

### getIconChildMiddle

    public java.lang.String getIconChildMiddle()

### setIconChildMiddle

    public void setIconChildMiddle(java.lang.String iconChildMiddle)

### getIconChildLast

    public java.lang.String getIconChildLast()

### setIconChildLast

    public void setIconChildLast(java.lang.String iconChildLast)

### getIconNodeOpen

    public java.lang.String getIconNodeOpen()

### setIconNodeOpen

    public void setIconNodeOpen(java.lang.String iconNodeOpen)

### getIconNodeOpenFirst

    public java.lang.String getIconNodeOpenFirst()

### setIconNodeOpenFirst

    public void setIconNodeOpenFirst(java.lang.String iconNodeOpenFirst)

### getIconNodeOpenMiddle

    public java.lang.String getIconNodeOpenMiddle()

### setIconNodeOpenMiddle

    public void setIconNodeOpenMiddle(java.lang.String iconNodeOpenMiddle)

### getIconNodeOpenLast

    public java.lang.String getIconNodeOpenLast()

### setIconNodeOpenLast

    public void setIconNodeOpenLast(java.lang.String iconNodeOpenLast)

### getIconNodeClose

    public java.lang.String getIconNodeClose()

### setIconNodeClose

    public void setIconNodeClose(java.lang.String iconNodeClose)

### getIconNodeCloseFirst

    public java.lang.String getIconNodeCloseFirst()

### setIconNodeCloseFirst

    public void setIconNodeCloseFirst(java.lang.String iconNodeCloseFirst)

### getIconNodeCloseMiddle

    public java.lang.String getIconNodeCloseMiddle()

### setIconNodeCloseMiddle

    public void setIconNodeCloseMiddle(java.lang.String iconNodeCloseMiddle)

### getIconNodeCloseLast

    public java.lang.String getIconNodeCloseLast()

### setIconNodeCloseLast

    public void setIconNodeCloseLast(java.lang.String iconNodeCloseLast)

### getStyleClass

    public java.lang.String getStyleClass()

### setStyleClass

    public void setStyleClass(java.lang.String styleClass)

### getNodeClass

    public java.lang.String getNodeClass()

### setNodeClass

    public void setNodeClass(java.lang.String nodeClass)

### getRowClasses

    public java.lang.String getRowClasses()

  Returns:
    Returns the rowClasses.

### setRowClasses

    public void setRowClasses(java.lang.String rowClasses)

  Parameters:
    `rowClasses` - The rowClasses to set.

### getColumnClasses

    public java.lang.String getColumnClasses()

  Returns:
    Returns the columnClasses.

### setColumnClasses

    public void setColumnClasses(java.lang.String columnClasses)

  Parameters:
    `columnClasses` - The columnClasses to set.

### getSelectedNodeClass

    public java.lang.String getSelectedNodeClass()

  Returns:
    Returns the selectedNodeClass.

### setSelectedNodeClass

    public void setSelectedNodeClass(java.lang.String selectedNodeClass)

  Parameters:
    `selectedNodeClass` - The selectedNodeClass to set.

### getIconClass

    public java.lang.String getIconClass()

### setIconClass

    public void setIconClass(java.lang.String iconClass)

### getExpireListeners

    public long getExpireListeners()

### setExpireListeners

    public void setExpireListeners(long expireListeners)

### getFamily

    public java.lang.String getFamily()

### expandPath

    public void expandPath(TreePath path,
                           javax.faces.context.FacesContext context)

  Ensures that the node identified by the specified path is expanded and viewable. If the last item in the path is a leaf, this will have no effect.

  Parameters:
    `path` - the `TreePath` identifying a node

### collapsePath

    public void collapsePath(TreePath path,
                             javax.faces.context.FacesContext context)

  Ensures that the node identified by the specified path is collapsed and viewable.

  Parameters:
    `path` - the `TreePath` identifying a node

### isExpanded

    public boolean isExpanded(TreePath path,
                              javax.faces.context.FacesContext context)

### getSelectionPath

    public TreePath getSelectionPath()

### selectionChanged

    public void selectionChanged(HtmlTreeNode node)

### getRootNode

    public HtmlTreeNode getRootNode()

### saveState

    public java.lang.Object saveState(javax.faces.context.FacesContext context)

  Specified by:
    `saveState` in interface `javax.faces.component.StateHolder`

### restoreState

    public void restoreState(javax.faces.context.FacesContext context,
                             java.lang.Object state)

  Specified by:
    `restoreState` in interface `javax.faces.component.StateHolder`

### decode

    public void decode(javax.faces.context.FacesContext context)

### processDecodes

    public void processDecodes(javax.faces.context.FacesContext context)

### processValidators

    public void processValidators(javax.faces.context.FacesContext context)

### processUpdates

    public void processUpdates(javax.faces.context.FacesContext context)

### encodeBegin

    public void encodeBegin(javax.faces.context.FacesContext context)
                     throws java.io.IOException

  Throws:
    `java.io.IOException`

### encodeEnd

    public void encodeEnd(javax.faces.context.FacesContext context)
                   throws java.io.IOException

  Throws:
    `java.io.IOException`

### restoreItemStates

    public void restoreItemStates(javax.faces.context.FacesContext facesContext,
                                  javax.faces.component.UIViewRoot previousRoot)

### treeNodesChanged

    public void treeNodesChanged(TreeModelEvent e)

  Description copied from interface: `TreeModelListener`

  Invoked after a node (or a set of siblings) has changed in some way. The node(s) have not changed locations in the tree or altered their children arrays, but other attributes have changed and may affect presentation. Example: the name of a file has changed, but it is in the same location in the file system.

  To indicate the root has changed, childIndices and children will be null.

  Use `e.getPath()` to get the parent of the changed node(s). `e.getChildIndices()` returns the index(es) of the changed node(s).

  Specified by:
    `treeNodesChanged` in interface `TreeModelListener`

### treeNodesInserted

    public void treeNodesInserted(TreeModelEvent e)

  Description copied from interface: `TreeModelListener`

  Invoked after nodes have been inserted into the tree.

  Use `e.getPath()` to get the parent of the new node(s). `e.getChildIndices()` returns the index(es) of the new node(s) in ascending order.

  Specified by:
    `treeNodesInserted` in interface `TreeModelListener`

### treeNodesRemoved

    public void treeNodesRemoved(TreeModelEvent e)

  Description copied from interface: `TreeModelListener`

  Invoked after nodes have been removed from the tree. Note that if a subtree is removed from the tree, this method may only be invoked once for the root of the removed subtree, not once for each individual set of siblings removed.

  Use `e.getPath()` to get the former parent of the deleted node(s). `e.getChildIndices()` returns, in ascending order, the index(es) the node(s) had before being deleted.

  Specified by:
    `treeNodesRemoved` in interface `TreeModelListener`

### treeStructureChanged

    public void treeStructureChanged(TreeModelEvent e)

  Description copied from interface: `TreeModelListener`

  Invoked after the tree has drastically changed structure from a given node down. If the path returned by e.getPath() is of length one and the first element does not identify the current root node the first element should become the new root of the tree.

  Use `e.getPath()` to get the path to the node. `e.getChildIndices()` returns null.

  Specified by:
    `treeStructureChanged` in interface `TreeModelListener`

### equals

    public boolean equals(java.lang.Object obj)

### hashCode

    public int hashCode()

### addToModelListeners

    public void addToModelListeners()

### collapseAll

    public void collapseAll()

### expandAll

    public void expandAll()

### getDefaultImagePath

    public static java.lang.String getDefaultImagePath(java.lang.String relativePathInResourceFolder)