org.springframework.richclient.dialog
Class MessageDialog

java.lang.Object
  extended by org.springframework.richclient.application.support.ApplicationServicesAccessor
      extended by org.springframework.richclient.dialog.ApplicationDialog
          extended by org.springframework.richclient.dialog.MessageDialog
All Implemented Interfaces:
Guarded, TitleConfigurable
Direct Known Subclasses:
BasicMessageDialog

public class MessageDialog
extends ApplicationDialog

Dialog for showing an message to the user. The severity of the message is used to determine the icon.

If the message text contains line feeds ('\n'), the message is split into different parts, and the first part is rendered in bold. This is to mimic the guidelines in http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGWindows/chapter_17_section_6.html#//apple_ref/doc/uid/20000957-20000961-BACFBACB


Field Summary
 
Fields inherited from class org.springframework.richclient.dialog.ApplicationDialog
DEFAULT_CANCEL_COMMAND_ID, DEFAULT_FINISH_COMMAND_ID, DEFAULT_FINISH_SUCCESS_MESSAGE_KEY, DEFAULT_FINISH_SUCCESS_TITLE_KEY, logger, SUCCESS_FINISH_MESSAGE_KEY, SUCCESS_FINISH_TITLE_KEY
 
Constructor Summary
MessageDialog(String title, Message message)
          Constructs a new dialog.
MessageDialog(String title, String message)
          Constructs a new dialog, the message is converted to an information message
MessageDialog(String title, Window parent, Message message)
          Constructs a new dialog.
MessageDialog(String title, Window parent, String message)
          Constructs a new dialog, the message is converted to an information message
 
Method Summary
protected  JComponent createDialogContentPane()
          Return the GUI which allows the user to manipulate the business objects related to this dialog.
protected  void disposeDialogContentPane()
          Cleanup any components/objects that are created during ApplicationDialog.createDialogContentPane().
protected  String getCancelCommandId()
          Returns the id for the cancel command.
protected  Object[] getCommandGroupMembers()
          Template getter method to return the commands to populate the dialog button bar.
 float getDialogScaleFactor()
          Get the scale factor for the dialog size (as compared to the parent window).
 Message getMessage()
          Get the message
 int getMinimumWidth()
          Get the minimum width for the dialog.
protected  void onAboutToShow()
          Template lifecycle method invoked right before the dialog is to become visible.
protected  boolean onFinish()
          Request invocation of the action taken when the user hits the OK (finish) button.
protected  void registerDefaultCommand()
          Register the finish button as the default dialog button.
 void setDialogScaleFactor(float dialogScaleFactor)
          Set the scale factory for the dialog size.
 void setMessage(Message message)
          Set the message.
 void setMessage(String text)
          Set the message text, severity is info.
 void setMinimumWidth(int minimumWidth)
          Set the minimum width for the dialog.
 
Methods inherited from class org.springframework.richclient.dialog.ApplicationDialog
addActionKeyBinding, addActionKeyBinding, addDialogComponents, attachListeners, componentsChanged, createButtonBar, createDialog, dispose, getActionMap, getCallingCommand, getCancelCommand, getDialog, getDialogContentPane, getDisplayFinishSuccessMessage, getFinishCommand, getFinishCommandId, getFinishSecurityControllerId, getFinishSuccessMessage, getFinishSuccessMessageArguments, getFinishSuccessTitle, getFinishSuccessTitleArguments, getInputMap, getLocation, getLocationRelativeTo, getParentComponent, getParentWindow, getPreferredSize, getTitle, getWindowForComponent, hide, init, isControlCreated, isEnabled, isShowing, onCancel, onInitialized, onWindowActivated, onWindowClosing, onWindowGainedFocus, onWindowLostFocus, registerCancelCommandAsDefault, registerDefaultCommand, setCallingCommand, setCloseAction, setDefaultEnabled, setDisplayFinishSuccessMessage, setEnabled, setFinishEnabled, setLocation, setLocationRelativeTo, setModal, setParentComponent, setPreferredSize, setResizable, setTitle, showDialog, showFinishSuccessMessageDialog
 
Methods inherited from class org.springframework.richclient.application.support.ApplicationServicesAccessor
getActiveWindow, getApplication, getApplicationContext, getApplicationName, getApplicationServices, getCommandConfigurer, getComponentFactory, getConversionService, getIconSource, getImageSource, getMessage, getMessage, getMessage, getMessage, getMessages, getMessageSource, getObjectConfigurer, getService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageDialog

public MessageDialog(String title,
                     Message message)
Constructs a new dialog.

Parameters:
title - the title
message - the message

MessageDialog

public MessageDialog(String title,
                     Window parent,
                     Message message)
Constructs a new dialog.

Parameters:
title - the title
parent - the parent window
message - the message

MessageDialog

public MessageDialog(String title,
                     String message)
Constructs a new dialog, the message is converted to an information message

Parameters:
title - the title
message - the message text

MessageDialog

public MessageDialog(String title,
                     Window parent,
                     String message)
Constructs a new dialog, the message is converted to an information message

Parameters:
title - the title
parent - the parent window
message - the message text
Method Detail

setMessage

public void setMessage(String text)
Set the message text, severity is info.

Parameters:
text - the message text

setMessage

public void setMessage(Message message)
Set the message.

Parameters:
message - the message

getMessage

public Message getMessage()
Get the message

Returns:
message

getCancelCommandId

protected String getCancelCommandId()
Description copied from class: ApplicationDialog
Returns the id for the cancel command.

Overrides:
getCancelCommandId in class ApplicationDialog
See Also:
ApplicationDialog.getCancelCommandId()

registerDefaultCommand

protected void registerDefaultCommand()
Description copied from class: ApplicationDialog
Register the finish button as the default dialog button.

Overrides:
registerDefaultCommand in class ApplicationDialog
See Also:
ApplicationDialog.registerDefaultCommand()

getCommandGroupMembers

protected Object[] getCommandGroupMembers()
Description copied from class: ApplicationDialog
Template getter method to return the commands to populate the dialog button bar.

Overrides:
getCommandGroupMembers in class ApplicationDialog
Returns:
The array of commands (may also be a separator or glue identifier)
See Also:
ApplicationDialog.getCommandGroupMembers()

createDialogContentPane

protected JComponent createDialogContentPane()
Description copied from class: ApplicationDialog
Return the GUI which allows the user to manipulate the business objects related to this dialog. This GUI will be placed above the OK and Cancel buttons, in a standard manner.

Any components/objects created at this point need to be disposed in ApplicationDialog.disposeDialogContentPane().

Specified by:
createDialogContentPane in class ApplicationDialog
See Also:
ApplicationDialog.createDialogContentPane()

disposeDialogContentPane

protected void disposeDialogContentPane()
Description copied from class: ApplicationDialog
Cleanup any components/objects that are created during ApplicationDialog.createDialogContentPane(). This method is called if the CloseAction is set to CloseAction.DISPOSE and the dialog is being closed. This ensures that when disposing the surrounding dialog, the content pane can be disposed as well.

Overrides:
disposeDialogContentPane in class ApplicationDialog
See Also:
ApplicationDialog.createDialogContentPane(), ApplicationDialog.dispose()

onFinish

protected final boolean onFinish()
Description copied from class: ApplicationDialog
Request invocation of the action taken when the user hits the OK (finish) button.

Specified by:
onFinish in class ApplicationDialog
Returns:
true if action completed successfully; false otherwise.
See Also:
ApplicationDialog.onFinish()

onAboutToShow

protected void onAboutToShow()
Description copied from class: ApplicationDialog
Template lifecycle method invoked right before the dialog is to become visible.

Overrides:
onAboutToShow in class ApplicationDialog
See Also:
ApplicationDialog.onAboutToShow()

getDialogScaleFactor

public float getDialogScaleFactor()
Get the scale factor for the dialog size (as compared to the parent window). The default returned here is 55% (.55).

Returns:
scale factor

setDialogScaleFactor

public void setDialogScaleFactor(float dialogScaleFactor)
Set the scale factory for the dialog size.

Parameters:
dialogScaleFactor - New dialog scale factor

getMinimumWidth

public int getMinimumWidth()
Get the minimum width for the dialog. This overrides the value calculated by the scale factor.

Returns:
minimum width
See Also:
setDialogScaleFactor(float)

setMinimumWidth

public void setMinimumWidth(int minimumWidth)
Set the minimum width for the dialog. This overrides the value calculated by the scale factor.



Copyright © 2004-2008 The Spring Framework. All Rights Reserved.