com.ibm.as400.ui.framework.java
Class WizardManager

java.lang.Object
  extended by com.ibm.as400.ui.framework.java.WizardManager
All Implemented Interfaces:
PaneManager, WindowManager

public class WizardManager
extends Object
implements PaneManager, WindowManager

Creates a wizard panel containing a series of windows which guide the user through a particular task. Each window consists of a panel defined using the Panel Definition Markup Language (PDML). The wizard may be either a standalone window or a modal dialog.

WizardManager performs the following processing on behalf of the application:

The total size of the wizard is a function of the size of the largest wizard panel.

To locate a wizard definition, WizardManager needs three pieces of information:

The framework first searches the specified location for a file with a name matching the wizard name, and an extension of .pdml.ser. If the serialized wizard definition is not found, an attempt will be made to load a ResourceBundle and a PDML file which correspond to the specified resource name. If the resources cannot be located a DisplayManagerException will be thrown.

The default path through the wizard panels is sequential. Applications may dynamically customize the order in which panels are displayed. This is done by defining a class that implements the WizardStateMachine interface, and passing an instance of this class to the WizardManager.

If desired, a "task list" may be defined in the wizard definition. The task list will appear on the left-hand side of the wizard window, and will show the user's progress through the wizard by "checking off" each task as it is performed.

Examples

Assume that the wizard MyWizard is defined in the file TestPanels.pdml, and that a properties file TestPanels.properties is associated with the wizard definition. Both files reside in the directory com/ourCompany/ourPackage, which is accessible from a directory defined in the classpath, or from a ZIP or JAR file defined in the classpath. The following code creates the wizard and displays it:

 import com.ibm.as400.ui.framework.java.*;
  
 // Create the wizard manager. Parameters:
 // 1. Resource name of the wizard definition
 // 2. Name of wizard
 // 3. List of DataBeans omitted
 // 5. Wizard navigation defaulted to sequential
  
 WizardManager wm = null;
 try {
 wm = new WizardManager("com.ourCompany.ourPackage.TestPanels",
                        "MyWizard",
                        null,
                        null);
 }
 catch (DisplayManagerException e) {
     e.displayUserMessage(null);
     System.exit(-1);
 }
  
 // Display the wizard
 wm.setVisible(true);
 
Once the DataBeans that supply data to the wizard panels have been implemented and the attributes have been identified in the PDML, the following code may be used to construct a fully-functioning wizard:

 import com.ibm.as400.ui.framework.java.*;
 import java.awt.Frame;
  
 // Instantiate the objects which supply data to the wizard
 TestDataBean1 db1 = new TestDataBean1();
 TestDataBean2 db2 = new TestDataBean2();
  
 // Initialize the objects
 db1.load();
 db2.load();
  
 // Set up to pass the objects to the UI framework
 DataBean[] dataBeans = { db1, db2 };
  
 // Create an application-defined state machine for
 // customized navigation through the panels
 MyStateMachine sm = new MyStateMachine();
  
 // Create the wizard manager. Parameters:
 // 1. Resource name of the wizard definition
 // 2. Name of wizard
 // 3. List of DataBeans
 // 4. Owner frame window
 // 5. Application-defined state machine
  
 Frame owner;
 ...
 WizardManager wm = null;
 try {
 wm = new WizardManager("com.ourCompany.ourPackage.TestPanels",
                        "MyWizard",
                        dataBeans,
                        owner,
                        sm);
 }
 catch (DisplayManagerException e) {
 e.displayUserMessage(null);
 System.exit(-1);
 }
  
 // Display the wizard
 wm.setVisible(true);
 

Command Line Interface

The command line interface may be used to display newly-defined wizards, or to serialize PDML wizard definitions.
 java com.ibm.as400.ui.framework.java.WizardManager
     [-serialize]
     [-locale <language code>_<country or region code>_<variant>]
     <resource name>
     <wizard name>
 
Options:
-serialize
Parses the PDML wizard definition and creates a serialized version of the wizard. The name of the serialized file will match the wizard name, and the file extension will be .pdml.ser. If this option is specified the wizard will not be displayed on the screen.

-locale <language code>_<country or region code>_<variant>
Identifies the locale which should be used to locate the wizard definition. The locale string should consist of a two-letter lowercase ISO Language Code, a two-letter uppercase ISO country or region code, and an optional variant string, each delimited by an underscore ("_") character. If this parameter is omitted the default locale will be used. If resources for the default locale cannot be found, an attempt will be made to use the base resources for the wizard.

<resource name>
The fully-qualified resource name of the PDML document/resource bundle combination which defines the wizard specification.

<wizard name>
The name of the wizard, as specified on the WIZARD tag in the PDML document.

Examples:

Test a base sample wizard:

java com.ibm.as400.ui.framework.java.WizardManager com.ourCompany.ourPackage.TestPanels MyWizard

Serialize the base wizard:

java com.ibm.as400.ui.framework.java.WizardManager -serialize com.ourCompany.ourPackage.TestPanels MyWizard

Test the UK version:

java com.ibm.as400.ui.framework.java.WizardManager -locale en_UK com.ourCompany.ourPackage.TestPanels MyWizard

Serialize the UK version:

java com.ibm.as400.ui.framework.java.WizardManager -serialize -locale en_UK com.ourCompany.ourPackage.TestPanels MyWizard

Since:
v4r2m0
Version:
1.0, 04/15/98
Author:
D. Petty
See Also:
DisplayManagerException, WizardStateMachine, PanelManager

Field Summary
Modifier and Type Field and Description
static int BACK_BUTTON
          Used to identify the Back button on the wizard panel.
static int CANCEL_BUTTON
          Used to identify the Cancel button on the wizard panel.
static int FINISH_BUTTON
          Used to identify the Finish button on the wizard panel.
static int HELP_BUTTON
          Used to identify the Help button on the wizard panel.
static int NEXT_BUTTON
          Used to identify the Next button on the wizard panel.
 
Fields inherited from interface com.ibm.as400.ui.framework.java.WindowManager
OFFSET_FROM_OWNER
 
Constructor Summary
Constructor and Description
WizardManager(String baseName, Locale locale, String wizardName)
          Constructs a WizardManager object for the specified wizard, and then serializes the wizard definition.
WizardManager(String baseName, Locale locale, String wizardName, DataBean[] dataBeans, Container container, WizardStateMachine stateMachine)
          Constructs a WizardManager for the specified wizard, using the specified container.
WizardManager(String baseName, Locale locale, String wizardName, DataBean[] dataBeans, Container container, WizardStateMachine stateMachine, boolean resize)
          Constructs a WizardManager for the specified wizard, using the specified container.
WizardManager(String baseName, Locale locale, String wizardName, DataBean[] dataBeans, Container container, WizardStateMachine stateMachine, boolean resize, boolean loadInBackground)
          Constructs a WizardManager for the specified wizard, using the specified container.
WizardManager(String baseName, Locale locale, String wizardName, DataBean[] dataBeans, Frame owner, WizardStateMachine stateMachine)
          Constructs a WizardManager object for the specified wizard.
WizardManager(String baseName, Locale locale, String wizardName, DataBean[] dataBeans, Frame owner, WizardStateMachine stateMachine, boolean resize)
          Constructs a WizardManager object for the specified wizard.
WizardManager(String baseName, Locale locale, String wizardName, DataBean[] dataBeans, Frame owner, WizardStateMachine stateMachine, boolean resize, boolean loadInBackground)
          Constructs a WizardManager object for the specified wizard.
WizardManager(String baseName, Locale locale, String wizardName, DataBean[] dataBeans, WizardStateMachine stateMachine)
          Constructs a WizardManager object for the specified wizard.
WizardManager(String baseName, Locale locale, String wizardName, DataBean[] dataBeans, WizardStateMachine stateMachine, boolean resize)
          Constructs a WizardManager object for the specified wizard.
WizardManager(String baseName, String wizardName, DataBean[] dataBeans, Container container, WizardStateMachine stateMachine)
          Constructs a WizardManager for the specified wizard, using the specified container.
WizardManager(String baseName, String wizardName, DataBean[] dataBeans, Container container, WizardStateMachine stateMachine, boolean resize)
          Constructs a WizardManager for the specified wizard, using the specified container.
WizardManager(String baseName, String wizardName, DataBean[] dataBeans, Frame owner, WizardStateMachine stateMachine)
          Constructs a WizardManager object for the specified wizard.
WizardManager(String baseName, String wizardName, DataBean[] dataBeans, Frame owner, WizardStateMachine stateMachine, boolean resize)
          Constructs a WizardManager object for the specified wizard.
WizardManager(String baseName, String wizardName, DataBean[] dataBeans, WizardStateMachine stateMachine)
          Constructs a WizardManager object for the specified wizard.
WizardManager(String baseName, String wizardName, DataBean[] dataBeans, WizardStateMachine stateMachine, boolean resize)
          Constructs a WizardManager object for the specified wizard.
 
Method Summary
Modifier and Type Method and Description
 void activatePanel()
          Runs the activation handlers for the currently selected pane.
 void addBackListener(ActionListener listener)
          Adds an ActionListener which is notified when the user presses the "Back" button.
 void addButtons(int flags)
          Adds the Back, Next, Finish, Cancel or Help buttons to the wizard panel if they have been previously removed.
 void addCancelListener(ActionListener listener)
          Adds an ActionListener which is notified when the user cancels out of a window.
 void addCancelListener(Object listener)
           
 void addCommitListener(ActionListener listener)
          Adds an ActionListener which is notified when commit processing is complete.
 void addCommitListener(Object listener)
           
 void addPanel(PanelManager pm, int index, int stepIndex)
          Adds a panel to the wizard managed by the receiver.
 void addUserButton(String buttonId, String text, ActionListener listener, ImageIcon imageIcon)
          Adds a user defined button to the wizard panel in addition to the standard Back, Next, Cancel, Finish and Help buttons.
 void applyChanges()
          Transmits changes to user data to the DataBeans which manage the data.
 void commit(Vector committedDataBeans)
          Commits the changes to data displayed on the panel.
 void disableButtons(int flags)
          Disables the Back, Next, Finish, Cancel or Help buttons on the wizard panel.
 void disableUserButton(String buttonId)
          Disable (gray out) a user defined button that was previously added with addUserButton.
 void dispose()
          Closes the panel and releases all resources used by the panel and its associated UI components.
 void enableButtons(int flags)
          Enables the Back, Next, Finish, Cancel or Help buttons on the wizard panel if they have been previously disabled.
 void enableUserButton(String buttonId)
          Enable a user defined button that was previously added with addUserButton.
 PaneManager getAggregateManager()
          Returns the owning PaneManager for the receiver.
 JButton getBackButton()
          Returns the wizard's Back button.
 JButton getCancelButton()
          Returns the wizard's Cancel button.
 Component getComponent(String componentName)
          Returns the requested user interface component.
 com.ibm.as400.ui.framework.java.JavaComponentDescriptor getComponentDescriptor(String componentName)
          Returns the JavaComponentDescriptor for the specified user interface component.
 PaneManager getDelegateManager(String paneName)
          Returns the PaneManager to which the receiver is delegating management of the specified subpane.
 boolean getExitOnClose()
          Determines whether the application exits when this wizard is closed.
 JButton getFinishButton()
          Returns the wizard's Finish button.
 DataFormatter getFormatter(String componentName)
          Returns the data formatter associated with the specified user interface component.
 JButton getNextButton()
          Returns the wizard's Next button.
 WindowManager getOwnerManager()
          Returns the WindowManager in relation to which the receiver has been set modal, or null if the receiver is not modal relative to another window.
 PanelManager getPage(int index)
          Returns the PanelManager for the specified wizard page.
 PanelManager getPage(String name)
          Returns the PanelManager for the specified wizard page.
 Dimension getPreferredSize()
          Gets the preferred size of this wizard.
 PaneManager getRootManager()
          Returns the root PaneManager for the receiver.
 boolean getSaveOnThread()
          Indicates whether calls to the save method on the application's DataBean objects will be called on a non-UI thread.
 String getTitle()
          Returns the wizard's title.
 JButton getUserButton(String buttonId)
          Returns one of the wizard's user defined buttons.
 Window getWindow()
          Returns the main wizard window.
 void handleDataException(IllegalUserDataException ex)
          Provides the default handling for an IllegalUserDataException.
 boolean isLoadOnPageSwap()
          Returns a flag indicating whether data is loaded from the databeans on every page switch
 boolean isVisible()
          Determines whether this wizard is visible.
 void loadData()
          Called during initialization to load data into the panel.
static void main(String[] args)
          Provides a command line interface to WizardManager.
 void prepareToCommit(Vector preparedDataBeans)
          Request the DataBeans which manage data for the panel to verify that their data is in a consistent state.
 void refreshComponent(String qualifiedName)
          Calls the associated dataBeans gettor method for a component.
 void removeButtons(int flags)
          Removes the Back, Next, Finish, Cancel or Help buttons from the wizard panel.
 void removePanel(int index)
          Removes a panel from the wizard managed by the receiver.
 void removeUserButton(String buttonId)
          Remove a user defined button that was previously added with addUserButton.
 void serialize()
          Serializes the wizard definition.
 void setAggregateManager(PaneManager mgr)
          Sets the owning PaneManager for the receiver.
 void setExitOnClose(boolean exit)
          Controls whether the application exits when the wizard is closed, based on the value of parameter exit.
 void setFormatter(String componentName, DataFormatter formatter, boolean required)
          Sets the data formatter associated with the specified user interface component.
 void setHelpPath(String path)
          Base location for help files.
 void setLoadOnPageSwap(boolean b)
          Sets a flag defining whether data should be loaded from the databeans on every page switch
 void setModalRelativeTo(WindowManager mgr)
          Sets the location of the panel being managed relative to a panel managed by the specified WindowManager.
 void setSaveOnThread(boolean saveOnThread)
          Controls whether calls to the save method on the application's DataBean objects will be called on a non-UI thread.
 void setTitle(String title)
          Sets the title for the currently displayed Page
 void setTitle(String title, String pageName)
          Sets the title for the page identified by pageName
 void setVisible(boolean show)
          Shows or hides the wizard, depending on the value of parameter show.
 void showPane(String paneName)
          Displays the specified pane.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BACK_BUTTON

public static final int BACK_BUTTON
Used to identify the Back button on the wizard panel.

See Also:
Constant Field Values

NEXT_BUTTON

public static final int NEXT_BUTTON
Used to identify the Next button on the wizard panel.

See Also:
Constant Field Values

FINISH_BUTTON

public static final int FINISH_BUTTON
Used to identify the Finish button on the wizard panel.

See Also:
Constant Field Values

CANCEL_BUTTON

public static final int CANCEL_BUTTON
Used to identify the Cancel button on the wizard panel.

See Also:
Constant Field Values

HELP_BUTTON

public static final int HELP_BUTTON
Used to identify the Help button on the wizard panel.

See Also:
Constant Field Values
Constructor Detail

WizardManager

public WizardManager(String baseName,
                     String wizardName,
                     DataBean[] dataBeans,
                     WizardStateMachine stateMachine)
              throws DisplayManagerException
Constructs a WizardManager object for the specified wizard. The wizard will be modeless.

The default locale will be used to load the wizard definition.

Parameters:
baseName - the resource name of the PDML document/resource bundle combination which define the wizard specification
wizardName - the name of the wizard, as specified on the WIZARD tag in the PDML document
dataBeans - a list of DataBeans which supply data to the wizard (may be null)
wizardStateMachine - the object that track's the user's path through the wizard panels (may be null)
Throws:
DisplayManagerException - if an error was encountered accessing the panel definition
Since:
v4r2m0
See Also:
DisplayManagerException

WizardManager

public WizardManager(String baseName,
                     String wizardName,
                     DataBean[] dataBeans,
                     WizardStateMachine stateMachine,
                     boolean resize)
              throws DisplayManagerException
Constructs a WizardManager object for the specified wizard. The wizard will be modeless.

The default locale will be used to load the wizard definition.

Parameters:
baseName - the resource name of the PDML document/resource bundle combination which define the wizard specification
wizardName - the name of the wizard, as specified on the WIZARD tag in the PDML document
dataBeans - a list of DataBeans which supply data to the wizard (may be null)
wizardStateMachine - the object that track's the user's path through the wizard panels (may be null)
resize - specifies whether the wizard should be dynamically resizable
Throws:
DisplayManagerException - if an error was encountered accessing the panel definition
Since:
v4r5m0
See Also:
DisplayManagerException

WizardManager

public WizardManager(String baseName,
                     Locale locale,
                     String wizardName,
                     DataBean[] dataBeans,
                     WizardStateMachine stateMachine)
              throws DisplayManagerException
Constructs a WizardManager object for the specified wizard. The wizard will be modeless.

Parameters:
baseName - the resource name of the PDML document/resource bundle combination which define the wizard specification
locale - the desired locale to be used to load the property sheet definition
wizardName - the name of the wizard, as specified on the WIZARD tag in the PDML document
dataBeans - a list of DataBeans which supply data to the wizard (may be null)
wizardStateMachine - the object that track's the user's path through the wizard panels (may be null)
Throws:
DisplayManagerException - if an error was encountered accessing the panel definition
Since:
v4r2m0
See Also:
DisplayManagerException

WizardManager

public WizardManager(String baseName,
                     Locale locale,
                     String wizardName,
                     DataBean[] dataBeans,
                     WizardStateMachine stateMachine,
                     boolean resize)
              throws DisplayManagerException
Constructs a WizardManager object for the specified wizard. The wizard will be modeless.

Parameters:
baseName - the resource name of the PDML document/resource bundle combination which define the wizard specification
locale - the desired locale to be used to load the property sheet definition
wizardName - the name of the wizard, as specified on the WIZARD tag in the PDML document
dataBeans - a list of DataBeans which supply data to the wizard (may be null)
wizardStateMachine - the object that track's the user's path through the wizard panels (may be null)
resize - specifies whether the wizard should be dynamically resizable
Throws:
DisplayManagerException - if an error was encountered accessing the panel definition
Since:
v4r5m0
See Also:
DisplayManagerException

WizardManager

public WizardManager(String baseName,
                     String wizardName,
                     DataBean[] dataBeans,
                     Frame owner,
                     WizardStateMachine stateMachine)
              throws DisplayManagerException
Constructs a WizardManager object for the specified wizard. The wizard will be modal, with the specified Frame as its owner. The application will block on the call to setVisible until the wizard has closed.

The default locale will be used to load the wizard definition.

Parameters:
baseName - the resource name of the PDML document/resource bundle combination which define the wizard specification
wizardName - the name of the wizard, as specified on the WIZARD tag in the PDML document
dataBeans - a list of DataBeans which supply data to the wizard (may be null)
owner - the owning frame
wizardStateMachine - the object that track's the user's path through the wizard panels (may be null)
Throws:
DisplayManagerException - if an error was encountered accessing the panel definition
Since:
v4r2m0
See Also:
DisplayManagerException, setVisible(boolean)

WizardManager

public WizardManager(String baseName,
                     String wizardName,
                     DataBean[] dataBeans,
                     Frame owner,
                     WizardStateMachine stateMachine,
                     boolean resize)
              throws DisplayManagerException
Constructs a WizardManager object for the specified wizard. The wizard will be modal, with the specified Frame as its owner. The application will block on the call to setVisible until the wizard has closed.

The default locale will be used to load the wizard definition.

Parameters:
baseName - the resource name of the PDML document/resource bundle combination which define the wizard specification
wizardName - the name of the wizard, as specified on the WIZARD tag in the PDML document
dataBeans - a list of DataBeans which supply data to the wizard (may be null)
owner - the owning frame
wizardStateMachine - the object that track's the user's path through the wizard panels (may be null)
resize - specifies whether the wizard should be dynamically resizable
Throws:
DisplayManagerException - if an error was encountered accessing the panel definition
Since:
v4r5m0
See Also:
DisplayManagerException, setVisible(boolean)

WizardManager

public WizardManager(String baseName,
                     Locale locale,
                     String wizardName,
                     DataBean[] dataBeans,
                     Frame owner,
                     WizardStateMachine stateMachine)
              throws DisplayManagerException
Constructs a WizardManager object for the specified wizard. The wizard will be modal, with the specified Frame as its owner. The application will block on the call to setVisible until the wizard has closed.

Parameters:
baseName - the resource name of the PDML document/resource bundle combination which define the wizard specification
locale - the desired locale to be used to load the wizard definition
wizardName - the name of the wizard, as specified on the WIZARD tag in the PDML document
dataBeans - a list of DataBeans which supply data to the wizard (may be null)
owner - the owning frame
wizardStateMachine - the object that track's the user's path through the wizard panels (may be null)
Throws:
DisplayManagerException - if an error was encountered accessing the panel definition
Since:
v4r2m0
See Also:
DisplayManagerException, setVisible(boolean)

WizardManager

public WizardManager(String baseName,
                     Locale locale,
                     String wizardName,
                     DataBean[] dataBeans,
                     Frame owner,
                     WizardStateMachine stateMachine,
                     boolean resize)
              throws DisplayManagerException
Constructs a WizardManager object for the specified wizard. The wizard will be modal, with the specified Frame as its owner. The application will block on the call to setVisible until the wizard has closed.

Parameters:
baseName - the resource name of the PDML document/resource bundle combination which define the wizard specification
locale - the desired locale to be used to load the wizard definition
wizardName - the name of the wizard, as specified on the WIZARD tag in the PDML document
dataBeans - a list of DataBeans which supply data to the wizard (may be null)
owner - the owning frame
wizardStateMachine - the object that track's the user's path through the wizard panels (may be null)
resize - specifies whether the wizard should be dynamically resizable
Throws:
DisplayManagerException - if an error was encountered accessing the panel definition
Since:
v4r5m0
See Also:
DisplayManagerException, setVisible(boolean)

WizardManager

public WizardManager(String baseName,
                     Locale locale,
                     String wizardName,
                     DataBean[] dataBeans,
                     Frame owner,
                     WizardStateMachine stateMachine,
                     boolean resize,
                     boolean loadInBackground)
              throws DisplayManagerException
Constructs a WizardManager object for the specified wizard. The wizard will be modal, with the specified Frame as its owner. The application will block on the call to setVisible until the wizard has closed.

Parameters:
baseName - the resource name of the PDML document/resource bundle combination which define the wizard specification
locale - the desired locale to be used to load the wizard definition
wizardName - the name of the wizard, as specified on the WIZARD tag in the PDML document
dataBeans - a list of DataBeans which supply data to the wizard (may be null)
owner - the owning frame
wizardStateMachine - the object that track's the user's path through the wizard panels (may be null)
resize - specifies whether the wizard should be dynamically resizable
loadInBackground - specifies whether pages should be loaded in the background. If this option is selected the first page determines the maximum size of the wizard.
Throws:
DisplayManagerException - if an error was encountered accessing the panel definition
Since:
v4r5m0
See Also:
DisplayManagerException, setVisible(boolean)

WizardManager

public WizardManager(String baseName,
                     String wizardName,
                     DataBean[] dataBeans,
                     Container container,
                     WizardStateMachine stateMachine)
              throws DisplayManagerException
Constructs a WizardManager for the specified wizard, using the specified container. This constructor allows the application to supply its own container, rather than relying on this object to create a container of the appropriate type.

The default locale will be used to load the wizard definition.

Parameters:
baseName - the resource name of the PDML document/resource bundle combination which defines the wizard specification
panelName - the name of the panel, as specified on the WIZARD tag in the PDML
dataBeans - a list of DataBeans which supply data to the wizard (may be null)
container - the application's container
wizardStateMachine - the object that track's the user's path through the wizard panels (may be null)
Throws:
DisplayManagerException - if an error was encountered accessing the panel definition
Since:
v4r2m0
See Also:
DisplayManagerException

WizardManager

public WizardManager(String baseName,
                     String wizardName,
                     DataBean[] dataBeans,
                     Container container,
                     WizardStateMachine stateMachine,
                     boolean resize)
              throws DisplayManagerException
Constructs a WizardManager for the specified wizard, using the specified container. This constructor allows the application to supply its own container, rather than relying on this object to create a container of the appropriate type.

The default locale will be used to load the wizard definition.

Parameters:
baseName - the resource name of the PDML document/resource bundle combination which defines the wizard specification
panelName - the name of the panel, as specified on the WIZARD tag in the PDML
dataBeans - a list of DataBeans which supply data to the wizard (may be null)
container - the application's container
wizardStateMachine - the object that track's the user's path through the wizard panels (may be null)
resize - specifies whether the wizard should be dynamically resizable
Throws:
DisplayManagerException - if an error was encountered accessing the panel definition
Since:
v4r5m0
See Also:
DisplayManagerException

WizardManager

public WizardManager(String baseName,
                     Locale locale,
                     String wizardName,
                     DataBean[] dataBeans,
                     Container container,
                     WizardStateMachine stateMachine)
              throws DisplayManagerException
Constructs a WizardManager for the specified wizard, using the specified container. This constructor allows the application to supply its own container, rather than relying on this object to create a container of the appropriate type.

Parameters:
baseName - the resource name of the PDML document/resource bundle combination which defines the wizard specification
locale - the desired locale to be used to load the panel definition
panelName - the name of the panel, as specified on the WIZARD tag in the PDML
dataBeans - a list of DataBeans which supply data to the wizard (may be null)
container - the application's container
wizardStateMachine - the object that track's the user's path through the wizard panels (may be null)
Throws:
DisplayManagerException - if an error was encountered accessing the panel definition
Since:
v4r2m0
See Also:
DisplayManagerException

WizardManager

public WizardManager(String baseName,
                     Locale locale,
                     String wizardName,
                     DataBean[] dataBeans,
                     Container container,
                     WizardStateMachine stateMachine,
                     boolean resize)
              throws DisplayManagerException
Constructs a WizardManager for the specified wizard, using the specified container. This constructor allows the application to supply its own container, rather than relying on this object to create a container of the appropriate type.

Parameters:
baseName - the resource name of the PDML document/resource bundle combination which defines the wizard specification
locale - the desired locale to be used to load the panel definition
panelName - the name of the panel, as specified on the WIZARD tag in the PDML
dataBeans - a list of DataBeans which supply data to the wizard (may be null)
container - the application's container
wizardStateMachine - the object that track's the user's path through the wizard panels (may be null)
resize - specifies whether the wizard should be dynamically resizable
Throws:
DisplayManagerException - if an error was encountered accessing the panel definition
Since:
v4r5m0
See Also:
DisplayManagerException

WizardManager

public WizardManager(String baseName,
                     Locale locale,
                     String wizardName,
                     DataBean[] dataBeans,
                     Container container,
                     WizardStateMachine stateMachine,
                     boolean resize,
                     boolean loadInBackground)
              throws DisplayManagerException
Constructs a WizardManager for the specified wizard, using the specified container. This constructor allows the application to supply its own container, rather than relying on this object to create a container of the appropriate type.

Parameters:
baseName - the resource name of the PDML document/resource bundle combination which defines the wizard specification
locale - the desired locale to be used to load the panel definition
panelName - the name of the panel, as specified on the WIZARD tag in the PDML
dataBeans - a list of DataBeans which supply data to the wizard (may be null)
container - the application's container
wizardStateMachine - the object that track's the user's path through the wizard panels (may be null)
resize - specifies whether the wizard should be dynamically resizable
loadInBackground - specifies whether pages should be loaded in the background. If this option is selected the first page determines the maximum size of the wizard.
Throws:
DisplayManagerException - if an error was encountered accessing the panel definition
Since:
v4r5m0
See Also:
DisplayManagerException

WizardManager

public WizardManager(String baseName,
                     Locale locale,
                     String wizardName)
              throws DisplayManagerException
Constructs a WizardManager object for the specified wizard, and then serializes the wizard definition. This constructor cannot be used to display the wizard.

If a null locale is specified, the default locale will be used to load the wizard definition. If resources for the default locale cannot be found, an attempt will be made to use the base resources for the wizard.

Parameters:
baseName - the resource name of the PDML document/resource bundle combination which define the wizard specification
locale - the desired locale to be used to load the wizard definition (may be null)
wizardName - the name of the wizard, as specified on the WIZARD tag in the PDML
Throws:
DisplayManagerException - if an error was encountered accessing or serializing the panel definition
Since:
v4r2m0
See Also:
serialize()
Method Detail

main

public static void main(String[] args)
Provides a command line interface to WizardManager. See the class description.

Since:
v4r2m0

serialize

public void serialize()
               throws IOException
Serializes the wizard definition. The filename of the serialized file will be of the form
 <wizard name>_<locale string>.pdml.ser
 
where <wizard name> is the name of the wizard as specified on the WIZARD tag in the PDML, and <locale string> consists of the ISO Language Code, ISO country or region code, and optional variant codes, each delimited by an underscore ("_") character.

Throws:
IOException - if serialized file cannot be written
Since:
v4r2m0

getBackButton

public JButton getBackButton()
Returns the wizard's Back button.

Returns:
an instance of JButton which represents this wizard's Back button
Since:
v4r2m0

getNextButton

public JButton getNextButton()
Returns the wizard's Next button.

Returns:
an instance of JButton which represents this wizard's Next button
Since:
v4r2m0

getCancelButton

public JButton getCancelButton()
Returns the wizard's Cancel button.

Returns:
an instance of JButton which represents this wizard's Cancel button
Since:
v4r2m0

getFinishButton

public JButton getFinishButton()
Returns the wizard's Finish button.

Returns:
an instance of JButton which represents this wizard's Finish button
Since:
v4r2m0

setExitOnClose

public void setExitOnClose(boolean exit)
Controls whether the application exits when the wizard is closed, based on the value of parameter exit. The default value is false.

This method should be called before the wizard is made visible.

Parameters:
exit - If true, exit the application; otherwise, just hide the panel.
Since:
v4r2m0
See Also:
getExitOnClose()

getExitOnClose

public boolean getExitOnClose()
Determines whether the application exits when this wizard is closed.

Returns:
true if the application will be exited; false otherwise.
Since:
v4r2m0
See Also:
setExitOnClose(boolean)

setVisible

public void setVisible(boolean show)
Shows or hides the wizard, depending on the value of parameter show. If an owner frame was specified on the constructor indicating that the wizard is modal, the application will block on the call to setVisible until the wizard has closed.

Specified by:
setVisible in interface WindowManager
Parameters:
show - If true, shows the wizard; otherwise, hides the wizard.
Since:
v4r2m0
See Also:
isVisible(), WindowManager

isVisible

public boolean isVisible()
Determines whether this wizard is visible. The wizard is initially invisible.

Specified by:
isVisible in interface WindowManager
Returns:
true if the wizard is visible; false otherwise.
Since:
v4r2m0
See Also:
setVisible(boolean), WindowManager

getPreferredSize

public Dimension getPreferredSize()
Gets the preferred size of this wizard.

Returns:
A dimension object indicating this wizard's preferred size.
Since:
v4r2m0

setFormatter

public void setFormatter(String componentName,
                         DataFormatter formatter,
                         boolean required)
Sets the data formatter associated with the specified user interface component. The name of the component must be of the form
<panel_name>.<component_name>
where panel_name is the name of the panel containing the desired component, and component_name is the name of the component, as defined in the PDML for the panel definition.

Specified by:
setFormatter in interface PaneManager
Parameters:
componentName - the fully-qualified name of the user interface component
formatter - a reference to the data formatter to be associated with the component
required - whether a value is required to be entered
Since:
v4r2m0
See Also:
DataFormatter

getFormatter

public DataFormatter getFormatter(String componentName)
Returns the data formatter associated with the specified user interface component. The name of the component must be of the form
<panel_name>.<component_name>
where panel_name is the name of the panel containing the desired component, and component_name is the name of the component, as defined in the PDML for the panel definition.

Specified by:
getFormatter in interface PaneManager
Parameters:
componentName - the fully-qualified name of the user interface component
Returns:
the associated DataFormatter, or null if the component cannot be found
Since:
v4r2m0
See Also:
DataFormatter

getTitle

public String getTitle()
Returns the wizard's title. This method has no implementation, since the wizard's title is dependent on which page is currently displayed.

Specified by:
getTitle in interface PaneManager
Returns:
the title specified in the PDML definition for the pane
Since:
v4r2m0
See Also:
PaneManager

setTitle

public void setTitle(String title)
Sets the title for the currently displayed Page

Parameters:
title - The title to be set on the panel
Since:
v5r1m0
See Also:
PaneManager

setTitle

public void setTitle(String title,
                     String pageName)
Sets the title for the page identified by pageName

Parameters:
title - The title to be set on the panel
pageName - The name of the page to set apply the title to
Since:
v5r1m0
See Also:
PaneManager

loadData

public void loadData()
Called during initialization to load data into the panel. This method has no implementation, since WizardManager doesn't participate in aggregates.

Specified by:
loadData in interface PaneManager
Since:
v4r2m0
See Also:
PaneManager

activatePanel

public void activatePanel()
Runs the activation handlers for the currently selected pane. This method has no implementation, since WizardManager isn't managed as a subpanel.

Specified by:
activatePanel in interface PaneManager
Since:
v4r2m0
See Also:
PaneManager

showPane

public void showPane(String paneName)
Displays the specified pane. This method has no implementation, since WizardManager isn't managed as a subpanel.

Specified by:
showPane in interface PaneManager
Parameters:
paneName - the name of the pane to be displayed, as defined in the PDML for this PaneManager
Since:
v4r2m0
See Also:
PaneManager

getComponent

public Component getComponent(String componentName)
Returns the requested user interface component. The name of the component must be of the form
<panel_name>.<component_name>
where panel_name is the name of the panel containing the desired component, and component_name is the name of the component, as defined in the PDML for the panel definition.

Specified by:
getComponent in interface PaneManager
Parameters:
componentName - the fully-qualified name of the user interface component
Returns:
the desired Component, or null if the component cannot be found
Since:
v4r2m0
See Also:
PaneManager

refreshComponent

public void refreshComponent(String qualifiedName)
Calls the associated dataBeans gettor method for a component. The name of the component must be of the form
<panel_name>.<component_name>
where panel_name is the name of the panel containing the desired component, and component_name is the name of the component, as defined in the PDML for the panel definition.

Parameters:
qualifiedName - the fully-qualified name of the user interface component
Since:
v4r2m0
See Also:
PanelManager.refreshComponent(java.lang.String)

getComponentDescriptor

public com.ibm.as400.ui.framework.java.JavaComponentDescriptor getComponentDescriptor(String componentName)
Returns the JavaComponentDescriptor for the specified user interface component. The name of the component must be of the form
<panel_name>.<component_name>
where panel_name is the name of the panel containing the desired component, and component_name is the name of the component, as defined in the PDML for the panel definition.

Specified by:
getComponentDescriptor in interface PaneManager
Parameters:
componentName - the fully-qualified name of the user interface component
Returns:
the desired JavaComponentDescriptor, or null if the descriptor cannot be found
Since:
v4r2m0
See Also:
PaneManager

getDelegateManager

public PaneManager getDelegateManager(String paneName)
Returns the PaneManager to which the receiver is delegating management of the specified subpane.

Specified by:
getDelegateManager in interface PaneManager
Parameters:
paneName - the name of the pane as specified in the PDML definition
Returns:
the desired PaneManager, or null if the object cannot be found
Since:
v4r2m0
See Also:
PaneManager

setAggregateManager

public void setAggregateManager(PaneManager mgr)
Sets the owning PaneManager for the receiver. This method has no implementation, since WizardManager doesn't participate in aggregates.

Specified by:
setAggregateManager in interface PaneManager
Parameters:
mgr - the PaneManager with which the receiver is to be associated
Since:
v4r2m0
See Also:
PaneManager

getAggregateManager

public PaneManager getAggregateManager()
Returns the owning PaneManager for the receiver.

Specified by:
getAggregateManager in interface PaneManager
Returns:
the PaneManager with which the receiver is associated when this object is participating in an aggregate user interface, or null if this PaneManager is not part of an aggregate.
Since:
v4r5m0
See Also:
PaneManager

getRootManager

public PaneManager getRootManager()
Returns the root PaneManager for the receiver.

Specified by:
getRootManager in interface PaneManager
Returns:
the PaneManager for the main panel that is managing the aggregate user interface, or null if this PaneManager is not part of an aggregate.
Since:
v4r5m0
See Also:
PaneManager

applyChanges

public void applyChanges()
Transmits changes to user data to the DataBeans which manage the data. This method has no implementation, since WizardManager doesn't participate in aggregates.

Specified by:
applyChanges in interface PaneManager
Since:
v4r2m0
See Also:
PaneManager

prepareToCommit

public void prepareToCommit(Vector preparedDataBeans)
Request the DataBeans which manage data for the panel to verify that their data is in a consistent state. This method has no implementation, since WizardManager doesn't participate in aggregates.

Specified by:
prepareToCommit in interface PaneManager
Parameters:
preparedDataBeans - a list of DataBeans which have already been prepared on the current commit operation
Since:
v4r2m0
See Also:
PaneManager

commit

public void commit(Vector committedDataBeans)
Commits the changes to data displayed on the panel. This method has no implementation, since WizardManager doesn't participate in aggregates.

Specified by:
commit in interface PaneManager
Parameters:
committedDataBeans - a list of DataBeans which have already been saved on the current commit operation
Since:
v4r2m0
See Also:
PaneManager

getWindow

public Window getWindow()
Returns the main wizard window. The window may be either an instance of JDialog or JFrame, depending on whether the wizard is modal or modeless.

Specified by:
getWindow in interface WindowManager
Returns:
the main window for this wizard
Since:
v4r2m0

setModalRelativeTo

public void setModalRelativeTo(WindowManager mgr)
Sets the location of the panel being managed relative to a panel managed by the specified WindowManager. If the panel is not currently showing, the panel for this WizardManager is centered on the screen.

This method has no effect if it is called after this wizard is made visible.

Specified by:
setModalRelativeTo in interface WindowManager
Parameters:
mgr - the WindowManager managing the panel in relation to which this object's panel location is determined
Since:
v4r2m0

getOwnerManager

public WindowManager getOwnerManager()
Returns the WindowManager in relation to which the receiver has been set modal, or null if the receiver is not modal relative to another window.

Specified by:
getOwnerManager in interface WindowManager
Returns:
the WindowManager managing the window in relation to which this object's window location is determined
Since:
v4r5m0
See Also:
WindowManager

addCommitListener

public void addCommitListener(ActionListener listener)
Adds an ActionListener which is notified when commit processing is complete.

This facility is provided for modeless windows, so that the application may learn when the window has closed. The listener's actionPerformed method will be called following successful completion of commit processing on the wizard. The ActionEvent passed to the listener object will have its action command string set to "COMMIT".

This method is not recommended for modal windows, since the application will be blocked on the setVisible call until the window is closed.

Specified by:
addCommitListener in interface WindowManager
Parameters:
listener - the instance of java.awt.event.ActionListener to be notified
Since:
v4r2m0
See Also:
WindowManager

addCommitListener

public void addCommitListener(Object listener)
Specified by:
addCommitListener in interface WindowManager
Since:
v5r1m0

addCancelListener

public void addCancelListener(ActionListener listener)
Adds an ActionListener which is notified when the user cancels out of a window.

This facility is provided for modeless windows, so that the application may learn when the window has closed. The listener's actionPerformed method will be called when the user cancels out of the wizard without committing any changes. The ActionEvent passed to the listener object will have its action command string set to "CANCEL".

This method is not recommended for modal windows, since the application will be blocked on the setVisible call until the window is closed.

Specified by:
addCancelListener in interface WindowManager
Parameters:
listener - the instance of java.awt.event.ActionListener to be notified
Since:
v4r2m0
See Also:
WindowManager

addCancelListener

public void addCancelListener(Object listener)
Specified by:
addCancelListener in interface WindowManager
Since:
v5r1m0

dispose

public void dispose()
Closes the panel and releases all resources used by the panel and its associated UI components.

Specified by:
dispose in interface WindowManager
Since:
v5r1m0
See Also:
WindowManager

handleDataException

public void handleDataException(IllegalUserDataException ex)
Provides the default handling for an IllegalUserDataException. If the exception message is non-null it will be displayed to the user in a message box. After the message box is closed, focus is set to the component identified in the exception object so that the user can change the data to a valid value.

Specified by:
handleDataException in interface WindowManager
Parameters:
ex - The IllegalUserDataException for which default handling is requested.
Since:
v5r1m0
See Also:
WindowManager, applyChanges()

getSaveOnThread

public boolean getSaveOnThread()
Indicates whether calls to the save method on the application's DataBean objects will be called on a non-UI thread.

Returns:
true if the save method will be called on a non-UI thread; false if the save methods will be called on the AWT event dispatch thread.
Since:
v5r1m0
See Also:
setSaveOnThread(boolean)

setSaveOnThread

public void setSaveOnThread(boolean saveOnThread)
Controls whether calls to the save method on the application's DataBean objects will be called on a non-UI thread. The default is false.

In general, requesting save method calls on a non-UI thread is the recommended approach. This is because save is typically a long-running method, and if it executes on the UI thread the application's UI will not respond to user input until the save operation completes. Requesting a non-UI thread solves this problem - the panel managed by this PanelManager will be disabled for the duration of the save operation, but the application's other windows will be unaffected and continue to behave normally.

The downside to calling save on a thread is that any UI calls in the save method must be queued on the UI thread via the SwingUtilities.invokeLater mechanism. A convenient way to do this is to bracket UI code with the following:

 SwingUtilities.invokeLater(new Runnable() {
     public void run() {
        <your UI code here>
     }
 });
 
Using this technique the UI code still has access to member fields of the enclosing class. Local variables should either be enclosed in the inner class or declared final.

Parameters:
saveOnThread - If true, call the save method on a non-UI thread; otherwise, call the save method on the AWT event dispatch thread.
Since:
v5r1m0
See Also:
getSaveOnThread()

setHelpPath

public void setHelpPath(String path)
Description copied from interface: PaneManager
Base location for help files. For use in the no-plugin applet case. For example for MyPanel, setHelpPath("http://www.ibm.com/help/") will cause the PanelManager to load http://www.ibm.com/help/MyPanel.html as the help file.

Specified by:
setHelpPath in interface PaneManager

addPanel

public void addPanel(PanelManager pm,
                     int index,
                     int stepIndex)
Adds a panel to the wizard managed by the receiver. This method has no effect if it is called after the wizard is made visible.

Parameters:
pm - the PanelManager for the new panel
index - the position at which the new page will be inserted
stepIndex - maps the wizard panel to one of the steps defined in the PDML for the wizard
Throws:
ArrayIndexOutOfBoundsException - if the value of the specified index exceeds the current page count
Since:
v4r5m0

getPage

public PanelManager getPage(int index)
Returns the PanelManager for the specified wizard page.

Parameters:
index - the index of the wizard page
Returns:
the PanelManager instance for the page
Throws:
ArrayIndexOutOfBoundsException - if the value of the specified index is not less than the page count
Since:
v4r5m0

getPage

public PanelManager getPage(String name)
Returns the PanelManager for the specified wizard page.

Parameters:
name - the name of the wizard page as specified in the PDML
Returns:
the PanelManager instance for the page, or null if the specified page is not found
Since:
v4r5m0

removePanel

public void removePanel(int index)
Removes a panel from the wizard managed by the receiver. This method has no effect if it is called after the wizard is made visible.

Parameters:
index - the index of the page to be removed
Throws:
ArrayIndexOutOfBoundsException - if the value of the specified index exceeds the current page count minus 1
Since:
v4r5m0

addButtons

public void addButtons(int flags)
Adds the Back, Next, Finish, Cancel or Help buttons to the wizard panel if they have been previously removed.

Parameters:
flags - button constants indicating which buttons should be added
Since:
v4r5m0
See Also:
removeButtons(int), enableButtons(int), disableButtons(int), BACK_BUTTON, NEXT_BUTTON, FINISH_BUTTON, CANCEL_BUTTON, HELP_BUTTON

removeButtons

public void removeButtons(int flags)
Removes the Back, Next, Finish, Cancel or Help buttons from the wizard panel.

Parameters:
flags - button constants indicating which buttons should be removed
Since:
v4r5m0
See Also:
addButtons(int), enableButtons(int), disableButtons(int), BACK_BUTTON, NEXT_BUTTON, FINISH_BUTTON, CANCEL_BUTTON, HELP_BUTTON

enableButtons

public void enableButtons(int flags)
Enables the Back, Next, Finish, Cancel or Help buttons on the wizard panel if they have been previously disabled.

Parameters:
flags - button constants indicating which buttons should be enabled
Since:
v4r5m0
See Also:
disableButtons(int), addButtons(int), removeButtons(int), BACK_BUTTON, NEXT_BUTTON, FINISH_BUTTON, CANCEL_BUTTON, HELP_BUTTON

disableButtons

public void disableButtons(int flags)
Disables the Back, Next, Finish, Cancel or Help buttons on the wizard panel.

Parameters:
flags - button constants indicating which buttons should be disabled
Since:
v4r5m0
See Also:
enableButtons(int), addButtons(int), removeButtons(int), BACK_BUTTON, NEXT_BUTTON, FINISH_BUTTON, CANCEL_BUTTON, HELP_BUTTON

addUserButton

public void addUserButton(String buttonId,
                          String text,
                          ActionListener listener,
                          ImageIcon imageIcon)
                   throws IllegalArgumentException
Adds a user defined button to the wizard panel in addition to the standard Back, Next, Cancel, Finish and Help buttons.

Parameters:
buttonId - the String that will be used to identify this button in subsequent calls.
text - the String that is to appear on the button.
listener - the ActionListener to be notified when the button is pressed.
imageIcon - the ImageIcon that will be placed on the button. This parameter may be null.
Throws:
IllegalArgumentException -
  • if the text parameter is a duplicate for a button that already exists.
  • if the buttonId is null.
  • if the text is null.
  • if the listener is null.
Since:
v5r1m0
See Also:
removeUserButton(java.lang.String), enableUserButton(java.lang.String), disableUserButton(java.lang.String), getUserButton(java.lang.String)

removeUserButton

public void removeUserButton(String buttonId)
                      throws IllegalArgumentException
Remove a user defined button that was previously added with addUserButton.

Parameters:
buttonId - the same String that was passed in as the buttonId on the addUserButton call.
Throws:
IllegalArgumentException - if the requested user defined button does not exist or if the buttonId parameter is null.
Since:
v5r1m0
See Also:
addUserButton(java.lang.String, java.lang.String, java.awt.event.ActionListener, javax.swing.ImageIcon), enableUserButton(java.lang.String), disableUserButton(java.lang.String), getUserButton(java.lang.String)

getUserButton

public JButton getUserButton(String buttonId)
                      throws IllegalArgumentException
Returns one of the wizard's user defined buttons.

Parameters:
buttonId - the same String that was passed in as the buttonId on the addUserButton call.
Returns:
an instance of the user defined button identified by the string passed in.
Throws:
IllegalArgumentException - if the requested user defined button does not exist or if the buttonId parameter is null.
Since:
v5r1m0
See Also:
addUserButton(java.lang.String, java.lang.String, java.awt.event.ActionListener, javax.swing.ImageIcon), removeUserButton(java.lang.String), enableUserButton(java.lang.String), disableUserButton(java.lang.String)

enableUserButton

public void enableUserButton(String buttonId)
                      throws IllegalArgumentException
Enable a user defined button that was previously added with addUserButton.

Parameters:
buttonId - the same String that was passed in as the buttonId on the addUserButton call.
Throws:
IllegalArgumentException - if the requested user defined button does not exist or if the buttonId parameter is null.
Since:
v5r1m0
See Also:
disableUserButton(java.lang.String), addUserButton(java.lang.String, java.lang.String, java.awt.event.ActionListener, javax.swing.ImageIcon), removeUserButton(java.lang.String), getUserButton(java.lang.String)

disableUserButton

public void disableUserButton(String buttonId)
                       throws IllegalArgumentException
Disable (gray out) a user defined button that was previously added with addUserButton.

Parameters:
buttonId - the same String that was passed in as the buttonId on the addUserButton call.
Throws:
IllegalArgumentException - if the requested user defined button does not exist or if the buttonId parameter is null.
Since:
v5r1m0
See Also:
enableUserButton(java.lang.String), addUserButton(java.lang.String, java.lang.String, java.awt.event.ActionListener, javax.swing.ImageIcon), removeUserButton(java.lang.String), getUserButton(java.lang.String)

addBackListener

public void addBackListener(ActionListener listener)
Adds an ActionListener which is notified when the user presses the "Back" button.

This facility is provided so the application can be notified when the back button has been pressed. The listener's actionPerformed method will be called when the user presses the Back button. The ActionEvent passed to the listener object will have its action command string set to "BACK".

Parameters:
listener - the ActionListener to be notified
Since:
v5r1m0

setLoadOnPageSwap

public void setLoadOnPageSwap(boolean b)
Sets a flag defining whether data should be loaded from the databeans on every page switch

Parameters:
b - true if data should be loaded on a page swap, false otherwise. (default is false)
Since:
v5r1m0
See Also:
isLoadOnPageSwap()

isLoadOnPageSwap

public boolean isLoadOnPageSwap()
Returns a flag indicating whether data is loaded from the databeans on every page switch

Returns:
true if data is loaded on a page swap, false otherwise.
Since:
v5r1m0
See Also:
setLoadOnPageSwap(boolean)