org.openide
Class WizardDescriptor

java.lang.Object
  |
  +--org.openide.NotifyDescriptor
        |
        +--org.openide.DialogDescriptor
              |
              +--org.openide.WizardDescriptor
Direct Known Subclasses:
TemplateWizard

public class WizardDescriptor
extends DialogDescriptor

Implements a basic "wizard" GUI system. A list of wizard panels may be specified and these may be traversed at the proper times using the "Previous" and "Next" buttons (or "Finish" on the last one).

See Also:
TopManager.createDialog(org.openide.DialogDescriptor)

Inner Class Summary
static class WizardDescriptor.ArrayIterator
          Special iterator that works on an array of Panels.
static interface WizardDescriptor.FinishPanel
          A special interface for panels in middle of the iterators path that would like to have the finish button enabled.
static interface WizardDescriptor.Iterator
          Iterator on the sequence of panels.
static interface WizardDescriptor.Panel
          One wizard panel with a component on it.
 
Inner classes inherited from class org.openide.NotifyDescriptor
NotifyDescriptor.Confirmation, NotifyDescriptor.Exception, NotifyDescriptor.InputLine, NotifyDescriptor.Message
 
Field Summary
static Object FINISH_OPTION
          "Finish" button option.
static Object NEXT_OPTION
          "Next" button option.
static Object PREVIOUS_OPTION
          "Previous" button option.
 
Fields inherited from class org.openide.DialogDescriptor
BOTTOM_ALIGN, DEFAULT_ALIGN, PROP_BUTTON_LISTENER, PROP_CLOSING_OPTIONS, PROP_HELP_CTX, PROP_MODAL, PROP_OPTIONS_ALIGN, RIGHT_ALIGN
 
Fields inherited from class org.openide.NotifyDescriptor
CANCEL_OPTION, CLOSED_OPTION, DEFAULT_OPTION, ERROR_MESSAGE, INFORMATION_MESSAGE, NO_OPTION, OK_CANCEL_OPTION, OK_OPTION, PLAIN_MESSAGE, PROP_DETAIL, PROP_MESSAGE, PROP_MESSAGE_TYPE, PROP_OPTION_TYPE, PROP_OPTIONS, PROP_TITLE, PROP_VALID, PROP_VALUE, QUESTION_MESSAGE, WARNING_MESSAGE, YES_NO_CANCEL_OPTION, YES_NO_OPTION, YES_OPTION
 
Constructor Summary
WizardDescriptor(WizardDescriptor.Iterator panels)
          Create wizard for a sequence of panels, with settings defaulted to this.
WizardDescriptor(WizardDescriptor.Iterator panels, Object settings)
          Create wizard for a sequence of panels, passing some settings to the panels.
WizardDescriptor(WizardDescriptor.Panel[] wizardPanels)
          Create a new wizard from a fixed list of panels with settings defaulted to this.
WizardDescriptor(WizardDescriptor.Panel[] wizardPanels, Object settings)
          Create a new wizard from a fixed list of panels, passing some settings to the panels.
 
Method Summary
 Object getProperty(String name)
          Getter for stored property.
 MessageFormat getTitleFormat()
          Getter for current format to be used to format title.
 Object getValue()
          Overriden to ensure that returned value is one of the XXX_OPTION constants.
protected  void initialize()
          Initializes settings.
 void putProperty(String name, Object value)
          Allows Panels that use WizardDescriptor as settings object to store additional settings into it.
 void setAdditionalOptions(Object[] options)
          Define an explicit description of the set of additional user-selectable options.
 void setClosingOptions(Object[] options)
          Setter for list of options that close the dialog.
 void setOptions(Object[] options)
          Set options permitted by the wizard considered as a DialogDescriptor.
 void setPanels(WizardDescriptor.Iterator panels)
          Set a different list of panels.
 void setTitleFormat(MessageFormat format)
          Sets the message format to create title of the wizard.
 void setValue(Object value)
          Overrides superclass method.
protected  void updateState()
          Updates buttons to reflect the current state of the panels.
 
Methods inherited from class org.openide.DialogDescriptor
getButtonListener, getClosingOptions, getHelpCtx, getOptionsAlign, isModal, setButtonListener, setHelpCtx, setModal, setOptionsAlign
 
Methods inherited from class org.openide.NotifyDescriptor
addPropertyChangeListener, firePropertyChange, getAdditionalOptions, getMessage, getMessageType, getOptions, getOptionType, getTitle, getTitleForType, isValid, removePropertyChangeListener, setMessage, setMessageType, setOptionType, setTitle, setValid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEXT_OPTION

public static final Object NEXT_OPTION
"Next" button option.
See Also:
setOptions(java.lang.Object[])

FINISH_OPTION

public static final Object FINISH_OPTION
"Finish" button option.
See Also:
setOptions(java.lang.Object[])

PREVIOUS_OPTION

public static final Object PREVIOUS_OPTION
"Previous" button option.
See Also:
setOptions(java.lang.Object[])
Constructor Detail

WizardDescriptor

public WizardDescriptor(WizardDescriptor.Panel[] wizardPanels,
                        Object settings)
Create a new wizard from a fixed list of panels, passing some settings to the panels.
Parameters:
wizardPanels - the panels to use
settings - the settings to pass to panels, or null
See Also:
WizardDescriptor(WizardDescriptor.Iterator, Object)

WizardDescriptor

public WizardDescriptor(WizardDescriptor.Panel[] wizardPanels)
Create a new wizard from a fixed list of panels with settings defaulted to this.
Parameters:
wizardPanels - the panels to use
See Also:
WizardDescriptor(WizardDescriptor.Iterator, Object)

WizardDescriptor

public WizardDescriptor(WizardDescriptor.Iterator panels,
                        Object settings)
Create wizard for a sequence of panels, passing some settings to the panels.
Parameters:
panels - iterator over all WizardDescriptor.Panels that can appear in the wizard
settings - the settings to provide to the panels (may be any data understood by them)
See Also:
WizardDescriptor.Panel.readSettings(java.lang.Object), WizardDescriptor.Panel.storeSettings(java.lang.Object)

WizardDescriptor

public WizardDescriptor(WizardDescriptor.Iterator panels)
Create wizard for a sequence of panels, with settings defaulted to this.
Parameters:
panels - iterator over all WizardDescriptor.Panels that can appear in the wizard
Method Detail

initialize

protected void initialize()
Initializes settings.
Overrides:
initialize in class NotifyDescriptor

setPanels

public final void setPanels(WizardDescriptor.Iterator panels)
Set a different list of panels. Correctly updates the buttons.
Parameters:
panels - the new list of WizardDescriptor.Panels

setOptions

public void setOptions(Object[] options)
Set options permitted by the wizard considered as a DialogDescriptor. Substitutes tokens such as NEXT_OPTION with the actual button.
Overrides:
setOptions in class NotifyDescriptor
Parameters:
options - the options to set

setAdditionalOptions

public void setAdditionalOptions(Object[] options)
Description copied from class: NotifyDescriptor
Define an explicit description of the set of additional user-selectable options. Additional options are supposed to be used for help button, etc.

The usual value for the options parameter is an array of Strings. But the parameter type is an array of Objects. Its interpretation depends on its type:

Component
The component is added to the button row directly.
Icon
A JButton is created with this icon as its label.
anything else
The Object is converted to a string and the result is used to label a JButton.
Overrides:
setAdditionalOptions in class NotifyDescriptor
Parameters:
options - the options to set

setClosingOptions

public void setClosingOptions(Object[] options)
Description copied from class: DialogDescriptor
Setter for list of options that close the dialog. Special values are:
Overrides:
setClosingOptions in class DialogDescriptor
Parameters:
options - the options to set

getValue

public Object getValue()
Overriden to ensure that returned value is one of the XXX_OPTION constants.
Overrides:
getValue in class NotifyDescriptor
Following copied from class: org.openide.NotifyDescriptor
Returns:
an Object indicating the option selected by the user
See Also:
NotifyDescriptor.setValue(java.lang.Object)

setTitleFormat

public void setTitleFormat(MessageFormat format)
Sets the message format to create title of the wizard. The format can take two parameters. The name of the current component and the name returned by the iterator that defines the order of panels. The default value is something like
   {0} wizard {1}
 
That can be expanded to something like this
   EJB wizard (1 of 8)
 
This method allows anybody to provide own title format.
Parameters:
format - message format to the title

getTitleFormat

public MessageFormat getTitleFormat()
Getter for current format to be used to format title.
Returns:
the format
See Also:
setTitleFormat(java.text.MessageFormat)

putProperty

public void putProperty(String name,
                        Object value)
Allows Panels that use WizardDescriptor as settings object to store additional settings into it.
Parameters:
name - name of the property
value - value of property

getProperty

public Object getProperty(String name)
Getter for stored property.
Parameters:
name - name of the property
Returns:
the value

updateState

protected void updateState()
Updates buttons to reflect the current state of the panels. Can be overridden by subclasses to change the options to special values. In such a case use:

   super.updateState ();
   setOptions (...);
 

setValue

public void setValue(Object value)
Overrides superclass method. Adds reseting of wizard for CLOSED_OPTION.
Overrides:
setValue in class NotifyDescriptor
Following copied from class: org.openide.NotifyDescriptor
Parameters:
newValue - the chosen value
See Also:
NotifyDescriptor.getValue()


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.