Class ModelAndViewServiceImpl
- All Implemented Interfaces:
ModelAndViewService
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildShowDialogScript(String dialogId, boolean confirmation, UifFormBase form) Builds a JavaScript string for invoking the showDialog method with the given dialog parameters.org.springframework.web.servlet.ModelAndViewcheckForm(UifFormBase form) InvokesViewValidationServiceto validate the contents of the given form instance.org.springframework.web.servlet.ModelAndViewgetMessageView(UifFormBase form, String headerText, String messageText) Retrieves an instance of the view with idUifConstants.MESSAGE_VIEW_IDand sets the header and message from the given parameters.org.springframework.web.servlet.ModelAndViewgetModelAndView(UifFormBase form) Configures the Spring model and view instance containing the form data and pointing to the generic Uif view.org.springframework.web.servlet.ModelAndViewgetModelAndView(UifFormBase form, String pageId) Configures the Spring model and view instance containing the form data and pointing to the generic Uif view, and also changes the current page to the given page id.org.springframework.web.servlet.ModelAndViewgetModelAndView(UifFormBase form, Map<String, Object> additionalViewAttributes) Configures the Spring model and view instance containing the form data and pointing to the generic Uif view, and also adds the given attributes (which can be referenced in the view templates).org.springframework.web.servlet.ModelAndViewgetModelAndViewWithInit(UifFormBase form, String viewId) Initialize a new view instance for the given view id, then configures the Spring model and view instance containing the form data and pointing to the generic Uif view.org.springframework.web.servlet.ModelAndViewgetModelAndViewWithInit(UifFormBase form, String viewId, String pageId) Initialize a new view instance for the given view id, then configures the Spring model and view instance containing the form data and pointing to the generic Uif view.protected ViewServiceprotected voidinvokeViewLifecycle(javax.servlet.http.HttpServletRequest request, UifFormBase form) Prepares theViewinstance contained on the form for rendering.org.springframework.web.servlet.ModelAndViewperformRedirect(UifFormBase form, String redirectUrl) Builds a model and view instance configured to redirect to the given URL.org.springframework.web.servlet.ModelAndViewperformRedirect(UifFormBase form, String baseUrl, Properties urlParameters) Builds an URL from the given base URL and parameters, then builds a model and view instance configured to redirect to the built URL.voidprepareView(javax.servlet.http.HttpServletRequest request, org.springframework.web.servlet.ModelAndView modelAndView) After the controller logic is executed, the form is placed into session and the corresponding view is prepared for rendering.voidsetViewService(ViewService viewService) voidsetViewValidationService(ViewValidationService viewValidationService) org.springframework.web.servlet.ModelAndViewshowDialog(String dialogId, boolean confirmation, UifFormBase form) Builds the dialog group with the given id then creates the script for showing the dialog once the page reloads.
-
Constructor Details
-
ModelAndViewServiceImpl
public ModelAndViewServiceImpl()
-
-
Method Details
-
checkForm
InvokesViewValidationServiceto validate the contents of the given form instance. Handles the check form action to validate the given form data.- Specified by:
checkFormin interfaceModelAndViewService- Parameters:
form- instance containing the model data- Returns:
- ModelAndView instance for rendering the view
-
showDialog
public org.springframework.web.servlet.ModelAndView showDialog(String dialogId, boolean confirmation, UifFormBase form) Builds the dialog group with the given id then creates the script for showing the dialog once the page reloads. Invoked by controller methods to show a dialog to the user.This will return back to the view and display the dialog to the user. When the users chooses a response, the initial action that triggered the controller method (which called showDialog) will be triggered again. The response will be captured in the form property
UifFormBase.getDialogResponses(). In the case of a confirmation, if 'false' (typically labeled cancel) is choosen the initial action will simply not be triggered again.- Specified by:
showDialogin interfaceModelAndViewService- Parameters:
dialogId- id for the dialog group to showconfirmation- whether the dialog should be shown as a confirmation, in this case it is expected the options are true (continue) or false (stop). In addition, if the user selects the false option, the dialog answer will not be resubmitted to the server, instead the user will remain on the viewform- instance containing the model data- Returns:
- ModelAndView instance for rendering the view
-
buildShowDialogScript
Builds a JavaScript string for invoking the showDialog method with the given dialog parameters.- Parameters:
dialogId- id for the dialog group to showconfirmation- whether the dialog should be shown as a confirmationform- instance containing the model data- Returns:
- String containing script
-
performRedirect
public org.springframework.web.servlet.ModelAndView performRedirect(UifFormBase form, String baseUrl, Properties urlParameters) Builds an URL from the given base URL and parameters, then builds a model and view instance configured to redirect to the built URL.- Specified by:
performRedirectin interfaceModelAndViewService- Parameters:
form- form instance containing the model databaseUrl- base URL to redirect tourlParameters- parameters to add to the base URL- Returns:
- ModelAndView instance configured to redirect to the built URL
-
performRedirect
public org.springframework.web.servlet.ModelAndView performRedirect(UifFormBase form, String redirectUrl) Builds a model and view instance configured to redirect to the given URL.- Specified by:
performRedirectin interfaceModelAndViewService- Parameters:
form- instance containing the model dataredirectUrl- URL to redirect to- Returns:
- ModelAndView instance configured to redirect to the given URL
-
getMessageView
public org.springframework.web.servlet.ModelAndView getMessageView(UifFormBase form, String headerText, String messageText) Retrieves an instance of the view with idUifConstants.MESSAGE_VIEW_IDand sets the header and message from the given parameters. Builds a message view from the given header and message text then forwards the UIF model and view.If an error or other type of interruption occurs during the request processing the controller can invoke this message to display the message to the user. This will abandon the view that was requested and display a view with just the message
- Specified by:
getMessageViewin interfaceModelAndViewService- Parameters:
form- instance containing the model dataheaderText- header text for the message view (can be blank)messageText- text for the message to display- Returns:
- instance for rendering the view
-
getModelAndView
Configures the Spring model and view instance containing the form data and pointing to the generic Uif view.The view and page to render is assumed to be set in the given form object.
- Specified by:
getModelAndViewin interfaceModelAndViewService- Parameters:
form- form instance containing the model data- Returns:
- ModelAndView instance for rendering the view
-
getModelAndView
public org.springframework.web.servlet.ModelAndView getModelAndView(UifFormBase form, String pageId) Configures the Spring model and view instance containing the form data and pointing to the generic Uif view, and also changes the current page to the given page id.The view to render is assumed to be set in the given form object.
- Specified by:
getModelAndViewin interfaceModelAndViewService- Parameters:
form- form instance containing the model datapageId- page id within the view to render- Returns:
- ModelAndView instance for rendering the view
-
getModelAndView
public org.springframework.web.servlet.ModelAndView getModelAndView(UifFormBase form, Map<String, Object> additionalViewAttributes) Configures the Spring model and view instance containing the form data and pointing to the generic Uif view, and also adds the given attributes (which can be referenced in the view templates).The view and page to render is assumed to be set in the given form object.
- Specified by:
getModelAndViewin interfaceModelAndViewService- Parameters:
form- form instance containing the model dataadditionalViewAttributes- additional attributes to add to the returned model and view- Returns:
- ModelAndView instance for rendering the view
-
getModelAndViewWithInit
public org.springframework.web.servlet.ModelAndView getModelAndViewWithInit(UifFormBase form, String viewId) Initialize a new view instance for the given view id, then configures the Spring model and view instance containing the form data and pointing to the generic Uif view.This can be used by controllers to render a different view from the one initially requested (if any)
- Specified by:
getModelAndViewWithInitin interfaceModelAndViewService- Parameters:
form- form instance containing the model dataviewId- id for the view to initialize- Returns:
- ModelAndView instance for rendering the view
-
getModelAndViewWithInit
public org.springframework.web.servlet.ModelAndView getModelAndViewWithInit(UifFormBase form, String viewId, String pageId) Initialize a new view instance for the given view id, then configures the Spring model and view instance containing the form data and pointing to the generic Uif view.This can be used by controllers to render a different view from the one initially requested (if any)
- Specified by:
getModelAndViewWithInitin interfaceModelAndViewService- Parameters:
form- form instance containing the model dataviewId- id for the view to initializepageId- page id within the view to render- Returns:
- ModelAndView instance for rendering the view
-
prepareView
public void prepareView(javax.servlet.http.HttpServletRequest request, org.springframework.web.servlet.ModelAndView modelAndView) After the controller logic is executed, the form is placed into session and the corresponding view is prepared for rendering.- Specified by:
prepareViewin interfaceModelAndViewService- Parameters:
request- servlet requestmodelAndView- model and view
-
invokeViewLifecycle
Prepares theViewinstance contained on the form for rendering.- Parameters:
request- servlet requestform- form instance containing the data and view instance
-
getViewService
-
setViewService
-
getViewValidationService
-
setViewValidationService
-