org.fife.ui.app
Class WizardPlugin

java.lang.Object
  extended by org.fife.ui.app.WizardPlugin
All Implemented Interfaces:
GUIApplicationConstants, Plugin, DockableWindowConstants

public abstract class WizardPlugin
extends java.lang.Object
implements Plugin, GUIApplicationConstants

A base plugin for creating dialog-based wizards.

Version:
0.1
Author:
Robert Futrell
See Also:
Plugin, GUIApplication

Field Summary
static int CANCEL
           
static int SUCCESSFUL
           
 
Fields inherited from interface org.fife.ui.app.GUIApplicationConstants
OS_LINUX, OS_MAC_OSX, OS_OTHER, OS_WINDOWS
 
Fields inherited from interface org.fife.ui.dockablewindows.DockableWindowConstants
BOTTOM, FLOATING, LEFT, RIGHT, TOP
 
Constructor Summary
WizardPlugin(GUIApplication app)
          Constructor.
 
Method Summary
protected  int addInfoPanel(WizardDialogInfoPanel panel)
          Adds a "step" to this wizard.
protected abstract  void createPanels()
          This method should be overridden to initialize all panels in this wizard via addInfoPanel.
protected  WizardDialogInfoPanel getInfoPanel(int index, WizardPluginDialog dialog)
          Returns the specified info panel.
protected abstract  WizardDialogInfoPanel getIntroductionPanel(WizardPluginDialog dialog)
          Returns the "introduction panel;" that is, the initial information displayed to the user explain what this wizard will do.
abstract  PluginOptionsDialogPanel getOptionsDialogPanel()
          Returns an options panel for use in an Options dialog.
 javax.swing.Icon getSideIcon()
          Returns the image to use on the side of the dialog.
 int getStepCount()
          Returns the number of steps in this wizard.
abstract  java.lang.String getWizardDialogTitle()
          Returns the title of the Wizard dialog.
protected abstract  WizardDialogInfoPanel getWizardSuccessfulPanel(WizardPluginDialog dialog)
          Returns the dialog information to display when the wizard has completed successfully.
protected abstract  void handleWizardSuccessful(WizardDialogInfoPanel[] panels)
          This method is called if the user runs the wizard and clicks the "Finish" button; e.g., the wizard has run to completion.
 boolean promptBeforeCancel()
          Returns whether or not the user should be prompted to confirm a "cancel" request by the user.
 int runWizard()
          Starts the wizard.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.fife.ui.app.Plugin
getOptionsDialogPanelParentPanelID, getPluginAuthor, getPluginIcon, getPluginName, getPluginVersion, install, savePreferences, uninstall
 

Field Detail

CANCEL

public static final int CANCEL
See Also:
Constant Field Values

SUCCESSFUL

public static final int SUCCESSFUL
See Also:
Constant Field Values
Constructor Detail

WizardPlugin

public WizardPlugin(GUIApplication app)
Constructor.

Parameters:
app - The GUI application.
Method Detail

addInfoPanel

protected int addInfoPanel(WizardDialogInfoPanel panel)
Adds a "step" to this wizard. The first panel passed to this method will become the panel displayed as "step 1", the second as "step 2", etc. Thus, you must pass the panels for your "steps" to this method in order.

Parameters:
panel - The panel to add.
Returns:
The "step number" that this panel will be. Note that this value is 1-based.
See Also:
getInfoPanel(int, org.fife.ui.app.WizardPluginDialog)

createPanels

protected abstract void createPanels()
This method should be overridden to initialize all panels in this wizard via addInfoPanel. Note that you only need to add the "step" panels in this way, not the "introduction" or "successful" panels.


getIntroductionPanel

protected abstract WizardDialogInfoPanel getIntroductionPanel(WizardPluginDialog dialog)
Returns the "introduction panel;" that is, the initial information displayed to the user explain what this wizard will do. For example,

This wizard will walk you through creating a simple Java
 class.

Parameters:
dialog - The dialog in which this information will be displayed.
Returns:
The panel.
See Also:
getInfoPanel(int, org.fife.ui.app.WizardPluginDialog), getWizardSuccessfulPanel(org.fife.ui.app.WizardPluginDialog)

getInfoPanel

protected WizardDialogInfoPanel getInfoPanel(int index,
                                             WizardPluginDialog dialog)
Returns the specified info panel. Each panel corresponds to a single "step" in the wizard.

Parameters:
index - The "step number." This value will be 1-based; that is, it will be in the range 1-getStepCount().
dialog - The dialog in which this information will be displayed.
Returns:
The specified info panel.
See Also:
getIntroductionPanel(org.fife.ui.app.WizardPluginDialog), getWizardSuccessfulPanel(org.fife.ui.app.WizardPluginDialog), addInfoPanel(org.fife.ui.app.WizardDialogInfoPanel)

getOptionsDialogPanel

public abstract PluginOptionsDialogPanel getOptionsDialogPanel()
Returns an options panel for use in an Options dialog. This panel should contain all options pertaining to this plugin.

Specified by:
getOptionsDialogPanel in interface Plugin
Returns:
The options panel.

getSideIcon

public javax.swing.Icon getSideIcon()
Returns the image to use on the side of the dialog. This image should be taller than it is wide (perhaps around three time taller) to match the appearance of Microsoft Windows-style wizards. If this method is not overridden, a bad-looking default icon will be used.

Returns:
The icon to use.

getStepCount

public final int getStepCount()
Returns the number of steps in this wizard. This number should be the number of times the user will have to click "Next".

Returns:
The number of steps in this wizard.

getWizardDialogTitle

public abstract java.lang.String getWizardDialogTitle()
Returns the title of the Wizard dialog.

Returns:
The title of the wizard dialog.

getWizardSuccessfulPanel

protected abstract WizardDialogInfoPanel getWizardSuccessfulPanel(WizardPluginDialog dialog)
Returns the dialog information to display when the wizard has completed successfully.

Parameters:
dialog - The dialog in which this information will be displayed.
Returns:
The panel.
See Also:
getIntroductionPanel(org.fife.ui.app.WizardPluginDialog), getInfoPanel(int, org.fife.ui.app.WizardPluginDialog)

handleWizardSuccessful

protected abstract void handleWizardSuccessful(WizardDialogInfoPanel[] panels)
This method is called if the user runs the wizard and clicks the "Finish" button; e.g., the wizard has run to completion. Subclasses should override this method to perform whatever action the wizard was gathering information about.

Parameters:
panels - The "step" panels in which the user entered values.

promptBeforeCancel

public boolean promptBeforeCancel()
Returns whether or not the user should be prompted to confirm a "cancel" request by the user. Override this method if you don't want the user to be prompted if they click "Cancel."

Returns:
Whether the user should be prompted whether or not they really want to cancel.

runWizard

public final int runWizard()
Starts the wizard.

Returns:
Either CANCEL or SUCCESSFUL, depending on whether the user cancelled the wizard.