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

java.lang.Object
  extended by org.kuali.rice.krad.web.form.UifFormBase
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CacheAdminForm, CourseOfferingForm, DocumentFormBase, EditorForm, IncidentReportForm, IngesterForm, InquiryForm, LookupForm, StatsForm, UILayoutTestForm, UITestForm

public class UifFormBase
extends Object
implements Serializable

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 previousView
           
protected  boolean renderFullView
           
protected  String returnFormKey
           
protected  String returnLocation
           
protected  Map<String,Set<String>> selectedCollectionLines
           
protected  boolean validateDirty
           
protected  View view
           
protected  String viewId
           
protected  String viewName
           
protected  Map<String,String> viewRequestParameters
           
protected  String viewTypeName
           
 
Constructor Summary
UifFormBase()
           
 
Method Summary
protected  String generateFormKey()
          Creates the unique id used to store this "conversation" in the session.
 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()
           
 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 getPreviousView()
          View instance for the page that made a request.
 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 form.
 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
 String 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 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)
           
 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 setPreviousView(View previousView)
          Setter for the previous view instance
 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 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(String 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 String 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

view

protected View view

previousView

protected View previousView

viewRequestParameters

protected Map<String,String> viewRequestParameters

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()
Unique Id for the View instance. This is specified for a view in its definition by setting the 'id' property.

Returns:
String view id

setViewId

public void setViewId(String viewId)
Setter for the unique view id

Parameters:
viewId -

getViewName

public String getViewName()
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)

Returns:
String view name

setViewName

public void setViewName(String viewName)
Setter for the view name

Parameters:
viewName -

getViewTypeName

public String getViewTypeName()
Name for the type of view being requested. This can be used to find View instances by request parameters (not necessary the unique id)

Returns:
String view type name

setViewTypeName

public void setViewTypeName(String viewTypeName)
Setter for the view type name

Parameters:
viewTypeName -

getPageId

public String getPageId()
Id for the current page being displayed within the view

Returns:
String page id

setPageId

public void setPageId(String pageId)
Setter for the current page id

Parameters:
pageId -

getFormPostUrl

public String getFormPostUrl()

setFormPostUrl

public void setFormPostUrl(String formPostUrl)

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()
Map of parameters that was used to configured the View. Maintained on the form to rebuild the view on posts and session timeout

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

Parameters:
viewRequestParameters -

getNewCollectionLines

public Map<String,Object> 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:
Map new collection lines

setNewCollectionLines

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

Parameters:
newCollectionLines -

getActionParameters

public Map<String,String> getActionParameters()
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.

Returns:
Map action parameters

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

Parameters:
actionParameters -

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

getClientStateForSyncing

public Map<String,Object> getClientStateForSyncing()
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.

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

getSelectedCollectionLines

public Map<String,Set<String>> getSelectedCollectionLines()
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.

Returns:
Map> map of collections and their selected lines
See Also:
DataObjectMetaDataService.getDataObjectIdentifierString(java.lang.Object)

setSelectedCollectionLines

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

Parameters:
selectedCollectionLines -

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()
Indicates whether the form has had default values from the configured View applied. This happens only once for each form instance

Returns:
boolean true if default values have been applied, false if not

setDefaultsApplied

public void setDefaultsApplied(boolean defaultsApplied)
Setter for the defaults applied indicator

Parameters:
defaultsApplied -

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()
View instance associated with the form. Used to render the user interface

Returns:
View

setView

public void setView(View view)
Setter for the view instance

Parameters:
view -

getPreviousView

public View getPreviousView()
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

Returns:
View instance

setPreviousView

public void setPreviousView(View previousView)
Setter for the previous view instance

Parameters:
previousView -

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 AttributeFields 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 © 2004-2011 The Kuali Foundation. All Rights Reserved.