com.borland.primetime.wizard
Class BasicWizard

java.lang.Object
  |
  +--com.borland.primetime.wizard.BasicWizard

public class BasicWizard
extends java.lang.Object
implements Wizard

The BasicWizard is a simple implementation of the Wizard interface to help quickly make a new Wizard. Add pages to the BasicWizard by calling the addWizardPage(...) methods.

See Also:
Wizard, WizardPage, BasicWizardPage

Field Summary
protected  java.util.ArrayList pages
          Storage for the list of WizardPage objects
protected  WizardHost wizardHost
          Storage for the wizard host.
protected  java.lang.String wizardTitle
          Storage for the wizard title.
 
Constructor Summary
BasicWizard()
           
 
Method Summary
 void addWizardPage(int index, WizardPage page)
          Adds a WizardPage to this Wizard at the specified index.
 void addWizardPage(WizardPage page)
          Adds a WizardPage to this Wizard at the end of the list of pages.
protected  void checkPage(WizardPage page)
           The user has clicked Next, and the Wizard should check that the page is correctly filled out.
protected  void finish()
           The user has clicked Finish, and the Wizard should go do its work.
 WizardPage finish(WizardPage currentPage, WizardHost host)
           Wizard interface method.
 java.lang.String getWizardTitle()
           Wizard interface method.
 void help(WizardPage currentPage, WizardHost host)
           Wizard interface method.
 int initTotalSteps()
           Wizard interface method.
 WizardPage invokeWizard(WizardHost host)
           Wizard interface method.
 WizardPage next(WizardPage currentPage, WizardHost host)
           Wizard interface method.
 void removeWizardPage(int index)
          Removes the WizardPage at the specified index from the Wizard.
 void removeWizardPage(WizardPage page)
          Removes the specified WizardPage from the Wizard.
 void setWizardTitle(java.lang.String title)
          Sets the title for this Wizard.
 void wizardCompleted()
           Wizard interface method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wizardTitle

protected java.lang.String wizardTitle
Storage for the wizard title.

wizardHost

protected WizardHost wizardHost
Storage for the wizard host.

pages

protected java.util.ArrayList pages
Storage for the list of WizardPage objects
Constructor Detail

BasicWizard

public BasicWizard()
Method Detail

setWizardTitle

public void setWizardTitle(java.lang.String title)
Sets the title for this Wizard. This is displayed as the title of the Wizard followed by the step number and total number of steps. If there is only 1 step in the Wizard, this title is displayed as-is.
Parameters:
title - The dialog title for this Wizard

getWizardTitle

public java.lang.String getWizardTitle()

Wizard interface method.

Returns the title for this Wizard. This is displayed as the title of the Wizard followed by the step number and total number of steps. If there is only 1 step in the Wizard, this title is displayed as-is.

Specified by:
getWizardTitle in interface Wizard
Returns:
The dialog title for this Wizard

addWizardPage

public void addWizardPage(WizardPage page)
Adds a WizardPage to this Wizard at the end of the list of pages.
Parameters:
page - The WizardPage to add to the Wizard

addWizardPage

public void addWizardPage(int index,
                          WizardPage page)
Adds a WizardPage to this Wizard at the specified index.
Parameters:
index - The index at which to add the WizardPage to the Wizard
page - The WizardPage to add to the Wizard

removeWizardPage

public void removeWizardPage(int index)
Removes the WizardPage at the specified index from the Wizard.
Parameters:
index - The index of the WizardPage to remove from the Wizard

removeWizardPage

public void removeWizardPage(WizardPage page)
Removes the specified WizardPage from the Wizard.
Parameters:
page - The WizardPage to remove from the Wizard

help

public void help(WizardPage currentPage,
                 WizardHost host)

Wizard interface method.

The user has clicked the Help button while viewing the specified page.

Specified by:
help in interface Wizard
Parameters:
currentPage - The current WizardPage displaying in the Wizard
host - The host of the Wizard

wizardCompleted

public void wizardCompleted()

Wizard interface method.

The Wizard has been completed (finished or cancelled), and any resource cleanup to help the garbage collector can occur.

Specified by:
wizardCompleted in interface Wizard

checkPage

protected void checkPage(WizardPage page)
                  throws VetoException

The user has clicked Next, and the Wizard should check that the page is correctly filled out. If the passed WizardPage is an instance of BasicWizardPage, the default implementation will automatically call the checkPage() method on the BasicWizardPage.

Throws:
VetoException - Can be thrown to stop the next operation and leave the Wizard on the current WizardPage

finish

protected void finish()
               throws VetoException

The user has clicked Finish, and the Wizard should go do its work.

Throws:
VetoException - Can be thrown to stop the finish operation and leave the Wizard on the current WizardPage

initTotalSteps

public int initTotalSteps()

Wizard interface method.

Returns the total number of steps for this Wizard.

Specified by:
initTotalSteps in interface Wizard
Returns:
the total number of steps.

invokeWizard

public WizardPage invokeWizard(WizardHost host)

Wizard interface method.

Returns the first page in this Wizard. This is the page that is displayed initially when the Wizard appears.

Specified by:
invokeWizard in interface Wizard
Parameters:
host - The WizardHost that will be hosting the Wizard.
Returns:
The first WizardPage for this Wizard.

next

public WizardPage next(WizardPage currentPage,
                       WizardHost host)
                throws VetoException

Wizard interface method.

Returns the next WizardPage - after the specified WizardPage.

Specified by:
next in interface Wizard
Parameters:
currentPage - The current WizardPage displaying in the Wizard
host - The host of the Wizard
Returns:
The next WizardPage for the Wizard to display
Throws:
VetoException - Can be thrown to stop forward navigation

finish

public WizardPage finish(WizardPage currentPage,
                         WizardHost host)
                  throws VetoException

Wizard interface method.

The user has clicked Finish, and the Wizard should go do its work. This calls the finish() method, where subclasses can put their logic.

Specified by:
finish in interface Wizard
Parameters:
currentPage - The current WizardPage displaying in the Wizard
host - The host of the Wizard
Returns:
null if all is well (the Wizard will dispose), or if there is a problem, the WizardPage for the Wizard to jump to and display
Throws:
VetoException - Can be thrown to stop the finish operation