org.kuali.rice.krad.uif.layout
Class StackedLayoutManagerBase

java.lang.Object
  extended by org.kuali.rice.krad.datadictionary.DictionaryBeanBase
      extended by org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase
          extended by org.kuali.rice.krad.uif.layout.LayoutManagerBase
              extended by org.kuali.rice.krad.uif.layout.StackedLayoutManagerBase
All Implemented Interfaces:
Serializable, Cloneable, Copyable, DictionaryBean, UifDictionaryBean, CollectionLayoutManager, LayoutManager, StackedLayoutManager, LifecycleElement

public class StackedLayoutManagerBase
extends LayoutManagerBase
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:
Serialized Form

Field Summary
 
Fields inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase
componentCode, namespaceCode
 
Constructor Summary
StackedLayoutManagerBase()
           
 
Method Summary
 void buildLine(LineBuilderContext lineBuilderContext)
          Call to the layout manager to build the components necessary for the given collection line, within an active view lifecycle.
protected  String buildLineHeaderText(Object line, Group lineGroup)
          Builds the header text for the collection line
 Group getAddLineGroup()
          Group instance that will be used for the add line
 Group getLineGroupPrototype()
          Group instance that is used as a prototype for creating the collection line groups.
 Pager getPagerWidget()
          The pagerWidget used for paging when the StackedLayout is using paging
 Field getSelectFieldPrototype()
          Field instance that serves as a prototype for creating the select field on each line when CollectionGroup.isIncludeLineSelectionField() is true
 List<Group> getStackedGroups()
          Final List of Groups to render for the collection
 List<Group> getStackedGroupsNoWrapper()
          Used by reflection during the lifecycle to get groups for the lifecycle when not using a wrapper group
 FieldGroup getSubCollectionFieldGroupPrototype()
          Field group instance that is used as a prototype for creating the sub-collection field groups.
 List<String> getSummaryFields()
          List of attribute names from the collection line class that should be used to build the line summary.
 String getSummaryTitle()
          Text to appears in the header for each collection lines Group.
 Class<? extends Container> getSupportedContainer()
          Default Impl Determines what Container classes are supported by the LayoutManager
 Group getWrapperGroup()
          Group that will 'wrap' the generated collection lines so that they have a different layout from the general stacked layout
 boolean isActionsInLineGroup()
          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
 void performApplyModel(Object model, LifecycleElement component)
          Called after the initialize phase to perform conditional logic based on the model data
 void performFinalize(Object model, LifecycleElement element)
          The last phase before the view is rendered
 void performInitialization(Object model)
          Initializes the component
 void processPagingRequest(Object model, CollectionGroup collectionGroup)
          Invokes CollectionPagingHelper to carry out the paging request.
 void setActionsInLineGroup(boolean actionsInLineGroup)
          Set flag to add actions in the same group as the line items
 void setAddLineGroup(Group addLineGroup)
          Setter for the add line group
 void setLineGroupPrototype(Group lineGroupPrototype)
          Setter for the line group prototype
 void setPagerWidget(Pager pagerWidget)
          Set the pagerWidget used for paging StackedLayouts
 void setSelectFieldPrototype(Field selectFieldPrototype)
          Setter for the prototype instance for select fields
 void setStackedGroups(List<Group> stackedGroups)
          Setter for the collection groups
 void setSubCollectionFieldGroupPrototype(FieldGroup subCollectionFieldGroupPrototype)
          Setter for the sub-collection field group prototype
 void setSummaryFields(List<String> summaryFields)
          Setter for the summary field name list
 void setSummaryTitle(String summaryTitle)
          Setter for the summary title text
 void setWrapperGroup(Group wrapperGroup)
          Setter for the wrapper group that will receive the generated line groups
 
Methods inherited from class org.kuali.rice.krad.uif.layout.LayoutManagerBase
addStyleClass, appendToStyle, checkMutable, clone, getAdditionalCssClasses, getContext, getCssClasses, getId, getLibraryCssClasses, getPhasePathMapping, getPropertyReplacers, getStyle, getStyleClassesAsString, getTemplate, getTemplateName, getViewPath, getViewStatus, initializePendingTasks, isFinal, isInitialized, isModelApplied, isMutable, isRender, notifyCompleted, preventModification, pushAllToContext, pushObjectToContext, setAdditionalCssClasses, setContext, setCssClasses, setId, setLibraryCssClasses, setPhasePathMapping, setPropertyReplacers, setRender, setStyle, setStyleClasses, setTemplate, setTemplateName, setViewPath, setViewStatus, skipLifecycle
 
Methods inherited from class org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase
getExpressionGraph, getPropertyExpression, getPropertyExpressions, setExpressionGraph, setPropertyExpressions
 
Methods inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase
copy, dataDictionaryPostProcessing, getComponentCode, getNamespaceCode, setComponentCode, setNamespaceCode, unwrap
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.kuali.rice.krad.uif.layout.StackedLayoutManager
getStyleClassesAsString
 
Methods inherited from interface org.kuali.rice.krad.uif.layout.LayoutManager
addStyleClass, appendToStyle, getAdditionalCssClasses, getCssClasses, getLibraryCssClasses, getPropertyReplacers, getStyle, getTemplate, getTemplateName, setAdditionalCssClasses, setCssClasses, setLibraryCssClasses, setPropertyReplacers, setStyle, setTemplate, setTemplateName
 
Methods inherited from interface org.kuali.rice.krad.datadictionary.uif.UifDictionaryBean
getExpressionGraph, getPropertyExpression, getPropertyExpressions, setExpressionGraph, setPropertyExpressions
 
Methods inherited from interface org.kuali.rice.krad.datadictionary.DictionaryBean
dataDictionaryPostProcessing, getComponentCode, getNamespaceCode
 
Methods inherited from interface org.kuali.rice.krad.uif.util.LifecycleElement
checkMutable, getContext, getId, getPhasePathMapping, getViewPath, getViewStatus, initializePendingTasks, isFinal, isInitialized, isModelApplied, isMutable, isRender, notifyCompleted, pushAllToContext, pushObjectToContext, setContext, setId, setPhasePathMapping, setRender, setViewPath, setViewStatus, skipLifecycle
 
Methods inherited from interface org.kuali.rice.krad.datadictionary.Copyable
clone, copy, preventModification, unwrap
 

Constructor Detail

StackedLayoutManagerBase

public StackedLayoutManagerBase()
Method Detail

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:
ComponentDefaultInitializeTask

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

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

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:
Class 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

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:
buildLineHeaderText(Object, org.kuali.rice.krad.uif.container.Group)

setSummaryFields

public void setSummaryFields(List<String> summaryFields)
Setter for the summary field name list

Specified by:
setSummaryFields in interface StackedLayoutManager

getAddLineGroup

@ViewLifecycleRestriction(value="INITIALIZE")
public Group getAddLineGroup()
Group instance that will be used for the add line

Add line fields and actions configured on the CollectionGroup will be set onto the add line group (if add line is enabled). If the add line group is not configured, a new instance of the line group prototype will be used for the add line.

Specified by:
getAddLineGroup in interface StackedLayoutManager
Returns:
add line group instance
See Also:
StackedLayoutManager.getAddLineGroup()

setAddLineGroup

public void setAddLineGroup(Group addLineGroup)
Setter for the add line group

Specified by:
setAddLineGroup in interface StackedLayoutManager

getLineGroupPrototype

@ViewLifecycleRestriction(value="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

getSubCollectionFieldGroupPrototype

@ViewLifecycleRestriction(value="INITIALIZE")
public FieldGroup getSubCollectionFieldGroupPrototype()
Field group instance that is used as a prototype for creating the sub-collection field groups.

Specified by:
getSubCollectionFieldGroupPrototype in interface CollectionLayoutManager
Returns:
GroupField instance to use as prototype

setSubCollectionFieldGroupPrototype

public void setSubCollectionFieldGroupPrototype(FieldGroup subCollectionFieldGroupPrototype)
Setter for the sub-collection field group prototype

Specified by:
setSubCollectionFieldGroupPrototype in interface StackedLayoutManager

getSelectFieldPrototype

@ViewLifecycleRestriction(value="INITIALIZE")
public Field getSelectFieldPrototype()
Field instance that serves as a prototype for creating the select field on each line when CollectionGroup.isIncludeLineSelectionField() is true

This prototype can be used to set the control used for the select field (generally will be a checkbox control) in addition to styling and other setting. The binding path will be formed with using the CollectionGroup.getLineSelectPropertyName() or if not set the framework will use UifFormBase.getSelectedCollectionLines()

Specified by:
getSelectFieldPrototype in interface StackedLayoutManager
Returns:
select field prototype instance

setSelectFieldPrototype

public void setSelectFieldPrototype(Field selectFieldPrototype)
Setter for the prototype instance for select fields

Specified by:
setSelectFieldPrototype in interface StackedLayoutManager

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

getPagerWidget

public Pager getPagerWidget()
The pagerWidget used for paging when the StackedLayout is using paging

Specified by:
getPagerWidget in interface StackedLayoutManager
Returns:
the pagerWidget

setPagerWidget

public void setPagerWidget(Pager pagerWidget)
Set the pagerWidget used for paging StackedLayouts

Specified by:
setPagerWidget in interface StackedLayoutManager

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

isActionsInLineGroup

public boolean isActionsInLineGroup()
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:
isActionsInLineGroup in interface StackedLayoutManager
Returns:
boolean

setActionsInLineGroup

public void setActionsInLineGroup(boolean actionsInLineGroup)
Set flag to add actions in the same group as the line items

Specified by:
setActionsInLineGroup in interface StackedLayoutManager


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.