Class TreeNode

All Implemented Interfaces:
PartialStateHolder, StateHolder, TransientStateHolder, ComponentSystemEventListener, FacesListener, SystemEventListenerHolder, EventListener

public class TreeNode extends TreeFamily

The <o:treeNode> is an UIComponent that represents a single tree node within a parent Tree component. Within this component, the var attribute of the parent Tree component will expose the tree node. Each of its children is processed by TreeNodeItem.

The level attribute can be used to specify for which tree node level as obtained by TreeModel.getLevel() this component should render the children by TreeNodeItem. The root tree node has level 0.

Author:
Bauke Scholtz
See Also:
  • Field Details

    • COMPONENT_TYPE

      public static final String COMPONENT_TYPE
      The component type, which is "org.omnifaces.component.tree.TreeNode".
      See Also:
  • Constructor Details

    • TreeNode

      public TreeNode()
  • Method Details

    • validateHierarchy

      protected void validateHierarchy(FacesContext context)
      Validate the component hierarchy.
      Specified by:
      validateHierarchy in class TreeFamily
      Parameters:
      context - The faces context to work with.
      Throws:
      IllegalStateException - When the direct parent component isn't of type Tree, or when this component is nested in another TreeNode, or when there aren't any children of type TreeNodeItem.
    • process

      protected void process(FacesContext context, PhaseId phaseId)
      This method is by design only called by Tree.processTreeNode(FacesContext, PhaseId) as it maintains all the nodes.
      Specified by:
      process in class TreeFamily
      Parameters:
      context - The faces context to work with.
      phaseId - The current phase ID.
      See Also:
    • 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.