org.kuali.rice.kns.uif.container
Class CollectionGroup

java.lang.Object
  extended by org.kuali.rice.kns.uif.core.ComponentBase
      extended by org.kuali.rice.kns.uif.container.ContainerBase
          extended by org.kuali.rice.kns.uif.container.Group
              extended by org.kuali.rice.kns.uif.container.CollectionGroup
All Implemented Interfaces:
Serializable, Container, Component, DataBinding, ScriptEventSupport, org.springframework.core.Ordered

public class CollectionGroup
extends Group
implements DataBinding

Group that holds a collection of objects and configuration for presenting the collection in the UI. Supports functionality such as add line, line actions, and nested collections.

Note the standard header/footer can be used to give a header to the collection as a whole, or to provide actions that apply to the entire collection

For binding purposes the binding path of each row field is indexed. The name property inherited from ComponentBase is used as the collection name. The collectionObjectClass property is used to lookup attributes from the data dictionary.

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
Serialized Form

Field Summary
private  List<ActionField> actionFields
           
private  CollectionFilter activeCollectionFilter
           
private  List<ActionField> addLineActionFields
           
private  BindingInfo addLineBindingInfo
           
private  List<? extends Field> addLineFields
           
private  LabelField addLineLabelField
           
private  String addLinePropertyName
           
private  BindingInfo bindingInfo
           
private  CollectionGroupBuilder collectionGroupBuilder
           
private  Class<?> collectionObjectClass
           
private  String propertyName
           
private  boolean renderAddLine
           
private  boolean renderLineActions
           
private static long serialVersionUID
           
private  boolean showInactive
           
private  List<CollectionGroup> subCollections
           
 
Fields inherited from interface org.kuali.rice.kns.uif.core.Ordered
INITIAL_ORDER_VALUE
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
CollectionGroup()
           
 
Method Summary
 List<ActionField> getActionFields()
          Action fields that should be rendered for each collection line.
 CollectionFilter getActiveCollectionFilter()
          Collection filter instance for filtering the collection data when the showInactive flag is set to false
 List<ActionField> getAddLineActionFields()
          Action fields that should be rendered for the add line.
 BindingInfo getAddLineBindingInfo()
          BindingInfo instance for the add line property used to determine the full binding path.
 List<? extends Field> getAddLineFields()
          List of Field instances that should be rendered for the collection add line (if enabled).
 String getAddLineLabel()
          Convenience getter for the add line label field text.
 LabelField getAddLineLabelField()
          LabelField instance for the add line label
 String getAddLinePropertyName()
          Name of the property that contains an instance for the add line.
 BindingInfo getBindingInfo()
          Determines the binding path for the collection.
 CollectionGroupBuilder getCollectionGroupBuilder()
          CollectionGroupBuilder instance that will build the components dynamically for the collection instance
 Class<?> getCollectionObjectClass()
          Object class the collection maintains.
 List<? extends Field> getItems()
          List of Component instances that are held by the container
 List<Component> getNestedComponents()
          List of components that are contained within the component
 String getPropertyName()
          Name of the property (relative to the parent object) the component binds to
 List<CollectionGroup> getSubCollections()
          List of CollectionGroup instances that are sub-collections of the collection represented by this collection group
 void initializeNewCollectionLine(View view, Object model, CollectionGroup collectionGroup, boolean clearExistingLine)
          New collection lines are handled in the framework by maintaining a map on the form.
 boolean isRenderAddLine()
          Indicates whether an add line should be rendered for the collection
 boolean isRenderLineActions()
          Indicates whether the action column for the collection should be rendered
 boolean isShowInactive()
          Indicates whether inactive collections lines should be displayed
 void performApplyModel(View view, Object model)
          Calls the configured CollectionGroupBuilder to build the necessary components based on the collection data
protected  void performCollectionFiltering(View view, Object model)
          Performs any filtering necessary on the collection before building the collection fields
 void performInitialization(View view)
          The following actions are performed: Set fieldBindModelPath to the collection model path (since the fields have to belong to the same model as the collection) Set defaults for binding Default add line field list to groups items list Sets default active collection filter if not set Sets the dictionary entry (if blank) on each of the items to the collection class
protected  void pushCollectionGroupToReference()
          Sets a reference in the context map for all nested components to the collection group instance, and sets name as parameter for an action fields in the group
 void setActionFields(List<ActionField> actionFields)
          Setter for the line action fields list
 void setActiveCollectionFilter(CollectionFilter activeCollectionFilter)
          Setter for the collection filter to use for filter inactive records from the collection
 void setAddLineActionFields(List<ActionField> addLineActionFields)
          Setter for the add line action fields
 void setAddLineBindingInfo(BindingInfo addLineBindingInfo)
          Setter for the add line binding info
 void setAddLineFields(List<? extends Field> addLineFields)
          Setter for the add line field list
 void setAddLineLabel(String addLineLabel)
          Setter for the add line label text
 void setAddLineLabelField(LabelField addLineLabelField)
          Setter for the LabelField instance for the add line label
 void setAddLinePropertyName(String addLinePropertyName)
          Setter for the add line property name
 void setBindingInfo(BindingInfo bindingInfo)
          Setter for the binding info instance
 void setCollectionGroupBuilder(CollectionGroupBuilder collectionGroupBuilder)
          Setter for the collection group building instance
 void setCollectionObjectClass(Class<?> collectionObjectClass)
          Setter for the collection object class
 void setPropertyName(String propertyName)
          Setter for the collections property name
 void setRenderAddLine(boolean renderAddLine)
          Setter for the render add line indicator
 void setRenderLineActions(boolean renderLineActions)
          Setter for the render line actions indicator
 void setShowInactive(boolean showInactive)
          Setter for the show inactive indicator
 void setSubCollections(List<CollectionGroup> subCollections)
          Setter for the sub collection list
 
Methods inherited from class org.kuali.rice.kns.uif.container.Group
getAccordion, getComponentTypeName, getFieldBindByNamePrefix, getFieldBindingObjectPath, getSupportedComponents, setAccordion, setFieldBindByNamePrefix, setFieldBindingObjectPath, setItems
 
Methods inherited from class org.kuali.rice.kns.uif.container.ContainerBase
getAdditionalMessageKeys, getAttributeFields, getErrorsField, getFooter, getHeader, getHelp, getItemOrderingSequence, getLayoutManager, getSummary, getSummaryMessageField, isFieldContainer, performFinalize, setAdditionalMessageKeys, setErrorsField, setFieldContainer, setFooter, setHeader, setHelp, setItemOrderingSequence, setLayoutManager, setRenderFooter, setRenderHeader, setSummary, setSummaryMessageField
 
Methods inherited from class org.kuali.rice.kns.uif.core.ComponentBase
addStyleClass, appendToStyle, getAlign, getColSpan, getComponentModifiers, getComponentOptions, getComponentOptionsJSString, getConditionalColSpan, getConditionalReadOnly, getConditionalRefresh, getConditionalRefreshConditionJs, getConditionalRefreshControlNames, getConditionalRender, getConditionalRequired, getConditionalRowSpan, getContext, getEventCode, getFinalizeMethodInvoker, getFinalizeMethodToCall, getId, getOnBlurScript, getOnChangeScript, getOnClickScript, getOnCloseScript, getOnDblClickScript, getOnDocumentReadyScript, getOnFocusScript, getOnKeyDownScript, getOnKeyPressScript, getOnKeyUpScript, getOnLoadScript, getOnMouseDownScript, getOnMouseMoveScript, getOnMouseOutScript, getOnMouseOverScript, getOnMouseUpScript, getOnSubmitScript, getOnUnloadScript, getOrder, getProgressiveDisclosureConditionJs, getProgressiveDisclosureControlNames, getProgressiveRender, getPropertiesForReferenceCopy, getPropertyExpressions, getPropertyReplacers, getRefreshWhenChanged, getRefreshWhenChangedControlNames, getRenderOutput, getRequired, getRowSpan, getStyle, getStyleClasses, getStyleClassesAsString, getSupportsOnBlur, getSupportsOnChange, getSupportsOnClick, getSupportsOnClose, getSupportsOnDblClick, getSupportsOnDocumentReady, getSupportsOnFocus, getSupportsOnKeyDown, getSupportsOnKeyPress, getSupportsOnKeyUp, getSupportsOnLoad, getSupportsOnMouseDown, getSupportsOnMouseMove, getSupportsOnMouseOut, getSupportsOnMouseOver, getSupportsOnMouseUp, getSupportsOnSubmit, getSupportsOnUnload, getTemplate, getTitle, getValign, getWidth, isHidden, isProgressiveRenderAndRefresh, isProgressiveRenderViaAJAX, isReadOnly, isRefresh, isRender, isSelfRendered, isSkipInTabOrder, pushObjectToContext, setAlign, setColSpan, setComponentModifiers, setComponentOptions, setConditionalColSpan, setConditionalReadOnly, setConditionalRefresh, setConditionalRender, setConditionalRequired, setConditionalRowSpan, setContext, setFinalizeMethodInvoker, setFinalizeMethodToCall, setHidden, setId, setOnBlurScript, setOnChangeScript, setOnClickScript, setOnCloseScript, setOnDblClickScript, setOnDocumentReadyScript, setOnFocusScript, setOnKeyDownScript, setOnKeyPressScript, setOnKeyUpScript, setOnLoadScript, setOnMouseDownScript, setOnMouseMoveScript, setOnMouseOutScript, setOnMouseOverScript, setOnMouseUpScript, setOnSubmitScript, setOnUnloadScript, setOrder, setProgressiveRender, setProgressiveRenderAndRefresh, setProgressiveRenderViaAJAX, setPropertyExpressions, setPropertyReplacers, setReadOnly, setRefresh, setRefreshWhenChanged, setRender, setRender, setRenderOutput, setRequired, setRowSpan, setSelfRendered, setSkipInTabOrder, setStyle, setStyleClasses, setTemplate, setTitle, setValign, setWidth
 
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.kns.uif.core.Component
addStyleClass, appendToStyle, getColSpan, getComponentModifiers, getComponentOptions, getConditionalReadOnly, getConditionalRefresh, getConditionalRefreshConditionJs, getConditionalRefreshControlNames, getConditionalRender, getContext, getFinalizeMethodInvoker, getFinalizeMethodToCall, getId, getOrder, getProgressiveDisclosureConditionJs, getProgressiveDisclosureControlNames, getProgressiveRender, getPropertiesForReferenceCopy, getPropertyReplacers, getRefreshWhenChanged, getRefreshWhenChangedControlNames, getRenderOutput, getRequired, getRowSpan, getStyle, getStyleClasses, getTemplate, getTitle, isHidden, isProgressiveRenderAndRefresh, isProgressiveRenderViaAJAX, isReadOnly, isRefresh, isRender, isSelfRendered, pushObjectToContext, setColSpan, setComponentModifiers, setComponentOptions, setConditionalReadOnly, setConditionalRefresh, setConditionalRender, setContext, setHidden, setId, setOrder, setProgressiveRender, setProgressiveRenderAndRefresh, setProgressiveRenderViaAJAX, setPropertyReplacers, setReadOnly, setRefresh, setRefreshWhenChanged, setRender, setRenderOutput, setRequired, setRowSpan, setSelfRendered, setStyle, setStyleClasses, setTemplate, setTitle
 
Methods inherited from interface org.kuali.rice.kns.uif.core.ScriptEventSupport
getOnBlurScript, getOnChangeScript, getOnClickScript, getOnCloseScript, getOnDblClickScript, getOnDocumentReadyScript, getOnFocusScript, getOnKeyDownScript, getOnKeyPressScript, getOnKeyUpScript, getOnLoadScript, getOnMouseDownScript, getOnMouseMoveScript, getOnMouseOutScript, getOnMouseOverScript, getOnMouseUpScript, getOnSubmitScript, getOnUnloadScript, getSupportsOnBlur, getSupportsOnChange, getSupportsOnClick, getSupportsOnClose, getSupportsOnDblClick, getSupportsOnDocumentReady, getSupportsOnFocus, getSupportsOnKeyDown, getSupportsOnKeyPress, getSupportsOnKeyUp, getSupportsOnLoad, getSupportsOnMouseDown, getSupportsOnMouseMove, getSupportsOnMouseOut, getSupportsOnMouseOver, getSupportsOnMouseUp, getSupportsOnSubmit, getSupportsOnUnload, setOnBlurScript
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

collectionObjectClass

private Class<?> collectionObjectClass

propertyName

private String propertyName

bindingInfo

private BindingInfo bindingInfo

renderAddLine

private boolean renderAddLine

addLinePropertyName

private String addLinePropertyName

addLineBindingInfo

private BindingInfo addLineBindingInfo

addLineLabelField

private LabelField addLineLabelField

addLineFields

private List<? extends Field> addLineFields

addLineActionFields

private List<ActionField> addLineActionFields

renderLineActions

private boolean renderLineActions

actionFields

private List<ActionField> actionFields

showInactive

private boolean showInactive

activeCollectionFilter

private CollectionFilter activeCollectionFilter

subCollections

private List<CollectionGroup> subCollections

collectionGroupBuilder

private CollectionGroupBuilder collectionGroupBuilder
Constructor Detail

CollectionGroup

public CollectionGroup()
Method Detail

performInitialization

public void performInitialization(View view)
The following actions are performed:

Specified by:
performInitialization in interface Component
Overrides:
performInitialization in class Group
Parameters:
view - - view instance in which the component belongs
See Also:
ComponentBase.performInitialization(org.kuali.rice.kns.uif.container.View)

performApplyModel

public void performApplyModel(View view,
                              Object model)
Calls the configured CollectionGroupBuilder to build the necessary components based on the collection data

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

pushCollectionGroupToReference

protected void pushCollectionGroupToReference()
Sets a reference in the context map for all nested components to the collection group instance, and sets name as parameter for an action fields in the group


performCollectionFiltering

protected void performCollectionFiltering(View view,
                                          Object model)
Performs any filtering necessary on the collection before building the collection fields

If showInactive is set to false and the collection line type implements Inactivatable, invokes the active collection filer

Parameters:
model - - object containing the views data, from which the collection will be pulled

initializeNewCollectionLine

public void initializeNewCollectionLine(View view,
                                        Object model,
                                        CollectionGroup collectionGroup,
                                        boolean clearExistingLine)
New collection lines are handled in the framework by maintaining a map on the form. The map contains as a key the collection name, and as value an instance of the collection type. An entry is created here for the collection represented by the CollectionGroup if an instance is not available (clearExistingLine will force a new instance). The given model must be a subclass of UifFormBase in order to find the Map.

Parameters:
model - - Model instance that contains the new collection lines Map
clearExistingLine - - boolean that indicates whether the line should be set to a new instance if it already exists

getNestedComponents

public List<Component> getNestedComponents()
Description copied from interface: Component
List of components that are contained within the component

Used by ViewHelperService for the various lifecycle callbacks

Specified by:
getNestedComponents in interface Component
Overrides:
getNestedComponents in class Group
Returns:
List child components
See Also:
ContainerBase.getNestedComponents()

getCollectionObjectClass

public Class<?> getCollectionObjectClass()
Object class the collection maintains. Used to get dictionary information in addition to creating new instances for the collection when necessary

Returns:
Class collection object class

setCollectionObjectClass

public void setCollectionObjectClass(Class<?> collectionObjectClass)
Setter for the collection object class

Parameters:
collectionObjectClass -

getPropertyName

public String getPropertyName()
Description copied from interface: DataBinding
Name of the property (relative to the parent object) the component binds to

Specified by:
getPropertyName in interface DataBinding
Returns:
String property name
See Also:
DataBinding.getPropertyName()

setPropertyName

public void setPropertyName(String propertyName)
Setter for the collections property name

Parameters:
propertyName -

getBindingInfo

public BindingInfo getBindingInfo()
Determines the binding path for the collection. Used to get the collection value from the model in addition to setting the binding path for the collection attributes

Specified by:
getBindingInfo in interface DataBinding
Returns:
BindingInfo
See Also:
DataBinding.getBindingInfo()

setBindingInfo

public void setBindingInfo(BindingInfo bindingInfo)
Setter for the binding info instance

Parameters:
bindingInfo -

getActionFields

public List<ActionField> getActionFields()
Action fields that should be rendered for each collection line. Example line action is the delete action

Returns:
List line action fields

setActionFields

public void setActionFields(List<ActionField> actionFields)
Setter for the line action fields list

Parameters:
actionFields -

isRenderLineActions

public boolean isRenderLineActions()
Indicates whether the action column for the collection should be rendered

Returns:
boolean true if the actions should be rendered, false if not
See Also:
getActionFields()

setRenderLineActions

public void setRenderLineActions(boolean renderLineActions)
Setter for the render line actions indicator

Parameters:
renderLineActions -

isRenderAddLine

public boolean isRenderAddLine()
Indicates whether an add line should be rendered for the collection

Returns:
boolean true if add line should be rendered, false if it should not be

setRenderAddLine

public void setRenderAddLine(boolean renderAddLine)
Setter for the render add line indicator

Parameters:
renderAddLine -

getAddLineLabel

public String getAddLineLabel()
Convenience getter for the add line label field text. The text is used to label the add line when rendered and its placement depends on the LayoutManager.

For the TableLayoutManager the label appears in the sequence column to the left of the add line fields. For the StackedLayoutManager the label is placed into the group header for the line.

Returns:
String add line label

setAddLineLabel

public void setAddLineLabel(String addLineLabel)
Setter for the add line label text

Parameters:
addLineLabel -

getAddLineLabelField

public LabelField getAddLineLabelField()
LabelField instance for the add line label

Returns:
LabelField add line label field
See Also:
getAddLineLabel()

setAddLineLabelField

public void setAddLineLabelField(LabelField addLineLabelField)
Setter for the LabelField instance for the add line label

Parameters:
addLineLabelField -
See Also:
getAddLineLabel()

getAddLinePropertyName

public String getAddLinePropertyName()
Name of the property that contains an instance for the add line. If set this is used with the binding info to create the path to the add line. Can be left blank in which case the framework will manage the add line instance in a generic map.

Returns:
String add line property name

setAddLinePropertyName

public void setAddLinePropertyName(String addLinePropertyName)
Setter for the add line property name

Parameters:
addLinePropertyName -

getAddLineBindingInfo

public BindingInfo getAddLineBindingInfo()
BindingInfo instance for the add line property used to determine the full binding path. If add line name given getAddLineLabel() then it is set as the binding name on the binding info. Add line label and binding info are not required, in which case the framework will manage the new add line instances through a generic map (model must extend UifFormBase)

Returns:
BindingInfo add line binding info

setAddLineBindingInfo

public void setAddLineBindingInfo(BindingInfo addLineBindingInfo)
Setter for the add line binding info

Parameters:
addLineBindingInfo -

getAddLineFields

public List<? extends Field> getAddLineFields()
List of Field instances that should be rendered for the collection add line (if enabled). If not set, the default group's items list will be used

Returns:
List add line field list

setAddLineFields

public void setAddLineFields(List<? extends Field> addLineFields)
Setter for the add line field list

Parameters:
addLineFields -

getAddLineActionFields

public List<ActionField> getAddLineActionFields()
Action fields that should be rendered for the add line. This is generally the add action (button) but can be configured to contain additional actions

Returns:
List add line action fields

setAddLineActionFields

public void setAddLineActionFields(List<ActionField> addLineActionFields)
Setter for the add line action fields

Parameters:
addLineActionFields -

isShowInactive

public boolean isShowInactive()
Indicates whether inactive collections lines should be displayed

Setting only applies when the collection line type implements the Inactivatable interface. If true and showInactive is set to false, the collection will be filtered to remove any items whose active status returns false

Returns:
boolean true to show inactive records, false to not render inactive records

setShowInactive

public void setShowInactive(boolean showInactive)
Setter for the show inactive indicator

Parameters:
boolean - show inactive

getActiveCollectionFilter

public CollectionFilter getActiveCollectionFilter()
Collection filter instance for filtering the collection data when the showInactive flag is set to false

Returns:
CollectionFilter

setActiveCollectionFilter

public void setActiveCollectionFilter(CollectionFilter activeCollectionFilter)
Setter for the collection filter to use for filter inactive records from the collection

Parameters:
activeCollectionFilter - - CollectionFilter instance

getSubCollections

public List<CollectionGroup> getSubCollections()
List of CollectionGroup instances that are sub-collections of the collection represented by this collection group

Returns:
List sub collections

setSubCollections

public void setSubCollections(List<CollectionGroup> subCollections)
Setter for the sub collection list

Parameters:
subCollections -

getCollectionGroupBuilder

public CollectionGroupBuilder getCollectionGroupBuilder()
CollectionGroupBuilder instance that will build the components dynamically for the collection instance

Returns:
CollectionGroupBuilder instance

setCollectionGroupBuilder

public void setCollectionGroupBuilder(CollectionGroupBuilder collectionGroupBuilder)
Setter for the collection group building instance

Parameters:
collectionGroupBuilder -

getItems

public List<? extends Field> getItems()
Description copied from interface: Container
List of Component instances that are held by the container

Contained components are rendered within the section template by calling the associated LayoutManager

Specified by:
getItems in interface Container
Overrides:
getItems in class Group
Returns:
List component instances
See Also:
ContainerBase.getItems()


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.