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:
CacheAdminForm, CourseOfferingForm, DocumentFormBase, IncidentReportForm, IngesterForm, InitiatedDocumentInfoForm, InquiryForm, LookupForm, RegistrationForm, StatsForm, UifComponentsTestForm, UITestForm

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 UI

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

Field Summary
protected  Map<String,String> actionParameters
           
protected  org.springframework.web.multipart.MultipartFile attachmentFile
           
protected  Map<String,Object> clientStateForSyncing
           
protected  boolean defaultsApplied
           
protected  String focusId
           
protected  History formHistory
           
protected  String formKey
           
protected  String formPostUrl
           
protected  String jumpToId
           
protected  String jumpToName
           
protected  String methodToCall
           
protected  Map<String,Object> newCollectionLines
           
protected  String pageId
           
protected  View postedView
           
protected  List<String> readOnlyFieldsList
           
protected  boolean renderFullView
           
protected  String returnFormKey
           
protected  String returnLocation
           
protected  Map<String,Set<String>> selectedCollectionLines
           
protected  boolean skipViewInit
           
protected  boolean validateDirty
           
protected  View view
           
protected  String viewId
           
protected  String viewName
           
protected  Map<String,String> viewRequestParameters
           
protected  UifConstants.ViewType viewTypeName
           
 
Constructor Summary
UifFormBase()
           
 
Method Summary
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
 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 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.
 History getFormHistory()
          History parameter representing the History of views that have come before the viewing of the current view
 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 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 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
 View getPostedView()
          View instance for the page that made a request.
 List<String> getReadOnlyFieldsList()
          List of fields that should be read only on the view
 String getReturnFormKey()
           
 String getReturnLocation()
           
 Map<String,Set<String>> getSelectedCollectionLines()
          Holds Set of String identifiers for lines that were selected in a collection
 View getView()
          View instance associated with the model.
 String getViewId()
          Unique Id for the View instance.
 String getViewName()
          Name for the View instance.
 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
 UifConstants.ViewType getViewTypeName()
          Name for the type of view being requested.
 boolean isDefaultsApplied()
          Indicates whether the form has had default values from the configured View applied.
 boolean isRenderFullView()
           
 boolean isSkipViewInit()
          Indicates whether a new view is being initialized or the call is refresh (or query) call
 boolean isValidateDirty()
          Indicates whether the form should be validated for dirtyness
 void postBind(javax.servlet.http.HttpServletRequest request)
          Called after Spring binds the request to the form and before the controller method is invoked.
 void setActionParameters(Map<String,String> actionParameters)
          Setter for the action parameters map
 void setAttachmentFile(org.springframework.web.multipart.MultipartFile attachmentFile)
          Setter for the form's attachment file
 void setDefaultsApplied(boolean defaultsApplied)
          Setter for the defaults applied indicator
 void setFocusId(String focusId)
           
 void setFormHistory(History history)
          Setter for the current History object
 void setFormKey(String formKey)
          Setter for the form's session key
 void setFormPostUrl(String formPostUrl)
          Setter for the form post URL
 void setJumpToId(String jumpToId)
           
 void setJumpToName(String jumpToName)
           
 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 setPostedView(View postedView)
          Setter for the previous view instance
 void setReadOnlyFieldsList(List<String> readOnlyFieldsList)
          Setter for the list of read only fields
 void setRenderFullView(boolean renderFullView)
           
 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 setSkipViewInit(boolean skipViewInit)
          Setter for the skip view initialization flag
 void setValidateDirty(boolean validateDirty)
          Setter for dirty validation indicator
 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 setViewRequestParameters(Map<String,String> viewRequestParameters)
          Setter for the view's request parameter map
 void setViewTypeName(UifConstants.ViewType viewTypeName)
          Setter for the view type name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

viewId

protected String viewId

viewName

protected String viewName

viewTypeName

protected UifConstants.ViewType viewTypeName

pageId

protected String pageId

methodToCall

protected String methodToCall

formKey

protected String formKey

jumpToId

protected String jumpToId

jumpToName

protected String jumpToName

focusId

protected String focusId

formPostUrl

protected String formPostUrl

defaultsApplied

protected boolean defaultsApplied

skipViewInit

protected boolean skipViewInit

view

protected View view

postedView

protected View postedView

viewRequestParameters

protected Map<String,String> viewRequestParameters

readOnlyFieldsList

protected List<String> readOnlyFieldsList

newCollectionLines

protected Map<String,Object> newCollectionLines

actionParameters

protected Map<String,String> actionParameters

clientStateForSyncing

protected Map<String,Object> clientStateForSyncing

selectedCollectionLines

protected Map<String,Set<String>> selectedCollectionLines

attachmentFile

protected org.springframework.web.multipart.MultipartFile attachmentFile

returnLocation

protected String returnLocation

returnFormKey

protected String returnFormKey

formHistory

protected History formHistory

renderFullView

protected boolean renderFullView

validateDirty

protected boolean validateDirty
Constructor Detail

UifFormBase

public UifFormBase()
Method Detail

generateFormKey

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

Returns:

postBind

public 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

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(java.lang.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(java.lang.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(java.lang.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(java.lang.String)

getReturnLocation

public String getReturnLocation()

setReturnLocation

public void setReturnLocation(String returnLocation)

getReturnFormKey

public String getReturnFormKey()

setReturnFormKey

public void setReturnFormKey(String returnFormKey)

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

setViewRequestParameters

public void setViewRequestParameters(Map<String,String> viewRequestParameters)
Description copied from interface: ViewModel
Setter for the view's request parameter map

Specified by:
setViewRequestParameters in interface ViewModel
See Also:
org.kuali.rice.krad.uif.view.ViewModel#setViewRequestParameters(java.util.Map)

getReadOnlyFieldsList

public List<String> getReadOnlyFieldsList()
Description copied from interface: ViewModel
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:
ViewModel.getReadOnlyFieldsList()

setReadOnlyFieldsList

public void setReadOnlyFieldsList(List<String> readOnlyFieldsList)
Description copied from interface: ViewModel
Setter for the list of read only fields

Specified by:
setReadOnlyFieldsList in interface ViewModel
See Also:
org.kuali.rice.krad.uif.view.ViewModel#setReadOnlyFieldsList(java.util.List)

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)
Description copied from interface: ViewModel
Setter for the new collection lines Map

Specified by:
setNewCollectionLines in interface ViewModel
See Also:
org.kuali.rice.krad.uif.view.ViewModel#setNewCollectionLines(java.util.Map)

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)
Description copied from interface: ViewModel
Setter for the action parameters map

Specified by:
setActionParameters in interface ViewModel
See Also:
org.kuali.rice.krad.uif.view.ViewModel#setActionParameters(java.util.Map)

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()

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

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)
Description copied from interface: ViewModel
Setter for the map that holds selected collection lines

Specified by:
setSelectedCollectionLines in interface ViewModel
See Also:
org.kuali.rice.krad.uif.view.ViewModel#setSelectedCollectionLines(java.util.Map>)

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 -

isDefaultsApplied

public boolean isDefaultsApplied()
Description copied from interface: ViewModel
Indicates whether the form has had default values from the configured View applied. This happens only once for each form instance

Specified by:
isDefaultsApplied in interface ViewModel
Returns:
boolean true if default values have been applied, false if not
See Also:
ViewModel.isDefaultsApplied()

setDefaultsApplied

public void setDefaultsApplied(boolean defaultsApplied)
Description copied from interface: ViewModel
Setter for the defaults applied indicator

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

isSkipViewInit

public boolean isSkipViewInit()
Indicates whether a new view is being initialized or the call is refresh (or query) call

Returns:
boolean true if view initialization was skipped, false if new view is being created

setSkipViewInit

public void setSkipViewInit(boolean skipViewInit)
Setter for the skip view initialization flag

Parameters:
skipViewInit -

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 -

isRenderFullView

public boolean isRenderFullView()
Returns:
the renderFullView

setRenderFullView

public void setRenderFullView(boolean renderFullView)
Parameters:
renderFullView -

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)

getPostedView

public View getPostedView()
Description copied from interface: ViewModel
View instance for the page that made a request. Since a new view instance gets initialized for each request before the controller logic is invoked, any state about the previous view is lost. This could be needed to read metadata from the view for such things as collection processing. When this is necessary the previous view instance can be retrieved

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

setPostedView

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

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

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

getFormHistory

public History getFormHistory()
History parameter representing the History of views that have come before the viewing of the current view

Used for breadcrumb widget generation on the view and also for navigating back to previous or hub locations

Returns:
History instance giving current history

setFormHistory

public void setFormHistory(History history)
Setter for the current History object

Parameters:
history - the history to set

isValidateDirty

public boolean isValidateDirty()
Indicates whether the form should be validated for dirtyness

For FormView, it's necessary to validate when the user tries to navigate out of the form. If set, all the InputFields will be validated on refresh, navigate, cancel or close Action or on form unload and if dirty, displays a message and user can decide whether to continue with the action or stay on the form

Returns:
boolean true if dirty validation should be enabled

setValidateDirty

public void setValidateDirty(boolean validateDirty)
Setter for dirty validation indicator

Parameters:
validateDirty -


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