org.kuali.rice.krad.uif.container
Class CollectionGroupBuilder

java.lang.Object
  extended by org.kuali.rice.krad.uif.container.CollectionGroupBuilder
All Implemented Interfaces:
Serializable

public class CollectionGroupBuilder
extends Object
implements Serializable

Builds out the Field instances for a collection group with a series of steps that interact with the configured CollectionLayoutManager to assemble the fields as necessary for the layout

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

Constructor Summary
CollectionGroupBuilder()
           
 
Method Summary
 void build(View view, Object model, CollectionGroup collectionGroup)
          Creates the Field instances that make up the table
protected  void buildAddLine(View view, Object model, CollectionGroup collectionGroup)
          Builds the fields for holding the collection add line and if necessary makes call to setup the new line instance
protected  void buildLine(View view, Object model, CollectionGroup collectionGroup, String bindingPath, List<ActionField> actions, boolean bindToForm, Object currentLine, int lineIndex)
          Builds the field instances for the collection line.
protected  boolean checkSubCollectionRender(View view, Object model, CollectionGroup collectionGroup, CollectionGroup subCollectionGroup)
          Checks whether the given sub-collection should be rendered, any conditional render string is evaluated
protected  List<ActionField> getAddLineActions(View view, Object model, CollectionGroup collectionGroup)
          Creates new ActionField instances for the add line
protected  ExpressionEvaluatorService getExpressionEvaluatorService()
           
protected  List<ActionField> getLineActions(View view, Object model, CollectionGroup collectionGroup, Object collectionLine, int lineIndex)
          Creates new ActionField instances for the line
 void initializeNewCollectionLine(View view, Object model, CollectionGroup collectionGroup, boolean clearExistingLine)
          Initializes a new instance of the collection class
protected  List<Field> removeNonRenderLineFields(View view, Object model, CollectionGroup collectionGroup, List<Field> lineFields, Object currentLine, int lineIndex)
          Evaluates the render property for the given list of Field instances for the line and removes any fields from the returned list that have render false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionGroupBuilder

public CollectionGroupBuilder()
Method Detail

build

public void build(View view,
                  Object model,
                  CollectionGroup collectionGroup)
Creates the Field instances that make up the table

The corresponding collection is retrieved from the model and iterated over to create the necessary fields. The binding path for fields that implement DataBinding is adjusted to point to the collection line it is apart of. For example, field 'number' of collection 'accounts' for line 1 will be set to 'accounts[0].number', and for line 2 'accounts[1].number'. Finally parameters are set on the line's action fields to indicate what collection and line they apply to.

Parameters:
view - - View instance the collection belongs to
model - - Top level object containing the data
collectionGroup - - CollectionGroup component for the collection

buildAddLine

protected void buildAddLine(View view,
                            Object model,
                            CollectionGroup collectionGroup)
Builds the fields for holding the collection add line and if necessary makes call to setup the new line instance

Parameters:
view - - view instance the collection belongs to
collectionGroup - - collection group the layout manager applies to
model - - Object containing the view data, should extend UifFormBase if using framework managed new lines

buildLine

protected void buildLine(View view,
                         Object model,
                         CollectionGroup collectionGroup,
                         String bindingPath,
                         List<ActionField> actions,
                         boolean bindToForm,
                         Object currentLine,
                         int lineIndex)
Builds the field instances for the collection line. A copy of the configured items on the CollectionGroup is made and adjusted for the line (id and binding). Then a call is made to the CollectionLayoutManager to assemble the line as necessary for the layout

Parameters:
view - - view instance the collection belongs to
model - - top level object containing the data
collectionGroup - - collection group component for the collection
bindingPath - - binding path for the line fields (if DataBinding)
actions - - List of actions to set in the lines action column
bindLineToForm - - whether the bindToForm property on the items bindingInfo should be set to true (needed for add line)
currentLine - - object instance for the current line, or null if add line
lineIndex - - index of the line in the collection, or -1 if we are building the add line

removeNonRenderLineFields

protected List<Field> removeNonRenderLineFields(View view,
                                                Object model,
                                                CollectionGroup collectionGroup,
                                                List<Field> lineFields,
                                                Object currentLine,
                                                int lineIndex)
Evaluates the render property for the given list of Field instances for the line and removes any fields from the returned list that have render false. The conditional render string is also taken into account. This needs to be done here as opposed to during the normal condition evaluation so the the fields are not used while building the collection lines

Parameters:
view - - view instance the collection group belongs to
model - - object containing the view data
collectionGroup - - collection group for the line fields
lineFields - - list of fields configured for the line
currentLine - - object containing the line data
lineIndex - - index of the line in the collection
Returns:
List list of field instances that should be rendered

checkSubCollectionRender

protected boolean checkSubCollectionRender(View view,
                                           Object model,
                                           CollectionGroup collectionGroup,
                                           CollectionGroup subCollectionGroup)
Checks whether the given sub-collection should be rendered, any conditional render string is evaluated

Parameters:
view - - view instance the sub collection belongs to
model - - object containing the view data
collectionGroup - - collection group the sub collection belongs to
subCollectionGroup - - sub collection group to check render status for
Returns:
boolean true if sub collection should be rendered, false if it should not be rendered

getLineActions

protected List<ActionField> getLineActions(View view,
                                           Object model,
                                           CollectionGroup collectionGroup,
                                           Object collectionLine,
                                           int lineIndex)
Creates new ActionField instances for the line

Adds context to the action fields for the given line so that the line the action was performed on can be determined when that action is selected

Parameters:
view - - view instance the collection belongs to
model - - top level object containing the data
collectionGroup - - collection group component for the collection
collectionLine - - object instance for the current line
lineIndex - - index of the line the actions should apply to

getAddLineActions

protected List<ActionField> getAddLineActions(View view,
                                              Object model,
                                              CollectionGroup collectionGroup)
Creates new ActionField instances for the add line

Adds context to the action fields for the add line so that the collection the action was performed on can be determined

Parameters:
view - - view instance the collection belongs to
model - - top level object containing the data
collectionGroup - - collection group component for the collection

initializeNewCollectionLine

public void initializeNewCollectionLine(View view,
                                        Object model,
                                        CollectionGroup collectionGroup,
                                        boolean clearExistingLine)
Initializes a new instance of the collection class

If the add line property was not specified for the collection group the new lines will be added to the generic map on the UifFormBase, else it will be added to the property given by the addLineBindingInfo

New line will only be created if the current line property is null or clearExistingLine is true. In the case of a new line default values are also applied

See Also:
initializeNewCollectionLine(View, Object, CollectionGroup, boolean)

getExpressionEvaluatorService

protected ExpressionEvaluatorService getExpressionEvaluatorService()


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