Interface ViewHelperService
- All Known Subinterfaces:
BulkUpdateMaintainable,Lookupable,Maintainable
- All Known Implementing Classes:
BulkUpdateMaintainableImpl,DocumentViewHelperServiceImpl,InquirableImpl,LookupableImpl,MaintainableImpl,ViewHelperServiceImpl
Custom view helpers can be configured with view property
View.getViewHelperServiceClass()
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddCustomContainerComponents(ViewModel model, Container container) Hook for creating new components with code and adding them to a containervoidapplyDefaultValues(Component component) Iterates through the view components picking up data fields and applying an default value configuredvoidapplyDefaultValuesForCollectionLine(CollectionGroup collectionGroup, Object line) Populate default values the model backing a line in a collection group.Builds JS script that will invoke the show growl method to display a growl message when the page is renderedvoidbuildInquiryLink(Object dataObject, String propertyName, Inquiry inquiry) Invoked by theInquirywidget to build the inquiry linkgetDefaultValueForField(Object object, DataField dataField) Retrieves the default value that is configured for the given data fieldGets an expression evaluator factory for use with the current view.voidperformCustomApplyModel(LifecycleElement component, Object model) Hook for service overrides to perform custom apply model logic on the componentvoidperformCustomFinalize(LifecycleElement component, Object model, LifecycleElement parent) Hook for service overrides to perform custom component finalizationvoidperformCustomInitialization(LifecycleElement component) Hook for service overrides to perform custom initialization on the componentvoidperformCustomViewFinalize(Object model) Hook for service overrides to perform view component finalizationvoidHook for service overrides to perform custom initialization prior to view initialization.voidpopulateDefaultValueForField(Object object, DataField dataField, String bindingPath) Applies the default value configured for the given field (if any) to the line given object property that is determined by the given binding pathvoidpopulateViewFromRequestParameters(Map<String, String> parameters) Uses reflection to find all fields defined on theViewinstance that have theRequestParameterannotation (which indicates the field may be populated by the request).voidprocessAfterAddLine(ViewModel model, Object addLine, String collectionId, String collectionPath, boolean isValidLine) Hook for service overrides to process the new collection line after it has been added to the collectionvoidprocessAfterDeleteLine(ViewModel model, String collectionId, String collectionPath, int lineIndex) Hook for service overrides to process the collection line after it has been deletedvoidprocessAfterEditLine(ViewModel model, Object lineObject, String collectionId, String collectionPath) Hook for service overrides to process the edit collection line after it has been validatedvoidprocessAfterSaveLine(ViewModel model, Object lineObject, String collectionId, String collectionPath) Hook for service overrides to process the save collection line after it has been validatedvoidprocessAndAddLineObject(ViewModel viewModel, Object newLine, String collectionId, String collectionPath) voidprocessBeforeAddLine(ViewModel model, Object addLine, String collectionId, String collectionPath) Hook for service overrides to process the new collection line before it is added to the collectionvoidprocessBeforeEditLine(ViewModel model, Object lineObject, String collectionId, String collectionPath) Hook for service overrides to process the edit collection line before it is validatedvoidprocessBeforeSaveLine(ViewModel model, Object lineObject, String collectionId, String collectionPath) Hook for service overrides to process the save collection line before it is validatedvoidprocessCollectionAddBlankLine(ViewModel model, String collectionId, String collectionPath) Adds a blank line to the collectionvoidprocessCollectionAddLine(ViewModel model, String collectionId, String collectionPath) Invoked when the add line action is chosen for a collection.voidprocessCollectionCloseEditLineDialog(ViewModel model, String collectionId, String collectionPath, int selectedLineIndex) Invoked when the close edit line dialog action is chosen for a collection.voidprocessCollectionDeleteLine(ViewModel model, String collectionId, String collectionPath, int lineIndex) Invoked when the delete line action is chosen for a collection.voidprocessCollectionEditLine(ViewModel model, CollectionControllerServiceImpl.CollectionActionParameters parameters) Invoked when the edit line action is chosen for a collection.voidprocessCollectionRetrieveEditLineDialog(ViewModel model, String collectionId, String collectionPath, int selectedLineIndex) Invoked when the retrieve edit line dialog action is chosen for a collection.voidprocessCollectionSaveLine(ViewModel model, CollectionControllerServiceImpl.CollectionActionParameters parameters) Invoked when the save line action is chosen for a collection.voidprocessMultipleValueLookupResults(ViewModel model, String collectionId, String collectionPath, String multiValueReturnFields, String lookupResultValues) Process the results returned from a multi-value lookup populating the lines for the collection given by the pathvoidrefreshReference(Object parentObject, String referenceObjectName) Perform a database or data dictionary based refresh of a specific property objectvoidrefreshReferences(String referencesToRefresh) Update the reference objects listed in referencesToRefresh of the modelvoidInvokes the configuredPresentationControllerandAuthorizerfor the view to get the exported action flags and edit modes that can be used in conditional logicvoidsetElementContext(LifecycleElement element, LifecycleElement parent) Invoked to set up the context for an element.voidSets up the view context which will be available to other components through their context for conditional logic evaluation.
-
Method Details
-
populateViewFromRequestParameters
Uses reflection to find all fields defined on theViewinstance that have theRequestParameterannotation (which indicates the field may be populated by the request).The
Viewinstance is inspected for fields that have theRequestParameterannotation and if corresponding parameters are found in the request parameter map, the request value is used to set the view property. The Map of parameter name/values that match are placed in the view so they can be later retrieved to rebuild the view. CustomViewServiceHelperimplementations can add additional parameter key/value pairs to the returned map if necessary.For each field found, if there is a corresponding key/value pair in the request parameters, the value is used to populate the field. In addition, any conditional properties of
PropertyReplacersconfigured for the field are cleared so that the request parameter value does not get overridden by the dictionary conditional logic- Parameters:
parameters- The request parameters that apply to the view.- See Also:
-
performCustomViewInitialization
Hook for service overrides to perform custom initialization prior to view initialization.- Parameters:
model- The model.
-
performCustomInitialization
Hook for service overrides to perform custom initialization on the component- Parameters:
component- component instance to initialize
-
performCustomApplyModel
Hook for service overrides to perform custom apply model logic on the component- Parameters:
component- component instance to apply model tomodel- Top level object containing the data (could be the model or a top level business object, dto)
-
performCustomFinalize
Hook for service overrides to perform custom component finalization- Parameters:
component- component instance to updatemodel- Top level object containing the dataparent- Parent component for the component being finalized
-
performCustomViewFinalize
Hook for service overrides to perform view component finalization- Parameters:
model- Top level object containing the data
-
processBeforeAddLine
void processBeforeAddLine(ViewModel model, Object addLine, String collectionId, String collectionPath) Hook for service overrides to process the new collection line before it is added to the collection- Parameters:
model- object instance that contain's the view's dataaddLine- the new line instance to be processedcollectionId- the id of the collection being added tocollectionPath- the path to the collection being modified
-
processAfterAddLine
void processAfterAddLine(ViewModel model, Object addLine, String collectionId, String collectionPath, boolean isValidLine) Hook for service overrides to process the new collection line after it has been added to the collection- Parameters:
model- object instance that contain's the views dataaddLine- the new line that was addedcollectionId- the id of the collection being added tocollectionPath- the path to the collection being modifiedisValidLine- indicates if the line is valid
-
processBeforeEditLine
void processBeforeEditLine(ViewModel model, Object lineObject, String collectionId, String collectionPath) Hook for service overrides to process the edit collection line before it is validated- Parameters:
model- object instance that contain's the views datalineObject- the line instance to be processedcollectionId- the id of the collection being edited fromcollectionPath- the path to the collection being modified
-
processAfterEditLine
void processAfterEditLine(ViewModel model, Object lineObject, String collectionId, String collectionPath) Hook for service overrides to process the edit collection line after it has been validated- Parameters:
model- object instance that contains the views datalineObject- the line instance to be processedcollectionId- the id of the collection being edited fromcollectionPath- the path to the collection being modified
-
processBeforeSaveLine
void processBeforeSaveLine(ViewModel model, Object lineObject, String collectionId, String collectionPath) Hook for service overrides to process the save collection line before it is validated- Parameters:
model- object instance that contain's the views datalineObject- the line instance to be processedcollectionId- the id of the collection being added tocollectionPath- the path to the collection being modified
-
processAfterSaveLine
void processAfterSaveLine(ViewModel model, Object lineObject, String collectionId, String collectionPath) Hook for service overrides to process the save collection line after it has been validated- Parameters:
model- object instance that contains the views datalineObject- the line instance to be processedcollectionId- the id of the collection being added tocollectionPath- the path to the collection being modified
-
processAfterDeleteLine
void processAfterDeleteLine(ViewModel model, String collectionId, String collectionPath, int lineIndex) Hook for service overrides to process the collection line after it has been deleted- Parameters:
model- object instance that contains the views datacollectionId- the id of the collection being added tocollectionPath- the path to the collection being modifiedlineIndex- index of the line that was deleted
-
addCustomContainerComponents
Hook for creating new components with code and adding them to a containerSubclasses can override this method to check for one or more containers by id and then adding components created in code. This is invoked before the initialize method on the container component, so the full lifecycle will be run on the components returned.
New components instances can be retrieved using
ComponentFactory- Parameters:
model- object containing the view datacontainer- container instance to add components to
-
processCollectionAddLine
Invoked when the add line action is chosen for a collection. The collection path gives the full path to the collection that action was selected for. Here validation can be performed on the line as well as further processing on the line such as defaults. If the action is valid the line should be added to the collection, otherwise errors should be added to the globalMessageMap- Parameters:
model- Top level object containing the view data including the collection and new linecollectionId- the id of the collection being added tocollectionPath- the path to the collection being modified
-
processAndAddLineObject
-
processCollectionAddBlankLine
Adds a blank line to the collectionAdds a new collection item to the collection and applies any default values.
- Parameters:
model- Top level object containing the view data including the collection and new linecollectionId- the id of the collection being added tocollectionPath- the path to the collection being modified
-
processCollectionRetrieveEditLineDialog
void processCollectionRetrieveEditLineDialog(ViewModel model, String collectionId, String collectionPath, int selectedLineIndex) Invoked when the retrieve edit line dialog action is chosen for a collection. This method only does server side validation by default but creates hook for client applications to add additional logic like persisting data.- Parameters:
model- Top level object containing the view data including the collection and new linecollectionId- the id of the collection being added tocollectionPath- the path to the collection being modifiedselectedLineIndex- The index within the collection of the line to edit.
-
processCollectionEditLine
void processCollectionEditLine(ViewModel model, CollectionControllerServiceImpl.CollectionActionParameters parameters) Invoked when the edit line action is chosen for a collection. This method only does server side validation by default but creates hook for client applications to add additional logic like persisting data.- Parameters:
model- Top level object containing the view data including the collection and new lineparameters- the parameters for edit line request
-
processCollectionCloseEditLineDialog
void processCollectionCloseEditLineDialog(ViewModel model, String collectionId, String collectionPath, int selectedLineIndex) Invoked when the close edit line dialog action is chosen for a collection.- Parameters:
model- Top level object containing the view data including the collection and new linecollectionId- the id of the collection being added tocollectionPath- the path to the collection being modifiedselectedLineIndex- The index within the collection of the line to edit.
-
processCollectionSaveLine
void processCollectionSaveLine(ViewModel model, CollectionControllerServiceImpl.CollectionActionParameters parameters) Invoked when the save line action is chosen for a collection. This method only does server side validation by default but creates hook for client applications to add additional logic like persisting data.- Parameters:
model- Top level object containing the view data including the collection and new lineparameters- the parameters for save line request
-
processCollectionDeleteLine
void processCollectionDeleteLine(ViewModel model, String collectionId, String collectionPath, int lineIndex) Invoked when the delete line action is chosen for a collection. The collection path gives the full path to the collection that action was selected for. Here validation can be performed to make sure the action is allowed. If the action is valid the line should be deleted from the collection, otherwise errors should be added to the globalMessageMap- Parameters:
model- Top level object containing the view data including the collectioncollectionId- the id of the collection being added tocollectionPath- the path to the collection being modifiedlineIndex- index of the collection line that was selected for removal
-
processMultipleValueLookupResults
void processMultipleValueLookupResults(ViewModel model, String collectionId, String collectionPath, String multiValueReturnFields, String lookupResultValues) Process the results returned from a multi-value lookup populating the lines for the collection given by the path- Parameters:
model- object containing the view datacollectionId- the id of the collection being added tocollectionPath- the path to the collection being modifiedmultiValueReturnFields- String containing the selected line field nameslookupResultValues- String containing the selected line values
-
buildInquiryLink
Invoked by theInquirywidget to build the inquiry linkNote this is used primarily for custom
Inquirableimplementations to customize the inquiry class or parameters for an inquiry. Instead of building the full inquiry link, implementations can make a callback to org.kuali.rice.krad.uif.widget.Inquiry.buildInquiryLink(Object, String, Classinvalid input: '<'?>, Mapinvalid input: '<'String, String>) given an inquiry class and parameters to build the link field.- Parameters:
dataObject- parent object for the inquiry propertypropertyName- name of the property the inquiry is being built forinquiry- instance of the inquiry widget being built for the property
-
setViewContext
void setViewContext()Sets up the view context which will be available to other components through their context for conditional logic evaluation. -
setElementContext
Invoked to set up the context for an element.Context is primarily used for expression evaluation. Any object in the context for a component will be available as a variable within expressions.
- Parameters:
element- element to setup context forparent- parent of the given element
-
retrieveEditModesAndActionFlags
void retrieveEditModesAndActionFlags()Invokes the configuredPresentationControllerandAuthorizerfor the view to get the exported action flags and edit modes that can be used in conditional logic -
refreshReference
Perform a database or data dictionary based refresh of a specific property objectThe object needs to be of type PersistableBusinessObject.
- Parameters:
parentObject- parent object that references the object to be refreshedreferenceObjectName- property name of the parent object to be refreshed
-
refreshReferences
Update the reference objects listed in referencesToRefresh of the modelThe the individual references in the referencesToRefresh string are separated by KRADConstants.REFERENCES_TO_REFRESH_SEPARATOR).
- Parameters:
referencesToRefresh- list of references to refresh (
-
getDefaultValueForField
Retrieves the default value that is configured for the given data fieldThe field's default value is determined in the following order:
- If default value on field is non-blank
- If expression is found for default value
- If default value finder class is configured for field
- If an expression is found for default values
- If default values on field is not null
- Parameters:
object- object that should be populateddataField- field to retrieve default value for- Returns:
- Object default value for field or null if value was not found
-
populateDefaultValueForField
Applies the default value configured for the given field (if any) to the line given object property that is determined by the given binding path- Parameters:
object- object that should be populateddataField- field to check for configured default valuebindingPath- path to the property on the object that should be populated
-
buildGrowlScript
String buildGrowlScript()Builds JS script that will invoke the show growl method to display a growl message when the page is renderedA growl call will be created for any explicit growl messages added to the message map.
Growls are only generated if @{link org.kuali.rice.krad.uif.view.View#isGrowlMessagingEnabled()} is enabled. If not, the growl messages are set as info messages for the page
- Returns:
- JS script string for generated growl messages
-
applyDefaultValues
Iterates through the view components picking up data fields and applying an default value configured- Parameters:
component- component that should be checked for default values
-
applyDefaultValuesForCollectionLine
Populate default values the model backing a line in a collection group.- Parameters:
collectionGroup- The collection group.line- The model object backing the line.
-
getExpressionEvaluatorFactory
ExpressionEvaluatorFactory getExpressionEvaluatorFactory()Gets an expression evaluator factory for use with the current view.- Returns:
- expression evaluator factory
-