org.netbeans.api.wizard
Class WizardDisplayer

java.lang.Object
  extended by org.netbeans.api.wizard.WizardDisplayer

public abstract class WizardDisplayer
extends java.lang.Object

Displaying Wizards

Factory which can display a Wizard in a dialog onscreen or in an ad-hoc container. Usage:
 Wizard wizard = WizardPage.createWizard (new Class[] {WizardPageSubclass1.class,
     WizardPageSubclass2.class, WizardPageSubclass3.class}, 
     new MyWizardResultProducer();
 WizardDisplayer.showWizard (wizard);
 
Alternately you can implement WizardPanelProvider instead of WizardPage to provide the panels of the wizard.

To use a Wizard in a JInternalFrame or similar, use WizardDisplayer.installInContainer(). You will need to implement WizardResultReceiver which will me notified when the wizard is finished or cancelled, to close the internal frame or whatever UI is showing the wizard.

Customizing the default implementation

The image on the left panel of the default implementation can be customized in the following ways:

Providing a custom WizardDisplayer:

The implementation of WizardDisplayer is pluggable. While the default implementation should be adequate for most cases, it is possible that in some cases one might want to completely replace the UI, buttons, etc. with custom UI code. To do that:

Author:
Tim Boudreau

Constructor Summary
Modifier Constructor and Description
protected WizardDisplayer()
           
 
Method Summary
Modifier and Type Method and Description
protected abstract  void install(java.awt.Container c, java.lang.Object layoutConstraint, Wizard awizard, javax.swing.Action helpAction, java.util.Map initialProperties, WizardResultReceiver receiver)
          Instance implementation of installInContainer().
static void installInContainer(java.awt.Container c, java.lang.Object layoutConstraint, Wizard awizard, javax.swing.Action helpAction, java.util.Map initialProperties, WizardResultReceiver receiver)
          Install a panel representing a Wizard in a user-supplied container with a user-supplied layout constraint.
protected abstract  java.lang.Object show(Wizard wizard, java.awt.Rectangle r, javax.swing.Action help, java.util.Map initialProperties)
          Show a wizard.
static java.lang.Object showWizard(Wizard wizard)
          Show a wizard with default window placement and no Help button
static java.lang.Object showWizard(Wizard wizard, javax.swing.Action help)
          Show a wizard with default window placement, showing the help button, which will invoke the passed action.
static java.lang.Object showWizard(Wizard wizard, java.awt.Rectangle r)
          Show a wizard in the passed location on screen with no help button
static java.lang.Object showWizard(Wizard wizard, java.awt.Rectangle rect, javax.swing.Action help, java.util.Map initialProperties)
          Display a wizard in a dialog, using the default implementation of WizardDisplayer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WizardDisplayer

protected WizardDisplayer()
Method Detail

showWizard

public static java.lang.Object showWizard(Wizard wizard,
                                          java.awt.Rectangle rect,
                                          javax.swing.Action help,
                                          java.util.Map initialProperties)
Display a wizard in a dialog, using the default implementation of WizardDisplayer.

Parameters:
wizard - The wizard to show. Must not be null
rect - The rectangle on screen for the wizard, may be null for default size
help - An action to invoke if the user presses the help button
initialProperties - are the initial values for properties to be shown and entered in the wizard. May be null.

showWizard

public static java.lang.Object showWizard(Wizard wizard)
Show a wizard with default window placement and no Help button


showWizard

public static java.lang.Object showWizard(Wizard wizard,
                                          javax.swing.Action help)
Show a wizard with default window placement, showing the help button, which will invoke the passed action.

Parameters:
wizard - The wizard to show
help - An action to invoke if the user presses the help button
Returns:
The result of Wizard.finish()

showWizard

public static java.lang.Object showWizard(Wizard wizard,
                                          java.awt.Rectangle r)
Show a wizard in the passed location on screen with no help button

Parameters:
wizard - The wizard to show
r - The rectangle on screen for the wizard
Returns:
The result of Wizard.finish()

show

protected abstract java.lang.Object show(Wizard wizard,
                                         java.awt.Rectangle r,
                                         javax.swing.Action help,
                                         java.util.Map initialProperties)
Show a wizard.

Parameters:
wizard - the Wizard to show
r - the bounding rectangle for the wizard dialog on screen, null means "computed from first panel size"
help - An action to be called if the Help button is pressed
initialProperties - are used to set initial values for screens within the wizard. This may be null.
Returns:
Whatever object the wizard returns from its finish() method, if the Wizard was completed by the user.

installInContainer

public static void installInContainer(java.awt.Container c,
                                      java.lang.Object layoutConstraint,
                                      Wizard awizard,
                                      javax.swing.Action helpAction,
                                      java.util.Map initialProperties,
                                      WizardResultReceiver receiver)
Install a panel representing a Wizard in a user-supplied container with a user-supplied layout constraint.

Parameters:
c - The container the wizard panel should be added to. May not be null.
layoutConstraint - The argument to use when adding the wizard's ui component to the container. May be null.
helpAction - An action that should be invoked when the help button is clicked (if null, no help button will be displayed)
initialProperties - A set of properties that should be pre-set upon entering the wizard. May be null.
receiver - An object which will be called when the Finish or Cancel buttons are pressed. May not be null.

install

protected abstract void install(java.awt.Container c,
                                java.lang.Object layoutConstraint,
                                Wizard awizard,
                                javax.swing.Action helpAction,
                                java.util.Map initialProperties,
                                WizardResultReceiver receiver)
Instance implementation of installInContainer().