org.kuali.rice.krad.uif.service
Interface ViewHelperService

All Known Subinterfaces:
Lookupable, Maintainable, Maintainable
All Known Implementing Classes:
AgendaEditorMaintainable, AgendaInquiryHelperServiceImpl, AgendaLookupableHelperServiceImpl, AuthorMaintainable, BookMaintainable, CampusMaintainableImpl, CampusTypeMaintainableImpl, ComponentInquirableImpl, ComponentViewHelperServiceImpl, ContextMaintainable, CountryMaintainableImpl, CountyMaintainableImpl, DocumentTypeMaintainable, DocumentViewHelperServiceImpl, FiscalOfficerInfoInquiryViewHelperServiceImpl, FiscalOfficerInfoLookupViewHelperServiceImpl, FiscalOfficerInfoMaintainableImpl, GenericPermissionMaintainable, GroupInquirableImpl, GroupLookupableImpl, InquirableImpl, KimTypeInquirableImpl, KualiGlobalMaintainableImpl, KualiInquirableImpl, KualiMaintainableImpl, LookupableImpl, MaintainableImpl, NamespaceMaintainableImpl, ParameterMaintainableImpl, PeopleFlowInquirableImpl, PeopleFlowMaintainableImpl, PermissionInquirableImpl, PersonInquirableImpl, PersonLookupableImpl, PostalCodeMaintainableImpl, PropositionLookupableHelperServiceImpl, ResponsibilityInquirableImpl, ReviewResponsibilityMaintainable, RoleInquirableImpl, RoleLookupableImpl, RoleMemberInquirableImpl, RoutingRuleDelegationMaintainable, RoutingRuleMaintainable, RuleBaseValuesInquirableImpl, RuleDelegationInquirableImpl, StateMaintainableImpl, TermMaintainable, TermSpecificationMaintainable, TravelAccountInfoInquiryViewHelperServiceImpl, UIfComponentsViewHelperServiceImpl, UIfComponentsViewHelperServiceImpl, UifGeneratedTestViewHelperServiceImpl, ViewHelperServiceImpl

public interface ViewHelperService

Provides methods for implementing the various phases of a View

Author:
Kuali Rice Team (rice.collab@kuali.org)

Method Summary
 void applyDefaultValuesForCollectionLine(View view, Object model, CollectionGroup collectionGroup, Object line)
          Applies configured default values for the line fields to the line instance
 String buildExportTableData(View view, Object model, String tableId, String formatType)
          Generates table formatted data based on data collected from the table model
 void buildInquiryLink(Object dataObject, String propertyName, Inquiry inquiry)
          Invoked by the Inquiry widget to build the inquiry link
 void cleanViewAfterRender(View view)
          Invoked after the view has been rendered to clear out objects that are not necessary to keep around for the post, this helps reduce the view size and overall cost to store the form in session
 Map<String,Object> getCommonContext(View view, Component component)
          Gets global objects for the context map and pushes them to the context for the component
 ExpressionEvaluator getExpressionEvaluator()
          Return an instance of ExpressionEvaluator that can be used for evaluating expressions contained on the view
 void performApplyModel(View view, Object model)
          Executes the ApplyModel phase.
 void performComponentInitialization(View view, Object model, Component component)
          Performs the Initialization phase for the given Component
 void performComponentLifecycle(View view, Object model, Component component, String origId)
          Performs the complete component lifecycle on the component passed in for use during a refresh process
 void performFinalize(View view, Object model)
          The last phase before the view is rendered.
 void performInitialization(View view, Object model)
          Performs the Initialization phase for the View.
 void populateViewFromRequestParameters(View view, Map<String,String> parameters)
          Populates the View properties from the given request parameters
 void processCollectionAddBlankLine(View view, Object model, String collectionPath)
          Adds a blank line to the collection
 void processCollectionAddLine(View view, Object model, String collectionPath)
          Invoked when the add line action is chosen for a collection.
 void processCollectionDeleteLine(View view, Object model, String collectionPath, int lineIndex)
          Invoked when the delete line action is chosen for a collection.
 void processCollectionSaveLine(View view, Object model, String collectionPath, int selectedLineIndex)
          Invoked when the save line action is chosen for a collection.
 void processMultipleValueLookupResults(View view, Object model, String collectionPath, String lookupResultValues)
          Process the results returned from a multi-value lookup populating the lines for the collection given by the path
 void refreshReferences(Object model, String referencesToRefresh)
          Update the reference objects listed in referencesToRefresh of the model
 void spawnSubLifecyle(View view, Object model, Component component, Component parent, String startPhase, String endPhase)
          Runs the lifecycle process for the given component starting at the given start phase and ending with the given end phase
 

Method Detail

populateViewFromRequestParameters

void populateViewFromRequestParameters(View view,
                                       Map<String,String> parameters)
Populates the View properties from the given request parameters

The View instance is inspected for fields that have the RequestParameter annotation 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. Custom ViewServiceHelper implementations can add additional parameter key/value pairs to the returned map if necessary.

See Also:
RequestParameter

performInitialization

void performInitialization(View view,
                           Object model)
Performs the Initialization phase for the View. During this phase each component of the tree is invoked to setup state based on the configuration and request options.

The initialize phase is only called once per View lifecycle

Note the View instance also contains the context Map that was created based on the parameters sent to the view service

Parameters:
view - View instance that should be initialized
model - object instance containing the view data

performComponentInitialization

void performComponentInitialization(View view,
                                    Object model,
                                    Component component)
Performs the Initialization phase for the given Component

Can be called for component instances constructed via code or prototypes to initialize the constructed component

Parameters:
view - view instance the component belongs to
model - object instance containing the view data
component - component instance that should be initialized

performApplyModel

void performApplyModel(View view,
                       Object model)
Executes the ApplyModel phase. During this phase each component of the tree if invoked to setup any state based on the given model data

Part of the view lifecycle that applies the model data to the view. Should be called after the model has been populated before the view is rendered. The main things that occur during this phase are:

The update phase can be called multiple times for the view's lifecycle (typically only once per request)

Parameters:
view - View instance that the model should be applied to
model - Top level object containing the data (could be the form or a top level business object, dto)

getCommonContext

Map<String,Object> getCommonContext(View view,
                                    Component component)
Gets global objects for the context map and pushes them to the context for the component

Parameters:
view - view instance for component
component - component instance to push context to

performFinalize

void performFinalize(View view,
                     Object model)
The last phase before the view is rendered. Here final preparations can be made based on the updated view state

The finalize phase runs after the apply model phase and can be called multiple times for the view's lifecylce (however typically only once per request)

Parameters:
view - view instance that should be finalized for rendering
model - top level object containing the data

cleanViewAfterRender

void cleanViewAfterRender(View view)
Invoked after the view has been rendered to clear out objects that are not necessary to keep around for the post, this helps reduce the view size and overall cost to store the form in session

Parameters:
view - view instance to be cleaned

performComponentLifecycle

void performComponentLifecycle(View view,
                               Object model,
                               Component component,
                               String origId)
Performs the complete component lifecycle on the component passed in for use during a refresh process

Runs the three lifecycle phases on the component passed in. Some adjustments are made to account for the component being processed without its parent. The component within the view (contained on the form) is retrieved to obtain the context to use (such as parent). The created components id is then updated to match the current id within the view.

Parameters:
view - view instance the component belongs to
model - object containing the full view data
component - component instance to perform lifecycle for
origId - id of the component within the view, used to pull the current component from the view

spawnSubLifecyle

void spawnSubLifecyle(View view,
                      Object model,
                      Component component,
                      Component parent,
                      String startPhase,
                      String endPhase)
Runs the lifecycle process for the given component starting at the given start phase and ending with the given end phase

Start or end phase can be null to indicate the first phase or last phase respectively

Parameters:
view - view instance the component belongs to
model - object providing the view data
component - component to run the lifecycle phases for
parent - parent component for the component being processed
startPhase - lifecycle phase to start with, or null to indicate the first phase
endPhase - lifecycle phase to end with, or null to indicate the last phase

refreshReferences

void refreshReferences(Object model,
                       String referencesToRefresh)
Update the reference objects listed in referencesToRefresh of the model

The the individual references in the referencesToRefresh string are separated by KRADConstants.REFERENCES_TO_REFRESH_SEPARATOR).

Parameters:
model - top level object containing the data
referencesToRefresh - list of references to refresh (

processCollectionAddLine

void processCollectionAddLine(View view,
                              Object model,
                              String collectionPath)
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 global MessageMap

Parameters:
view - view instance that is being presented (the action was taken on)
model - Top level object containing the view data including the collection and new line
collectionPath - full path to the collection on the model

processCollectionAddBlankLine

void processCollectionAddBlankLine(View view,
                                   Object model,
                                   String collectionPath)
Adds a blank line to the collection

Adds a new collection item to the collection and applies any default values.

Parameters:
view - view instance that is being presented (the action was taken on)
model - Top level object containing the view data including the collection and new line
collectionPath - full path to the collection on the model

processCollectionSaveLine

void processCollectionSaveLine(View view,
                               Object model,
                               String collectionPath,
                               int selectedLineIndex)
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:
view - view instance that is being presented (the action was taken on)
model - Top level object containing the view data including the collection and new line
collectionPath - full path to the collection on the model

processCollectionDeleteLine

void processCollectionDeleteLine(View view,
                                 Object model,
                                 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 global MessageMap

Parameters:
view - view instance that is being presented (the action was taken on)
model - Top level object containing the view data including the collection
collectionPath - full path to the collection on the model
lineIndex - index of the collection line that was selected for removal

processMultipleValueLookupResults

void processMultipleValueLookupResults(View view,
                                       Object model,
                                       String collectionPath,
                                       String lookupResultValues)
Process the results returned from a multi-value lookup populating the lines for the collection given by the path

Parameters:
view - view instance the collection belongs to
model - object containing the view data
collectionPath - binding path to the collection to populated
lookupResultValues - String containing the selected line values

buildInquiryLink

void buildInquiryLink(Object dataObject,
                      String propertyName,
                      Inquiry inquiry)
Invoked by the Inquiry widget to build the inquiry link

Note this is used primarily for custom Inquirable implementations 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, Class, Map) given an inquiry class and parameters to build the link field.

Parameters:
dataObject - parent object for the inquiry property
propertyName - name of the property the inquiry is being built for
inquiry - instance of the inquiry widget being built for the property

applyDefaultValuesForCollectionLine

void applyDefaultValuesForCollectionLine(View view,
                                         Object model,
                                         CollectionGroup collectionGroup,
                                         Object line)
Applies configured default values for the line fields to the line instance

Parameters:
view - view instance the collection line belongs to
model - object containing the full view data
collectionGroup - collection group component the line belongs to
line - line instance to apply default values to

getExpressionEvaluator

ExpressionEvaluator getExpressionEvaluator()
Return an instance of ExpressionEvaluator that can be used for evaluating expressions contained on the view

A ExpressionEvaluator must be initialized with a model for expression evaluation. One instance is constructed for the view lifecycle and made available to all components/helpers through this method

Returns:
instance of ExpressionEvaluator

buildExportTableData

String buildExportTableData(View view,
                            Object model,
                            String tableId,
                            String formatType)
Generates table formatted data based on data collected from the table model

Parameters:
view - view instance where the table is located
model - top level object containing the data
tableId - id of the table being generated
formatType - format which the table should be generated in
Returns:


Copyright © 2005-2014 The Kuali Foundation. All Rights Reserved.