Interface ViewModel
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
DocumentFormBase,DummyLoginForm,DynaForm,IncidentReportForm,InitiatedDocumentInfoForm,InquiryForm,LookupForm,MaintenanceDocumentForm,SessionTimeoutForm,TransactionalDocumentFormBase,UifFormBase
View.
Since the View relies on helper properties from the model it is necessary the backing object implement the
ViewModel interface. Note model objects can extend UifFormBase which implements
the ViewModel interface.
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Method Summary
Modifier and TypeMethodDescriptionCopy of the action flags on the view to be used by subsequent requests (so they don't need to be evaluated on each request).Map of parameters sent for the invoked actionGets the return type for the ajax callMap that is populated from the component state maintained on the clientContains values for dialog explanation fields present on the page.getDialogResponse(String dialogId) Helper method to get a dialog response for the given dialog id.Map containing dialog responses for a request 'conversation'.Copy of the edit modes on the view to be used by subsequent requests (so they don't need to be evaluated on each request).A generic map for framework pieces (such as component modifiers) that need to dynamically store data to the formURL the form generated for the view should post toScript that will run on render (view or component) for generating growl messagesHolds instances for collection add lines.Id for the current page being displayed within the viewList of fields that should be read only on the viewTemplate the will be invoked to return a JSON stringHolds Set of String identifiers for lines that were selected in a collection from a single page.getState()Gets the state.When the request has been triggered by an action component, gives the id for the action.Component instance that been built for a refresh/disclosure request.Id for the component that should be updated for a component refresh processgetView()View instance associated with the model.Returns the view helper service instance that was configured for the current view.Unique Id for theViewinstance.Name for theViewinstance.Gets theViewPostMetadatathat has been built up from processing of a view.Map of parameters that was used to configured theView.Name for the type of view being requested.booleanIndicates whether the request was made by an ajax callbooleanIndicates whether default values should be applied.Copy of the edit view flag to be used by subsequent requests (so they don't need to be evaluated on each request).booleanIndicates whether the request is for paging a collection (or sorting).booleanDetermines whether edit modes and action flags should be evaluated.booleanIndicates whether the request should return a JSON stringbooleanIndicates whether the request is to update a component (only applicable for ajax requests)booleanIndicates whether the request is to update a dialog (only applicable for ajax requests)booleanIndicates whether the request is for a non-update of the view (only applicable for ajax requests)booleanIndicates whether the request is to update a page (only applicable for ajax requests)voidpostBind(javax.servlet.http.HttpServletRequest request) Called after Spring binds the request to the form and before the controller method is invokedvoidpreBind(javax.servlet.http.HttpServletRequest request) Called before Spring binds the request to the form to allow for pre-processing before setting values.voidpreRender(javax.servlet.http.HttpServletRequest request) Called after the controller has finished executing, but before rendering occurs.voidsetActionFlags(Map<String, Boolean> actionFlags) voidsetActionParameters(Map<String, String> actionParameters) Setter for the action parameters mapvoidsetAjaxRequest(boolean ajaxRequest) Set the ajaxRequestvoidsetAjaxReturnType(String ajaxReturnType) Setter for the type of ajax returnvoidsetApplyDefaultValues(boolean applyDefaultValues) Set whether default values should be applied to the viewvoidsetCanEditView(Boolean canEditView) voidsetCollectionPagingRequest(boolean collectionPagingRequest) voidsetDialogExplanations(Map<String, String> dialogExplanations) voidsetDialogResponses(Map<String, DialogResponse> dialogResponses) voidsetEditModes(Map<String, Boolean> editModes) voidsetEvaluateFlagsAndModes(boolean evaluateFlagsAndModes) voidsetExtensionData(Map<String, Object> extensionData) Setter for the generic extension data mapvoidsetFormPostUrl(String formPostUrl) Setter for the form post URLvoidsetGrowlScript(String growlScript) Setter for the script that generates growls on rendervoidsetNewCollectionLines(Map<String, Object> newCollectionLines) Setter for the new collection lines MapvoidSetter for the current page idvoidsetReadOnlyFieldsList(List<String> readOnlyFieldsList) Setter for the list of read only fieldsvoidsetRequestJsonTemplate(String requestJsonTemplate) Setter for the template to render for the requestvoidsetSelectedCollectionLines(Map<String, Set<String>> selectedCollectionLines) Setter for the map that holds selected collection linesvoidSet the statevoidsetTriggerActionId(String triggerActionId) voidsetUpdateComponent(Component updateComponent) voidsetUpdateComponentId(String updateComponentId) Setter for the component id that should be refreshedvoidSetter for the view instancevoidSetter for the unique view idvoidsetViewName(String viewName) Setter for the view namevoidsetViewPostMetadata(ViewPostMetadata viewPostMetadata) voidsetViewRequestParameters(Map<String, String> viewRequestParameters) Setter for the view's request parameter mapvoidsetViewTypeName(UifConstants.ViewType viewTypeName) Setter for the view type name
-
Method Details
-
preBind
void preBind(javax.servlet.http.HttpServletRequest request) Called before Spring binds the request to the form to allow for pre-processing before setting values.- Parameters:
request- request object containing the query parameters
-
postBind
void postBind(javax.servlet.http.HttpServletRequest request) Called after Spring binds the request to the form and before the controller method is invoked- Parameters:
request- request object containing the query parameters
-
preRender
void preRender(javax.servlet.http.HttpServletRequest request) Called after the controller has finished executing, but before rendering occurs.- Parameters:
request- request object containing the query parameters
-
getViewId
String getViewId()Unique Id for theViewinstance. This is specified for a view in its definition by setting the 'id' property.- Returns:
- String view id
-
setViewId
Setter for the unique view id- Parameters:
viewId-
-
getViewName
String getViewName()Name for theViewinstance. This is specified for a view in its definition by setting the 'id' property. The name is not necessary unique and cannot be used by itself to retrieve a view. Typically it is used with other parameters to identify a view with a certain type (view type)- Returns:
- String view name
-
setViewName
Setter for the view name- Parameters:
viewName-
-
getViewTypeName
UifConstants.ViewType getViewTypeName()Name for the type of view being requested. This can be used to findViewinstances by request parameters (not necessary the unique id)- Returns:
- String view type name
-
setViewTypeName
Setter for the view type name- Parameters:
viewTypeName-
-
getView
View getView()View instance associated with the model. Used to render the user interface- Returns:
- View
-
setView
Setter for the view instance- Parameters:
view-
-
getViewHelperService
Returns the view helper service instance that was configured for the current view.- Returns:
- instance of view helper service, null if view is null
- Throws:
IllegalAccessExceptionInstantiationException
-
getViewPostMetadata
ViewPostMetadata getViewPostMetadata()Gets theViewPostMetadatathat has been built up from processing of a view.The view post metadata is used to read information about the view that was rendered when a post occurs. For example, you might need to check whether a particular flag was enabled for the rendered view when processing the post logic
- Returns:
- ViewPostMetadata instance for the previously processed view
-
setViewPostMetadata
- See Also:
-
getPageId
String getPageId()Id for the current page being displayed within the view- Returns:
- String page id
-
setPageId
Setter for the current page id- Parameters:
pageId-
-
getFormPostUrl
String getFormPostUrl()URL the form generated for the view should post to- Returns:
- String form post URL
-
setFormPostUrl
Setter for the form post URL- Parameters:
formPostUrl-
-
getViewRequestParameters
Map of parameters that was used to configured theView. Maintained on the form to rebuild the view on posts and session timeout- Returns:
- Mapinvalid input: '<'String, String> view parameters
-
setViewRequestParameters
Setter for the view's request parameter map- Parameters:
viewRequestParameters- map of request parameters
-
getReadOnlyFieldsList
List of fields that should be read only on the viewIf the view being rendered supports request setting of read-only fields, the readOnlyFields request parameter can be sent to mark fields as read only that might not have been otherwise
Note the paths specified should be the simple property names (not the full binding path). Therefore if the property name appears multiple times in the view, all instances will be set as read only
- Returns:
- List<String> read only property names
- See Also:
-
setReadOnlyFieldsList
Setter for the list of read only fields -
getNewCollectionLines
Holds instances for collection add lines. The key of the Map gives the collection name the line instance applies to, the Map value is an instance of the collection object class that holds the new line data- Returns:
- Mapinvalid input: '<'String, Object> new collection lines
-
setNewCollectionLines
Setter for the new collection lines Map- Parameters:
newCollectionLines-
-
getTriggerActionId
String getTriggerActionId()When the request has been triggered by an action component, gives the id for the action.- Returns:
- String action id, or null if request was not triggered by an action component
-
setTriggerActionId
- See Also:
-
getActionParameters
Map of parameters sent for the invoked actionMany times besides just setting the method to call actions need to send additional parameters. For instance the method being called might do a redirect, in which case the action needs to send parameters for the redirect URL. An example of this is redirecting to a
Lookupview. In some cases the parameters that need to be sent conflict with properties already on the form, and putting all the action parameters as form properties would grow massive (in addition to adds an additional step from the XML config). So this general map solves those issues.- Returns:
- Mapinvalid input: '<'String, String> action parameters
-
setActionParameters
Setter for the action parameters map- Parameters:
actionParameters-
-
getClientStateForSyncing
Map that is populated from the component state maintained on the clientUsed when a request is made that refreshes part of the view. The current state for components (which have state that can be changed on the client), is populated into this map which is then used by the
ViewHelperServiceto update the components so that the state is maintained when they render.- Returns:
- Mapinvalid input: '<'String, Object> map where key is name of property or component id, and value is the property value or another map of component key/value pairs
-
getSelectedCollectionLines
Holds Set of String identifiers for lines that were selected in a collection from a single page. selectedCollectionLines are request level values and get reset with every page requestWhen the select field is enabled for a
CollectionGroup, the framework will be default bind the selected identifier strings to this property. The key of the map uniquely identifies the collection by the full binding path to the collection, and the value is a set of Strings for the checked lines.- Returns:
- Map<String, Set<String>> map of collections and their selected lines
- See Also:
-
setSelectedCollectionLines
Setter for the map that holds selected collection lines -
isApplyDefaultValues
boolean isApplyDefaultValues()Indicates whether default values should be applied.Default field values of a view need to be applied after the view life cycle completes. Otherwise, they risk getting over written.
- Returns:
- boolean true if the request was an ajax call, false if not
-
setApplyDefaultValues
void setApplyDefaultValues(boolean applyDefaultValues) Set whether default values should be applied to the view -
isEvaluateFlagsAndModes
boolean isEvaluateFlagsAndModes()Determines whether edit modes and action flags should be evaluated.Initially this will be true causing edit modes and action flags to be evaluated on the initial request to a view. If these need to be reevaluated at some point (for a particular view instance), this flag can be set to true and causing the authorization to be reevaluated during the lifecycle.
- Returns:
- boolean true if flags and modes should be evaluate during the view lifecycle, false if not
-
setEvaluateFlagsAndModes
void setEvaluateFlagsAndModes(boolean evaluateFlagsAndModes) - See Also:
-
isCanEditView
Boolean isCanEditView()Copy of the edit view flag to be used by subsequent requests (so they don't need to be evaluated on each request).If null, edit check will be performed
- See Also:
-
setCanEditView
- See Also:
-
getActionFlags
Copy of the action flags on the view to be used by subsequent requests (so they don't need to be evaluated on each request).- See Also:
-
setActionFlags
- See Also:
-
getEditModes
Copy of the edit modes on the view to be used by subsequent requests (so they don't need to be evaluated on each request).- See Also:
-
setEditModes
- See Also:
-
getGrowlScript
String getGrowlScript()Script that will run on render (view or component) for generating growl messages- Returns:
- String JS growl script
-
setGrowlScript
Setter for the script that generates growls on render- Parameters:
growlScript-
-
getState
String getState()Gets the state. This is the default location for state on KRAD forms.- Returns:
- the state
-
setState
Set the state- Parameters:
state-
-
getUpdateComponentId
String getUpdateComponentId()Id for the component that should be updated for a component refresh process- Returns:
- String component id
-
setUpdateComponentId
Setter for the component id that should be refreshed- Parameters:
updateComponentId-
-
getUpdateComponent
Component getUpdateComponent()Component instance that been built for a refresh/disclosure request.This is generally set by org.kuali.rice.krad.uif.lifecycle.ViewLifecycle#performComponentLifecycle(org.kuali.rice.krad.uif.view.View, java.lang.Object, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.kuali.rice.krad.uif.lifecycle.ViewPostMetadata, java.lang.String) after processing the lifecycle. The form property provides access to the rendering layer.
- Returns:
- component instance for updating
-
setUpdateComponent
- See Also:
-
isAjaxRequest
boolean isAjaxRequest()Indicates whether the request was made by an ajax callDepending on whether the request was made via ajax (versus standard browser submit) the response will be handled different. For example with an ajax request we can send back partial page updates, which cannot be done with standard submits
If this indicator is true,
getAjaxReturnType()will be used to determine how to handling the ajax return- Returns:
- boolean true if the request was an ajax call, false if not
-
setAjaxRequest
void setAjaxRequest(boolean ajaxRequest) Set the ajaxRequest- Parameters:
ajaxRequest-
-
getAjaxReturnType
String getAjaxReturnType()Gets the return type for the ajax callThe ajax return type indicates how the response content will be handled in the client. Typical examples include updating a component, the page, or doing a redirect.
- Returns:
- String return type
- See Also:
-
setAjaxReturnType
Setter for the type of ajax return- Parameters:
ajaxReturnType-
-
isUpdateComponentRequest
boolean isUpdateComponentRequest()Indicates whether the request is to update a component (only applicable for ajax requests)- Returns:
- boolean true if the request is for update component, false if not
-
isUpdatePageRequest
boolean isUpdatePageRequest()Indicates whether the request is to update a page (only applicable for ajax requests)- Returns:
- boolean true if the request is for update page, false if not
-
isUpdateDialogRequest
boolean isUpdateDialogRequest()Indicates whether the request is to update a dialog (only applicable for ajax requests)- Returns:
- boolean true if the request is for update dialog, false if not
-
isUpdateNoneRequest
boolean isUpdateNoneRequest()Indicates whether the request is for a non-update of the view (only applicable for ajax requests)Examples of requests that do not update the view are ajax queries or requests that download a file
- Returns:
- boolean true if the request is for non-update, false if not
-
isJsonRequest
boolean isJsonRequest()Indicates whether the request should return a JSON stringWhen this indicator is true, the rendering process will invoke the template given by
getRequestJsonTemplate()which should return a JSON stringFor JSON requests the view is not built, however a component can be retrieved and exported in the request by setting
getUpdateComponentId()- Returns:
- boolean true if request is for JSON, false if not
-
getRequestJsonTemplate
String getRequestJsonTemplate()Template the will be invoked to return a JSON stringCertain templates can be rendered to build JSON for a JSON request. The template set here (by a controller) will be rendered
- Returns:
- path to template
-
setRequestJsonTemplate
Setter for the template to render for the request- Parameters:
requestJsonTemplate-
-
isCollectionPagingRequest
boolean isCollectionPagingRequest()Indicates whether the request is for paging a collection (or sorting).- Returns:
- boolean true if a paging request is present, false if not
-
setCollectionPagingRequest
void setCollectionPagingRequest(boolean collectionPagingRequest) - See Also:
-
getDialogExplanations
Contains values for dialog explanation fields present on the page.Since multiple dialogs can be present on the same page using the generic explanation field, the values are maintained in this map using the dialog id as the key. Values are cleared on each request.
- Returns:
- map of dialog explanations, where key is the dialog id and map value is the explanation
-
setDialogExplanations
- See Also:
-
getDialogResponses
Map<String,DialogResponse> getDialogResponses()Map containing dialog responses for a request 'conversation'.When a controller methods requests a dialog, the response is collected on the return call and placed into this map. The key to the map is the id for the dialog. Since a single controller method can spawn multiple dialogs in a single conversation (these are actually multiple requests/responses, but part of the same action request), the responses are collected in this map. Whenever a request is encountered that is not a return, the map is cleared. This means the responses will be cleared in case the action is triggered action.
- Returns:
- map of dialog responses, where map key is the dialog id and the map value is the dialog response object
-
getDialogResponse
Helper method to get a dialog response for the given dialog id.- Parameters:
dialogId- id of the dialog to get response for- Returns:
- dialog response object, or null if response does not exist
- See Also:
-
setDialogResponses
- See Also:
-
getExtensionData
A generic map for framework pieces (such as component modifiers) that need to dynamically store data to the form- Returns:
- Mapinvalid input: '<'String, Object>
-
setExtensionData
Setter for the generic extension data map- Parameters:
extensionData-
-