- java.lang.Object
-
- jakarta.faces.component.UIComponent
-
- jakarta.faces.component.UIComponentBase
-
- org.omnifaces.component.tree.TreeFamily
-
- org.omnifaces.component.tree.TreeNode
-
- All Implemented Interfaces:
PartialStateHolder
,StateHolder
,TransientStateHolder
,ComponentSystemEventListener
,FacesListener
,SystemEventListenerHolder
,EventListener
public class TreeNode extends TreeFamily
The
<o:treeNode>
is anUIComponent
that represents a single tree node within a parentTree
component. Within this component, thevar
attribute of the parentTree
component will expose the tree node. Each of its children is processed byTreeNodeItem
.The
level
attribute can be used to specify for which tree node level as obtained byTreeModel.getLevel()
this component should render the children byTreeNodeItem
. The root tree node has level 0.- Author:
- Bauke Scholtz
- See Also:
Tree
,TreeNodeItem
-
-
Field Summary
Fields Modifier and Type Field Description static String
COMPONENT_TYPE
The component type, which is "org.omnifaces.component.tree.TreeNode".-
Fields inherited from class org.omnifaces.component.tree.TreeFamily
COMPONENT_FAMILY
-
Fields inherited from class jakarta.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, VIEW_LOCATION_KEY
-
-
Constructor Summary
Constructors Constructor Description TreeNode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Integer
getLevel()
Returns the level for which this node should render the items.protected void
process(FacesContext context, PhaseId phaseId)
This method is by design only called byTree.processTreeNode(FacesContext, PhaseId)
as it maintains all the nodes.void
setLevel(Integer level)
Sets the level for which this node should render the items.protected void
validateHierarchy()
Validate the component hierarchy.-
Methods inherited from class org.omnifaces.component.tree.TreeFamily
encodeChildren, getFamily, getRendersChildren, processDecodes, processSuper, processUpdates, processValidators
-
Methods inherited from class jakarta.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeBegin, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getPassThroughAttributes, getRenderer, getRendererType, getValueBinding, invokeOnComponent, isRendered, isTransient, markInitialState, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEvent
-
Methods inherited from class jakarta.faces.component.UIComponent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression, visitTree
-
-
-
-
Field Detail
-
COMPONENT_TYPE
public static final String COMPONENT_TYPE
The component type, which is "org.omnifaces.component.tree.TreeNode".- See Also:
- Constant Field Values
-
-
Method Detail
-
validateHierarchy
protected void validateHierarchy()
Validate the component hierarchy.- Specified by:
validateHierarchy
in classTreeFamily
- Throws:
IllegalStateException
- When the direct parent component isn't of typeTree
, or when this component is nested in anotherTreeNode
, or when there aren't any children of typeTreeNodeItem
.
-
process
protected void process(FacesContext context, PhaseId phaseId)
This method is by design only called byTree.processTreeNode(FacesContext, PhaseId)
as it maintains all the nodes.- Specified by:
process
in classTreeFamily
- Parameters:
context
- The faces context to work with.phaseId
- The current phase ID.- See Also:
Tree.processTreeNode(FacesContext, PhaseId)
-
getLevel
public Integer getLevel()
Returns the level for which this node should render the items.- Returns:
- The level for which this node should render the items.
-
setLevel
public void setLevel(Integer level)
Sets the level for which this node should render the items.- Parameters:
level
- The level for which this node should render the items.
-
-