org.openpermis.editor.policy.view
Class MessageDialog

java.lang.Object
  extended by org.openpermis.editor.policy.view.WizardDialog
      extended by org.openpermis.editor.policy.view.MessageDialog

public class MessageDialog
extends WizardDialog

Dialog to display messages to the user, similar to the Swing option pane.

Since:
0.9.0

Nested Class Summary
static class MessageDialog.Style
          The dialog style enumeration.
 
Nested classes/interfaces inherited from class org.openpermis.editor.policy.view.WizardDialog
WizardDialog.ContentStyle
 
Field Summary
 
Fields inherited from class org.openpermis.editor.policy.view.WizardDialog
CHOOSER_TEXT, NEXT_FOCUS, TEXT_AREA_ROWS, TEXT_FIELD_COLUMNS
 
Constructor Summary
MessageDialog(ApplicationContext context)
          Creates a message dialog for the specified application context.
 
Method Summary
 void cancel()
          The default abort action.
protected  void configureButton(JButton button, Action action)
          Configures a button that has the specified action.
protected  JComponent createButtonPane(ControlFactory controlFactory)
          Creates the button pane of this dialog.
protected  JComponent createContentPane(ControlFactory factory)
          Creates the content pane of this dialog.
protected  JComponent createHeaderPane(ControlFactory controlFactory)
          Creates the header pane of this dialog.
 void details()
          The show/hide details action.
 void execute()
          The default execute action.
protected  List<Action> getButtonActions()
          Returns a list of actions to use for buttons at the bottom of the dialog.
protected  String getDialogTitle()
          Returns the title used by the wizard dialog.
protected  HeaderPane getHeaderPane()
          Returns the lazily created header pane.
protected  JLabel getMessageLabel()
          Returns the lazily created message label.
protected  boolean initialize(Component parent)
          Initialize some wizard specific fields.
 void setCancelEnabled(boolean cancelEnabled)
          Sets if the cancel button is enabled or not.
 void setDetails(Object details)
          Sets the dialog details.
 void setHeader(String headerKey, String descriptionKey)
          Sets the texts used by the header.
 void setMessage(String messagekey, Object... args)
          Sets the message displayed in the message dialog.
 void setStyle(MessageDialog.Style style)
          Sets the dialog style.
 void setTitle(String titleKey, Object... args)
          Sets the title of the dialog.
 boolean show()
          Shows the dialog using the main frame of the application context as parent.
static void showError(ApplicationContext context, org.jdesktop.application.ResourceMap resourceMap, String keyPrefix, Object details, Object... args)
          Shows an error dialog.
static boolean showErrorQuestion(ApplicationContext context, org.jdesktop.application.ResourceMap resourceMap, String keyPrefix, Object details, Object... args)
          Shows an error dialog with an ok and cancel button.
static void showInformation(ApplicationContext context, org.jdesktop.application.ResourceMap resourceMap, String keyPrefix, Object details, Object... args)
          Shows an information dialog.
static boolean showQuestion(ApplicationContext context, org.jdesktop.application.ResourceMap resourceMap, String keyPrefix, Object details, Object... args)
          Shows a question dialog with an ok and cancel button.
protected  void updateActions()
          Updates the actions according to the values in the wizard fields.
 
Methods inherited from class org.openpermis.editor.policy.view.WizardDialog
chooseFile, close, configure, createChooser, createDialogContent, createDisplayTextField, createFormBuilder, createLabel, createPasswordField, focusNextComponent, getAction, getActionMap, getApplicationContext, getCancelAction, getContentStyle, getDefaultButton, getDialog, getExecuteAction, getResourceMap, getTitleDescriptionKey, getTitleIconKey, getTitleTextKey, sameAction, setNextFocusComponent, show, showErrorDialog, showErrorDialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageDialog

public MessageDialog(ApplicationContext context)
Creates a message dialog for the specified application context.

Parameters:
context - the application context to create the message dialog for.
Since:
0.9.0
Method Detail

showError

public static void showError(ApplicationContext context,
                             org.jdesktop.application.ResourceMap resourceMap,
                             String keyPrefix,
                             Object details,
                             Object... args)
Shows an error dialog.

The following translation strings are used:

Parameters:
context - the application context to use.
keyPrefix - translation key prefix used to retrieve the various translation strings.
details - the error details, may be null.
args - additional arguments passed to the translator.
Since:
0.9.0

showErrorQuestion

public static boolean showErrorQuestion(ApplicationContext context,
                                        org.jdesktop.application.ResourceMap resourceMap,
                                        String keyPrefix,
                                        Object details,
                                        Object... args)
Shows an error dialog with an ok and cancel button.

The following translation strings are used:

Parameters:
context - the application context to use.
keyPrefix - translation key prefix used to retrieve the various translation strings.
details - the error details, may be null.
args - additional arguments passed to the translator.
Returns:
true if the ok button was pressed, false otherwise.
Since:
0.9.0

showQuestion

public static boolean showQuestion(ApplicationContext context,
                                   org.jdesktop.application.ResourceMap resourceMap,
                                   String keyPrefix,
                                   Object details,
                                   Object... args)
Shows a question dialog with an ok and cancel button.

The following translation strings are used:

Parameters:
context - the application context to use.
keyPrefix - translation key prefix used to retrieve the various translation strings.
details - the error details, may be null.
args - additional arguments passed to the translator.
Returns:
true if the ok button was pressed, false otherwise.
Since:
0.9.0

showInformation

public static void showInformation(ApplicationContext context,
                                   org.jdesktop.application.ResourceMap resourceMap,
                                   String keyPrefix,
                                   Object details,
                                   Object... args)
Shows an information dialog.

The following translation strings are used:

Parameters:
context - the application context to use.
keyPrefix - translation key prefix used to retrieve the various translation strings.
details - the error details, may be null.
args - additional arguments passed to the translator.
Since:
0.9.0

setTitle

public void setTitle(String titleKey,
                     Object... args)
Sets the title of the dialog.

Parameters:
titleKey - the translation key of the title.
args - additional arguments for the translation.
Since:
0.9.0

setStyle

public void setStyle(MessageDialog.Style style)
Sets the dialog style.

Parameters:
style - the dialog style.
Since:
0.9.0

setHeader

public void setHeader(String headerKey,
                      String descriptionKey)
Sets the texts used by the header.

Parameters:
headerKey - the translation key of the header title.
descriptionKey - the translation key of the header description.
Since:
0.9.0

getHeaderPane

protected HeaderPane getHeaderPane()
Returns the lazily created header pane.

Returns:
the lazily created header pane.
Since:
0.9.0

setMessage

public void setMessage(String messagekey,
                       Object... args)
Sets the message displayed in the message dialog.

Parameters:
messagekey - the translation key of the message to display.
args - additional arguments for the translation.
Since:
0.9.0

setCancelEnabled

public void setCancelEnabled(boolean cancelEnabled)
Sets if the cancel button is enabled or not.

Parameters:
cancelEnabled - true to enable the cancel button.
Since:
0.9.0

setDetails

public void setDetails(Object details)
Sets the dialog details.

If the details specified denote a Throwable its stack trace is used as details. Otherwise the string representation of the details will be used.

Parameters:
details - the details to set, may be null.
Since:
0.9.0

getMessageLabel

protected JLabel getMessageLabel()
Returns the lazily created message label.

Returns:
the lazily created message label.
Since:
0.9.0

cancel

@Action
public void cancel()
The default abort action.

Since:
0.9.0

execute

@Action
public void execute()
The default execute action.

Since:
0.9.0

details

@Action
public void details()
The show/hide details action.

Since:
0.9.0

show

public boolean show()
Shows the dialog using the main frame of the application context as parent.

Returns:
true if the ok button was used to close the dialog, false otherwise.
Since:
0.9.0

getButtonActions

protected List<Action> getButtonActions()
Description copied from class: WizardDialog
Returns a list of actions to use for buttons at the bottom of the dialog.

The default value returned is a list containing the name of the WizardDialog.getCancelAction() and WizardDialog.getExecuteAction().

Overrides:
getButtonActions in class WizardDialog
Returns:
the list of button action keys to display.
Since:
0.9.0

getDialogTitle

protected String getDialogTitle()
Description copied from class: WizardDialog
Returns the title used by the wizard dialog.

Overrides:
getDialogTitle in class WizardDialog
Returns:
the title used by the wizard dialog.
Since:
0.9.0

createHeaderPane

protected JComponent createHeaderPane(ControlFactory controlFactory)
Description copied from class: WizardDialog
Creates the header pane of this dialog.

The default implementation creates a HeaderPane with the dialog icon, title and description.

Overrides:
createHeaderPane in class WizardDialog
Parameters:
controlFactory - the control factory to use for creating controls.
Returns:
the header pane requested.
Since:
0.9.0

createContentPane

protected JComponent createContentPane(ControlFactory factory)
Description copied from class: WizardDialog
Creates the content pane of this dialog.

Overrides:
createContentPane in class WizardDialog
Parameters:
factory - the control factory to use for creating controls.
Returns:
the content pane requested.
Since:
0.9.0

configureButton

protected void configureButton(JButton button,
                               Action action)
Description copied from class: WizardDialog
Configures a button that has the specified action.

Overrides:
configureButton in class WizardDialog
Parameters:
button - the button to configure.
action - the action of the button.
Since:
0.9.0

createButtonPane

protected JComponent createButtonPane(ControlFactory controlFactory)
Description copied from class: WizardDialog
Creates the button pane of this dialog.

The default implementation creates a panel with buttons for all the WizardDialog.getButtonActions().

Sets the default button according to the default action.

Overrides:
createButtonPane in class WizardDialog
Parameters:
controlFactory - the control factory to use for creating controls.
Returns:
the button pane requested.
Since:
0.9.0

initialize

protected boolean initialize(Component parent)
Description copied from class: WizardDialog
Initialize some wizard specific fields.

Specified by:
initialize in class WizardDialog
Parameters:
parent - the parent component of the dialog.
Returns:
true if the initialization succeeded, false otherwise.
Since:
0.9.0

updateActions

protected void updateActions()
Description copied from class: WizardDialog
Updates the actions according to the values in the wizard fields.

Specified by:
updateActions in class WizardDialog
Since:
0.9.0


OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:17:21
Copyright (c) 2002-2007 Ergon Informatik AG