Package ca.cgjennings.ui.wizard
Class DefaultWizardModel
- java.lang.Object
-
- ca.cgjennings.ui.wizard.AbstractWizardModel
-
- ca.cgjennings.ui.wizard.DefaultWizardModel
-
- All Implemented Interfaces:
WizardModel
public class DefaultWizardModel extends AbstractWizardModel
A default implementation ofWizardModel
.The methods
AbstractWizardModel.aboutToHide(int, javax.swing.JComponent)
,AbstractWizardModel.aboutToShow(int, javax.swing.JComponent)
, andAbstractWizardModel.finish()
take no direct action but do fire events.- Since:
- 3.0
- Author:
- Chris Jennings
-
-
Field Summary
-
Fields inherited from class ca.cgjennings.ui.wizard.AbstractWizardModel
blocked, curPage, listeners
-
-
Constructor Summary
Constructors Constructor Description DefaultWizardModel()
Creates a default wizard model with no pages.DefaultWizardModel(javax.swing.JComponent[] pages)
Creates a default wizard model with an initial set of pages.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.swing.JComponent[]
getPageOrder()
Returns the current order of pages in the wizard.javax.swing.JComponent[]
getPages()
Returns the current page order.void
setPages(javax.swing.JComponent[] pages)
Sets the list of fixed pages to be used by the model.-
Methods inherited from class ca.cgjennings.ui.wizard.AbstractWizardModel
aboutToHide, aboutToShow, addWizardListener, backward, canFinish, canGoBackward, canGoForward, checkPages, finish, fireBlockStateChanged, fireFinished, fireHidingPage, firePageChanged, firePageOrderChanged, fireReset, fireShowingPage, forward, getCurrentPage, getCurrentPageComponent, getPageCount, isProgressBlocked, removeWizardListener, reset, setCurrentPage, setProgressBlocked
-
-
-
-
Constructor Detail
-
DefaultWizardModel
public DefaultWizardModel()
Creates a default wizard model with no pages. The user must callsetPages(javax.swing.JComponent[])
before using the model.
-
DefaultWizardModel
public DefaultWizardModel(javax.swing.JComponent[] pages)
Creates a default wizard model with an initial set of pages.- Parameters:
pages
- the page list- Throws:
java.lang.NullPointerException
- ifpages
isnull
-
-
Method Detail
-
setPages
public void setPages(javax.swing.JComponent[] pages)
Sets the list of fixed pages to be used by the model. This does not reset the page order, so it can be used to create non-linear page structures. For example, depending on the controls selected by the user, you could set an alternate page order that diverges after the current page.- Parameters:
pages
- the page list- Throws:
java.lang.NullPointerException
- ifpages
isnull
-
getPages
public final javax.swing.JComponent[] getPages()
Returns the current page order. This is identical to callinggetPageOrder()
; this method is provided for symmetry withsetPages(javax.swing.JComponent[])
.- Returns:
- the current page order, or
null
if no pages have been set
-
getPageOrder
public javax.swing.JComponent[] getPageOrder()
Description copied from interface:WizardModel
Returns the current order of pages in the wizard. This method is called to set up the panel and before each page transition. This allows the model to change the page order in response to user choices.Unless otherwise stated, the caller must assume that the returned array should be considered immutable. Changing the values of elements in the array is forbidden.
- Returns:
- an array of components (typically panels) in the order they should be displayed
-
-