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

java.lang.Object
  extended by org.kuali.rice.krad.uif.component.ConfigurableBase
      extended by org.kuali.rice.krad.uif.layout.LayoutManagerBase
          extended by org.kuali.rice.krad.uif.layout.StackedLayoutManager
All Implemented Interfaces:
Serializable, Configurable, CollectionLayoutManager, LayoutManager

public class StackedLayoutManager
extends LayoutManagerBase
implements CollectionLayoutManager

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

Constructor Summary
StackedLayoutManager()
           
 
Method Summary
 void buildLine(View view, Object model, CollectionGroup collectionGroup, List<Field> lineFields, List<FieldGroup> subCollectionFields, String bindingPath, List<Action> actions, String idSuffix, Object currentLine, int lineIndex)
          Builds a Group instance for a collection line.
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
 List<Component> getComponentPrototypes()
          List of components that are maintained by the layout manager as prototypes for creating other component instances
 List<Component> getComponentsForLifecycle()
          List of components that are contained within the layout manager that should be sent through the lifecycle
 Group getLineGroupPrototype()
          Group instance that is used as a prototype for creating the collection line groups.
 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
 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
 Group getWrapperGroup()
          Group that will 'wrap' the generated collection lines so that they have a different layout from the general stacked layout
 void performApplyModel(View view, Object model, Container container)
          The following actions are performed: If wrapper group is specified, places the stacked groups into the wrapper
 void performInitialization(View view, Object model, Container container)
          The following actions are performed: Initializes the prototypes
 void setAddLineGroup(Group addLineGroup)
          Setter for the add line group
 void setLineGroupPrototype(Group lineGroupPrototype)
          Setter for the line group prototype
 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, getContext, getCssClasses, getId, getPropertiesForReferenceCopy, getPropertyReplacers, getStyle, getStyleClassesAsString, getTemplate, getTemplateName, performFinalize, pushObjectToContext, setContext, setCssClasses, setId, setPropertyReplacers, setStyle, setStyleClasses, setTemplate, setTemplateName
 
Methods inherited from class org.kuali.rice.krad.uif.component.ConfigurableBase
getExpressionGraph, getPropertyExpression, getPropertyExpressions, getRefreshExpressionGraph, setExpressionGraph, setPropertyExpressions, setRefreshExpressionGraph
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.kuali.rice.krad.uif.layout.LayoutManager
addStyleClass, appendToStyle, getContext, getCssClasses, getId, getPropertiesForReferenceCopy, getPropertyReplacers, getStyle, getTemplate, performFinalize, pushObjectToContext, setContext, setCssClasses, setId, setPropertyReplacers, setStyle, setTemplate
 
Methods inherited from interface org.kuali.rice.krad.uif.component.Configurable
getExpressionGraph, getPropertyExpression, getPropertyExpressions, getRefreshExpressionGraph, setExpressionGraph, setPropertyExpressions, setRefreshExpressionGraph
 

Constructor Detail

StackedLayoutManager

public StackedLayoutManager()
Method Detail

performInitialization

public void performInitialization(View view,
                                  Object model,
                                  Container container)
The following actions are performed:

Specified by:
performInitialization in interface LayoutManager
Overrides:
performInitialization in class LayoutManagerBase
Parameters:
view - - View instance the layout manager is a part of
model - - the object instance containing the view data
container - - Container the layout manager applies to
See Also:
BoxLayoutManager.performInitialization(org.kuali.rice.krad.uif.view.View, java.lang.Object, org.kuali.rice.krad.uif.container.Container)

performApplyModel

public void performApplyModel(View view,
                              Object model,
                              Container container)
The following actions are performed:

Specified by:
performApplyModel in interface LayoutManager
Overrides:
performApplyModel in class LayoutManagerBase
Parameters:
view - - view instance to which the layout manager belongs
model - - Top level object containing the data (could be the form or a top level business object, dto)
container - - Container the layout manager applies to
See Also:
LayoutManagerBase.performApplyModel(org.kuali.rice.krad.uif.view.View, java.lang.Object, org.kuali.rice.krad.uif.container.Container)

buildLine

public void buildLine(View view,
                      Object model,
                      CollectionGroup collectionGroup,
                      List<Field> lineFields,
                      List<FieldGroup> subCollectionFields,
                      String bindingPath,
                      List<Action> actions,
                      String idSuffix,
                      Object currentLine,
                      int lineIndex)
Builds a Group instance for a collection line. The group is built by first creating a copy of the configured prototype. Then the header for the group is created using the configured summary fields on the CollectionGroup. The line fields passed in are set as the items for the group, and finally the actions are placed into the group footer

Specified by:
buildLine in interface CollectionLayoutManager
Parameters:
view - - view instance the collection belongs to
model - - object containing the data
collectionGroup - - collection group the layout manager applies to
lineFields - - the field instances for the collection line which were copied from the collection groups items, id and binding already updated
subCollectionFields - - group field instances for each sub collection of the current line
bindingPath - - binding path for the groups items (if DataBinding)
actions - - list of action instances for the collection line, with id and binding updated
idSuffix - - suffix to use for any generated items
currentLine - - object instance for the current line, or null if add line
lineIndex - - index of the collection line being iterated over, or -1 if the add line
See Also:
CollectionLayoutManager.buildLine(org.kuali.rice.krad.uif.view.View, Object, org.kuali.rice.krad.uif.container.CollectionGroup, java.util.List, java.util.List, String, java.util.List, String, Object, int)

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:
String header text for line

getSupportedContainer

public Class<? extends Container> getSupportedContainer()
Description copied from class: LayoutManagerBase
Default Impl

Specified by:
getSupportedContainer in interface LayoutManager
Overrides:
getSupportedContainer in class LayoutManagerBase
Returns:
Class container class supported
See Also:
LayoutManager.getSupportedContainer()

getComponentsForLifecycle

public List<Component> getComponentsForLifecycle()
Description copied from interface: LayoutManager
List of components that are contained within the layout manager that should be sent through the lifecycle

Used by ViewHelperService for the various lifecycle callbacks

Specified by:
getComponentsForLifecycle in interface LayoutManager
Overrides:
getComponentsForLifecycle in class LayoutManagerBase
Returns:
List child components
See Also:
LayoutManagerBase.getComponentsForLifecycle()

getComponentPrototypes

public List<Component> getComponentPrototypes()
Description copied from interface: LayoutManager
List of components that are maintained by the layout manager as prototypes for creating other component instances

Prototypes are held for configuring how a component should be created during the lifecycle. An example of this are the fields in a collection group that are created for each collection record. They only participate in the initialize phase.

Specified by:
getComponentPrototypes in interface LayoutManager
Overrides:
getComponentPrototypes in class LayoutManagerBase
Returns:
List child component prototypes
See Also:
LayoutManager.getComponentPrototypes()

getSummaryTitle

public String getSummaryTitle()
Text to appears in the header for each collection lines Group. Used in conjunction with getSummaryFields() to build up the final header text

Returns:
String summary title text

setSummaryTitle

public void setSummaryTitle(String summaryTitle)
Setter for the summary title text

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.

Returns:
List 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

Parameters:
summaryFields -

getAddLineGroup

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.

Returns:
Group add line group instance
See Also:
getAddLineGroup()

setAddLineGroup

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

Parameters:
addLineGroup -

getLineGroupPrototype

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

Returns:
Group instance to use as prototype

setLineGroupPrototype

public void setLineGroupPrototype(Group lineGroupPrototype)
Setter for the line group prototype

Parameters:
lineGroupPrototype -

getSubCollectionFieldGroupPrototype

public FieldGroup getSubCollectionFieldGroupPrototype()
Description copied from interface: CollectionLayoutManager
Field group instance that is used as a prototype for creating the sub-collection field groups. For each sub-collection a copy of the prototype is made and the list will be passed to the layout manager buildLine method

Specified by:
getSubCollectionFieldGroupPrototype in interface CollectionLayoutManager
Returns:
GroupField instance to use as prototype
See Also:
CollectionLayoutManager.getSubCollectionFieldGroupPrototype()

setSubCollectionFieldGroupPrototype

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

Parameters:
subCollectionFieldGroupPrototype -

getSelectFieldPrototype

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()

Returns:
Field select field prototype instance

setSelectFieldPrototype

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

Parameters:
selectFieldPrototype -

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.

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

Parameters:
wrapperGroup -

getStackedGroups

public List<Group> getStackedGroups()
Final List of Groups to render for the collection

Returns:
List collection groups

setStackedGroups

public void setStackedGroups(List<Group> stackedGroups)
Setter for the collection groups

Parameters:
stackedGroups -


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.