# Wizard Descriptor API

Class `WizardDescriptor` allows developer to create wizard from supplied `WizardDescriptor.Iterator` or array of `WizardDesriptor.Panel`.
`WizardDescriptor` can create wizard panel (steps, graphics, help on the left; subtitle and user panel on the right). To achieve that, developer have to use `WizardDescriptor.putProperty()` or `JComponent.putClientProperty()` in his/her panel to set needed properties (e.g. `String[]` for steps, `URL` for help, some `Boolean` for layout control, ...).
To create simple wizard try this:

    WizardDescriptor wd = new WizardDescriptor(
        new WizardDescriptor.Panel[] {
            myPanel1,
            myPanel2,
            myPanel3,
            myPanel4
    });

It will create four steps wizard with no additional graphic. To achieve creation of subtitle, steps pane, help tab, ... one have to set initialization properties.

## Wizard panel initialization

Use `WizardDescriptor.putProperty()` to set following initialization properties.

- `Name `"WizardPanel_autoWizardStyle"`, type `Boolean`
  The key property for layouting of wizard dialog. Recommended to be set `Boolean.TRUE` to most cases.
  If switch on `WizardPanel_autoWizardStyle` then wizard can display wizards steps on the left side, create a subtitle on active panel, display of error messages and others. Wizards infrastructure will check the properties:
  - `WizardPanel_contentDisplayed`
  - `WizardPanel_helpDisplayed`
  - `WizardPanel_contentNumbered`
  If doesn't set or set to `Boolean.FALSE` then these properties are ignored.
  Also set to `Boolean.TRUE` to turn on subtitle creation from `WizardDesriptor.Panel.getComponent()``.getName()` as first and `WizardDescriptor.Iterator.name()` as second parameter in subtitle format set with `WizardDesriptor.setTitleFormat()`. Default subtitle format is `"{0} wizard ({1})"` and name of default `WizardDescriptor.ArrayIterator` is `"{0} of {1}"` where `{0}` is number of current panel and `{1}` is size of iterator.
  `
- `Name `"WizardPanel_contentDisplayed"`, type `Boolean`
  Set to `Boolean.TRUE` to turn on displaying of steps pane (content, behind which can be displayed image). Content will be constructed from not initialization property `"WizardPanel_contentData"`.`
- `Name `"WizardPanel_helpDisplayed"`, type `Boolean`
  Set to `Boolean.TRUE` to turn on displaying of help (html browser) in a special tabbed pane of wizard panel.
  Help will be taken from not initialization property `"WizardPanel_helpURL"`. If also steps are displayed then put help and content panes into tabbed pane.
  Note: If do you need a help on invoking the Help button then ensure a `WizardDescriptor.Panel` supply a non-default `HelpCtx`.`
- `Name `"WizardPanel_contentNumbered"`, type `Boolean`
  Set to `Boolean.TRUE` to turn on numbering of steps (before every step is placed it's sequence number).`
- `Name `"WizardPanel_leftDimension"`, type `Dimension`
  Set size of left pane (steps and help pane).`

That was initialization part. All `Boolean` properties are `Boolean.FALSE` by default. Initialization properties could be set also in the first panel (through `JComponent.putClientProperty()`) of supplied iterator. Later change of these properties will not cause change of wizard behavior. Properties have to be set before `TopManager.getDefault().createDialog(wd)` is called.
Follow properties which could be changed at wizard runtime.

## Wizard panel properties

These properties could be changed dynamically.

- `Name `"WizardPanel_contentData"`, type `String[]`
  Set step names which will be displayed in the content pane.
  `
- `Name `"WizardPanel_image"`, type `java.awt.Image`
  Set image displayed as background of content.`
- `Set subtitle (!!!) format with `WizardDescriptor.setTitleFormat()`.`
- `Set title of the wizard with `WizardDescriptor.setTitle()`.`
- `Name `"WizardPanel_errorMessage"`, type `String`
  Set the localized message which is then shown at the bottom of the wizard panel. This message should be set when panel becomes invalid and Next/Finish buttons are disabled. It helps user to understand what is wrong. The property must be set to null value to clear the message. This property is supported since NetBeans 3.5.`

In every panel set these client properties (`JComponent.putClientProperty()`):

- `Name `"WizardPanel_helpURL"`, type `java.net.URL`
  Help url which explains your pane.`
- `Name `"WizardPanel_contentSelectedIndex"`, type `java.lang.Integer`
  Index of highlighted step in the content, the index is zero-based.`
- `Name `"WizardPanel_contentBackgroundColor"`, type `java.awt.Color`
  Color used as background of content pane.`
- `Set name of panel `JComponent.setName("First wizard panel")`, used as first part of subtitle, second is `WizardDescriptor.Panel.name()` when you use `"{0}{1}"` message format.`

All properties could be set with both alternatives (`WizardDescriptor.putProperty()` or `JComponent.putClientProperty()`) except `"WizardPanel_helpURL"` which can be set only with `JComponent.putClientProperty()` and the property `"WizardPanel_errorMessage"` which can be set only by `WizardDescriptor.putProperty()`.
If both are used at the same time then `WizardDescriptor.putProperty()` matters. `WizardDescriptor` listens on property changes of not initialization properties and makes immediate changes.