public class CollectionGroupBuilder extends Object implements Serializable
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 layoutConstructor and Description |
---|
CollectionGroupBuilder() |
Modifier and Type | Method and Description |
---|---|
protected void |
applyLineFieldAuthorizationAndPresentationLogic(View view,
ViewModel model,
CollectionGroup collectionGroup,
Object line,
boolean readOnlyLine,
List<Field> lineFields,
List<Action> actions)
Iterates through the line fields and checks the view field authorization using the view's configured authorizer
and presentation controller.
|
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<Action> actions,
boolean bindToForm,
Object currentLine,
int lineIndex)
Builds the field instances for the collection line.
|
protected void |
buildLinesForDisplayedRows(List<org.kuali.rice.krad.uif.container.CollectionGroupBuilder.IndexedElement> filteredIndexedElements,
View view,
Object model,
CollectionGroup collectionGroup)
Build the lines for the collection rows to be rendered.
|
protected boolean |
checkEditLineAuthorizationAndPresentationLogic(View view,
ViewModel model,
CollectionGroup collectionGroup,
Object line)
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(View view,
Object model,
CollectionGroup collectionGroup,
CollectionGroup subCollectionGroup)
Checks whether the given sub-collection should be rendered, any
conditional render string is evaluated
|
protected boolean |
checkViewLineAuthorizationAndPresentationLogic(View view,
ViewModel model,
CollectionGroup collectionGroup,
Object line)
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 List<Action> |
getAddLineActions(View view,
Object model,
CollectionGroup collectionGroup)
Creates new
Action instances for the add line |
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<Action> |
initializeLineActions(List<Action> lineActions,
View view,
Object model,
CollectionGroup collectionGroup,
Object collectionLine,
int lineIndex)
Creates new
Action instances for the line |
void |
initializeNewCollectionLine(View view,
Object model,
CollectionGroup collectionGroup,
boolean clearExistingLine)
Initializes a new instance of the collection class
|
protected List<Integer> |
performCollectionFiltering(View view,
Object model,
CollectionGroup collectionGroup,
Collection<?> collection)
Performs any filtering necessary on the collection before building the collection fields
|
protected List<Field> |
processAnyRemoteFieldsHolder(View view,
Object model,
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(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. |
public CollectionGroupBuilder()
public void build(View view, Object model, CollectionGroup collectionGroup)
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.
Only the lines that are to be rendered (as specified by the displayStart and displayLength properties of the CollectionGroup) will be built.
view
- View instance the collection belongs tomodel
- Top level object containing the datacollectionGroup
- CollectionGroup component for the collectionprotected void buildLinesForDisplayedRows(List<org.kuali.rice.krad.uif.container.CollectionGroupBuilder.IndexedElement> filteredIndexedElements, View view, Object model, CollectionGroup collectionGroup)
filteredIndexedElements
- a filtered and indexed list of the model collection elementsview
- View instance the collection belongs tomodel
- Top level object containing the datacollectionGroup
- CollectionGroup component for the collectionprotected List<Integer> performCollectionFiltering(View view, Object model, CollectionGroup collectionGroup, Collection<?> collection)
If showInactive is set to false and the collection line type implements Inactivatable
,
invokes the active collection filter. Then any CollectionFilter
instances configured for the collection
group are invoked to filter the collection. Collections lines must pass all filters in order to be
displayed
view
- view instance that contains the collectionmodel
- object containing the views datacollectionGroup
- collection group component instance that will display the collectioncollection
- collection instance that will be filteredprotected void buildAddLine(View view, Object model, CollectionGroup collectionGroup)
view
- view instance the collection belongs tocollectionGroup
- collection group the layout manager applies tomodel
- Object containing the view data, should extend UifFormBase
if using framework managed new linesprotected void buildLine(View view, Object model, CollectionGroup collectionGroup, String bindingPath, List<Action> actions, boolean bindToForm, Object currentLine, int lineIndex)
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 layoutview
- view instance the collection belongs tomodel
- top level object containing the datacollectionGroup
- collection group component for the collectionbindingPath
- binding path for the line fields (if DataBinding)actions
- List of actions to set in the lines action columnbindToForm
- 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 linelineIndex
- index of the line in the collection, or -1 if we are
building the add lineprotected List<Field> processAnyRemoteFieldsHolder(View view, Object model, CollectionGroup group, List<? extends Component> items)
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 holderview
- view instance containing the containermodel
- object instance containing the view datagroup
- collection group instance to check for any remotable fields holderitems
- list of items to processprotected List<Field> removeNonRenderLineFields(View view, Object model, CollectionGroup collectionGroup, List<Field> lineFields, Object currentLine, int lineIndex)
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 linesview
- view instance the collection group belongs tomodel
- object containing the view datacollectionGroup
- collection group for the line fieldslineFields
- list of fields configured for the linecurrentLine
- object containing the line datalineIndex
- index of the line in the collectionprotected boolean checkViewLineAuthorizationAndPresentationLogic(View view, ViewModel model, CollectionGroup collectionGroup, Object line)
view
- view instance the collection belongs to and from which the authorizer/presentation controller will
be pulledmodel
- object containing the view's datacollectionGroup
- collection group containing the lineline
- object containing the lines dataprotected boolean checkEditLineAuthorizationAndPresentationLogic(View view, ViewModel model, CollectionGroup collectionGroup, Object line)
view
- view instance the collection belongs to and from which the authorizer/presentation controller will
be pulledmodel
- object containing the view's datacollectionGroup
- collection group containing the lineline
- object containing the lines dataprotected void applyLineFieldAuthorizationAndPresentationLogic(View view, ViewModel model, CollectionGroup collectionGroup, Object line, boolean readOnlyLine, List<Field> lineFields, List<Action> actions)
view
- view instance the collection belongs to and from which the authorizer/presentation controller will
be pulledmodel
- object containing the view's datacollectionGroup
- collection group containing the lineline
- object containing the lines datareadOnlyLine
- 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 lineactions
- list of action field instances for the lineprotected boolean checkSubCollectionRender(View view, Object model, CollectionGroup collectionGroup, CollectionGroup subCollectionGroup)
view
- view instance the sub collection belongs tomodel
- object containing the view datacollectionGroup
- collection group the sub collection belongs tosubCollectionGroup
- sub collection group to check render status forprotected List<Action> initializeLineActions(List<Action> lineActions, View view, Object model, CollectionGroup collectionGroup, Object collectionLine, int lineIndex)
Action
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
lineActions
- the actions to copyview
- view instance the collection belongs tomodel
- top level object containing the datacollectionGroup
- collection group component for the collectioncollectionLine
- object instance for the current linelineIndex
- index of the line the actions should apply toprotected List<Action> getAddLineActions(View view, Object model, CollectionGroup collectionGroup)
Action
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
view
- view instance the collection belongs tomodel
- top level object containing the datacollectionGroup
- collection group component for the collectionprotected Map<String,Object> getContextForField(View view, CollectionGroup collectionGroup, Field field)
view
- view instance the field belongs tocollectionGroup
- collection group instance the field belongs tofield
- field instance to build context forpublic void initializeNewCollectionLine(View view, Object model, CollectionGroup collectionGroup, boolean clearExistingLine)
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
initializeNewCollectionLine(View, Object, CollectionGroup, boolean)
Copyright © 2005–2015 The Kuali Foundation. All rights reserved.