org.kuali.rice.krad.web.form
Class UifFormBase

java.lang.Object
  extended by org.kuali.rice.krad.web.form.UifFormBase
All Implemented Interfaces:
Serializable, ViewModel
Direct Known Subclasses:
ActionListForm, CacheAdminForm, CourseOfferingForm, DocumentFormBase, DummyLoginForm, EncryptionForm, IncidentReportForm, InitiatedDocumentInfoForm, InquiryForm, KitchenSinkPerformanceForm, KradLabsForm, KradSampleAppForm, LookupForm, ParameterForm, RegistrationForm, ServerPagingTestForm, SessionTimeoutForm, StatsForm, TrainingApplicationForm, TransactionForm, UifComponentsTestForm, UifComponentsTestForm, UifDialogTestForm, UITestForm, UITestForm, XmlIngesterForm

public class UifFormBase
extends Object
implements ViewModel

Base form class for views within the KRAD User Interface Framework.

Holds properties necessary to determine the View instance that will be used to render the user interface

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
Serialized Form

Field Summary
protected  Map<String,String> actionParameters
           
protected  List<Object> addedCollectionItems
           
protected  boolean ajaxRequest
           
protected  String ajaxReturnType
           
protected  org.springframework.web.multipart.MultipartFile attachmentFile
           
protected  Map<String,Object> clientStateForSyncing
           
protected  String controllerMapping
           
protected  String dialogExplanation
           
protected  DialogManager dialogManager
           
protected  String dialogResponse
           
protected  boolean dirtyForm
           
protected  Map<String,Object> extensionData
           
protected  String flowKey
           
protected  String focusId
           
protected  String formKey
           
protected  String formPostUrl
           
protected  String growlScript
           
protected  HistoryFlow historyFlow
           
protected  HistoryManager historyManager
           
protected  String jumpToId
           
protected  String jumpToName
           
protected  String lightboxScript
           
protected  String methodToCall
           
protected  Map<String,Object> newCollectionLines
           
protected  String pageId
           
protected  Map<String,String> queryParameters
           
protected  List<String> readOnlyFieldsList
           
protected  boolean renderedInIframe
           
protected  boolean renderedInLightBox
           
protected  String requestedFormKey
           
protected  boolean requestRedirected
           
protected  String returnFormKey
           
protected  String returnLocation
           
protected  Map<String,Set<String>> selectedCollectionLines
           
protected  Set<String> selectedLookupResultsCache
           
protected  String sessionId
           
protected  int sessionTimeoutInterval
           
protected  String state
           
protected  String updateComponentId
           
protected  View view
           
protected  String viewId
           
protected  String viewName
           
protected  ViewPostMetadata viewPostMetadata
           
protected  Map<String,String> viewRequestParameters
           
protected  List<String> viewsThatNeedDefaultValuesApplied
           
protected  UifConstants.ViewType viewTypeName
           
 
Constructor Summary
UifFormBase()
           
 
Method Summary
 void addViewThatNeedsDefaultValuesApplied(String viewId)
          Adds unique view id to list of views that need default values applied.
protected  String generateFormKey()
          Creates the unique id used to store this "conversation" in the session.
 String getActionEvent()
          Returns the action event that was sent in the action parameters (if any)
 String getActionParamaterValue(String actionParameterName)
          Retrieves the value for the given action parameter, or empty string if not found
 Map<String,String> getActionParameters()
          Map of parameters sent for the invoked action
 Properties getActionParametersAsProperties()
          Returns the action parameters map as a Properties instance
 List getAddedCollectionItems()
          The List that contains all newly added items for the collections on the model
 String getAjaxReturnType()
          Gets the return type for the ajax call
 org.springframework.web.multipart.MultipartFile getAttachmentFile()
          Holder for files that are attached through the view
 Map<String,Object> getClientStateForSyncing()
          Map that is populated from the component state maintained on the client
 String getControllerMapping()
          Name of the controllerMapping for this form (includes slash)
 String getDialogExplanation()
          Returns the String entered by the user when presented a dialog
 DialogManager getDialogManager()
          Gets the DialogManager for this view/form
 String getDialogResponse()
          Represents the option chosen by the user when interacting with a modal dialog
 Map<String,Object> getExtensionData()
          A generic map for framework pieces (such as component modifiers) that need to dynamically store data to the form
 String getFlowKey()
          The flowKey representing the HistoryFlow this form may be in.
 String getFocusId()
          Field to place focus on when the page loads An empty focusId will result in focusing on the first visible input element by default.
 String getFormKey()
          Key string that identifies the form instance in session storage
 String getFormPostUrl()
          URL the form generated for the view should post to
 String getGrowlScript()
          Script that will run on render (view or component) for generating growl messages
 HistoryFlow getHistoryFlow()
          The current HistoryFlow for this form which stores a trail of urls/breadcrumbs primarily used for path-based breadcrumb display
 HistoryManager getHistoryManager()
          The current HistoryManager that was pulled from session which store all HistoryFlow objects in the current session to keep track of the path the user has taken across views (primarily used by path-based breadcrumbs)
 Map<String,String[]> getInitialRequestParameters()
          The requestParameters represent all the parameters in the query string that were initially passed to this View by the initial request
 String getJumpToId()
          The jumpToId for this form, the element with this id will be jumped to automatically when the form is loaded in the view.
 String getJumpToName()
          The jumpToName for this form, the element with this name will be jumped to automatically when the form is loaded in the view.
 String getLightboxScript()
          Script that will run on render (view or component) for a lightbox
 String getMethodToCall()
          Identifies the controller method that should be invoked to fulfill a request.
 Map<String,Object> getNewCollectionLines()
          Holds instances for collection add lines.
 String getPageId()
          Id for the current page being displayed within the view
 Map<String,String> getQueryParameters()
          A generic map for query parameters
 List<String> getReadOnlyFieldsList()
          List of fields that should be read only on the view
 String getRequestedFormKey()
          This is the formKey sent on the original request.
 String getRequestJsonTemplate()
          Template the will be invoked to return a JSON string
 String getRequestUrl()
          The original requestUrl for the View represented by this form (url received by the controller for initial request)
 String getReturnFormKey()
           
 String getReturnLocation()
           
 Map<String,Set<String>> getSelectedCollectionLines()
          Holds Set of String identifiers for lines that were selected in a collection from a single page.
 Set<String> getSelectedLookupResultsCache()
          Holds Set of String identifiers for lines that were selected in a lookup collection results across multiple pages.
 String getSessionId()
          Holds the id for the user's current session
 int getSessionTimeoutInterval()
          Holds the configured session timeout interval
 String getState()
          Gets the state.
 Component getUpdateComponent()
          Component instance that been built for a refresh/disclosure request.
 String getUpdateComponentId()
          Id for the component that should be updated for a component refresh process
 View getView()
          View instance associated with the model.
 ViewHelperService getViewHelperService()
          Returns an instance of the view's configured view helper service.
 String getViewId()
          Unique Id for the View instance.
 String getViewName()
          Name for the View instance.
 ViewPostMetadata getViewPostMetadata()
          Gets the ViewPostMetadata that has been built up from processing of a view.
 Map<String,String> getViewRequestParameters()
          Map of parameters that was used to configured the View.
protected  ViewService getViewService()
          Instance of the ViewService that can be used to retrieve View instances
 List<String> getViewsThatNeedDefaultValuesApplied()
          Unique list of view ids that need default values applied.
 UifConstants.ViewType getViewTypeName()
          Name for the type of view being requested.
 boolean isAddedCollectionItem(Object item)
          Indicates whether an collection item has been newly added
 boolean isAjaxRequest()
          Indicates whether the request was made by an ajax call
 boolean isCollectionPagingRequest()
          Indicates whether the request is for paging a collection (or sorting).
 boolean isDirtyForm()
          True when the form is considered dirty (data has changed from original value), false otherwise
 boolean isJsonRequest()
          Indicates whether the request should return a JSON string
 boolean isRenderedInIframe()
          Indicates whether the view is rendered within an iframe (this setting must be passed to the View on the url)
 boolean isRenderedInLightBox()
          Indicates whether the view is rendered within a lightbox
 boolean isRequestRedirected()
          Indicates whether a redirect has been requested for the view
 boolean isUpdateComponentRequest()
          Indicates whether the request is to update a component (only applicable for ajax requests)
 boolean isUpdateDialogRequest()
          Indicates whether the request is to update a dialog (only applicable for ajax requests)
 boolean isUpdateNoneRequest()
          Indicates whether the request is for a non-update of the view (only applicable for ajax requests)
 boolean isUpdatePageRequest()
          Indicates whether the request is to update a page (only applicable for ajax requests)
 void postBind(javax.servlet.http.HttpServletRequest request)
          Called after Spring binds the request to the form and before the controller method is invoked
 void preBind(javax.servlet.http.HttpServletRequest request)
          Called before Spring binds the request to the form to allow for pre-processing before setting values.
 void setActionParameters(Map<String,String> actionParameters)
          Setter for the action parameters map
 void setAddedCollectionItems(List addedCollectionItems)
          Setter for the newly added item list
 void setAjaxRequest(boolean ajaxRequest)
          Set the ajaxRequest
 void setAjaxReturnType(String ajaxReturnType)
          Setter for the type of ajax return
 void setAttachmentFile(org.springframework.web.multipart.MultipartFile attachmentFile)
          Setter for the form's attachment file
 void setClientStateForSyncing(Map<String,Object> clientStateForSyncing)
          Setter for the client state
 void setCollectionPagingRequest(boolean collectionPagingRequest)
          
 void setDialogExplanation(String dialogExplanation)
          Sets the dialogExplanation text value.
 void setDialogManager(DialogManager dialogManager)
          Sets the DialogManager for this view
 void setDialogResponse(String dialogResponse)
          Sets the response key text selected by the user as a response to a modal dialog
 void setDirtyForm(boolean dirtyForm)
          Sets the dirtyForm flag
 void setDirtyForm(String dirtyForm)
          Set the dirtyForm flag using a String that will be converted to boolean
 void setExtensionData(Map<String,Object> extensionData)
          Setter for the generic extension data map
 void setFlowKey(String flowKey)
          Set the flowKey
 void setFocusId(String focusId)
           
 void setFormKey(String formKey)
          Setter for the form's session key
 void setFormPostUrl(String formPostUrl)
          Setter for the form post URL
 void setGrowlScript(String growlScript)
          Setter for the script that generates growls on render
 void setHistoryFlow(HistoryFlow historyFlow)
          Set the current HistoryFlow for this form
 void setHistoryManager(HistoryManager historyManager)
          Set the current HistoryManager
 void setInitialRequestParameters(Map<String,String[]> requestParameters)
          Set the requestParameters
 void setJumpToId(String jumpToId)
           
 void setJumpToName(String jumpToName)
           
 void setLightboxScript(String lightboxScript)
          Setter for the script that generates a lightbox on render
 void setMethodToCall(String methodToCall)
          Setter for the method to call
 void setNewCollectionLines(Map<String,Object> newCollectionLines)
          Setter for the new collection lines Map
 void setPageId(String pageId)
          Setter for the current page id
 void setQueryParameters(Map<String,String> queryParameters)
          Setter for the generic query parameters
 void setReadOnlyFieldsList(List<String> readOnlyFieldsList)
          Setter for the list of read only fields
 void setRenderedInIframe(boolean renderedInIframe)
           
 void setRenderedInLightBox(boolean renderedInLightBox)
          Setter for the rendered within lightbox indicator
 void setRequestedFormKey(String requestedFormKey)
          Set the requestedFormKey
 void setRequestJsonTemplate(String requestJsonTemplate)
          Setter for the template to render for the request
 void setRequestRedirected(boolean requestRedirected)
          Setter for the request redirect indicator
 void setRequestUrl(String requestUrl)
          Set the requestUrl
 void setReturnFormKey(String returnFormKey)
           
 void setReturnLocation(String returnLocation)
           
 void setSelectedCollectionLines(Map<String,Set<String>> selectedCollectionLines)
          Setter for the map that holds selected collection lines
 void setSelectedLookupResultsCache(Set<String> selectedLookupResultsCache)
          Sets the lookup result selection cache values
 void setState(String state)
          Set the state
 void setUpdateComponent(Component updateComponent)
           
 void setUpdateComponentId(String updateComponentId)
          Setter for the component id that should be refreshed
 void setView(View view)
          Setter for the view instance
 void setViewId(String viewId)
          Setter for the unique view id
 void setViewName(String viewName)
          Setter for the view name
 void setViewPostMetadata(ViewPostMetadata viewPostMetadata)
           
 void setViewRequestParameters(Map<String,String> viewRequestParameters)
          Setter for the view's request parameter map
 void setViewsThatNeedDefaultValuesApplied(List<String> viewsThatNeedDefaultValuesApplied)
          Setter for the list of view ids that need default values applied.
 void setViewTypeName(UifConstants.ViewType viewTypeName)
          Setter for the view type name
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

viewId

@RequestAccessible
protected String viewId

viewName

@RequestAccessible
protected String viewName

viewTypeName

@RequestAccessible
protected UifConstants.ViewType viewTypeName

pageId

@RequestAccessible
protected String pageId

methodToCall

@RequestAccessible
protected String methodToCall

formKey

@RequestAccessible
protected String formKey

requestedFormKey

@RequestAccessible
protected String requestedFormKey

flowKey

@RequestAccessible
protected String flowKey

sessionId

protected String sessionId

sessionTimeoutInterval

protected int sessionTimeoutInterval

historyFlow

protected HistoryFlow historyFlow

historyManager

protected HistoryManager historyManager

jumpToId

@RequestAccessible
protected String jumpToId

jumpToName

protected String jumpToName

focusId

@RequestAccessible
protected String focusId

dirtyForm

@RequestAccessible
protected boolean dirtyForm

formPostUrl

protected String formPostUrl

controllerMapping

protected String controllerMapping

state

protected String state

viewsThatNeedDefaultValuesApplied

protected List<String> viewsThatNeedDefaultValuesApplied

renderedInLightBox

@RequestAccessible
protected boolean renderedInLightBox

renderedInIframe

@RequestAccessible
protected boolean renderedInIframe

growlScript

protected String growlScript

lightboxScript

protected String lightboxScript

view

protected View view

viewPostMetadata

protected ViewPostMetadata viewPostMetadata

viewRequestParameters

protected Map<String,String> viewRequestParameters

readOnlyFieldsList

protected List<String> readOnlyFieldsList

newCollectionLines

protected Map<String,Object> newCollectionLines

actionParameters

@RequestAccessible
protected Map<String,String> actionParameters

clientStateForSyncing

protected Map<String,Object> clientStateForSyncing

selectedCollectionLines

protected Map<String,Set<String>> selectedCollectionLines

selectedLookupResultsCache

protected Set<String> selectedLookupResultsCache

addedCollectionItems

protected List<Object> addedCollectionItems

attachmentFile

protected org.springframework.web.multipart.MultipartFile attachmentFile

returnLocation

@RequestAccessible
protected String returnLocation

returnFormKey

@RequestAccessible
protected String returnFormKey

ajaxRequest

@RequestAccessible
protected boolean ajaxRequest

ajaxReturnType

@RequestAccessible
protected String ajaxReturnType

dialogExplanation

@RequestAccessible
protected String dialogExplanation

dialogResponse

@RequestAccessible
protected String dialogResponse

dialogManager

protected DialogManager dialogManager

requestRedirected

protected boolean requestRedirected

updateComponentId

@RequestAccessible
protected String updateComponentId

extensionData

@RequestAccessible
protected Map<String,Object> extensionData

queryParameters

protected Map<String,String> queryParameters
Constructor Detail

UifFormBase

public UifFormBase()
Method Detail

preBind

public void preBind(javax.servlet.http.HttpServletRequest request)
Called before Spring binds the request to the form to allow for pre-processing before setting values.

Specified by:
preBind in interface ViewModel
Parameters:
request - - request object containing the query parameters

postBind

public void postBind(javax.servlet.http.HttpServletRequest request)
Description copied from interface: ViewModel
Called after Spring binds the request to the form and before the controller method is invoked

Specified by:
postBind in interface ViewModel
Parameters:
request - - request object containing the query parameters
See Also:
ViewModel.postBind(javax.servlet.http.HttpServletRequest)

generateFormKey

protected String generateFormKey()
Creates the unique id used to store this "conversation" in the session. The default method generates a java UUID.

Returns:
UUID

getViewId

public String getViewId()
Description copied from interface: ViewModel
Unique Id for the View instance. This is specified for a view in its definition by setting the 'id' property.

Specified by:
getViewId in interface ViewModel
Returns:
String view id
See Also:
ViewModel.getViewId()

setViewId

public void setViewId(String viewId)
Description copied from interface: ViewModel
Setter for the unique view id

Specified by:
setViewId in interface ViewModel
See Also:
ViewModel.setViewId(String)

getViewName

public String getViewName()
Description copied from interface: ViewModel
Name for the View instance. 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)

Specified by:
getViewName in interface ViewModel
Returns:
String view name
See Also:
ViewModel.getViewName()

setViewName

public void setViewName(String viewName)
Description copied from interface: ViewModel
Setter for the view name

Specified by:
setViewName in interface ViewModel
See Also:
ViewModel.setViewName(String)

getViewTypeName

public UifConstants.ViewType getViewTypeName()
Description copied from interface: ViewModel
Name for the type of view being requested. This can be used to find View instances by request parameters (not necessary the unique id)

Specified by:
getViewTypeName in interface ViewModel
Returns:
String view type name
See Also:
ViewModel.getViewTypeName()

setViewTypeName

public void setViewTypeName(UifConstants.ViewType viewTypeName)
Description copied from interface: ViewModel
Setter for the view type name

Specified by:
setViewTypeName in interface ViewModel
See Also:
ViewModel.setViewTypeName(org.kuali.rice.krad.uif.UifConstants.ViewType)

getPageId

public String getPageId()
Description copied from interface: ViewModel
Id for the current page being displayed within the view

Specified by:
getPageId in interface ViewModel
Returns:
String page id
See Also:
ViewModel.getPageId()

setPageId

public void setPageId(String pageId)
Description copied from interface: ViewModel
Setter for the current page id

Specified by:
setPageId in interface ViewModel
See Also:
ViewModel.setPageId(String)

getFormPostUrl

public String getFormPostUrl()
Description copied from interface: ViewModel
URL the form generated for the view should post to

Specified by:
getFormPostUrl in interface ViewModel
Returns:
String form post URL
See Also:
ViewModel.getFormPostUrl()

setFormPostUrl

public void setFormPostUrl(String formPostUrl)
Description copied from interface: ViewModel
Setter for the form post URL

Specified by:
setFormPostUrl in interface ViewModel
See Also:
ViewModel.setFormPostUrl(String)

getControllerMapping

public String getControllerMapping()
Name of the controllerMapping for this form (includes slash)

Returns:
the controllerMapping string

getHistoryFlow

public HistoryFlow getHistoryFlow()
The current HistoryFlow for this form which stores a trail of urls/breadcrumbs primarily used for path-based breadcrumb display

Returns:
the HistoryFlow

setHistoryFlow

public void setHistoryFlow(HistoryFlow historyFlow)
Set the current HistoryFlow for this form

Parameters:
historyFlow -

getHistoryManager

public HistoryManager getHistoryManager()
The current HistoryManager that was pulled from session which store all HistoryFlow objects in the current session to keep track of the path the user has taken across views (primarily used by path-based breadcrumbs)

Returns:
the HistoryManager

setHistoryManager

public void setHistoryManager(HistoryManager historyManager)
Set the current HistoryManager

Parameters:
historyManager -

getFlowKey

public String getFlowKey()
The flowKey representing the HistoryFlow this form may be in.

This allows for a flow to continue by key or start (if set to "start"). If null or blank, no flow (or path based breadcrumbs) are being tracked.

Returns:
the flowKey

setFlowKey

public void setFlowKey(String flowKey)
Set the flowKey

Parameters:
flowKey -

getRequestUrl

public String getRequestUrl()
The original requestUrl for the View represented by this form (url received by the controller for initial request)

Returns:
the requestUrl

setRequestUrl

public void setRequestUrl(String requestUrl)
Set the requestUrl

Parameters:
requestUrl -

getInitialRequestParameters

public Map<String,String[]> getInitialRequestParameters()
The requestParameters represent all the parameters in the query string that were initially passed to this View by the initial request

Returns:
the requestParameters

setInitialRequestParameters

public void setInitialRequestParameters(Map<String,String[]> requestParameters)
Set the requestParameters

Parameters:
requestParameters -

getReturnLocation

public String getReturnLocation()

setReturnLocation

public void setReturnLocation(String returnLocation)

getReturnFormKey

public String getReturnFormKey()

setReturnFormKey

public void setReturnFormKey(String returnFormKey)

getSessionId

public String getSessionId()
Holds the id for the user's current session

The user's session id is used to track when a timeout has occurred and enforce the policy configured with the ViewSessionPolicy. This property gets initialized in the postBind(javax.servlet.http.HttpServletRequest) method and then is written out as a hidden on the view. Therefore each post done on the view will send back the session id when the view was rendering, and the UifSessionTimeoutFilter can use that to determine if a timeout has occurred

Returns:
id for the user's current session

getSessionTimeoutInterval

public int getSessionTimeoutInterval()
Holds the configured session timeout interval

Holds the session timeout interval so it can be referenced to give the user notifications (for example the session timeout warning reads this property). This is initialized from the session object in postBind(javax.servlet.http.HttpServletRequest)

Returns:
amount of time in milliseconds before the session will timeout

getMethodToCall

public String getMethodToCall()
Identifies the controller method that should be invoked to fulfill a request. The value will be matched up against the 'params' setting on the RequestMapping annotation for the controller method

Returns:
String method to call

setMethodToCall

public void setMethodToCall(String methodToCall)
Setter for the method to call

Parameters:
methodToCall -

getViewRequestParameters

public Map<String,String> getViewRequestParameters()
Map of parameters that was used to configured the View. Maintained on the form to rebuild the view on posts and session timeout

Specified by:
getViewRequestParameters in interface ViewModel
Returns:
Map view parameters
See Also:
org.kuali.rice.krad.uif.view.View.getViewRequestParameters()

setViewRequestParameters

public void setViewRequestParameters(Map<String,String> viewRequestParameters)
Setter for the view's request parameter map

Specified by:
setViewRequestParameters in interface ViewModel
Parameters:
viewRequestParameters - map of request parameters

getReadOnlyFieldsList

public List<String> getReadOnlyFieldsList()
List of fields that should be read only on the view

If 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

Specified by:
getReadOnlyFieldsList in interface ViewModel
Returns:
List read only property names
See Also:
View.isSupportsRequestOverrideOfReadOnlyFields()

setReadOnlyFieldsList

public void setReadOnlyFieldsList(List<String> readOnlyFieldsList)
Setter for the list of read only fields

Specified by:
setReadOnlyFieldsList in interface ViewModel

getNewCollectionLines

public Map<String,Object> getNewCollectionLines()
Description copied from interface: ViewModel
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

Specified by:
getNewCollectionLines in interface ViewModel
Returns:
Map new collection lines
See Also:
ViewModel.getNewCollectionLines()

setNewCollectionLines

public void setNewCollectionLines(Map<String,Object> newCollectionLines)
Setter for the new collection lines Map

Specified by:
setNewCollectionLines in interface ViewModel

getActionParameters

public Map<String,String> getActionParameters()
Description copied from interface: ViewModel
Map of parameters sent for the invoked action

Many 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 Lookup view. 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.

Specified by:
getActionParameters in interface ViewModel
Returns:
Map action parameters
See Also:
ViewModel.getActionParameters()

getActionParametersAsProperties

public Properties getActionParametersAsProperties()
Returns the action parameters map as a Properties instance

Returns:
Properties action parameters

setActionParameters

public void setActionParameters(Map<String,String> actionParameters)
Setter for the action parameters map

Specified by:
setActionParameters in interface ViewModel

getActionParamaterValue

public String getActionParamaterValue(String actionParameterName)
Retrieves the value for the given action parameter, or empty string if not found

Parameters:
actionParameterName - - name of the action parameter to retrieve value for
Returns:
String parameter value or empty string

getActionEvent

public String getActionEvent()
Returns the action event that was sent in the action parameters (if any)

The action event is a special action parameter that can be sent to indicate a type of action being taken. This can be looked at by the view or components to render differently

TODO: make sure action parameters are getting reinitialized on each request

Returns:
String action event name or blank if action event was not sent

getClientStateForSyncing

public Map<String,Object> getClientStateForSyncing()
Description copied from interface: ViewModel
Map that is populated from the component state maintained on the client

Used 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 ViewHelperService to update the components so that the state is maintained when they render.

Specified by:
getClientStateForSyncing in interface ViewModel
Returns:
Map map where key is name of property or component id, and value is the property value or another map of component key/value pairs
See Also:
ViewModel.getClientStateForSyncing()

setClientStateForSyncing

public void setClientStateForSyncing(Map<String,Object> clientStateForSyncing)
Setter for the client state

Parameters:
clientStateForSyncing -

getSelectedCollectionLines

public Map<String,Set<String>> getSelectedCollectionLines()
Description copied from interface: ViewModel
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 request

When 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.

Specified by:
getSelectedCollectionLines in interface ViewModel
Returns:
Map> map of collections and their selected lines
See Also:
ViewModel.getSelectedCollectionLines()

setSelectedCollectionLines

public void setSelectedCollectionLines(Map<String,Set<String>> selectedCollectionLines)
Setter for the map that holds selected collection lines

Specified by:
setSelectedCollectionLines in interface ViewModel

getSelectedLookupResultsCache

public Set<String> getSelectedLookupResultsCache()
Holds Set of String identifiers for lines that were selected in a lookup collection results across multiple pages. The value in the cache is preserved in the session across multiple requests. This allows for the server side paging of results to retain the user choices as they move through the pages.

Returns:
set of identifiers

setSelectedLookupResultsCache

public void setSelectedLookupResultsCache(Set<String> selectedLookupResultsCache)
Sets the lookup result selection cache values

Parameters:
selectedLookupResultsCache -

getFormKey

public String getFormKey()
Key string that identifies the form instance in session storage

When the view is posted, the previous form instance is retrieved and then populated from the request parameters. This key string is retrieve the session form from the session service

Returns:
String form session key

setFormKey

public void setFormKey(String formKey)
Setter for the form's session key

Parameters:
formKey -

getRequestedFormKey

public String getRequestedFormKey()
This is the formKey sent on the original request. It may differ from the actual form key stored in formKey based on if the form still exists in session by this key or not.

Returns:
the original requested form key

setRequestedFormKey

public void setRequestedFormKey(String requestedFormKey)
Set the requestedFormKey

Parameters:
requestedFormKey -

getViewsThatNeedDefaultValuesApplied

public List<String> getViewsThatNeedDefaultValuesApplied()
Description copied from interface: ViewModel
Unique list of view ids that need default values applied.

Specified by:
getViewsThatNeedDefaultValuesApplied in interface ViewModel
Returns:
List view ids
See Also:
ViewModel.getViewsThatNeedDefaultValuesApplied()

setViewsThatNeedDefaultValuesApplied

public void setViewsThatNeedDefaultValuesApplied(List<String> viewsThatNeedDefaultValuesApplied)
Description copied from interface: ViewModel
Setter for the list of view ids that need default values applied.

Specified by:
setViewsThatNeedDefaultValuesApplied in interface ViewModel
See Also:
org.kuali.rice.krad.uif.view.ViewModel#setgetViewsThatNeedDefaultValuesApplied(List)

addViewThatNeedsDefaultValuesApplied

public void addViewThatNeedsDefaultValuesApplied(String viewId)
Adds unique view id to list of views that need default values applied.

Parameters:
viewid -

isRequestRedirected

public boolean isRequestRedirected()
Indicates whether a redirect has been requested for the view

Returns:
boolean true if redirect was requested, false if not

setRequestRedirected

public void setRequestRedirected(boolean requestRedirected)
Setter for the request redirect indicator

Parameters:
requestRedirected -

getAttachmentFile

public org.springframework.web.multipart.MultipartFile getAttachmentFile()
Holder for files that are attached through the view

Returns:
MultipartFile representing the attachment

setAttachmentFile

public void setAttachmentFile(org.springframework.web.multipart.MultipartFile attachmentFile)
Setter for the form's attachment file

Parameters:
attachmentFile -

getUpdateComponentId

public String getUpdateComponentId()
Description copied from interface: ViewModel
Id for the component that should be updated for a component refresh process

Specified by:
getUpdateComponentId in interface ViewModel
Returns:
String component id
See Also:
ViewModel.getUpdateComponentId()

setUpdateComponentId

public void setUpdateComponentId(String updateComponentId)
Description copied from interface: ViewModel
Setter for the component id that should be refreshed

Specified by:
setUpdateComponentId in interface ViewModel
See Also:
ViewModel.setUpdateComponentId(java.lang.String)

getUpdateComponent

public Component getUpdateComponent()
Description copied from interface: ViewModel
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.

Specified by:
getUpdateComponent in interface ViewModel
Returns:
component instance for updating
See Also:
ViewModel.getUpdateComponent()

setUpdateComponent

public void setUpdateComponent(Component updateComponent)
Specified by:
setUpdateComponent in interface ViewModel
See Also:
ViewModel.setUpdateComponent(org.kuali.rice.krad.uif.component.Component)

getView

public View getView()
Description copied from interface: ViewModel
View instance associated with the model. Used to render the user interface

Specified by:
getView in interface ViewModel
Returns:
View
See Also:
ViewModel.getView()

setView

public void setView(View view)
Description copied from interface: ViewModel
Setter for the view instance

Specified by:
setView in interface ViewModel
See Also:
ViewModel.setView(org.kuali.rice.krad.uif.view.View)

getViewHelperService

public ViewHelperService getViewHelperService()
Returns an instance of the view's configured view helper service.

First checks if there is an initialized view containing a view helper instance. If not, and there is a view id on the form, a call is made to retrieve the view helper instance or class configuration.

Returns the view helper service instance that was configured for the current view.

Specified by:
getViewHelperService in interface ViewModel
Returns:
instance of view helper service, null if view is null

getViewPostMetadata

public ViewPostMetadata getViewPostMetadata()
Gets the ViewPostMetadata that 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

Specified by:
getViewPostMetadata in interface ViewModel
Returns:
ViewPostMetadata instance for the previously processed view

setViewPostMetadata

public void setViewPostMetadata(ViewPostMetadata viewPostMetadata)
Specified by:
setViewPostMetadata in interface ViewModel
See Also:
getViewPostMetadata()

getViewService

protected ViewService getViewService()
Instance of the ViewService that can be used to retrieve View instances

Returns:
ViewService implementation

getJumpToId

public String getJumpToId()
The jumpToId for this form, the element with this id will be jumped to automatically when the form is loaded in the view. Using "TOP" or "BOTTOM" will jump to the top or the bottom of the resulting page. jumpToId always takes precedence over jumpToName, if set.

Returns:
the jumpToId

setJumpToId

public void setJumpToId(String jumpToId)
Parameters:
jumpToId - the jumpToId to set

getJumpToName

public String getJumpToName()
The jumpToName for this form, the element with this name will be jumped to automatically when the form is loaded in the view. WARNING: jumpToId always takes precedence over jumpToName, if set.

Returns:
the jumpToName

setJumpToName

public void setJumpToName(String jumpToName)
Parameters:
jumpToName - the jumpToName to set

getFocusId

public String getFocusId()
Field to place focus on when the page loads An empty focusId will result in focusing on the first visible input element by default.

Returns:
the focusId

setFocusId

public void setFocusId(String focusId)
Parameters:
focusId - the focusId to set

isDirtyForm

public boolean isDirtyForm()
True when the form is considered dirty (data has changed from original value), false otherwise

For most scenarios, this flag should NOT be set to true. If this is set, it must be managed explicitly by the application. This flag exists for marking a form dirty from a server call, so it must be changed to false when the form is no longer considered dirty. The krad save Action and navigate methodToCall resets this flag back to false, but any other setting of this flag must be managed by custom configuration/methods, if custom dirtyForm management is needed.

Returns:
true if the form is considered dirty, false otherwise

setDirtyForm

public void setDirtyForm(boolean dirtyForm)
Sets the dirtyForm flag

For most scenarios, this flag should NOT be set to true. If this is set, it must be managed explicitly by the application. This flag exists for marking a form dirty from a server call, so it must be changed to false when the form is no longer considered dirty. The krad save Action and navigate methodToCall resets this flag back to false, but any other setting of this flag must be managed by custom configuration/methods, if custom dirtyForm management is needed.

Parameters:
dirtyForm -

setDirtyForm

public void setDirtyForm(String dirtyForm)
Set the dirtyForm flag using a String that will be converted to boolean

Parameters:
dirtyForm -

isRenderedInLightBox

public boolean isRenderedInLightBox()
Indicates whether the view is rendered within a lightbox

Some discussion (for example how a close button behaves) need to change based on whether the view is rendered within a lightbox or the standard browser window. This boolean is true when it is within a lightbox

Returns:
boolean true if view is rendered within a lightbox, false if not

setRenderedInLightBox

public void setRenderedInLightBox(boolean renderedInLightBox)
Setter for the rendered within lightbox indicator

Parameters:
renderedInLightBox -

isRenderedInIframe

public boolean isRenderedInIframe()
Indicates whether the view is rendered within an iframe (this setting must be passed to the View on the url)

Returns:
boolean true if view is rendered within a iframe, false if not

setRenderedInIframe

public void setRenderedInIframe(boolean renderedInIframe)
See Also:
isRenderedInIframe()

getGrowlScript

public String getGrowlScript()
Description copied from interface: ViewModel
Script that will run on render (view or component) for generating growl messages

Specified by:
getGrowlScript in interface ViewModel
Returns:
String JS growl script
See Also:
ViewModel.getGrowlScript()

setGrowlScript

public void setGrowlScript(String growlScript)
Description copied from interface: ViewModel
Setter for the script that generates growls on render

Specified by:
setGrowlScript in interface ViewModel
See Also:
ViewModel.setGrowlScript(String)

getState

public String getState()
Description copied from interface: ViewModel
Gets the state. This is the default location for state on KRAD forms.

Specified by:
getState in interface ViewModel
Returns:
the state
See Also:
ViewModel.getState()

setState

public void setState(String state)
Description copied from interface: ViewModel
Set the state

Specified by:
setState in interface ViewModel
See Also:
ViewModel.setState(String)

getLightboxScript

public String getLightboxScript()
Description copied from interface: ViewModel
Script that will run on render (view or component) for a lightbox

Specified by:
getLightboxScript in interface ViewModel
Returns:
String JS lightbox script
See Also:
ViewModel.getLightboxScript()

setLightboxScript

public void setLightboxScript(String lightboxScript)
Description copied from interface: ViewModel
Setter for the script that generates a lightbox on render

Specified by:
setLightboxScript in interface ViewModel
See Also:
ViewModel.setLightboxScript(String)

isAjaxRequest

public boolean isAjaxRequest()
Description copied from interface: ViewModel
Indicates whether the request was made by an ajax call

Depending 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, ViewModel.getAjaxReturnType() will be used to determine how to handling the ajax return

Specified by:
isAjaxRequest in interface ViewModel
Returns:
boolean true if the request was an ajax call, false if not
See Also:
ViewModel.isAjaxRequest()

setAjaxRequest

public void setAjaxRequest(boolean ajaxRequest)
Description copied from interface: ViewModel
Set the ajaxRequest

Specified by:
setAjaxRequest in interface ViewModel
See Also:
ViewModel.setAjaxRequest(boolean)

getAjaxReturnType

public String getAjaxReturnType()
Description copied from interface: ViewModel
Gets the return type for the ajax call

The 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.

Specified by:
getAjaxReturnType in interface ViewModel
Returns:
String return type
See Also:
ViewModel.getAjaxReturnType()

setAjaxReturnType

public void setAjaxReturnType(String ajaxReturnType)
Description copied from interface: ViewModel
Setter for the type of ajax return

Specified by:
setAjaxReturnType in interface ViewModel
See Also:
ViewModel.setAjaxReturnType(String)

isUpdateComponentRequest

public boolean isUpdateComponentRequest()
Description copied from interface: ViewModel
Indicates whether the request is to update a component (only applicable for ajax requests)

Specified by:
isUpdateComponentRequest in interface ViewModel
Returns:
boolean true if the request is for update component, false if not
See Also:
ViewModel.isUpdateComponentRequest()

isUpdateDialogRequest

public boolean isUpdateDialogRequest()
Description copied from interface: ViewModel
Indicates whether the request is to update a dialog (only applicable for ajax requests)

Specified by:
isUpdateDialogRequest in interface ViewModel
Returns:
boolean true if the request is for update dialog, false if not
See Also:
ViewModel.isUpdateDialogRequest()

isUpdatePageRequest

public boolean isUpdatePageRequest()
Description copied from interface: ViewModel
Indicates whether the request is to update a page (only applicable for ajax requests)

Specified by:
isUpdatePageRequest in interface ViewModel
Returns:
boolean true if the request is for update page, false if not
See Also:
ViewModel.isUpdatePageRequest()

isUpdateNoneRequest

public boolean isUpdateNoneRequest()
Description copied from interface: ViewModel
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

Specified by:
isUpdateNoneRequest in interface ViewModel
Returns:
boolean true if the request is for non-update, false if not
See Also:
ViewModel.isUpdateNoneRequest()

isJsonRequest

public boolean isJsonRequest()
Description copied from interface: ViewModel
Indicates whether the request should return a JSON string

When this indicator is true, the rendering process will invoke the template given by ViewModel.getRequestJsonTemplate() which should return a JSON string

For JSON requests the view is not built, however a component can be retrieved and exported in the request by setting ViewModel.getUpdateComponentId()

Specified by:
isJsonRequest in interface ViewModel
Returns:
boolean true if request is for JSON, false if not
See Also:
ViewModel.isJsonRequest()

getRequestJsonTemplate

public String getRequestJsonTemplate()
Description copied from interface: ViewModel
Template the will be invoked to return a JSON string

Certain templates can be rendered to build JSON for a JSON request. The template set here (by a controller) will be rendered

Specified by:
getRequestJsonTemplate in interface ViewModel
Returns:
path to template
See Also:
ViewModel.getRequestJsonTemplate()

setRequestJsonTemplate

public void setRequestJsonTemplate(String requestJsonTemplate)
Description copied from interface: ViewModel
Setter for the template to render for the request

Specified by:
setRequestJsonTemplate in interface ViewModel
See Also:
ViewModel.setRequestJsonTemplate(java.lang.String)

isCollectionPagingRequest

public boolean isCollectionPagingRequest()
Indicates whether the request is for paging a collection (or sorting).

Specified by:
isCollectionPagingRequest in interface ViewModel
Returns:
boolean true if a paging request is present, false if not

setCollectionPagingRequest

public void setCollectionPagingRequest(boolean collectionPagingRequest)

Specified by:
setCollectionPagingRequest in interface ViewModel
See Also:
ViewModel.isCollectionPagingRequest()

getDialogExplanation

public String getDialogExplanation()
Returns the String entered by the user when presented a dialog

Field defined here so all forms will be able to bind to a dialog using the same property

Returns:
String - the text entered by a user as a reply in a modal dialog.

setDialogExplanation

public void setDialogExplanation(String dialogExplanation)
Sets the dialogExplanation text value.

Parameters:
dialogExplanation - - text entered by user when replying to a modal dialog

getDialogResponse

public String getDialogResponse()
Represents the option chosen by the user when interacting with a modal dialog

This is used to determine which option was chosen by the user. The value is the key in the key/value pair selected in the control.

Returns:
- String key selected by the user

setDialogResponse

public void setDialogResponse(String dialogResponse)
Sets the response key text selected by the user as a response to a modal dialog

Parameters:
dialogResponse - - the key of the option chosen by the user

getDialogManager

public DialogManager getDialogManager()
Gets the DialogManager for this view/form

The DialogManager tracks modal dialog interactions with the user

Returns:
dialog manager

setDialogManager

public void setDialogManager(DialogManager dialogManager)
Sets the DialogManager for this view

Parameters:
dialogManager - - DialogManager instance for this view

getExtensionData

public Map<String,Object> getExtensionData()
Description copied from interface: ViewModel
A generic map for framework pieces (such as component modifiers) that need to dynamically store data to the form

Specified by:
getExtensionData in interface ViewModel
Returns:
Map
See Also:
ViewModel.getExtensionData()

setExtensionData

public void setExtensionData(Map<String,Object> extensionData)
Setter for the generic extension data map

Specified by:
setExtensionData in interface ViewModel

getQueryParameters

public Map<String,String> getQueryParameters()
A generic map for query parameters

Returns:
Map

setQueryParameters

public void setQueryParameters(Map<String,String> queryParameters)
Setter for the generic query parameters

Parameters:
queryParameters -

getAddedCollectionItems

public List getAddedCollectionItems()
The List that contains all newly added items for the collections on the model

This list contains the new items for all the collections on the model.

Returns:
List of the newly added item lists

setAddedCollectionItems

public void setAddedCollectionItems(List addedCollectionItems)
Setter for the newly added item list

Parameters:
addedCollectionItems -

isAddedCollectionItem

public boolean isAddedCollectionItem(Object item)
Indicates whether an collection item has been newly added

Tests collection items against the list of newly added items on the model. This list gets cleared when the view is submitted and the items are persisted.

Parameters:
item - - the item to test against list of newly added items
Returns:
boolean true if the item has been newly added

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.