Class DialogGroup

All Implemented Interfaces:
Serializable, Cloneable, Copyable, DictionaryBean, UifDictionaryBean, Component, Ordered, ScriptEventSupport, Container, Group, LifecycleElement, Helpable, org.springframework.core.Ordered

public class DialogGroup extends GroupBase
Special type of group that presents the content in a modal dialog.

A dialog group can be used for many different purposes. First it can be used to give a simple confirmation ( a prompt with ok/cancel or yes/no options). The Action component contains properties for adding a confirmation dialog. Next, a dialog can be used to prompt for a response or to gather addition data on the client. In this situation, the dialog is configured either in the view or external to the view, and the developers triggers the display of the dialog using the javascript method showDialog. See krad.modal.js for more information. Dialogs can also be triggered from a controller method (or other piece of server code). Again the dialog is configured with the view or external to the view, and the controller method triggers the show using the method UifControllerBase.showDialog(java.lang.String, boolean, org.kuali.rice.krad.web.form.UifFormBase).

A dialog is a group and can be configured like any other general group. For building basic dialogs, there are convenience properties that can be used. In addition, there are base beans provided with definitions for these properties. This includes a basic prompt message and responses. Note to have responses with different action properties, set the items of the dialog groups footer directly.

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
  • Constructor Details

    • DialogGroup

      public DialogGroup()
  • Method Details

    • performInitialization

      public void performInitialization(Object model)
      The following actions are performed in this phase:
      • If property name nor binding path is set on the explanation field, sets to generic form property
      • Move custom dialogGroup properties prompt and explanation into items collection if the items list is not already populated
      The following initialization is performed:
      • Sorts the containers list of components
      • Initializes the instructional field if necessary
      • Initializes LayoutManager
      The following updates are done here:
      • Invoke performInitialize on component modifiers
      Initializes the component

      Where components can set defaults and setup other necessary state. The initialize method should only be called once per component lifecycle and is invoked within the initialize phase of the view lifecylce.

      Specified by:
      performInitialization in interface LifecycleElement
      Overrides:
      performInitialization in class GroupBase
      Parameters:
      model - - object instance containing the view data
      See Also:
    • performApplyModel

      public void performApplyModel(Object model, LifecycleElement parent)
      The following actions are performed in this phase:
      • For each configured key value response, create an action component and add to the footer items.
      The following updates are done here:
      • Evaluate the progressive render condition (if set) and combine with the current render status to set the render status
      Called after the initialize phase to perform conditional logic based on the model data

      Where components can perform conditional logic such as dynamically generating new fields or setting field state based on the given data

      Specified by:
      performApplyModel in interface LifecycleElement
      Overrides:
      performApplyModel in class ContainerBase
      Parameters:
      model - - Top level object containing the data (could be the form or a top level business object, dto)
      parent - parent lifecycle element
    • performFinalize

      public void performFinalize(Object model, LifecycleElement parent)
      The following actions are performed in this phase:
      • Add data attributes for any configured event handlers
      Sets the section boolean to true if this group has a rendering header with text The following finalization is performed:
      • Sets the headerText of the header Group if it is blank
      • Set the messageText of the summary Message if it is blank
      • Finalizes LayoutManager
      The following finalization is done here:
      • progressiveRender and conditionalRefresh variables are processed if set
      • If any of the style properties were given, sets the style string on the style property
      • Set the skipInTabOrder flag for nested components
      The last phase before the view is rendered

      Here final preparations can be made based on the updated view state.

      Specified by:
      performFinalize in interface LifecycleElement
      Overrides:
      performFinalize in class GroupBase
      Parameters:
      model - - top level object containing the data
      parent - - parent component
    • getPromptText

      public String getPromptText()
      Text to be displayed as the prompt or main message in this simple dialog.

      This is a convenience method for setting the message text on getPrompt()

      Returns:
      String containing the prompt text
    • setPromptText

      public void setPromptText(String promptText)
      See Also:
    • getPrompt

      Message component to use for the dialog prompt.
      Returns:
      Message component for prompt
    • setPrompt

      public void setPrompt(MessageField prompt)
      See Also:
    • getExplanation

      @ViewLifecycleRestriction public InputField getExplanation()
      Input field use to gather explanation text with the dialog.

      By default, the control for this input is configured as a TextAreaControl. It may be configured for other types of input fields.

      Returns:
      InputField component
    • setExplanation

      public void setExplanation(InputField explanation)
      See Also:
    • getAvailableResponses

      public List<org.kuali.rice.core.api.util.KeyValue> getAvailableResponses()
      List of options that are available for the user to choice as a response to the dialog.

      If given, the list of key value pairs is used to create action components that are inserted into the dialog footer. The key will be used as the response value, and the value as the label for the action.

      Note responses can be also be created by populating the footer items with action components.

      Returns:
      the List of response actions to provide the user
    • setAvailableResponses

      public void setAvailableResponses(List<org.kuali.rice.core.api.util.KeyValue> availableResponses)
      See Also:
    • getDialogCssClass

      public String getDialogCssClass()
      Gets CSS class to use when rendering dialog (default is modal-sm).
      Returns:
      String of CSS class
    • setDialogCssClass

      public void setDialogCssClass(String dialogCssClass)
    • getOnDialogResponseScript

      public String getOnDialogResponseScript()
      Script that will be invoked when the dialog response event is thrown.

      The dialog group will throw a custom event type 'dialogresponse.uif' when an response action within the dialog is selected. Script given here will bind to that event as a handler

      The event object contains: event.response - response value for the action that was selected event.action - jQuery object for the action element that was selected event.dialogId - id for the dialog the response applies to

      Returns:
      js that will execute for the response event
    • setOnDialogResponseScript

      public void setOnDialogResponseScript(String onDialogResponseScript)
      See Also:
    • getOnShowDialogScript

      public String getOnShowDialogScript()
      Script that will get invoked when the dialog group is shown.

      Initially a dialog group will either be hidden in the DOM or not present at all (if retrieved via Ajax). When the dialog is triggered and shown, a show event will be thrown and this script will be executed

      Returns:
      js code to execute when the dialog is shown
    • setOnShowDialogScript

      public void setOnShowDialogScript(String onShowDialogScript)
      See Also:
    • getOnHideDialogScript

      public String getOnHideDialogScript()
      Script that will get invoked when the dialog group receives a hide event.
      Returns:
      js code to execute when the dialog receives a hide event
    • setOnHideDialogScript

      public void setOnHideDialogScript(String onHideDialogScript)
      See Also:
    • getOnHiddenDialogScript

      public String getOnHiddenDialogScript()
      Script that will get invoked once the dialog group is hidden.
      Returns:
      js code to execute when the dialog is hidden
    • setOnHiddenDialogScript

      public void setOnHiddenDialogScript(String onHiddenDialogScript)
      See Also:
    • isDestroyDialogOnHidden

      public boolean isDestroyDialogOnHidden()
      Flag to indicate whether the contents of the dialog should be destroyed on hidden.
      Returns:
      boolean to destroy contents
    • setDestroyDialogOnHidden

      public void setDestroyDialogOnHidden(boolean destroyDialogOnHidden)
      See Also: