All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.netobjects.nfx.wizard.Wizard

java.lang.Object
   |
   +----java.util.Observable
           |
           +----com.netobjects.nfx.wizard.Wizard

public class Wizard
extends Observable
implements Observer
This class is the model corrisponding to the wizard-view class which is the view portion. It takes care of storage of page change logic, adding pages, etc... The controller is replaced by the java Observable/Observer mechanism.

OVERVIEW. The NFX wizard, especially when used in the context of a layout component, is basically a smart property-sheet interface which fills in complex property values. In other words the property-sheet is ANOTHER VIEW of the data the user enters in the wizard. With this in mind, it seems advantageous to have only one model for both the property-sheet row and it's corresponding control(s) in the wizard. For example a 'result columns' model may be rendered within multiple views within a wizard, as a filled-in JList or JTree, but also within the component property sheet, possibly as a simple comma-delimited list of columns.

With the advent of Swing/JFC, for all the major UI controls, model interfaces exist as well as default model implementations. i.e. DefaultListModel. This implies that Swing controls are purely "views", in principle. This means we mayconserve memory by passing in the model for each UI control, making it a "pure" view and letting us reuse the SAME model for other UI controls and even the NFX component property-sheet. Within the wizard framework, derivatives of the model class, WizardPage, should be aggregates of all the models used within the corresponding view. And the derivatives of the view class, WizardPageView, should be "pure" views.

The purpose for the model-view-controller approach is not just that it is good design practice but that we want the ability to load page objects into the wizard without initially creating all the expensive and numerous Swing UI controls. If the user gets only a couple of pages into the wizard and hits 'finish', all subsequent view pages will never get created.

Version:
1.0
Author:
Scott Cinnamond

Variable Index

 o dmCodeBase
The code base.
 o dmCurrPage
The current page.
 o dmExceptionHandler
The exception handler.
 o dmOk
True if the wizard was not cancelled.
 o dmPageIndex
A hash table of page models.
 o dmWizardView
The view for this model.

Constructor Index

 o Wizard(Frame, String, String, ExceptionHandler)
Constructor.
 o Wizard(JFrame, String, String, int, int, ExceptionHandler)
Constructor.

Method Index

 o add(WizardPage)
Add the given page to the wizard.
 o destroy()
Remove the wizard observers and all page observers.
 o enableButtons()
Enable/diable the wizard buttons according tho wizard-page info such as validity, etc.
 o finish()
Do finish processing.
 o getCodeBase()
 o getExceptionHandler()
 o getFinal(WizardPage)
Find the final page in the wizard to display.
 o getNext(WizardPage)
Find the next page in the wizard to display.
 o getPageIndex()
 o getPrevious(WizardPage)
Find the previous page in the wizard to display.
 o getView()
 o initialize()
 o isOk()
 o nextPage()
Flip to the next wizard page.
 o previousPage()
 o setExceptionHandler(ExceptionHandler)
 o setOk(boolean)
 o setVisible(boolean)
 o update(Observable, Object)
Implements the Observer interface.

Variables

 o dmWizardView
 private WizardView dmWizardView
The view for this model.

 o dmExceptionHandler
 private ExceptionHandler dmExceptionHandler
The exception handler.

 o dmPageIndex
 private Hashtable dmPageIndex
A hash table of page models.

 o dmCodeBase
 private String dmCodeBase
The code base.

 o dmCurrPage
 private WizardPage dmCurrPage
The current page.

 o dmOk
 private boolean dmOk
True if the wizard was not cancelled.

Constructors

 o Wizard
 public Wizard(Frame parent,
               String title,
               String codeBase,
               ExceptionHandler handler)
Constructor.

Parameters:
parent - the parent frame.
title - the title for the dialog.
codeBase - the code base for NFX components.
handler - the exception handler.
 o Wizard
 public Wizard(JFrame parent,
               String title,
               String codeBase,
               int width,
               int height,
               ExceptionHandler handler)
Constructor.

Parameters:
parent - the parent frame.
title - the title for the dialog.
codeBase - the code base for NFX components.
width - the view width in pixels.
height - the view height in pixels.
handler - the exception handler.

Methods

 o getExceptionHandler
 public ExceptionHandler getExceptionHandler()
 o setExceptionHandler
 public void setExceptionHandler(ExceptionHandler handler)
 o getCodeBase
 public String getCodeBase()
 o getPageIndex
 public Hashtable getPageIndex()
 o getView
 public WizardView getView()
 o setVisible
 public void setVisible(boolean set)
 o isOk
 public boolean isOk()
 o setOk
 public void setOk(boolean set)
 o initialize
 public void initialize() throws InternalError, ExternalError
 o destroy
 public void destroy()
Remove the wizard observers and all page observers. Removes all from the card-layout and destroys each page. Clears the page index.

 o finish
 public void finish() throws InternalError, ExternalError
Do finish processing.

Throws: InternalError
if an internal(system) error has occurred.
Throws: ExternalError
if an external(user) error has occurred.
 o nextPage
 public final void nextPage() throws InternalError, ExternalError
Flip to the next wizard page. First get the next page by calling a method in the current page. We assume that the order of pages may change dynamically and that often the control settings in the current page are what determines which page is to be displayed next and it may already exist or be created on the fly. Then if the view for the 'next' page does not exist, we create it and add it to the page-panel which has a java.awt.CardLayout as its layout. The CardLayout is very important as it is the only means known to flip through pages in the same parent panel without causing severe flashing, weird painting anomolies and exceptions in the bowels of AWT.

Throws: InternalError
if an internal(system) error has occurred.
Throws: ExternalError
if an external(user) error has occurred.
 o previousPage
 public final void previousPage() throws InternalError, ExternalError
Throws: InternalError
if an internal(system) error has occurred.
Throws: ExternalError
if an external(user) error has occurred.
 o getNext
 public WizardPage getNext(WizardPage page) throws InternalError, ExternalError
Find the next page in the wizard to display. By default, the corrisponding method in the page is used to find it's next page. This method may be overridden by derived classes where a more complex mechanism is needed such as a "page manager".

Parameters:
page - the given page.
Returns:
the wizard page.
Throws: InternalError
if an internal(system) error has occurred.
Throws: ExternalError
if an external(user) error has occurred.
 o getPrevious
 public WizardPage getPrevious(WizardPage page) throws InternalError, ExternalError
Find the previous page in the wizard to display. By default, the corrisponding method in the page is used to find it's previous page. This method may be overridden by derived classes where a more complex mechanism is needed such as a "page manager".

Parameters:
page - the given page.
Returns:
the wizard page.
Throws: InternalError
if an internal(system) error has occurred.
Throws: ExternalError
if an external(user) error has occurred.
 o getFinal
 public WizardPage getFinal(WizardPage page) throws InternalError, ExternalError
Find the final page in the wizard to display. By default, the corrisponding method in the page is used to find it's final page. This method may be overridden by derived classes where a more complex mechanism is needed such as a "page manager".

Parameters:
page - the given page.
Returns:
the wizard page.
Throws: InternalError
if an internal(system) error has occurred.
Throws: ExternalError
if an external(user) error has occurred.
 o add
 public void add(WizardPage page) throws InternalError
Add the given page to the wizard. Auto-set its parent and an id value. Add observable relationships to and from all existing pages. If the given page is the first page, create its page-view and hash its id to the page-view in the card-layout and page index.

Parameters:
page - the wizard page.
Throws: InternalError
if an internal(system) error has occurred.
 o enableButtons
 public void enableButtons()
Enable/diable the wizard buttons according tho wizard-page info such as validity, etc.

 o update
 public void update(Observable observable,
                    Object object)
Implements the Observer interface.

Parameters:
observable - the observable object.
object - an object argument.

All Packages  Class Hierarchy  This Package  Previous  Next  Index