Class CollectionGroupBuilder
- All Implemented Interfaces:
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.- Author:
- Kuali Rice Team (rice.collab@kuali.org)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbuild(View view, Object model, CollectionGroup collectionGroup) Invoked within the lifecycle to carry out the collection build process.protected voidbuildAddLine(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 voidbuildLinesForDisplayedRows(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.getAddLineActionComponents(View view, Object model, CollectionGroup collectionGroup) Creates newComponentinstances for the add linegetCollectionGroupLineBuilder(LineBuilderContext lineBuilderContext) Returns an instance ofCollectionGroupLineBuilderfor building the line.voidinitializeActions(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 voidinitializeEditLineDialog(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.initializeLineActions(List<? extends Component> lineActions, View view, CollectionGroup collectionGroup, Object collectionLine, int lineIndex) Creates newActioninstances for the line.voidinitializeNewCollectionLine(View view, Object model, CollectionGroup collectionGroup, boolean clearExistingLine) Initializes a new instance of the collection data object class for the add line.performCollectionFiltering(View view, Object model, CollectionGroup collectionGroup, Collection<?> collection) Performs any filtering necessary on the collection before building the collection fields.booleanrefreshEditLineDialogContents(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 ActionsetupEditLineActionForDialog(CollectionGroup collectionGroup, String lineSuffix, int lineIndex, int actionIndex) Helper method to setup the edit line action to show the dialogprotected voidsetupEditLineDialog(DialogGroup editLineDialog, CollectionGroup group, int lineIndex, String lineSuffix, Object currentLine) Helper method to create and setup the edit line dialog for the indexed line.
-
Constructor Details
-
CollectionGroupBuilder
public CollectionGroupBuilder()
-
-
Method Details
-
build
Invoked within the lifecycle to carry out the collection build process.The corresponding collection is retrieved from the model and iterated over to create the necessary fields. The binding path for fields that implement
DataBindingis 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.
- Parameters:
view- View instance the collection belongs tomodel- Top level object containing the datacollectionGroup- CollectionGroup component for the collection
-
buildLinesForDisplayedRows
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.- Parameters:
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 collection
-
initializeEditLineDialog
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.- Parameters:
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 data
-
setupEditLineDialog
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.- Parameters:
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 line
-
performCollectionFiltering
protected List<Integer> performCollectionFiltering(View view, Object model, CollectionGroup collectionGroup, Collection<?> collection) 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 filter. Then anyCollectionFilterinstances configured for the collection group are invoked to filter the collection. Collections lines must pass all filters in order to be displayed- Parameters:
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 filtered
-
buildAddLine
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 tomodel- Object containing the view data, should extend UifFormBase if using framework managed new linescollectionGroup- collection group the layout manager applies to
-
initializeLineActions
protected List<? extends Component> initializeLineActions(List<? extends Component> lineActions, View view, CollectionGroup collectionGroup, Object collectionLine, int lineIndex) Creates newActioninstances 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:
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 to
-
setupEditLineActionForDialog
protected Action setupEditLineActionForDialog(CollectionGroup collectionGroup, String lineSuffix, int lineIndex, int actionIndex) Helper method to setup the edit line action to show the dialog- Parameters:
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 id- Returns:
- the line action for edit line in dialog
-
initializeActions
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.- Parameters:
actions- list of action components to updatecollectionGroup- collection group instance the actions belong tolineIndex- index of the line the actions are associate with
-
getAddLineActionComponents
protected List<? extends Component> getAddLineActionComponents(View view, Object model, CollectionGroup collectionGroup) Creates newComponentinstances for the add lineAdds 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 tomodel- top level object containing the datacollectionGroup- 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 data object class for the add line.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 addLineBindingInfoNew 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
-
refreshEditLineDialogContents
public 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.- Parameters:
dialogGroup- the dialog group to check formodel- the form datacollectionGroup- the collection group the line belongs tolineIndex- the current line index- Returns:
-
getCollectionGroupLineBuilder
public CollectionGroupLineBuilder getCollectionGroupLineBuilder(LineBuilderContext lineBuilderContext) Returns an instance ofCollectionGroupLineBuilderfor building the line.- Parameters:
lineBuilderContext- context of line for initializing line builder- Returns:
- CollectionGroupLineBuilder instance
-