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 layout.Constructor and Description |
---|
CollectionGroupBuilder() |
Modifier and Type | Method and Description |
---|---|
void |
build(View view,
Object model,
CollectionGroup collectionGroup)
Invoked within the lifecycle to carry out the collection build process.
|
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 |
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 List<? extends Component> |
getAddLineActionComponents(View view,
Object model,
CollectionGroup collectionGroup)
Creates new
Component instances for the add line |
CollectionGroupLineBuilder |
getCollectionGroupLineBuilder(LineBuilderContext lineBuilderContext)
Returns an instance of
CollectionGroupLineBuilder for building the line. |
void |
initializeActions(List<Action> actions,
CollectionGroup collectionGroup,
int lineIndex)
Updates the action parameters, jump to, refresh id, and validation configuration for the list of actions
associated with the given collection group and line index.
|
protected void |
initializeEditLineDialog(CollectionGroup collectionGroup,
int lineIndex,
Object currentLine,
Object model)
Helper method to initialize the edit line dialog and add it to the line dialogs for the group.
|
protected List<? extends Component> |
initializeLineActions(List<? extends Component> lineActions,
View view,
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 data object class for the add line.
|
protected List<Integer> |
performCollectionFiltering(View view,
Object model,
CollectionGroup collectionGroup,
Collection<?> collection)
Performs any filtering necessary on the collection before building the collection fields.
|
boolean |
refreshEditLineDialogContents(DialogGroup dialogGroup,
Object model,
CollectionGroup collectionGroup,
int lineIndex)
Helper method that checks if this is a refresh lifecycle and if the component to be refreshed is the
dialog group, and if the action parameters bind to the same object as the collection's current line, and
if they are then it returns true.
|
protected Action |
setupEditLineActionForDialog(CollectionGroup collectionGroup,
String lineSuffix,
int lineIndex,
int actionIndex)
Helper method to setup the edit line action to show the dialog
|
protected void |
setupEditLineDialog(DialogGroup editLineDialog,
CollectionGroup group,
int lineIndex,
String lineSuffix,
Object currentLine)
Helper method to create and setup the edit line dialog for the indexed line.
|
public CollectionGroupBuilder()
public void build(View view, Object model, CollectionGroup collectionGroup)
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 void initializeEditLineDialog(CollectionGroup collectionGroup, int lineIndex, Object currentLine, Object model)
collectionGroup
- the collection group to initialize the line dialogs forlineIndex
- the current line indexcurrentLine
- the data object bound to the current linemodel
- the view's dataprotected void setupEditLineDialog(DialogGroup editLineDialog, CollectionGroup group, int lineIndex, String lineSuffix, Object currentLine)
editLineDialog
- the dialog to setup for editing the linegroup
- the collection group to create line dialogs forlineIndex
- the current line indexlineSuffix
- the line suffix to use on dialog component id'scurrentLine
- the data object bound to the current lineprotected 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 List<? extends Component> initializeLineActions(List<? extends Component> lineActions, View view, 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 tocollectionGroup
- collection group component for the collectioncollectionLine
- object instance for the current linelineIndex
- index of the line the actions should apply toprotected Action setupEditLineActionForDialog(CollectionGroup collectionGroup, String lineSuffix, int lineIndex, int actionIndex)
collectionGroup
- the collection group the line belongs tolineSuffix
- the line index of the current linelineIndex
- the current line indexactionIndex
- the action index used in the idpublic void initializeActions(List<Action> actions, CollectionGroup collectionGroup, int lineIndex)
actions
- list of action components to updatecollectionGroup
- collection group instance the actions belong tolineIndex
- index of the line the actions are associate withprotected List<? extends Component> getAddLineActionComponents(View view, Object model, CollectionGroup collectionGroup)
Component
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 collectionpublic 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
public boolean refreshEditLineDialogContents(DialogGroup dialogGroup, Object model, CollectionGroup collectionGroup, int lineIndex)
dialogGroup
- the dialog group to check formodel
- the form datacollectionGroup
- the collection group the line belongs tolineIndex
- the current line indexpublic CollectionGroupLineBuilder getCollectionGroupLineBuilder(LineBuilderContext lineBuilderContext)
CollectionGroupLineBuilder
for building the line.lineBuilderContext
- context of line for initializing line builderCopyright © 2005–2014 The Kuali Foundation. All rights reserved.