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
-
dmCodeBase
- The code base.
-
dmCurrPage
- The current page.
-
dmExceptionHandler
- The exception handler.
-
dmOk
- True if the wizard was not cancelled.
-
dmPageIndex
- A hash table of page models.
-
dmWizardView
- The view for this model.
-
Wizard(Frame, String, String, ExceptionHandler)
- Constructor.
-
Wizard(JFrame, String, String, int, int, ExceptionHandler)
- Constructor.
-
add(WizardPage)
- Add the given page to the wizard.
-
destroy()
- Remove the wizard observers and all page
observers.
-
enableButtons()
- Enable/diable the wizard buttons according tho
wizard-page info such as validity, etc.
-
finish()
- Do finish processing.
-
getCodeBase()
-
-
getExceptionHandler()
-
-
getFinal(WizardPage)
- Find the final page in the wizard to display.
-
getNext(WizardPage)
- Find the next page in the wizard to display.
-
getPageIndex()
-
-
getPrevious(WizardPage)
- Find the previous page in the wizard to display.
-
getView()
-
-
initialize()
-
-
isOk()
-
-
nextPage()
- Flip to the next wizard page.
-
previousPage()
-
-
setExceptionHandler(ExceptionHandler)
-
-
setOk(boolean)
-
-
setVisible(boolean)
-
-
update(Observable, Object)
- Implements the Observer interface.
dmWizardView
private WizardView dmWizardView
- The view for this model.
dmExceptionHandler
private ExceptionHandler dmExceptionHandler
- The exception handler.
dmPageIndex
private Hashtable dmPageIndex
- A hash table of page models.
dmCodeBase
private String dmCodeBase
- The code base.
dmCurrPage
private WizardPage dmCurrPage
- The current page.
dmOk
private boolean dmOk
- True if the wizard was not cancelled.
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.
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.
getExceptionHandler
public ExceptionHandler getExceptionHandler()
setExceptionHandler
public void setExceptionHandler(ExceptionHandler handler)
getCodeBase
public String getCodeBase()
getPageIndex
public Hashtable getPageIndex()
getView
public WizardView getView()
setVisible
public void setVisible(boolean set)
isOk
public boolean isOk()
setOk
public void setOk(boolean set)
initialize
public void initialize() throws InternalError, ExternalError
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.
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.
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.
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.
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.
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.
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.
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.
enableButtons
public void enableButtons()
- Enable/diable the wizard buttons according tho
wizard-page info such as validity, etc.
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