uic.widgets
Class WizardPanel

java.lang.Object
  extended byWizardPanelBase
      extended byuic.widgets.WizardPanel

public class WizardPanel
extends WizardPanelBase

A Wizard in Java; This is the old wizard implementation, and is still here for backwards compatibility. It is preferred to use the UICWizard instead.

Author:
Stefan Rotman (stefan @ rotman . net)
See Also:
UICWizard, Serialized Form

Field Summary
static int CANCEL_OPTION
          Returned by showWizard when exited with cancel button
static int FINISH_OPTION
          Returned by showWizard when exited with finish button
protected  JDialog parentDialog
           
 
Constructor Summary
WizardPanel()
           
WizardPanel(JDialog parentDialog)
           
 
Method Summary
 void addPanel(String title, JPanel panel)
          Adds the specified panel with the specified title at the end of the panel list.
 void bBackPressedSlot()
          Called when bBack is pressed.
 void bCancelPressedSlot()
          Called when bCancel is pressed.
 void bNextPressedSlot()
          Called when bNext is pressed.
 void enteringPanel(int justLeftIndex, int enteredPanelIndex)
          Called when entering a panel.
protected  char getFinishButtonMnemonic()
          Returns the mnemonic for the next button when in finish mode (last panel is reached).
protected  String getFinishButtonText()
          Returns the text for the next button when in finish mode (last panel is reached).
 int getIndexOfPanel(JPanel panel)
          Returns the index in the panel list of the first occurence of the specified panel or -1 if the panel list does not contain this panel.
 int getIndexOfPanel(String title)
          Returns the index in the panel list of the first occurence of the panel with the specified title, or -1 if there is no panel with this title.
 JPanel getPanel(int index)
          Returns the panel at the specified postition in the panel list, or null if the index is out of bounds.
 JPanel getPanel(String title)
          Returns the panel with the specified title, or null if there is no panel with this title.
 int getPanelCount()
          Returns the number of panels.
 boolean getPanelVerified(int panelIndex)
          Returns true if the panel at the specified index is marked as verified, or false otherwise.
 String getTitleOfPanel(int index)
          Returns the title for the panel at the specified postition in the panel list, or null if the index is out of bounds.
 void insertPanel(int index, String title, JPanel panel)
          Inserts the specified panel with the specified title at the specified index in the panel list.
 void leavingPanel(int leavingPanelIndex, int aboutToEnterIndex)
          Called when leaving a panel.
 void leavingWizard(boolean finish)
          Called when leaving the wizard.
 void removePanel(int index)
          Removes the panel at the specified position in the panel list.
 void removePanel(JPanel panel)
          Removes the specified panel from the panel list.
 void removePanel(String title)
          Removes the first panel with the specified title from the panel list.
 void setPanel(int index, JPanel panel)
          Replaces the panel at the specified position with the specified panel.
 void setPanelVerified(int panelIndex, boolean verified)
          Replaces the boolean at the specified index with the new boolean.
 void setTitle(int index, String title)
          Replaces the title at the specified position with the specified title.
 int showWizard()
          Shows the wizard dialog and returns the exit option.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parentDialog

protected JDialog parentDialog

CANCEL_OPTION

public static final int CANCEL_OPTION
Returned by showWizard when exited with cancel button

See Also:
Constant Field Values

FINISH_OPTION

public static final int FINISH_OPTION
Returned by showWizard when exited with finish button

See Also:
Constant Field Values
Constructor Detail

WizardPanel

public WizardPanel()

WizardPanel

public WizardPanel(JDialog parentDialog)
Method Detail

enteringPanel

public void enteringPanel(int justLeftIndex,
                          int enteredPanelIndex)
Called when entering a panel.

Parameters:
justLeftIndex - the index for the panel that was just left.
enteredPanelIndex - the index for the panel that is entered.

leavingPanel

public void leavingPanel(int leavingPanelIndex,
                         int aboutToEnterIndex)
Called when leaving a panel.

Parameters:
leavingPanelIndex - the index for the panel we are leaving.
aboutToEnterIndex - the index for the panel that is about to be entered.

leavingWizard

public void leavingWizard(boolean finish)
Called when leaving the wizard. The specified boolean indicates whether the wizard is left on cancel or finish.

Parameters:
finish - true if the wizard is left on finish, false otherwise

bCancelPressedSlot

public void bCancelPressedSlot()
Called when bCancel is pressed.


bBackPressedSlot

public void bBackPressedSlot()
Called when bBack is pressed. If this method is overruled you might break the swapping between the panels!


bNextPressedSlot

public void bNextPressedSlot()
Called when bNext is pressed. If this method is overruled you might break the swapping between the panels!


getFinishButtonText

protected String getFinishButtonText()
Returns the text for the next button when in finish mode (last panel is reached).

Returns:
the finish mode button text.

getFinishButtonMnemonic

protected char getFinishButtonMnemonic()
Returns the mnemonic for the next button when in finish mode (last panel is reached).

Returns:
the finish mode button mnemonic.

addPanel

public void addPanel(String title,
                     JPanel panel)
Adds the specified panel with the specified title at the end of the panel list.

Parameters:
title - title for panel to be added.
panel - panel to be added.

insertPanel

public void insertPanel(int index,
                        String title,
                        JPanel panel)
Inserts the specified panel with the specified title at the specified index in the panel list. Shifts the element currently at that postition (if any) and any subsequent panels to the right (adds one to thei indices).

Parameters:
index - index at which specified panel is to be inserted.
title - title for panel to be inserted.
panel - panel to be inserted.
Throws:
IndexOutOfBoundsException - - if the index is out of range (index i < 0 || index i > size()).

getPanelCount

public int getPanelCount()
Returns the number of panels.

Returns:
the number of panels.

setTitle

public void setTitle(int index,
                     String title)
Replaces the title at the specified position with the specified title.

Parameters:
index - index of panel to replace.
title - title to be stored at specified position.

setPanel

public void setPanel(int index,
                     JPanel panel)
Replaces the panel at the specified position with the specified panel.

Parameters:
index - index of panel to replace.
panel - panel to be stored at specified postition.

setPanelVerified

public void setPanelVerified(int panelIndex,
                             boolean verified)
Replaces the boolean at the specified index with the new boolean. While a panel is not verified the next button is not enabled.

Parameters:
panelIndex - index for panel to change verification value.
verified - value for panel verification.

removePanel

public void removePanel(int index)
Removes the panel at the specified position in the panel list. Shifts any subsequent panels to the left (substracts one from their indeces).

Parameters:
index - index of panel to be removed.

removePanel

public void removePanel(String title)
Removes the first panel with the specified title from the panel list. If more panels with the specified title are found only the first will be removed.

Parameters:
title - title of panel to remove.

removePanel

public void removePanel(JPanel panel)
Removes the specified panel from the panel list.

Parameters:
panel - panel to be removed.

getIndexOfPanel

public int getIndexOfPanel(String title)
Returns the index in the panel list of the first occurence of the panel with the specified title, or -1 if there is no panel with this title.

Parameters:
title - title to search for.
Returns:
index in panel list for the first occurence of the panel with the specified title, of -1 if there is no panel with this title.

getIndexOfPanel

public int getIndexOfPanel(JPanel panel)
Returns the index in the panel list of the first occurence of the specified panel or -1 if the panel list does not contain this panel.

Parameters:
panel - panel to search for.
Returns:
index is panel lsit for the first occurrence of the specified panel, or -1 if the panel list does not containt this panel.

getTitleOfPanel

public String getTitleOfPanel(int index)
Returns the title for the panel at the specified postition in the panel list, or null if the index is out of bounds.

Parameters:
index - index of panel to return
Returns:
title for panel at specified postition in panel list, or null if index is out of bounds.
Throws:
ArrayIndexOutOfBoundsException - when index is out of range of contents.

getPanel

public JPanel getPanel(int index)
Returns the panel at the specified postition in the panel list, or null if the index is out of bounds.

Parameters:
index - index of panel to return
Returns:
panel at specified postition in panel list, or null if index is out of bounds.
Throws:
ArrayIndexOutOfBoundsException - when index is out of range of contents.

getPanel

public JPanel getPanel(String title)
Returns the panel with the specified title, or null if there is no panel with this title.

Parameters:
title - title to search for
Returns:
panel with specified title, or null if there is no panel with this title.

getPanelVerified

public boolean getPanelVerified(int panelIndex)
Returns true if the panel at the specified index is marked as verified, or false otherwise.

Parameters:
panelIndex - index of panel to check for verification.
Returns:
the verification value of the panel at the specified index.

showWizard

public int showWizard()
Shows the wizard dialog and returns the exit option. If the wizard is exited with the cancel button it returns CANCEL_OPTION, if exited with the finish button it returns FINISH_OPTION.

Returns:
the exit option


Copyright © 2002,2003 Thomas Zander Available under the Free Apache licence