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

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

public class CollectionGroupLineBuilder
extends Object
implements Serializable

Process configuration from the collection group to prepare components for a new line and invokes the associated layout manager to add the line.

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

Constructor Summary
CollectionGroupLineBuilder(LineBuilderContext lineBuilderContext)
           
 
Method Summary
protected  void addUnauthorizedBindingInfo()
          Adds a BindingInfo instance for the given binding path to the collection groups unauthorized list.
protected  void adjustFieldBindingAndId(List<Field> lineFields)
          Adjusts the binding path for the given fields to match the collections path, and updates the field ids to contain a suffix for the line.
protected  void applyLineFieldAuthorizationAndPresentationLogic(boolean readOnlyLine, List<Field> lineFields, List<? extends Component> actionList)
          Iterates through the line fields and checks the view field authorization using the view's configured authorizer and presentation controller.
protected  void applyOnChangeForSave(List<Field> lineFields)
          If CollectionGroup.isRenderSaveLineActions() is true and the line has been added by the user, on change script is added to any controls in the line to enable the save action.
 void buildLine()
          Invoked to build a line in the collection.
protected  void buildSubCollectionFieldGroups()
          For each configured sub collection of the collection group, creates a field group by copying CollectionLayoutManager.getSubCollectionFieldGroupPrototype() and adds to a list which is stored in the line context.
protected  boolean checkEditLineAuthorization()
          Determines whether the user is authorized to the edit the line.
protected  boolean checkEditLineAuthorizationAndPresentationLogic()
          Invokes the view's configured authorizer and presentation controller to determine if the user has permission to edit the line (if a permission has been established).
protected  boolean checkSubCollectionRender(CollectionGroup subCollectionGroup)
          Checks whether the given sub-collection should be rendered, any conditional render string is evaluated.
protected  boolean checkViewLineAuthorization()
          Determines whether the user is authorized to the view the line.
protected  boolean checkViewLineAuthorizationAndPresentationLogic()
          Invokes the view's configured authorizer and presentation controller to determine if the user has permission to view the line (if a permission has been established).
protected  Map<String,Object> getContextForField(View view, CollectionGroup collectionGroup, Field field)
          Helper method to build the context for a field (needed because the apply model phase for line fields has not been applied yet and their full context not set)
protected  List<? extends Component> initializeLineItems()
          Copies either the collections groups items or add line items to a list of components that will be used for the collection line.
 void preprocessLine()
          Performs various preprocessing of the line components and configuration.
 List<Field> processAnyRemoteFieldsHolder(CollectionGroup group, List<? extends Component> items)
          Iterates through the given items checking for RemotableFieldsHolder, if found the holder is invoked to retrieved the remotable fields and translate to attribute fields.
protected  List<Field> removeNonRenderLineFields(List<Field> lineFields)
          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.
protected  void setFocusOnIdForActions(List<Action> actions, List<Field> lineFields)
          For any actions with focus id UifConstants.Order.LINE_FIRST, the focus id is replaced to match to id of the first control in the line.
protected  void setupAddLineControlValidation(List<Field> lineFields)
          Add additional information to the group and fields in the add line to allow for correct add control selection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionGroupLineBuilder

public CollectionGroupLineBuilder(LineBuilderContext lineBuilderContext)
Method Detail

buildLine

public void buildLine()
Invoked to build a line in the collection.

First the context for the line is preprocessed in preprocessLine(). After preprocessing the configured layout manager is invoked to place the line into the layout.


preprocessLine

public void preprocessLine()
Performs various preprocessing of the line components and configuration.

Preprocessing includes:


initializeLineItems

protected List<? extends Component> initializeLineItems()
Copies either the collections groups items or add line items to a list of components that will be used for the collection line.

Returns:
list of component instance for the collection line

processAnyRemoteFieldsHolder

public List<Field> processAnyRemoteFieldsHolder(CollectionGroup group,
                                                List<? extends Component> items)
Iterates through the given items checking for RemotableFieldsHolder, if found the holder is invoked to retrieved the remotable fields and translate to attribute fields.

The translated list is then inserted into the returned list at the position of the holder

Parameters:
group - collection group instance to check for any remotable fields holder
items - list of items to process

adjustFieldBindingAndId

protected void adjustFieldBindingAndId(List<Field> lineFields)
Adjusts the binding path for the given fields to match the collections path, and updates the field ids to contain a suffix for the line.

Parameters:
lineFields - list of fields to update

setFocusOnIdForActions

protected void setFocusOnIdForActions(List<Action> actions,
                                      List<Field> lineFields)
For any actions with focus id UifConstants.Order.LINE_FIRST, the focus id is replaced to match to id of the first control in the line.

Parameters:
actions - list of actions to potientially update
lineFields - list of line fields, the control for the first field in the list will be used for the focus id

applyOnChangeForSave

protected void applyOnChangeForSave(List<Field> lineFields)
If CollectionGroup.isRenderSaveLineActions() is true and the line has been added by the user, on change script is added to any controls in the line to enable the save action.

Parameters:
lineFields - list of line fields

removeNonRenderLineFields

protected List<Field> removeNonRenderLineFields(List<Field> lineFields)
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:
lineFields - list of fields configured for the line
Returns:
list of field instances that should be rendered

checkViewLineAuthorization

protected boolean checkViewLineAuthorization()
Determines whether the user is authorized to the view the line.

Returns:
boolean true if the user can view the line, false if not

checkViewLineAuthorizationAndPresentationLogic

protected boolean checkViewLineAuthorizationAndPresentationLogic()
Invokes the view's configured authorizer and presentation controller to determine if the user has permission to view the line (if a permission has been established).

Returns:
true if the user can view the line, false if not

checkEditLineAuthorization

protected boolean checkEditLineAuthorization()
Determines whether the user is authorized to the edit the line.

Returns:
boolean true if the user can edit the line, false if not

checkEditLineAuthorizationAndPresentationLogic

protected boolean checkEditLineAuthorizationAndPresentationLogic()
Invokes the view's configured authorizer and presentation controller to determine if the user has permission to edit the line (if a permission has been established).

Returns:
true if the user can edit the line, false if not

addUnauthorizedBindingInfo

protected void addUnauthorizedBindingInfo()
Adds a BindingInfo instance for the given binding path to the collection groups unauthorized list.


applyLineFieldAuthorizationAndPresentationLogic

protected void applyLineFieldAuthorizationAndPresentationLogic(boolean readOnlyLine,
                                                               List<Field> lineFields,
                                                               List<? extends Component> actionList)
Iterates through the line fields and checks the view field authorization using the view's configured authorizer and presentation controller.

If the field is viewable, then sets the edit field authorization. Finally iterates through the line actions invoking the authorizer and presentation controller to authorizer the action

Parameters:
readOnlyLine - flag indicating whether the line has been marked as read only (which will force the fields to be read only)
lineFields - list of fields instances for the line
actionList - list of action field instances for the line

buildSubCollectionFieldGroups

protected void buildSubCollectionFieldGroups()
For each configured sub collection of the collection group, creates a field group by copying CollectionLayoutManager.getSubCollectionFieldGroupPrototype() and adds to a list which is stored in the line context.


checkSubCollectionRender

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

Parameters:
subCollectionGroup - sub collection group to check render status for
Returns:
true if sub collection should be rendered, false if it should not be rendered

setupAddLineControlValidation

protected void setupAddLineControlValidation(List<Field> lineFields)
Add additional information to the group and fields in the add line to allow for correct add control selection.


getContextForField

protected Map<String,Object> getContextForField(View view,
                                                CollectionGroup collectionGroup,
                                                Field field)
Helper method to build the context for a field (needed because the apply model phase for line fields has not been applied yet and their full context not set)

Parameters:
view - view instance the field belongs to
collectionGroup - collection group instance the field belongs to
field - field instance to build context for
Returns:
Map context for field


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