Class StackedLayoutManagerBase

All Implemented Interfaces:
Serializable, Cloneable, Copyable, DictionaryBean, UifDictionaryBean, CollectionLayoutManager, LayoutManager, StackedLayoutManager, LifecycleElement

public class StackedLayoutManagerBase extends CollectionLayoutManagerBase implements StackedLayoutManager
Layout manager that works with CollectionGroup containers and renders the collection lines in a vertical row

For each line of the collection, a Group instance is created. The group header contains a label for the line (summary information), the group fields are the collection line fields, and the group footer contains the line actions. All the groups are rendered using the BoxLayoutManager with vertical orientation.

Modify the lineGroupPrototype to change header/footer styles or any other customization for the line groups

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
  • Constructor Details

    • StackedLayoutManagerBase

      public StackedLayoutManagerBase()
  • Method Details

    • performInitialization

      public void performInitialization(Object model)
      Initializes the component

      Where components can set defaults and setup other necessary state. The initialize method should only be called once per component lifecycle and is invoked within the initialize phase of the view lifecylce.

      Specified by:
      performInitialization in interface LifecycleElement
      Overrides:
      performInitialization in class LayoutManagerBase
      Parameters:
      model - - object instance containing the view data
      See Also:
    • performApplyModel

      public void performApplyModel(Object model, LifecycleElement component)
      Called after the initialize phase to perform conditional logic based on the model data

      Where components can perform conditional logic such as dynamically generating new fields or setting field state based on the given data

      Specified by:
      performApplyModel in interface LifecycleElement
      Overrides:
      performApplyModel in class LayoutManagerBase
      Parameters:
      model - - Top level object containing the data (could be the form or a top level business object, dto)
      component - parent lifecycle element
    • performFinalize

      public void performFinalize(Object model, LifecycleElement element)
      The last phase before the view is rendered

      Here final preparations can be made based on the updated view state.

      Specified by:
      performFinalize in interface LifecycleElement
      Overrides:
      performFinalize in class LayoutManagerBase
      Parameters:
      model - - top level object containing the data
      element - - parent component
    • buildLine

      public void buildLine(LineBuilderContext lineBuilderContext)
      Call to the layout manager to build the components necessary for the given collection line, within an active view lifecycle.

      As the collection is being iterated over by the CollectionGroupLineBuilder this method is invoked for each line. The builder will create copies of the configured fields and actions for the line and pass into the layout manager so they can be assembled

      Specified by:
      buildLine in interface CollectionLayoutManager
      Parameters:
      lineBuilderContext - context for the line to be built
    • determineLineActionPlacement

      protected void determineLineActionPlacement(Group lineGroup, CollectionGroup collectionGroup, LineBuilderContext lineBuilderContext, List<Component> groupFields)
      Places actions in the appropriate location for the stacked group line based on placement flags set on this layout manager
      Parameters:
      lineGroup - the current line group
      collectionGroup - the current collection group
      lineBuilderContext - the line's building context
      groupFields - the list of fields which will be added to the line group
    • buildLineHeaderText

      protected String buildLineHeaderText(Object line, Group lineGroup)
      Builds the header text for the collection line

      Header text is built up by first the collection label, either specified on the collection definition or retrieved from the dictionary. Then for each summary field defined, the value from the model is retrieved and added to the header.

      Note the getSummaryTitle() field may have expressions defined, in which cause it will be copied to the property expressions map to set the title for the line group (which will have the item context variable set)

      Parameters:
      line - Collection line containing data
      lineGroup - Group instance for rendering the line and whose title should be built
      Returns:
      header text for line
    • processPagingRequest

      public void processPagingRequest(Object model, CollectionGroup collectionGroup)
      Invokes CollectionPagingHelper to carry out the paging request. Invoked when a paging request occurs to carry out the paging request.
      Specified by:
      processPagingRequest in interface CollectionLayoutManager
      Parameters:
      model - object containing the view's data
      collectionGroup - collection group the request was made for
    • getAddLineGroup

      @ViewLifecycleRestriction("INITIALIZE") public Group getAddLineGroup()
      Returns the parent CollectionLayoutManagerBase's add line group

      This method is overridden to restrict the lifecycle of the add line group as a resolution to avoid duplicate components from being added to the view, for example, quickfinders.

      Group for rendering the add line when separate (always the case for stacked layout, and a configuration for table layout).

      This group can be used to configure how the add line will be rendered. For example the layout manager configured on the group will be used to rendered the add line fields. If the header (title) is not set on the group, it will be set from CollectionGroup.getAddLabel(). In addition, CollectionGroup.getAddLineActions() will be added to the group footer items.

      Specified by:
      getAddLineGroup in interface CollectionLayoutManager
      Overrides:
      getAddLineGroup in class CollectionLayoutManagerBase
      Returns:
      Group instance for the collection add line
    • getSupportedContainer

      public Class<? extends Container> getSupportedContainer()
      Default Impl Determines what Container classes are supported by the LayoutManager
      Specified by:
      getSupportedContainer in interface LayoutManager
      Overrides:
      getSupportedContainer in class LayoutManagerBase
      Returns:
      Classinvalid input: '<'? extends Container> container class supported
    • getSummaryTitle

      public String getSummaryTitle()
      Text to appears in the header for each collection lines Group. Used in conjunction with StackedLayoutManager.getSummaryFields() to build up the final header text
      Specified by:
      getSummaryTitle in interface StackedLayoutManager
      Returns:
      summary title text
    • setSummaryTitle

      public void setSummaryTitle(String summaryTitle)
      Setter for the summary title text
      Specified by:
      setSummaryTitle in interface StackedLayoutManager
      Parameters:
      summaryTitle -
    • getSummaryFields

      public List<String> getSummaryFields()
      List of attribute names from the collection line class that should be used to build the line summary. To build the summary the value for each attribute is retrieved from the line instance. All the values are then placed together with a separator.
      Specified by:
      getSummaryFields in interface StackedLayoutManager
      Returns:
      summary field names
      See Also:
    • setSummaryFields

      public void setSummaryFields(List<String> summaryFields)
      Setter for the summary field name list
      Specified by:
      setSummaryFields in interface StackedLayoutManager
      Parameters:
      summaryFields -
    • getLineGroupPrototype

      @ViewLifecycleRestriction("INITIALIZE") public Group getLineGroupPrototype()
      Group instance that is used as a prototype for creating the collection line groups. For each line a copy of the prototype is made and then adjusted as necessary
      Specified by:
      getLineGroupPrototype in interface StackedLayoutManager
      Returns:
      Group instance to use as prototype
    • setLineGroupPrototype

      public void setLineGroupPrototype(Group lineGroupPrototype)
      Setter for the line group prototype
      Specified by:
      setLineGroupPrototype in interface StackedLayoutManager
      Parameters:
      lineGroupPrototype -
    • getWrapperGroup

      public Group getWrapperGroup()
      Group that will 'wrap' the generated collection lines so that they have a different layout from the general stacked layout

      By default (when the wrapper group is null), each collection line will become a group and the groups are rendered one after another. If the wrapper group is configured, the generated groups will be inserted as the items for the wrapper group, and the layout manager configured for the wrapper group will determine how they are rendered. For example, the layout manager could be a grid layout configured for three columns, which would layout the first three lines horizontally then break to a new row.

      Specified by:
      getWrapperGroup in interface StackedLayoutManager
      Returns:
      Group instance whose items list should be populated with the generated groups, or null to use the default layout
    • setWrapperGroup

      public void setWrapperGroup(Group wrapperGroup)
      Setter for the wrapper group that will receive the generated line groups
      Specified by:
      setWrapperGroup in interface StackedLayoutManager
      Parameters:
      wrapperGroup -
    • getStackedGroups

      @ViewLifecycleRestriction public List<Group> getStackedGroups()
      Final List of Groups to render for the collection
      Specified by:
      getStackedGroups in interface StackedLayoutManager
      Returns:
      collection groups
    • getStackedGroupsNoWrapper

      public List<Group> getStackedGroupsNoWrapper()
      Used by reflection during the lifecycle to get groups for the lifecycle when not using a wrapper group

      There are no references to this method in the code, this is intentional. DO NOT REMOVE.

      Specified by:
      getStackedGroupsNoWrapper in interface StackedLayoutManager
      Returns:
      the stacked groups, if any
    • setStackedGroups

      public void setStackedGroups(List<Group> stackedGroups)
      Setter for the collection groups
      Specified by:
      setStackedGroups in interface StackedLayoutManager
      Parameters:
      stackedGroups -
    • isRenderLineActionsInLineGroup

      public boolean isRenderLineActionsInLineGroup()
      Flag that indicates whether actions will be added in the same group as the line items instead of in the footer of the line group
      Specified by:
      isRenderLineActionsInLineGroup in interface StackedLayoutManager
      Returns:
      boolean
    • setRenderLineActionsInLineGroup

      public void setRenderLineActionsInLineGroup(boolean renderLineActionsInLineGroup)
      Set flag to add actions in the same group as the line items
      Specified by:
      setRenderLineActionsInLineGroup in interface StackedLayoutManager
      Parameters:
      renderLineActionsInLineGroup -
    • isRenderLineActionsInHeader

      public boolean isRenderLineActionsInHeader()
      When true, actions specified in lineActions will appear to the very right of the header (appears in the corner of the stacked item) by placing the actions in the Header's rightGroup.
      Specified by:
      isRenderLineActionsInHeader in interface StackedLayoutManager
      Returns:
      true if rendering actions at the header level, false otherwise
    • setRenderLineActionsInHeader

      public void setRenderLineActionsInHeader(boolean renderLineActionsInHeader)
      Specified by:
      setRenderLineActionsInHeader in interface StackedLayoutManager
      See Also: