org.kuali.rice.krad.uif.view
Class DialogManager

java.lang.Object
  extended by org.kuali.rice.krad.uif.view.DialogManager
All Implemented Interfaces:
Serializable

public class DialogManager
extends Object
implements Serializable

Manages the status of any modal dialogs that are used in the view.

Keeps track of which modal dialogs have been asked and/or answered during the life cycle of a view.

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

Constructor Summary
DialogManager()
          Constructs new instance
 
Method Summary
 void addDialog(String dialogId, String returnMethod)
          Creates a new DialogInfo record and adds it to the list of dialogs used in the view
 String getCurrentDialogId()
          Gets the name of the currently active dialog
 String getDialogAnswer(String dialogId)
          Gets the answer previously entered by the user when responding to this dialog
 String getDialogExplanation(String dialogId)
          Gets the text String value of the explanation input field
 String getDialogReturnMethod(String dialogId)
          Retrieves the target method to redirect to when returning from a lightbox
 Map<String,org.kuali.rice.krad.uif.view.DialogManager.DialogInfo> getDialogs()
          Gets the Map used to track dialog interactions related to the view
 boolean hasDialogBeenAnswered(String dialogId)
          Indicates whether the named dialog has alread been answered by the user
 boolean hasDialogBeenDisplayed(String dialogId)
          Indicates whether the named dialog has already been presented to the user
 void removeAllDialogs()
          Removes all dialogs from the list of dialogs used in this vew.
 void removeDialog(String dialogId)
          Removes a dialog from the list of dialogs used in this vew.
 void resetDialogStatus(String dialogId)
          Sets the status of the dialog tracking record to indicate that this dialog has not yet been asked or answered.
 void setCurrentDialogId(String currentDialogId)
          Sets the name of the currently active dialog
 void setDialogAnswer(String dialogId, String answer)
          Sets the answer chosen by the user when responding to the dialog
 void setDialogExplanation(String dialogId, String explanation)
          Sets the exlanation text String obtained from the explanation input field for the dialog
 void setDialogReturnMethod(String dialogId, String returnMethod)
          sets the return method to call after returning from dialog
 void setDialogs(Map<String,org.kuali.rice.krad.uif.view.DialogManager.DialogInfo> dialogs)
          Sets the Map of DialogInfo records used to track modal dialog interactions within a view
 boolean wasDialogAnswerAffirmative(String dialogId)
          Indicates whethe the user answered affirmatively to the question
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DialogManager

public DialogManager()
Constructs new instance

Method Detail

hasDialogBeenDisplayed

public boolean hasDialogBeenDisplayed(String dialogId)
Indicates whether the named dialog has already been presented to the user

Parameters:
dialogId - the key identifying the specific dialog
Returns:
true if dialog has been displayed, false if not

hasDialogBeenAnswered

public boolean hasDialogBeenAnswered(String dialogId)
Indicates whether the named dialog has alread been answered by the user

Parameters:
dialogId - name of the dialog in questions
Returns:
true if the dialog has been answered by the user

getDialogAnswer

public String getDialogAnswer(String dialogId)
Gets the answer previously entered by the user when responding to this dialog

Returns the key value of the option chosen by the user. Returns null if the dialog has not yet been asked, or if the user has not yet responded.

Parameters:
dialogId - a String identifying the dialog
Returns:
the key String of the option KeyValue chosen by the user

setDialogAnswer

public void setDialogAnswer(String dialogId,
                            String answer)
Sets the answer chosen by the user when responding to the dialog

Parameters:
dialogId - id of the dialog
answer - value chosen by the user

getDialogExplanation

public String getDialogExplanation(String dialogId)
Gets the text String value of the explanation input field

Parameters:
dialogId - dialog identifier
Returns:
String representing user text input entered into the dialog

setDialogExplanation

public void setDialogExplanation(String dialogId,
                                 String explanation)
Sets the exlanation text String obtained from the explanation input field for the dialog

Parameters:
dialogId - identifier of the dialog
explanation - text String from input field

wasDialogAnswerAffirmative

public boolean wasDialogAnswerAffirmative(String dialogId)
Indicates whethe the user answered affirmatively to the question

The answer string is the key used for the option key/value pair selected by the user. This assumes that the developer used one of the common keys used for yes/no questions. The answer is checked to see if it is one of the acceptable values for "Yes". If so, the method returns true. False if not. Also returns false, if the question has not even been asked of the user.

Parameters:
dialogId -
Returns:
true if the user answered the modal dialog affirmatively, false if answered negatively; also returns false if the questions hasn't yet been answered

getDialogReturnMethod

public String getDialogReturnMethod(String dialogId)
Retrieves the target method to redirect to when returning from a lightbox

Parameters:
dialogId - identifies the dialog currently being handled
Returns:
controller method to call

setDialogReturnMethod

public void setDialogReturnMethod(String dialogId,
                                  String returnMethod)
sets the return method to call after returning from dialog

Parameters:
dialogId -
returnMethod -

addDialog

public void addDialog(String dialogId,
                      String returnMethod)
Creates a new DialogInfo record and adds it to the list of dialogs used in the view

New dialog entry is initialized to asked=false, answered=false. If the dialog already has a record, nothing is performed.

Parameters:
dialogId - String name identifying the dialog

removeDialog

public void removeDialog(String dialogId)
Removes a dialog from the list of dialogs used in this vew.

If the dialog is in the list, it is removed. If the dialog is not in the list, nothing is performed.

Parameters:
dialogId - String identifying the dialog to be removed

removeAllDialogs

public void removeAllDialogs()
Removes all dialogs from the list of dialogs used in this vew.


resetDialogStatus

public void resetDialogStatus(String dialogId)
Sets the status of the dialog tracking record to indicate that this dialog has not yet been asked or answered.

Parameters:
dialogId - String identifier for the dialog

getDialogs

public Map<String,org.kuali.rice.krad.uif.view.DialogManager.DialogInfo> getDialogs()
Gets the Map used to track dialog interactions related to the view

Returns:
a Map of DialogInfo records

setDialogs

public void setDialogs(Map<String,org.kuali.rice.krad.uif.view.DialogManager.DialogInfo> dialogs)
Sets the Map of DialogInfo records used to track modal dialog interactions within a view

Parameters:
dialogs - a Map of DialogInfo records keyed by the dialog id

getCurrentDialogId

public String getCurrentDialogId()
Gets the name of the currently active dialog

Returns:
the name of the current dialog

setCurrentDialogId

public void setCurrentDialogId(String currentDialogId)
Sets the name of the currently active dialog

Parameters:
currentDialogId - the name of the dialog


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