Class ViewIndex

java.lang.Object
org.kuali.rice.krad.uif.view.ViewIndex
All Implemented Interfaces:
Serializable

public class ViewIndex extends Object implements Serializable
Holds component indexes of a View instance for convenient retrieval during the lifecycle.
Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
  • Constructor Details

    • ViewIndex

      public ViewIndex()
  • Method Details

    • clearIndex

      protected void clearIndex(View view)
      Clears view indexes, for reinitializing indexes at the start of each phase.
    • indexComponent

      public void indexComponent(Component component)
      Adds an entry to the main index for the given component. If the component is of type DataField or CollectionGroup an entry is created in the corresponding indexes for those types as well. Then the #indexComponent method is called for each of the component's children

      If the component is already contained in the indexes, it will be replaced

      DataField instances are indexed by the attribute path. This is useful for retrieving the InputField based on the incoming request parameter

      CollectionGroup instances are indexed by the collection path. This is useful for retrieving the CollectionGroup based on the incoming request parameter

      Parameters:
      component - component instance to index
    • observeAssignedId

      public boolean observeAssignedId(String id)
      Observe an assigned ID.
      Parameters:
      id - ID to observe
      Returns:
      true if the ID is unique, false if the ID has already been observed
    • getComponentById

      public Component getComponentById(String id)
      Retrieves a Component from the view index by Id
      Parameters:
      id - id for the component to retrieve
      Returns:
      Component instance found in index, or null if no such component exists
    • getDataFieldByPath

      public DataField getDataFieldByPath(String propertyPath)
      Retrieves a DataField instance from the index
      Parameters:
      propertyPath - full path of the data field (from the form)
      Returns:
      DataField instance for the path or Null if not found
    • getDataFieldByPropertyName

      public DataField getDataFieldByPropertyName(String propertyName)
      Retrieves a DataField instance that has the given property name specified (note this is not the full binding path and first match is returned)
      Parameters:
      propertyName - property name for field to retrieve
      Returns:
      DataField instance found or null if not found
    • getLifecycleElementsByPath

      public Map<String,LifecycleElement> getLifecycleElementsByPath()
      Gets the Map of lifecycle elements that are indexed by their path relative to the view.
      Returns:
      map of all indexed lifecycle elements, key is the element path and value is the element instance
    • getLifecycleElementByPath

      public LifecycleElement getLifecycleElementByPath(String path)
      Gets a lifecycle element instance by the given path (relative to the view).
      Parameters:
      path - path of the element that should be returned
      Returns:
      lifecycle element instance for given path or null if element at that path does not exist
    • getDataFieldIndex

      public Map<String,DataField> getDataFieldIndex()
      Gets the Map that contains attribute field indexing information. The Map key points to an attribute binding path, and the Map value is the DataField instance
      Returns:
      data fields index map
    • getCollectionsIndex

      public Map<String,CollectionGroup> getCollectionsIndex()
      Gets the Map that contains collection indexing information. The Map key gives the binding path to the collection, and the Map value givens the CollectionGroup instance
      Returns:
      collection index map
    • getCollectionGroupByPath

      public CollectionGroup getCollectionGroupByPath(String collectionPath)
      Retrieves a CollectionGroup instance from the index
      Parameters:
      collectionPath - full path of the collection (from the form)
      Returns:
      CollectionGroup instance for the collection path or Null if not found
    • copy

      public ViewIndex copy()
      Returns a clone of the view index.
      Returns:
      ViewIndex clone