org.apache.myfaces.trinidad.model

## Class ProcessMenuModel

- java.lang.Object
- - javax.faces.model.DataModel
  - - org.apache.myfaces.trinidad.model.CollectionModel
    - - org.apache.myfaces.trinidad.model.TreeModel
      - - org.apache.myfaces.trinidad.model.MenuModel
        - - org.apache.myfaces.trinidad.model.BaseMenuModel
          - - org.apache.myfaces.trinidad.model.ViewIdPropertyMenuModel
            - - org.apache.myfaces.trinidad.model.ProcessMenuModel

- All Implemented Interfaces:
    Iterable, LocalRowKeyIndex, RowKeyIndex, TreeLocalRowKeyIndex

      public class ProcessMenuModel
      extends ViewIdPropertyMenuModel

  There are two common scenarios for processes, "Plus One" and "Max Visited" which are explained below.

  - "Plus One" - from the current step the user can navigate to any previous page and the next page. If the user is on the 5th step of a process and goes back to step 2, then the user can only navigate from step 2 to step 1 and step 3.
  - "Max Visited" - the user can navigate to the max visited page. If the user is currently on the max visited page then the user can also navigate to the next page. If the user is on the 5th step of a process and goes back to step 2, then the user can navigate from step 2 to steps 1, 2, 3, 4, and 5.

  A node in a process should be readOnly if that step of the process is not reachable from the current step. The `isReadOnly()` method can be used to bind the node's readOnly attribute.

  A node in a process should be immediate if the values in the current step don't need to be validated. The `isImmediate()` method can be used to bind the node's immediate attribute.

  See Also:
    `ProcessUtils`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.myfaces.trinidad.model.LocalRowKeyIndex

      `LocalRowKeyIndex.Confidence, LocalRowKeyIndex.LocalCachingStrategy`

  - ### Field Summary

    - ### Fields inherited from class org.apache.myfaces.trinidad.model.CollectionModel

      `UNKNOWN_ROW_LIMIT, UNLIMITED_ROW`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ProcessMenuModel()` No-arg constructor for use with managed-beans.
    `ProcessMenuModel(Object instance, String viewIdProperty)` The "Plus One" behavior will be used with this constructor.
    `ProcessMenuModel(Object instance, String viewIdProperty, String maxPathKey)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearMaxPath()` to clear the max visited path out of the session
    `String` | `getMaxPathKey()`
    `boolean` | `isImmediate()` A node in a process should be immediate if the values in the current step don't need to be validated.
    `boolean` | `isReadOnly()` A node in a process should be readOnly if that step of the process is not reachable from the current step.
    `boolean` | `isVisited()` For the Max Visited case, a stop is considered visited if - a stop is before the max visited stop - or is the max visited stop For the Plus One case, a stop is considered visited if, - it's before the current or, - is the current stop itself
    `void` | `setMaxPathKey(String maxPathKey)`

    - ### Methods inherited from class org.apache.myfaces.trinidad.model.ViewIdPropertyMenuModel

      `addViewId, getCurrentViewId, getFocusRowKey, getViewIdProperty, setViewIdProperty, setWrappedData`

    - ### Methods inherited from class org.apache.myfaces.trinidad.model.BaseMenuModel

      `enterContainer, exitContainer, getContainerRowKey, getRowCount, getRowData, getRowIndex, getRowKey, getWrappedData, isContainer, isRowAvailable, setRowIndex, setRowKey`

    - ### Methods inherited from class org.apache.myfaces.trinidad.model.TreeModel

      `areRowsLocallyAvailable, areRowsLocallyAvailable, areRowsLocallyAvailable, getAllAncestorContainerRowKeys, getContainerRowKey, getDepth, getDepth, isChildCollectionLocallyAvailable, isChildCollectionLocallyAvailable, isChildCollectionLocallyAvailable, isContainerEmpty`

    - ### Methods inherited from class org.apache.myfaces.trinidad.model.CollectionModel

      `addRowKeyChangeListener, areRowsAvailable, areRowsAvailable, areRowsAvailable, areRowsLocallyAvailable, areRowsLocallyAvailable, areRowsLocallyAvailable, clearCachedRow, clearCachedRow, clearCachedRows, clearCachedRows, clearLocalCache, ensureRowsAvailable, fireRowKeyChange, getCachingStrategy, getEstimatedRowCount, getEstimatedRowCountConfidence, getRowData, getRowData, getRowLimit, getSortCriteria, isRowAvailable, isRowAvailable, isRowLocallyAvailable, isRowLocallyAvailable, isSortable, removeRowKeyChangeListener, setSortCriteria`

    - ### Methods inherited from class javax.faces.model.DataModel

      `addDataModelListener, getDataModelListeners, iterator, removeDataModelListener`

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

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

- - ### Constructor Detail

    - #### ProcessMenuModel

          public ProcessMenuModel()

      No-arg constructor for use with managed-beans. Must call the `ViewIdPropertyMenuModel.setViewIdProperty(java.lang.String)` and `ViewIdPropertyMenuModel.setWrappedData(java.lang.Object)` methods after constructing this instance.

    - #### ProcessMenuModel

          public ProcessMenuModel(Object instance,
                          String viewIdProperty)
                           throws IntrospectionException

      The "Plus One" behavior will be used with this constructor.
      Parameters:
        `instance` - a treeModel. This object will be passed to `ModelUtils.toTreeModel(java.lang.Object)`
        `viewIdProperty` - the property to use to retrieve a viewId from a node in the tree
      Throws:
        `IntrospectionException`

    - #### ProcessMenuModel

          public ProcessMenuModel(Object instance,
                          String viewIdProperty,
                          String maxPathKey)
                           throws IntrospectionException

      Parameters:
        `instance` - a treeModel. This object will be passed to `ModelUtils.toTreeModel(java.lang.Object)`
        `viewIdProperty` - the property to use to retrieve a viewId from a node in the tree
        `maxPathKey` - if the "Max Visited" behavior is desired, this is the key that will be used to get and set the maxPath value on the session and request. For the "Plus One" behavior pass in null.
      Throws:
        `IntrospectionException`

  - ### Method Detail

    - #### isImmediate

          public boolean isImmediate()

      A node in a process should be immediate if the values in the current step don't need to be validated. This method can be used to bind the node's immediate attribute. If a user will have to return to the current page then immediate can be set to true. For example in a "Plus One" process, if the user is on step 5 and goes back to step 2, the user will have to come back to step 5 again, so the fields on page 5 don't need to be validated when going back to steps 1,2,3,4, but should be validated when going to step 6.

      - "Plus One"
        - immediate - immediate will be true for any previous step, and false otherwise.
      - "Max Visited" - when the current step and the max step are the same, "max visited" behaves like "plus one". If the current step is before the max step, then:
        - immediate - immediate is false.

    - #### isReadOnly

          public boolean isReadOnly()

      A node in a process should be readOnly if that step of the process is not reachable from the current step. This method can be used to bind the node's readOnly attribute.

      - "Plus One"
        - readOnly - readOnly will be true for any step past the next available step
      - "Max Visited" - when the current step and the max step are the same, "max visited" behaves like "plus one". If the current step is before the max step, then:
        - readOnly - readOnly will be true for any step past the max step

    - #### isVisited

          public boolean isVisited()

      For the Max Visited case, a stop is considered visited if - a stop is before the max visited stop - or is the max visited stop For the Plus One case, a stop is considered visited if, - it's before the current or, - is the current stop itself

    - #### clearMaxPath

          public void clearMaxPath()

      to clear the max visited path out of the session

    - #### setMaxPathKey

          public void setMaxPathKey(String maxPathKey)

    - #### getMaxPathKey

          public String getMaxPathKey()

Copyright © 2001-2017 The Apache Software Foundation. All Rights Reserved.