org.apache.myfaces.custom.tree
Class HtmlTree

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIPanel
              extended by javax.faces.component.html.HtmlPanelGroup
                  extended by org.apache.myfaces.custom.tree.HtmlTree
All Implemented Interfaces:
EventListener, javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, javax.faces.event.ComponentSystemEventListener, javax.faces.event.FacesListener, javax.faces.event.SystemEventListenerHolder, org.apache.myfaces.custom.tree.model.TreeModelListener

public class HtmlTree
extends javax.faces.component.html.HtmlPanelGroup
implements org.apache.myfaces.custom.tree.model.TreeModelListener

A tree data component. Unless otherwise specified, all attributes accept static values or EL expressions.

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 HtmlTreeNodeobjects is used to represent the current expanded state of the tree. The root node is held as a faces named * rootNode.

Version:
$Revision: 672986 $ $Date: 2008-06-30 23:13:55 -0500 (lun, 30 jun 2008) $
Author:
Oliver Rossmueller

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.faces.component.html.HtmlPanelGroup
javax.faces.component.html.HtmlPanelGroup.PropertyKeys
 
Field Summary
static String COMPONENT_FAMILY
           
static String COMPONENT_TYPE
           
static long DEFAULT_EXPIRE_LISTENERS
           
 
Fields inherited from class javax.faces.component.UIComponent
BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, VIEW_LOCATION_KEY
 
Constructor Summary
HtmlTree()
          

Default constructor.

 
Method Summary
 void addToModelListeners()
           
 void addTreeSelectionListener(org.apache.myfaces.custom.tree.event.TreeSelectionListener listener)
           
 void collapseAll()
           
 void collapsePath(org.apache.myfaces.custom.tree.model.TreePath path, javax.faces.context.FacesContext context)
          Ensures that the node identified by the specified path is collapsed and viewable.
 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(Object obj)
           
 void expandAll()
           
 void expandPath(org.apache.myfaces.custom.tree.model.TreePath path, javax.faces.context.FacesContext context)
          Ensures that the node identified by the specified path is expanded and viewable.
 String getColumnClasses()
           
 long getExpireListeners()
          Time interval the tree will remain registered as a TreeModelListener without being accessed
 String getFamily()
           
 String getIconChildFirst()
           
 String getIconChildLast()
           
 String getIconChildMiddle()
           
 String getIconClass()
           
 String getIconLine()
           
 String getIconNodeClose()
           
 String getIconNodeCloseFirst()
           
 String getIconNodeCloseLast()
           
 String getIconNodeCloseMiddle()
           
 String getIconNodeOpen()
           
 String getIconNodeOpenFirst()
           
 String getIconNodeOpenLast()
           
 String getIconNodeOpenMiddle()
           
 String getIconNoline()
           
 org.apache.myfaces.custom.tree.IconProvider getIconProvider()
           
 org.apache.myfaces.custom.tree.model.TreeModel getModel(javax.faces.context.FacesContext context)
           
 String getNodeClass()
           
 HtmlTreeNode getRootNode()
           
 String getRowClasses()
           
 String getSelectedNodeClass()
           
 org.apache.myfaces.custom.tree.model.TreePath getSelectionPath()
           
protected  String getStringValue(String value, String vbName)
           
 String getVar()
           
 int hashCode()
           
 boolean isExpanded(org.apache.myfaces.custom.tree.model.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, Object state)
           
 Object saveState(javax.faces.context.FacesContext context)
           
 void selectionChanged(HtmlTreeNode node)
           
 void setColumnClasses(String columnClasses)
           
 void setExpireListeners(long expireListeners)
           
 void setIconChildFirst(String iconChildFirst)
           
 void setIconChildLast(String iconChildLast)
           
 void setIconChildMiddle(String iconChildMiddle)
           
 void setIconClass(String iconClass)
           
 void setIconLine(String iconLine)
           
 void setIconNodeClose(String iconNodeClose)
           
 void setIconNodeCloseFirst(String iconNodeCloseFirst)
           
 void setIconNodeCloseLast(String iconNodeCloseLast)
           
 void setIconNodeCloseMiddle(String iconNodeCloseMiddle)
           
 void setIconNodeOpen(String iconNodeOpen)
           
 void setIconNodeOpenFirst(String iconNodeOpenFirst)
           
 void setIconNodeOpenLast(String iconNodeOpenLast)
           
 void setIconNodeOpenMiddle(String iconNodeOpenMiddle)
           
 void setIconNoline(String iconNoline)
           
 void setIconProvider(org.apache.myfaces.custom.tree.IconProvider iconProvider)
           
 void setNodeClass(String nodeClass)
           
 void setRowClasses(String rowClasses)
           
 void setSelectedNodeClass(String selectedNodeClass)
           
 void setVar(String var)
           
 void treeNodesChanged(org.apache.myfaces.custom.tree.model.TreeModelEvent e)
           
 void treeNodesInserted(org.apache.myfaces.custom.tree.model.TreeModelEvent e)
           
 void treeNodesRemoved(org.apache.myfaces.custom.tree.model.TreeModelEvent e)
           
 void treeStructureChanged(org.apache.myfaces.custom.tree.model.TreeModelEvent e)
           
 
Methods inherited from class javax.faces.component.html.HtmlPanelGroup
getLayout, getStyle, getStyleClass, setLayout, setStyle, setStyleClass, setValueBinding, setValueExpression
 
Methods inherited from class javax.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, clearInitialState, encodeAll, encodeChildren, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, initialStateMarked, invokeOnComponent, isRendered, isTransient, markInitialState, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, visitTree
 
Methods inherited from class javax.faces.component.UIComponent
getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getListenersForEventClass, getNamingContainer, getResourceBundleMap, getStateHelper, getStateHelper, getValueExpression, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, setInView, subscribeToEvent, unsubscribeFromEvent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPONENT_TYPE

public static final String COMPONENT_TYPE
See Also:
Constant Field Values

COMPONENT_FAMILY

public static final String COMPONENT_FAMILY
See Also:
Constant Field Values

DEFAULT_EXPIRE_LISTENERS

public static final long DEFAULT_EXPIRE_LISTENERS
See Also:
Constant Field Values
Constructor Detail

HtmlTree

public HtmlTree()

Default constructor.

Method Detail

getModel

public org.apache.myfaces.custom.tree.model.TreeModel getModel(javax.faces.context.FacesContext context)

createUniqueId

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

addTreeSelectionListener

public void addTreeSelectionListener(org.apache.myfaces.custom.tree.event.TreeSelectionListener listener)

getIconProvider

public org.apache.myfaces.custom.tree.IconProvider getIconProvider()

setIconProvider

public void setIconProvider(org.apache.myfaces.custom.tree.IconProvider iconProvider)

getVar

public String getVar()
Returns:
Returns the var.

setVar

public void setVar(String var)
Parameters:
var - The var to set.

getStringValue

protected String getStringValue(String value,
                                String vbName)

getIconLine

public String getIconLine()

setIconLine

public void setIconLine(String iconLine)

getIconNoline

public String getIconNoline()

setIconNoline

public void setIconNoline(String iconNoline)

getIconChildFirst

public String getIconChildFirst()

setIconChildFirst

public void setIconChildFirst(String iconChildFirst)

getIconChildMiddle

public String getIconChildMiddle()

setIconChildMiddle

public void setIconChildMiddle(String iconChildMiddle)

getIconChildLast

public String getIconChildLast()

setIconChildLast

public void setIconChildLast(String iconChildLast)

getIconNodeOpen

public String getIconNodeOpen()

setIconNodeOpen

public void setIconNodeOpen(String iconNodeOpen)

getIconNodeOpenFirst

public String getIconNodeOpenFirst()

setIconNodeOpenFirst

public void setIconNodeOpenFirst(String iconNodeOpenFirst)

getIconNodeOpenMiddle

public String getIconNodeOpenMiddle()

setIconNodeOpenMiddle

public void setIconNodeOpenMiddle(String iconNodeOpenMiddle)

getIconNodeOpenLast

public String getIconNodeOpenLast()

setIconNodeOpenLast

public void setIconNodeOpenLast(String iconNodeOpenLast)

getIconNodeClose

public String getIconNodeClose()

setIconNodeClose

public void setIconNodeClose(String iconNodeClose)

getIconNodeCloseFirst

public String getIconNodeCloseFirst()

setIconNodeCloseFirst

public void setIconNodeCloseFirst(String iconNodeCloseFirst)

getIconNodeCloseMiddle

public String getIconNodeCloseMiddle()

setIconNodeCloseMiddle

public void setIconNodeCloseMiddle(String iconNodeCloseMiddle)

getIconNodeCloseLast

public String getIconNodeCloseLast()

setIconNodeCloseLast

public void setIconNodeCloseLast(String iconNodeCloseLast)

getNodeClass

public String getNodeClass()

setNodeClass

public void setNodeClass(String nodeClass)

getRowClasses

public String getRowClasses()
Returns:
Returns the rowClasses.

setRowClasses

public void setRowClasses(String rowClasses)
Parameters:
rowClasses - The rowClasses to set.

getColumnClasses

public String getColumnClasses()
Returns:
Returns the columnClasses.

setColumnClasses

public void setColumnClasses(String columnClasses)
Parameters:
columnClasses - The columnClasses to set.

getSelectedNodeClass

public String getSelectedNodeClass()
Returns:
Returns the selectedNodeClass.

setSelectedNodeClass

public void setSelectedNodeClass(String selectedNodeClass)
Parameters:
selectedNodeClass - The selectedNodeClass to set.

getIconClass

public String getIconClass()

setIconClass

public void setIconClass(String iconClass)

getExpireListeners

public long getExpireListeners()
Time interval the tree will remain registered as a TreeModelListener without being accessed


setExpireListeners

public void setExpireListeners(long expireListeners)

getFamily

public String getFamily()
Overrides:
getFamily in class javax.faces.component.html.HtmlPanelGroup

expandPath

public void expandPath(org.apache.myfaces.custom.tree.model.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(org.apache.myfaces.custom.tree.model.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(org.apache.myfaces.custom.tree.model.TreePath path,
                          javax.faces.context.FacesContext context)

getSelectionPath

public org.apache.myfaces.custom.tree.model.TreePath getSelectionPath()

selectionChanged

public void selectionChanged(HtmlTreeNode node)

getRootNode

public HtmlTreeNode getRootNode()

saveState

public Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class javax.faces.component.UIComponentBase

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class javax.faces.component.UIComponentBase

decode

public void decode(javax.faces.context.FacesContext context)
Overrides:
decode in class javax.faces.component.UIComponentBase

processDecodes

public void processDecodes(javax.faces.context.FacesContext context)
Overrides:
processDecodes in class javax.faces.component.UIComponentBase

processValidators

public void processValidators(javax.faces.context.FacesContext context)
Overrides:
processValidators in class javax.faces.component.UIComponentBase

processUpdates

public void processUpdates(javax.faces.context.FacesContext context)
Overrides:
processUpdates in class javax.faces.component.UIComponentBase

encodeBegin

public void encodeBegin(javax.faces.context.FacesContext context)
                 throws IOException
Overrides:
encodeBegin in class javax.faces.component.UIComponentBase
Throws:
IOException

encodeEnd

public void encodeEnd(javax.faces.context.FacesContext context)
               throws IOException
Overrides:
encodeEnd in class javax.faces.component.UIComponentBase
Throws:
IOException

restoreItemStates

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

treeNodesChanged

public void treeNodesChanged(org.apache.myfaces.custom.tree.model.TreeModelEvent e)
Specified by:
treeNodesChanged in interface org.apache.myfaces.custom.tree.model.TreeModelListener

treeNodesInserted

public void treeNodesInserted(org.apache.myfaces.custom.tree.model.TreeModelEvent e)
Specified by:
treeNodesInserted in interface org.apache.myfaces.custom.tree.model.TreeModelListener

treeNodesRemoved

public void treeNodesRemoved(org.apache.myfaces.custom.tree.model.TreeModelEvent e)
Specified by:
treeNodesRemoved in interface org.apache.myfaces.custom.tree.model.TreeModelListener

treeStructureChanged

public void treeStructureChanged(org.apache.myfaces.custom.tree.model.TreeModelEvent e)
Specified by:
treeStructureChanged in interface org.apache.myfaces.custom.tree.model.TreeModelListener

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

addToModelListeners

public void addToModelListeners()

collapseAll

public void collapseAll()

expandAll

public void expandAll()


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.