org.richfaces.ui.iteration.tree

## Class AbstractTree

- java.lang.Object
- - javax.faces.component.UIComponent
  - - javax.faces.component.UIComponentBase
    - - org.richfaces.ui.iteration.UIDataAdaptor
      - - org.richfaces.ui.iteration.tree.AbstractTree

- All Implemented Interfaces:
    EventListener, javax.faces.component.NamingContainer, javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, javax.faces.component.TransientStateHolder, javax.faces.component.UniqueIdVendor, javax.faces.event.ComponentSystemEventListener, javax.faces.event.FacesListener, javax.faces.event.SystemEventListener, javax.faces.event.SystemEventListenerHolder, AjaxEventsProps, AjaxProps, CoreProps, EventsKeyProps, EventsMouseProps, I18nProps, ImmediateProps, SequenceProps, TreeCommonProps, TreeProps, MetaComponentEncoder, MetaComponentResolver, IterationStateHolder, TreeSelectionChangeSource, TreeToggleSource
  Direct Known Subclasses:
    UITree

      public abstract class AbstractTree
      extends UIDataAdaptor
      implements MetaComponentResolver, MetaComponentEncoder, TreeSelectionChangeSource, TreeToggleSource, AjaxProps, CoreProps, EventsKeyProps, EventsMouseProps, ImmediateProps, I18nProps, SequenceProps, TreeProps, TreeCommonProps

  The <r:tree> component provides a hierarchical tree control. Each <r:tree> component typically consists of <r:treeNode> child components. The appearance and behavior of the tree and its nodes can be fully customized.

  Author:
    Nick Belaevski

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.richfaces.ui.iteration.UIDataAdaptor

      `UIDataAdaptor.ComponentVisitor`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `COMPONENT_FAMILY`
    `static String` | `COMPONENT_TYPE`
    `static String` | `DEFAULT_TREE_NODE_FACET_NAME`
    `static String` | `DEFAULT_TREE_NODE_ID`
    `static String` | `SELECTION_META_COMPONENT_ID`

    - ### Fields inherited from class org.richfaces.ui.iteration.UIDataAdaptor

      `decodeVisitor, updateVisitor, validateVisitor`

    - ### Fields inherited from class javax.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`

    - ### Fields inherited from interface org.richfaces.ui.common.meta.MetaComponentResolver

      `META_COMPONENT_SEPARATOR_CHAR`

    - ### Fields inherited from interface javax.faces.component.NamingContainer

      `SEPARATOR_CHAR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractTree()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTreeSelectionChangeListener(TreeSelectionChangeListener listener)`
    `void` | `addTreeToggleListener(TreeToggleListener listener)`
    `void` | `broadcast(javax.faces.event.FacesEvent event)`
    `DeclarativeModelKey` | `convertDeclarativeKeyFromString(javax.faces.context.FacesContext context, String modelId, String modelKeyAsString)`
    `String` | `convertDeclarativeKeyToString(javax.faces.context.FacesContext context, DeclarativeModelKey declarativeKey)`
    `protected DataComponentState` | `createComponentState()`
    `protected ExtendedDataModel<?>` | `createExtendedDataModel()`
    `TreeDataModelTuple` | `createSnapshot()`
    `protected Iterator<javax.faces.component.UIComponent>` | `dataChildren()`
    `void` | `encodeMetaComponent(javax.faces.context.FacesContext context, String metaComponentId)`
    `protected javax.faces.component.UIComponent` | `findDeclarativeModel(String modelId)`
    `protected Iterator<javax.faces.component.UIComponent>` | `findMatchingTreeNodeComponent(String nodeType, javax.faces.component.UIComponent parentComponent)`
    `AbstractTreeNode` | `findTreeNodeComponent()`
    `String` | `getFamily()`
    `abstract String` | `getNodeClass()` Space-separated list of CSS style class(es) to be applied to the tree nodes.
    `abstract String` | `getNodeType()` Determines which treeNode should be used for rendering.
    `abstract String` | `getOnbeforenodetoggle()` The client-side script method to be called before the node is toggled.
    `abstract String` | `getOnbeforeselectionchange()` The client-side script method to be called before the selection is changed.
    `abstract String` | `getOnnodetoggle()` The client-side script method to be called after the node is toggled.
    `abstract String` | `getOnselectionchange()` The client-side script method to be called after the selection is changed.
    `javax.faces.convert.Converter` | `getRowKeyConverter()` Converter for a row key object
    `Collection<Object>` | `getSelection()` The collections of selected nodes.
    `abstract SwitchType` | `getSelectionType()` The type of type of the selection - ajax (default), client, server.
    `abstract String` | `getToggleNodeEvent()` Client-side event used for toggling tree nodes (click, dblclick, etc.)
    `abstract SwitchType` | `getToggleType()` The type of type of the node toggling - ajax (default), client, server.
    `protected TreeDataModel<?>` | `getTreeDataModel()`
    `protected TreeRange` | `getTreeRange()`
    `TreeSelectionChangeListener[]` | `getTreeSelectionChangeListeners()`
    `TreeToggleListener[]` | `getTreeToggleListeners()`
    `abstract Object` | `getValue()` Points to the data model
    `boolean` | `isExpanded()`
    `abstract boolean` | `isImmediate()` Flag indicating that, if this component is activated by the user, notifications should be delivered to interested listeners and actions immediately (that is, during Apply Request Values phase) rather than waiting until the Invoke Application phase.
    `boolean` | `isLeaf()`
    `void` | `removeTreeSelectionChangeListener(TreeSelectionChangeListener listener)`
    `void` | `removeTreeToggleListener(TreeToggleListener listener)`
    `protected void` | `resetDataModel()`
    `String` | `resolveClientId(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent contextComponent, String metaComponentId)` Resolves and returns string identifying supported meta-component or `null` if provided meta-component name is not a supported one.
    `protected void` | `restoreChildState(javax.faces.context.FacesContext facesContext)`
    `void` | `restoreFromSnapshot(javax.faces.context.FacesContext context, TreeDataModelTuple tuple)`
    `void` | `setSelection(Collection<Object> selection)`
    `protected void` | `setupCurrentComponent()`
    `String` | `substituteUnresolvedClientId(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent contextComponent, String metaComponentId)` Provides replacement for unresolved meta-component names.
    `protected boolean` | `visitFixedChildren(javax.faces.component.visit.VisitContext visitContext, javax.faces.component.visit.VisitCallback callback)`
    `void` | `walk(javax.faces.context.FacesContext faces, DataVisitor visitor, Object argument)` Walk ( visit ) this component on all data-aware children for each row.
    `void` | `walkModel(javax.faces.context.FacesContext context, TreeDataVisitor dataVisitor)`

    - ### Methods inherited from class org.richfaces.ui.iteration.UIDataAdaptor

      `allFixedChildren, captureOrigValue, clearExtendedDataModel, clearInitialState, createUniqueId, doUpdate, extractKeySegment, fixedChildren, getComponentState, getContainerClientId, getContainerClientId, getExtendedDataModel, getIterationState, getLocalComponentState, getRowCount, getRowData, getRowKey, getRowKeyVar, getStateVar, getVar, getVariablesMap, invokeOnComponent, invokeOnRow, isKeepSaved, isListenerForSource, isRowAvailable, iterate, keepSaved, markInitialState, preDecode, preEncodeBegin, preUpdate, preValidate, processDecodes, processDecodesChildren, processEvent, processEvent, processUpdates, processUpdatesChildren, processValidatesChildren, processValidators, queueEvent, resetChildState, restoreChildState, restoreOrigValue, restoreState, saveChildState, saveChildState, saveState, setExtendedDataModel, setId, setIterationState, setKeepSaved, setRowKey, setRowKey, setRowKeyConverter, setRowKeyVar, setStateVar, setupVariable, setValueExpression, setVar, visitDataChildren, visitDataChildrenMetaComponents, visitTree, wrapEvent`

    - ### Methods inherited from class javax.faces.component.UIComponentBase

      `addClientBehavior, addFacesListener, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getPassThroughAttributes, getRenderer, getRendererType, getRendersChildren, getValueBinding, isRendered, isTransient, processRestoreState, processSaveState, removeFacesListener, restoreAttachedState, saveAttachedState, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEvent`

    - ### Methods inherited from class javax.faces.component.UIComponent

      `encodeAll, getClientId, getCompositeComponentParent, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, pushComponentToEL, restoreTransientState, saveTransientState, setInView`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.richfaces.ui.attribute.AjaxProps

      `getData, getExecute, getRender, getStatus, isLimitRender`

    - ### Methods inherited from interface org.richfaces.ui.attribute.AjaxEventsProps

      `getOnbeforedomupdate, getOnbegin, getOncomplete`

    - ### Methods inherited from interface org.richfaces.ui.attribute.CoreProps

      `getStyle, getStyleClass, getTitle`

    - ### Methods inherited from interface org.richfaces.ui.attribute.EventsKeyProps

      `getOnkeydown, getOnkeypress, getOnkeyup`

    - ### Methods inherited from interface org.richfaces.ui.attribute.EventsMouseProps

      `getOnclick, getOndblclick, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup`

    - ### Methods inherited from interface org.richfaces.ui.attribute.I18nProps

      `getDir, getLang`

    - ### Methods inherited from interface org.richfaces.ui.attribute.TreeProps

      `getRowKeyVar, getSelectionChangeListener, getStateVar, getToggleListener, getVar, isKeepSaved`

    - ### Methods inherited from interface org.richfaces.ui.attribute.TreeCommonProps

      `getHandleClass, getIconClass, getIconCollapsed, getIconExpanded, getIconLeaf, getLabelClass`

- - ### 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

    - #### SELECTION_META_COMPONENT_ID

          public static final String SELECTION_META_COMPONENT_ID

      See Also:
        Constant Field Values

    - #### DEFAULT_TREE_NODE_ID

          public static final String DEFAULT_TREE_NODE_ID

      See Also:
        Constant Field Values

    - #### DEFAULT_TREE_NODE_FACET_NAME

          public static final String DEFAULT_TREE_NODE_FACET_NAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AbstractTree

          public AbstractTree()

  - ### Method Detail

    - #### getTreeRange

          protected TreeRange getTreeRange()

    - #### getValue

          public abstract Object getValue()

      Points to the data model

    - #### isImmediate

          public abstract boolean isImmediate()

      Description copied from interface: `ImmediateProps`
      Flag indicating that, if this component is activated by the user, notifications should be delivered to interested listeners and actions immediately (that is, during Apply Request Values phase) rather than waiting until the Invoke Application phase.
      Specified by:
        `isImmediate` in interface `ImmediateProps`

    - #### getNodeClass

          public abstract String getNodeClass()

      Description copied from interface: `TreeProps`
      Space-separated list of CSS style class(es) to be applied to the tree nodes.
      Specified by:
        `getNodeClass` in interface `TreeProps`

    - #### getOnnodetoggle

          public abstract String getOnnodetoggle()

      Description copied from interface: `TreeProps`
      The client-side script method to be called after the node is toggled.
      Specified by:
        `getOnnodetoggle` in interface `TreeProps`

    - #### getOnbeforenodetoggle

          public abstract String getOnbeforenodetoggle()

      Description copied from interface: `TreeProps`
      The client-side script method to be called before the node is toggled.
      Specified by:
        `getOnbeforenodetoggle` in interface `TreeProps`

    - #### getOnselectionchange

          public abstract String getOnselectionchange()

      Description copied from interface: `TreeProps`
      The client-side script method to be called after the selection is changed.
      Specified by:
        `getOnselectionchange` in interface `TreeProps`

    - #### getOnbeforeselectionchange

          public abstract String getOnbeforeselectionchange()

      Description copied from interface: `TreeProps`
      The client-side script method to be called before the selection is changed.
      Specified by:
        `getOnbeforeselectionchange` in interface `TreeProps`

    - #### getToggleType

          public abstract SwitchType getToggleType()

      Description copied from interface: `TreeProps`
      The type of type of the node toggling - ajax (default), client, server.
      Specified by:
        `getToggleType` in interface `TreeProps`

    - #### getSelectionType

          public abstract SwitchType getSelectionType()

      Description copied from interface: `TreeProps`
      The type of type of the selection - ajax (default), client, server.
      Specified by:
        `getSelectionType` in interface `TreeProps`

    - #### getNodeType

          public abstract String getNodeType()

      Description copied from interface: `TreeProps`
      Determines which treeNode should be used for rendering. Should contain EL expressions which uses request-scoped variable with name defied in attribute 'var'.
      Specified by:
        `getNodeType` in interface `TreeProps`

    - #### getToggleNodeEvent

          public abstract String getToggleNodeEvent()

      Description copied from interface: `TreeProps`
      Client-side event used for toggling tree nodes (click, dblclick, etc.)
      Specified by:
        `getToggleNodeEvent` in interface `TreeProps`

    - #### getFamily

          public String getFamily()

      Overrides:
        `getFamily` in class `UIDataAdaptor`

    - #### getSelection

          public Collection<Object> getSelection()

      Description copied from interface: `TreeProps`
      The collections of selected nodes.
      Specified by:
        `getSelection` in interface `TreeProps`

    - #### setSelection

          public void setSelection(Collection<Object> selection)

    - #### createComponentState

          protected DataComponentState createComponentState()

      Specified by:
        `createComponentState` in class `UIDataAdaptor`

    - #### getRowKeyConverter

          public javax.faces.convert.Converter getRowKeyConverter()

      Description copied from interface: `SequenceProps`
      Converter for a row key object
      Specified by:
        `getRowKeyConverter` in interface `SequenceProps`
      Overrides:
        `getRowKeyConverter` in class `UIDataAdaptor`

    - #### findMatchingTreeNodeComponent

          protected Iterator<javax.faces.component.UIComponent> findMatchingTreeNodeComponent(String nodeType,
                                                                                  javax.faces.component.UIComponent parentComponent)

    - #### setupCurrentComponent

          protected void setupCurrentComponent()

    - #### findTreeNodeComponent

          public AbstractTreeNode findTreeNodeComponent()

    - #### broadcast

          public void broadcast(javax.faces.event.FacesEvent event)
                         throws javax.faces.event.AbortProcessingException

      Overrides:
        `broadcast` in class `UIDataAdaptor`
      Throws:
        `javax.faces.event.AbortProcessingException`

    - #### visitFixedChildren

          protected boolean visitFixedChildren(javax.faces.component.visit.VisitContext visitContext,
                                   javax.faces.component.visit.VisitCallback callback)

      Overrides:
        `visitFixedChildren` in class `UIDataAdaptor`

    - #### encodeMetaComponent

          public void encodeMetaComponent(javax.faces.context.FacesContext context,
                                 String metaComponentId)
                                   throws IOException

      Specified by:
        `encodeMetaComponent` in interface `MetaComponentEncoder`
      Throws:
        `IOException`

    - #### resolveClientId

          public String resolveClientId(javax.faces.context.FacesContext facesContext,
                               javax.faces.component.UIComponent contextComponent,
                               String metaComponentId)

      Description copied from interface: `MetaComponentResolver`
      Resolves and returns string identifying supported meta-component or `null` if provided meta-component name is not a supported one.
      Specified by:
        `resolveClientId` in interface `MetaComponentResolver`
      Parameters:
        `facesContext` - - current instance of `FacesContext`
        `contextComponent` - - instance of `UIComponent` that requested resolution of meta-component
        `metaComponentId` - - name of meta-component (without leading '@' sign)
      Returns:
        clientId, one of supported meta-names such as @all, @this, etc. or `null`

    - #### substituteUnresolvedClientId

          public String substituteUnresolvedClientId(javax.faces.context.FacesContext facesContext,
                                            javax.faces.component.UIComponent contextComponent,
                                            String metaComponentId)

      Description copied from interface: `MetaComponentResolver`
      Provides replacement for unresolved meta-component names. Returns identifier string for the chosen substitution or `null`
      Specified by:
        `substituteUnresolvedClientId` in interface `MetaComponentResolver`
      Parameters:
        `facesContext` - - current instance of `FacesContext`
        `contextComponent` - - instance of `UIComponent` that requested resolution of meta-component
        `metaComponentId` - - name of meta-component (without leading '@' sign)
      Returns:
        clientId, one of supported meta-names such as @all, @this, etc. or `null`

    - #### dataChildren

          protected Iterator<javax.faces.component.UIComponent> dataChildren()

      Overrides:
        `dataChildren` in class `UIDataAdaptor`

    - #### addTreeSelectionChangeListener

          public void addTreeSelectionChangeListener(TreeSelectionChangeListener listener)

      Specified by:
        `addTreeSelectionChangeListener` in interface `TreeSelectionChangeSource`

    - #### getTreeSelectionChangeListeners

          public TreeSelectionChangeListener[] getTreeSelectionChangeListeners()

    - #### removeTreeSelectionChangeListener

          public void removeTreeSelectionChangeListener(TreeSelectionChangeListener listener)

      Specified by:
        `removeTreeSelectionChangeListener` in interface `TreeSelectionChangeSource`

    - #### addTreeToggleListener

          public void addTreeToggleListener(TreeToggleListener listener)

      Specified by:
        `addTreeToggleListener` in interface `TreeToggleSource`

    - #### getTreeToggleListeners

          public TreeToggleListener[] getTreeToggleListeners()

    - #### removeTreeToggleListener

          public void removeTreeToggleListener(TreeToggleListener listener)

      Specified by:
        `removeTreeToggleListener` in interface `TreeToggleSource`

    - #### isExpanded

          public boolean isExpanded()

    - #### getTreeDataModel

          protected TreeDataModel<?> getTreeDataModel()

    - #### isLeaf

          public boolean isLeaf()

    - #### walk

          public void walk(javax.faces.context.FacesContext faces,
                  DataVisitor visitor,
                  Object argument)

      Description copied from class: `UIDataAdaptor`
      Walk ( visit ) this component on all data-aware children for each row.
      Overrides:
        `walk` in class `UIDataAdaptor`

    - #### createExtendedDataModel

          protected ExtendedDataModel<?> createExtendedDataModel()

      Specified by:
        `createExtendedDataModel` in class `UIDataAdaptor`

    - #### walkModel

          public void walkModel(javax.faces.context.FacesContext context,
                       TreeDataVisitor dataVisitor)

    - #### resetDataModel

          protected void resetDataModel()

      Overrides:
        `resetDataModel` in class `UIDataAdaptor`

    - #### createSnapshot

          public TreeDataModelTuple createSnapshot()

    - #### restoreFromSnapshot

          public void restoreFromSnapshot(javax.faces.context.FacesContext context,
                                 TreeDataModelTuple tuple)

    - #### restoreChildState

          protected void restoreChildState(javax.faces.context.FacesContext facesContext)

      Overrides:
        `restoreChildState` in class `UIDataAdaptor`

    - #### findDeclarativeModel

          protected javax.faces.component.UIComponent findDeclarativeModel(String modelId)

    - #### convertDeclarativeKeyToString

          public String convertDeclarativeKeyToString(javax.faces.context.FacesContext context,
                                             DeclarativeModelKey declarativeKey)
                                               throws javax.faces.convert.ConverterException

      Throws:
        `javax.faces.convert.ConverterException`

    - #### convertDeclarativeKeyFromString

          public DeclarativeModelKey convertDeclarativeKeyFromString(javax.faces.context.FacesContext context,
                                                            String modelId,
                                                            String modelKeyAsString)
                                                              throws javax.faces.convert.ConverterException

      Throws:
        `javax.faces.convert.ConverterException`

Copyright © 2014 JBoss by Red Hat. All rights reserved.