org.springframework.richclient.dialog.support
Class DialogPageUtils

java.lang.Object
  extended by org.springframework.richclient.dialog.support.DialogPageUtils

public class DialogPageUtils
extends Object

Useful methods for working with DialogPages. These methods make it easier to place dialog pages in arbitrary containers, wire in message listeners, wire actions to the page complete status, etc.

These helpers can be used to quickly construct a standard layout (like that found in the TitledPageApplicationDialog, or you can use these methods to construct the various components (title area and button bar) and then lay things out as you like.

The standard layout is obtained using the createStandardView(DialogPage, ActionCommand, ActionCommand) or createStandardView(DialogPage, Object[]) methods. To create the pieces and do the layout independently, use createTitlePane(DialogPage) to get the title pane and wire your OK command into the page complete status using adaptPageCompletetoGuarded(DialogPage, Guarded). If you don't want to use the standard title pane, you can easily arrange for the messages coming from the dialog page to be sent to a Messagable of your choice using addMessageMonitor(DialogPage, Messagable).

Author:
Larry Streepy

Nested Class Summary
protected static class DialogPageUtils.PageCompleteAdapter
          Internal class to handle the PAGE_COMPLETE property changes in the dialog page and adapt them to operations on a Guarded object.
 
Constructor Summary
DialogPageUtils()
           
 
Method Summary
static void adaptPageCompletetoGuarded(DialogPage dialogPage, Guarded guarded)
          Create an adapter that will monitor the page complete status of the dialog page and adapt it to operations on the provided Guarded object.
static void addMessageMonitor(DialogPage dialogPage, Messagable monitor)
          Add a message monitor.
static JComponent createButtonBar(Object[] groupMembers)
          Return a standardized row of command buttons.
static JComponent createStandardView(DialogPage dialogPage, ActionCommand okCommand, ActionCommand cancelCommand)
          Construct a complete standard layout for a dialog page.
static JComponent createStandardView(DialogPage dialogPage, Object[] commandGroupMembers)
          Construct a complete standard layout for a dialog page.
static TitlePane createTitlePane(DialogPage dialogPage)
          Create a standard TitlePane wired to receive messages from the given dialog page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DialogPageUtils

public DialogPageUtils()
Method Detail

createTitlePane

public static TitlePane createTitlePane(DialogPage dialogPage)
Create a standard TitlePane wired to receive messages from the given dialog page. The title pane will also be configured from the dialog page's title and icon.

Parameters:
dialogPage - to process

createStandardView

public static JComponent createStandardView(DialogPage dialogPage,
                                            ActionCommand okCommand,
                                            ActionCommand cancelCommand)
Construct a complete standard layout for a dialog page. This is a panel with the title/message area at the top, the dialog page control in the center, and the command button bar (using the provided ok and cancel commands) on the bottom. The finishCommand provided will automatically be wired into the page complete status of the dialog page.

Parameters:
dialogPage - to process
okCommand - Action command to wire into dialogPage's page complete status
cancelCommand - to add to the command button bar
Returns:
created component
See Also:
createTitlePane(DialogPage), adaptPageCompletetoGuarded(DialogPage, Guarded)

createStandardView

public static JComponent createStandardView(DialogPage dialogPage,
                                            Object[] commandGroupMembers)
Construct a complete standard layout for a dialog page. This is a panel with the title/message area at the top, the dialog page control in the center, and the command button bar (using the provided group of commands) on the bottom. You should have already wired any commands to the page complete status as needed.

Parameters:
dialogPage - to process
commandGroupMembers - Array of commands to place in the button bar
Returns:
created component
See Also:
createTitlePane(DialogPage), adaptPageCompletetoGuarded(DialogPage, Guarded)

createButtonBar

public static JComponent createButtonBar(Object[] groupMembers)
Return a standardized row of command buttons.

Parameters:
groupMembers -
Returns:
button bar

addMessageMonitor

public static void addMessageMonitor(DialogPage dialogPage,
                                     Messagable monitor)
Add a message monitor. Each monitor will have its Messagable.setMessage(Message) method called whenever the MESSAGE property on the dialog page changes.

Parameters:
dialogPage - to monitor
monitor - to add

adaptPageCompletetoGuarded

public static void adaptPageCompletetoGuarded(DialogPage dialogPage,
                                              Guarded guarded)
Create an adapter that will monitor the page complete status of the dialog page and adapt it to operations on the provided Guarded object. If the page is complete, then the guarded object will be enabled. If this page is not complete, then the guarded object will be disabled.

Parameters:
dialogPage - to monitor
guarded - object to adapt


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