public class WizardPanelSequence extends Object implements ChangeListener
WizardPanel
s for a
WizardView
. A WizardPanelSequence
maintains a set
of WizardPanel
s and a Config
object. When a
WizardPanel
is added to the sequence, a reference to the
Config
object is passed to the panel. The panel may use this
Config
object to store results from user input or to look up
the current or default values for its input fields.
Whenever the value of a property is changed or a property is added to or
removed from the Config
object, the Config
object notifies the WizardPanelSequence
via a
ChangeEvent
. Subclassers may override the
stateChanged()
method to handle these events.
WizardView
,
WizardPanel
,
Config
,
ChangeEvent
Modifier and Type | Field and Description |
---|---|
protected Config |
config
The configuration object for this sequence.
|
protected int |
currentIndex
The index of the currently-selected
WizardPanel . |
protected Vector |
panels
The list of
WizardPanel s. |
private ChangeSupport |
support |
Constructor and Description |
---|
WizardPanelSequence()
Construct a new
WizardPanelSequence . |
WizardPanelSequence(Config config)
Construct a new
WizardPanelSequence with the given
configuration object. |
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(ChangeListener listener)
Add a
ChangeListener to this object's list of listeners. |
void |
addPanel(WizardPanel panel)
Add a
WizardPanel to this sequence. |
void |
addPanels(WizardPanel[] panels)
Add an array of
WizardPanel s to this sequence. |
boolean |
canMoveBackward()
Determine if the user is allowed to move to the previous
panel.
|
boolean |
canMoveForward()
Determine if the user is allowed to move to the next panel.
|
void |
dispose()
Dispose of this object.
|
protected void |
fireChangeEvent()
Fire a change event.
|
Config |
getConfig()
Get a reference to this
WizardPanelSequence 's
Config object. |
WizardPanel |
getCurrentPanel()
Get the currently displayed panel from this sequence.
|
WizardPanel |
getNextPanel()
Get the next panel from this sequence.
|
WizardPanel |
getPreviousPanel()
Get the previous panel from this sequence.
|
boolean |
isLastPanel()
Determine if the current panel is the last panel in the sequence.
|
void |
removeChangeListener(ChangeListener listener)
Remove a
ChangeListener from this object's list of
listeners. |
void |
reset()
Reset the sequence.
|
void |
stateChanged(ChangeEvent evt)
Handle
ChangeEvent s fired by the WizardPanel s
that belong to this sequence. |
protected int currentIndex
WizardPanel
.private ChangeSupport support
public WizardPanelSequence()
WizardPanelSequence
.public WizardPanelSequence(Config config)
WizardPanelSequence
with the given
configuration object.config
- The configuration object to use as a datasource.public final void addPanel(WizardPanel panel)
WizardPanel
to this sequence. All panels should be
added before the sequence is used to construct a WizardView
.panel
- The panel to add.addPanels(kiwi.ui.WizardPanel[])
public final void addPanels(WizardPanel[] panels)
WizardPanel
s to this sequence. All panels
should be added before the sequence is used to construct a
WizardView
.panels
- The panels to add.addPanel(kiwi.ui.WizardPanel)
public void reset()
getNextPanel()
will return the first panel in the sequence.getNextPanel()
public final Config getConfig()
WizardPanelSequence
's
Config
object.Config
object.public WizardPanel getCurrentPanel()
public WizardPanel getNextPanel()
panels
vector and
increments the currentIndex
variable only if the end of
the sequence has not been reached and the next panel is
reachable (e.g., if canMoveForward()
returns
WizardView
.public WizardPanel getPreviousPanel()
panels
vector and
decrements the currentIndex
variable only if the beginning
of the sequence has not been reached and the previous panel is
reachable (e.g., if canMoveBackward()
returns
true
).WizardView
.public boolean isLastPanel()
WizardView
changes its Next button to a
Finish button.true
if the current panel is the last panel, and
false
otherwise.public boolean canMoveForward()
true
if the current panel
is not the last panel in the sequence and the
canMoveForward()
method of the current panel
returns true
. Subclassers may wish to override this
method to allow movement forward only if certain conditions are
met.true
if the previous panel is reachable, and
false
otherwise.public boolean canMoveBackward()
true
if the
current panel is not the first panel in the sequence and
the canMoveBackward()
method of the current panel
returns true
. Subclassers may wish to override this
method to allow movement backward only if certain conditions are
met.public void stateChanged(ChangeEvent evt)
ChangeEvent
s fired by the WizardPanel
s
that belong to this sequence. The default implementation does nothing;
subclassers may wish to add logic to determine (based on the current
values of properties in the Config
object) whether movement
to the next or previous panel is allowed, or to determine which panel
will be displayed next, for example.stateChanged
in interface ChangeListener
evt
- The event. The source of the event is the
WizardPanel
that fired it.EventObject.getSource()
public void addChangeListener(ChangeListener listener)
ChangeListener
to this object's list of listeners.listener
- The listener to add.public void removeChangeListener(ChangeListener listener)
ChangeListener
from this object's list of
listeners.listener
- The listener to remove.protected void fireChangeEvent()
WizardView
that owns this sequence) that the state of this
WizardPanelSequence
has changed. Subclassers may wish to
call this method from the body of the stateChanged()
method if a change in the Config
object has changed the
state of this WizardPanelSequence
in a way that will
affect the appearance of the WizardView
.public void dispose()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses