|
Side of Software Wizard Library 1.6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The model that controls the pages and steps in a wizard.
A wizard takes the user through a sequence of steps to accomplish a task.
A step may involve one or more pages in which the user must
read and/or enter information. The WizardModel
interface controls
the steps and pages. It has
getCurrentPage
.
To receive a notification that the current page has changed, register
a property change listener that reponds to CURRENT_PAGE_PROPERTY
.
int getSize()
Object getElementAt(int)
Object getSelectedItem()
java.lang.Object
.
There is no restriction
as to the type; however, models with a one-to-one relationship typically
return the pages themselves as the steps. Clients should not assume
pages are returned, though.
Method | Action |
---|---|
stepBack | Return to the previous page |
stepNext | Advance to the next page |
stepLast | Jump to the last page |
finish | End this model and perform the desired task |
cancel | Abort this model |
The ability to perform these methods, however, depends on the model's state, as described next.
WIZARD_IN_PROGRESS
state. In this state,
clients have the ability to advance to different pages.
Eventually, finish
is called on this
model and its state changes to WIZARD_FINISHING
.
When the task completes, the state changes to WIZARD_FINISHED
.
If cancel
is called instead of finish
or
if the task fails to complete, the model's state changes to
WIZARD_CANCELED
. The following state diagram illustrates this:
Model
, it has
the ability to notify listeners
that a property has changed. Implementations of this
interface should handle the following properties:
Property | Values |
---|---|
BACK_PROPERTY | Boolean |
CANCEL_PROPERTY | Boolean |
CURRENT_PAGE_PROPERTY | Page |
FINISH_PROPERTY | Boolean |
LAST_PROPERTY | Boolean |
NEXT_PROPERTY | Boolean |
STATE_PROPERTY | Integer: One of
WIZARD_CANCELED , WIZARD_FINISHED ,
WIZARD_FINISHING , and WIZARD_IN_PROGRESS |
SUPPORTS_LAST_PROPERTY | Boolean |
Besides handling PropertyChangeListener
s, this interface
manages ListDataListener
s.
Field Summary | |
static java.lang.String |
BACK_PROPERTY
Constant used by property change events to signal that the wizard's ability to return to the previous step has changed. |
static java.lang.String |
CANCEL_PROPERTY
Constant used by property change events to signal that the wizard's ability to cancel has changed. |
static java.lang.String |
CURRENT_PAGE_PROPERTY
Constant used by property change events to signal that this wizard's current page has changed. |
static java.lang.String |
FINISH_PROPERTY
Constant used by property change events to signal that the wizard's ability to finish has changed. |
static java.lang.String |
LAST_PROPERTY
Constant used by property change events to signal that the wizard's ability to jump to the last step has changed. |
static java.lang.String |
NEXT_PROPERTY
Constant used by property change events to signal that the wizard's ability to advance to the next step has changed. |
static java.lang.String |
STATE_PROPERTY
Constant used by property change events to signal that the state of this wizard has changed. |
static java.lang.String |
SUPPORTS_LAST_PROPERTY
Constant used by property change events to signal that the wizard's support of jumping to the last step has changed. |
static int |
WIZARD_CANCELED
Constant signifying that the wizard has been canceled. |
static int |
WIZARD_FINISHED
Constant signifying that the wizard has finished. |
static int |
WIZARD_FINISHING
Constant signifying that the wizard is in the process of finishing. |
static int |
WIZARD_IN_PROGRESS
Constant signifying that the wizard is in progress. |
Method Summary | |
void |
addListDataListener(javax.swing.event.ListDataListener listener)
Adds a listener to the list that is notified each time a change to the data model occurs. |
boolean |
canCancel()
Returns true if this wizard can be canceled. |
void |
cancel()
Cancels this wizard. |
boolean |
canFinish()
Returns true if this wizard allows the user to finish,
given the current state. |
boolean |
canStepBack()
Returns true if this wizard has a previous page. |
boolean |
canStepLast()
Returns true if this wizard can accept
the current values and advance to the last page. |
boolean |
canStepNext()
Returns true if this wizard has a subsequent page. |
void |
finish()
Ends this wizard. |
Page |
getCurrentPage()
Retrieves the page currently being processed. |
java.lang.Object |
getElementAt(int index)
Returns the step at the specified index. |
java.lang.Object |
getSelectedItem()
Returns the current step. |
int |
getSize()
Returns the length of the list of steps. |
int |
getState()
Returns the state of this wizard. |
void |
removeListDataListener(javax.swing.event.ListDataListener listener)
Removes a listener from the list that is notified each time a change to the data model occurs. |
void |
setSelectedItem(java.lang.Object anItem)
Set the selected item. |
void |
stepBack()
Advances this wizard to the previous page. |
void |
stepLast()
Advances this wizard to the last step. |
void |
stepNext()
Advances this wizard to the next step. |
boolean |
supportsLast()
Returns true if this wizard has the ability to
skip intermediate pages and advance to the last page. |
Methods inherited from interface sos.wizard.Model |
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener |
Field Detail |
public static final java.lang.String BACK_PROPERTY
public static final java.lang.String CANCEL_PROPERTY
public static final java.lang.String CURRENT_PAGE_PROPERTY
public static final java.lang.String FINISH_PROPERTY
public static final java.lang.String LAST_PROPERTY
public static final java.lang.String NEXT_PROPERTY
public static final java.lang.String STATE_PROPERTY
public static final java.lang.String SUPPORTS_LAST_PROPERTY
public static final int WIZARD_CANCELED
public static final int WIZARD_FINISHED
public static final int WIZARD_FINISHING
public static final int WIZARD_IN_PROGRESS
Method Detail |
public void addListDataListener(javax.swing.event.ListDataListener listener)
addListDataListener
in interface javax.swing.ListModel
listener
- the ListDataListener
to be addedpublic void cancel() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if this wizard is not in progress
or canCancel
returns false
canCancel()
public boolean canCancel()
true
if this wizard can be canceled.
true
if this wizard can be canceled.cancel()
public boolean canFinish()
true
if this wizard allows the user to finish,
given the current state.
If this wizard is not in progress,
false
is returned.
finish()
public boolean canStepBack()
true
if this wizard has a previous page.
If this wizard is not in progress,
false
is returned.
true
if this wizard has a previous pagecanStepNext()
public boolean canStepLast()
true
if this wizard can accept
the current values and advance to the last page.
If this wizard is not in progress
or if this wizard does not support last,
false
is returned.
true
if this wizard can advance to the last pagestepLast()
,
supportsLast()
public boolean canStepNext()
true
if this wizard has a subsequent page.
If this wizard is not in progress,
false
is returned.
true
if this wizard has a subsequent pagecanStepBack()
public void finish() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if this wizard is not in progress
or canFinish
returns false
canFinish()
public Page getCurrentPage()
public java.lang.Object getElementAt(int index)
getElementAt
in interface javax.swing.ListModel
index
- the requested index
index
public java.lang.Object getSelectedItem()
getSelectedItem
in interface javax.swing.ComboBoxModel
null
if there is nonepublic int getSize()
getSize
in interface javax.swing.ListModel
public int getState()
WIZARD_IN_PROGRESS
,
WIZARD_FINISHED
, WIZARD_FINISHING
,
and WIZARD_CANCELED
public void removeListDataListener(javax.swing.event.ListDataListener listener)
removeListDataListener
in interface javax.swing.ListModel
listener
- the ListDataListener
to be removedaddListDataListener(javax.swing.event.ListDataListener)
public void setSelectedItem(java.lang.Object anItem)
UnsupportedOperationException
.
setSelectedItem
in interface javax.swing.ComboBoxModel
anItem
- the list object to select or null
to clear the selectionpublic void stepLast() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if this wizard is not in progress,
canStepLast
returns false
,
or this wizard does not support advancing to the last
stepcanStepLast()
,
supportsLast()
public void stepNext() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if this wizard is not in progress
or canStepNext
returns false
canStepNext()
,
stepBack()
public void stepBack() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if this wizard is not in progress
or canStepBack
returns false
canStepBack()
,
stepNext()
public boolean supportsLast()
true
if this wizard has the ability to
skip intermediate pages and advance to the last page.
Note that this method ignores the current state of this wizard.
To check if this wizard can jump to the last page given the
current state, use canStepLast
.
JWizard
uses this property to determine if it should
show the Last button.
true
if this wizard has the ability to
skip intermediate pages and advance to the last pagecanStepLast()
|
Side of Software Wizard Library 1.6 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |