org.qdwizard
Class Wizard

java.lang.Object
  extended by org.qdwizard.Wizard
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.WindowListener, java.util.EventListener

public abstract class Wizard
extends java.lang.Object
implements java.awt.event.ActionListener, java.awt.event.WindowListener

A Wizard dialog displaying one to many screens

Author:
Bertrand Florat

Field Summary
static java.util.HashMap<java.lang.String,java.lang.Object> data
          Wizard data
protected static int DEFAULT_H_LAYOUT_PADDING
           
protected static int DEFAULT_H_SIZE
          Default Wizard size
protected static int DEFAULT_V_LAYOUT_PADDING
           
protected static int DEFAULT_V_SIZE
           
 
Constructor Summary
Wizard(java.lang.String sName, java.lang.Class<? extends Screen> initial, javax.swing.ImageIcon icon, java.awt.Frame parentWindow)
          Wizard constructor (uses default locale)
Wizard(java.lang.String sName, java.lang.Class<? extends Screen> initial, javax.swing.ImageIcon icon, java.awt.Frame parentWindow, java.util.Locale locale)
          Wizard constructor
Wizard(java.lang.String sName, java.lang.Class<? extends Screen> initial, javax.swing.ImageIcon icon, java.awt.Image backgroundImage, java.awt.Frame parentWindow)
          Wizard constructor (uses default locale)
Wizard(java.lang.String sName, java.lang.Class<? extends Screen> initial, javax.swing.ImageIcon icon, java.awt.Image backgroundImage, java.awt.Frame parentWindow, java.util.Locale locale)
          Wizard constructor
Wizard(java.lang.String sName, java.lang.Class initial, javax.swing.ImageIcon icon, java.awt.Frame parentWindow, java.util.Locale locale, int iHSize, int iVSize)
          Wizard constructor
Wizard(java.lang.String sName, java.lang.Class initial, javax.swing.ImageIcon icon, java.awt.Image backgroundImage, java.awt.Frame parentWindow, java.util.Locale locale, int iHSize, int iVSize, int iLayoutHPadding, int iLayoutVPadding)
          Wizard constructor
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ae)
           
 void clearScreens()
          Clear screens history
abstract  void finish()
          Finish action.
 java.lang.Class<? extends Screen> getCurrentScreen()
          Get current screen
 javax.swing.JDialog getDialog()
          access to the JDialog of the wizard, in case we need it (for instance to set a glass pane when waiting)
abstract  java.lang.Class<? extends Screen> getNextScreen(java.lang.Class<? extends Screen> screen)
           
abstract  java.lang.Class<? extends Screen> getPreviousScreen(java.lang.Class<? extends Screen> screen)
           
 boolean onCancel()
          Called when user clicks on "cancel".
 void setActionsBackgroundColor(java.awt.Color color)
          Set the background color of the ActionPanel
 void setHeaderIcon(javax.swing.ImageIcon icon)
          Set the header icon
 void setHeaderImage(java.awt.Image img)
          Set the header image
 void setProblemBackgroundColor(java.awt.Color color)
          Set the background color of the ActionPanel's Problem notification area
 void show()
           
 void updateGUI()
          Refresh buttons and problems.
 boolean wasCancelled()
           
 void windowActivated(java.awt.event.WindowEvent windowEvent)
          Called when the wizard dialog is activated.
 void windowClosed(java.awt.event.WindowEvent windowEvent)
          Called when the wizard dialog is closed.
 void windowClosing(java.awt.event.WindowEvent windowEvent)
           
 void windowDeactivated(java.awt.event.WindowEvent windowEvent)
          Called when the wizard dialog is deactivated.
 void windowDeiconified(java.awt.event.WindowEvent windowEvent)
          Called when the wizard dialog is deiconified.
 void windowIconified(java.awt.event.WindowEvent windowEvent)
          Called when the wizard dialog is iconified.
 void windowOpened(java.awt.event.WindowEvent windowEvent)
          Called when the wizard dialog opens.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

public static java.util.HashMap<java.lang.String,java.lang.Object> data
Wizard data


DEFAULT_H_SIZE

protected static final int DEFAULT_H_SIZE
Default Wizard size

See Also:
Constant Field Values

DEFAULT_V_SIZE

protected static final int DEFAULT_V_SIZE
See Also:
Constant Field Values

DEFAULT_H_LAYOUT_PADDING

protected static final int DEFAULT_H_LAYOUT_PADDING
See Also:
Constant Field Values

DEFAULT_V_LAYOUT_PADDING

protected static final int DEFAULT_V_LAYOUT_PADDING
See Also:
Constant Field Values
Constructor Detail

Wizard

public Wizard(java.lang.String sName,
              java.lang.Class initial,
              javax.swing.ImageIcon icon,
              java.awt.Image backgroundImage,
              java.awt.Frame parentWindow,
              java.util.Locale locale,
              int iHSize,
              int iVSize,
              int iLayoutHPadding,
              int iLayoutVPadding)
Wizard constructor

Parameters:
sName - Wizard name displayed in dialog title
initial - Initial screen class
icon - Wizard icon (null if no icon)
backgroundImage - background image
parentWindow - wizard parent window
locale - Wizard locale
iHSize - Horizontal size
iVSize - Vertical size
iLayoutHPadding - Horizontal layout padding
iLayoutVPadding - Vertical layout padding

Wizard

public Wizard(java.lang.String sName,
              java.lang.Class initial,
              javax.swing.ImageIcon icon,
              java.awt.Frame parentWindow,
              java.util.Locale locale,
              int iHSize,
              int iVSize)
Wizard constructor

Parameters:
sName - Wizard name displayed in dialog title
initial - Initial screen class
icon - Wizard icon (null if no icon)
parentWindow - wizard parent window
locale - Wizard locale
iHSize - Horizontal size
iVSize - Vertical size

Wizard

public Wizard(java.lang.String sName,
              java.lang.Class<? extends Screen> initial,
              javax.swing.ImageIcon icon,
              java.awt.Image backgroundImage,
              java.awt.Frame parentWindow,
              java.util.Locale locale)
Wizard constructor

Parameters:
sName - Wizard name displayed in dialog title
initial - Initial screen class
icon - Wizard icon (null if no icon)
backgroundImage - Wizard header background (null if no image)
parentWindow - wizard parent window
locale - Wizard locale

Wizard

public Wizard(java.lang.String sName,
              java.lang.Class<? extends Screen> initial,
              javax.swing.ImageIcon icon,
              java.awt.Frame parentWindow,
              java.util.Locale locale)
Wizard constructor

Parameters:
sName - Wizard name displayed in dialog title
initial - Initial screen class
icon - Wizard icon (null if no icon)
parentWindow - wizard parent window
locale - Wizard locale

Wizard

public Wizard(java.lang.String sName,
              java.lang.Class<? extends Screen> initial,
              javax.swing.ImageIcon icon,
              java.awt.Image backgroundImage,
              java.awt.Frame parentWindow)
Wizard constructor (uses default locale)

Parameters:
sName - Wizard name displayed in dialog title
initial - Initial screen class
icon - Wizard icon (null if no icon)
backgroundImage - Wizard header background (null if no image)
parentWindow - wizard parent window

Wizard

public Wizard(java.lang.String sName,
              java.lang.Class<? extends Screen> initial,
              javax.swing.ImageIcon icon,
              java.awt.Frame parentWindow)
Wizard constructor (uses default locale)

Parameters:
sName - Wizard name displayed in dialog title
initial - Initial screen class
icon - Wizard icon (null if no icon)
parentWindow - wizard parent window
Method Detail

show

public void show()

getDialog

public javax.swing.JDialog getDialog()
access to the JDialog of the wizard, in case we need it (for instance to set a glass pane when waiting)

Returns:
the wizard dialog

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

setHeaderImage

public void setHeaderImage(java.awt.Image img)
Set the header image

Parameters:
img -

setHeaderIcon

public void setHeaderIcon(javax.swing.ImageIcon icon)
Set the header icon

Parameters:
img -

setActionsBackgroundColor

public void setActionsBackgroundColor(java.awt.Color color)
Set the background color of the ActionPanel

Parameters:
color -

setProblemBackgroundColor

public void setProblemBackgroundColor(java.awt.Color color)
Set the background color of the ActionPanel's Problem notification area

Parameters:
color -

getPreviousScreen

public abstract java.lang.Class<? extends Screen> getPreviousScreen(java.lang.Class<? extends Screen> screen)
Returns:
previous screen class

clearScreens

public void clearScreens()
Clear screens history


getNextScreen

public abstract java.lang.Class<? extends Screen> getNextScreen(java.lang.Class<? extends Screen> screen)
Returns:
next screen class

getCurrentScreen

public java.lang.Class<? extends Screen> getCurrentScreen()
Get current screen

Returns:
current screen class

updateGUI

public void updateGUI()
Refresh buttons and problems. Called asynchronously by the screens or by the wizard itself.


finish

public abstract void finish()
Finish action. Called when user clicks on "finish"


onCancel

public boolean onCancel()
Called when user clicks on "cancel". Override it if you want to do something in cancel such as display a confirmation dialog.

Returns:
return true if the Wizard should continue to close

windowClosing

public void windowClosing(java.awt.event.WindowEvent windowEvent)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent windowEvent)
Called when the wizard dialog opens. Override it if you want notification of this event.

Specified by:
windowOpened in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent windowEvent)
Called when the wizard dialog is closed. Override it if you want notification of this event.

caution: You must always call super.windowClosed(windowEvent) within the override function to ensure that the Wizard closes completely.

Specified by:
windowClosed in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent windowEvent)
Called when the wizard dialog is iconified. Override it if you want notification of this event.

Specified by:
windowIconified in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent windowEvent)
Called when the wizard dialog is deiconified. Override it if you want notification of this event.

Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowActivated

public void windowActivated(java.awt.event.WindowEvent windowEvent)
Called when the wizard dialog is activated. Override it if you want notification of this event.

Specified by:
windowActivated in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent windowEvent)
Called when the wizard dialog is deactivated. Override it if you want notification of this event.

Specified by:
windowDeactivated in interface java.awt.event.WindowListener

wasCancelled

public boolean wasCancelled()