juife
v0.1a

net.sf.juife.wizard
Class DefaultWizardModel

java.lang.Object
  extended by net.sf.juife.wizard.AbstractWizardModel
      extended by net.sf.juife.wizard.DefaultWizardModel
All Implemented Interfaces:
WizardModel

public class DefaultWizardModel
extends AbstractWizardModel

Default implementation of the WizardModel interface.


Constructor Summary
DefaultWizardModel()
          Creates a new instance of DefaultWizardModel
DefaultWizardModel(WizardPage[] pages)
          Creates a new instance of DefaultWizardModel using the specified pages.
 
Method Summary
 void addPage(WizardPage page)
          Adds the specified wizard page to the end of the list.
 void addStep(java.lang.String step)
          Adds a step that corresponds to one wizard page.
 void addStep(java.lang.String step, int pageCount)
          Adds a step to this model.
 WizardPage getCurrentPage()
          Gets the current page.
 java.lang.String getCurrentStep()
          Gets the current step in the wizard.
 java.lang.String[] getSteps()
          Gets a String array providing the current list of steps.
 boolean hasLast()
          Determines whether the last page is specified.
 boolean hasNext()
          Determines whether there is a next page in this wizard.
 boolean hasPrevious()
          Determines whether there is a previous page in this wizard.
 WizardPage last()
          Moves to the last page in the wizard.
 WizardPage next()
          Moves to the next page in the wizard.
 WizardPage previous()
          Moves to the previous page in the wizard.
 void setLast()
          Sets the last page of the wizard to be the last page of the model.
 void setLast(WizardPage page)
          Sets the last page of the wizard.
 void setPages(WizardPage[] pages)
          Sets the pages this wizard will use in the specified order.
 
Methods inherited from class net.sf.juife.wizard.AbstractWizardModel
addActionListener, fireActionPerformed, removeActionListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultWizardModel

public DefaultWizardModel()
Creates a new instance of DefaultWizardModel


DefaultWizardModel

public DefaultWizardModel(WizardPage[] pages)
Creates a new instance of DefaultWizardModel using the specified pages.

Parameters:
pages - A WizardPage array providing the pages this wizard will use arranged in order of appearance.
Method Detail

addPage

public void addPage(WizardPage page)
Adds the specified wizard page to the end of the list.

Parameters:
page - The non null wizard page to be added.
Throws:
java.lang.IllegalArgumentException - If the page is null.

setPages

public void setPages(WizardPage[] pages)
Sets the pages this wizard will use in the specified order. Note that this method removes all previously added pages.

Parameters:
pages - A WizardPage array providing the pages this wizard will use arranged in order of appearance.
Throws:
java.lang.IllegalArgumentException - If pages contains null element.

setLast

public void setLast()
Sets the last page of the wizard to be the last page of the model.

Throws:
java.lang.IllegalArgumentException - If the model is empty.

setLast

public void setLast(WizardPage page)
Sets the last page of the wizard. The last page in the wizard is not necessarily the last page in the model. It is just the page which will be displayed when the user clicks the 'Last' button.

Note that the specified page must be added to the model before the invocation of this method.

Parameters:
page - Specifies the last page of the wizard.
Throws:
java.lang.IllegalArgumentException - If the model does not contain the specified page.

hasNext

public boolean hasNext()
Determines whether there is a next page in this wizard.

Returns:
true if there is a next page in this wizard, false otherwise.
See Also:
next()

next

public WizardPage next()
Moves to the next page in the wizard.

Returns:
The next page in the wizard.
See Also:
hasNext()

hasPrevious

public boolean hasPrevious()
Determines whether there is a previous page in this wizard.

Returns:
true if there is a previous page in this wizard, false otherwise.
See Also:
previous()

previous

public WizardPage previous()
Moves to the previous page in the wizard.

Returns:
The previous page in the wizard.
See Also:
hasPrevious()

hasLast

public boolean hasLast()
Determines whether the last page is specified. If the last page is specified the 'Last' button in the wizard will be enabled.

Returns:
true if last page is specified, false otherwise.
See Also:
last

last

public WizardPage last()
Moves to the last page in the wizard. Last page is the page which will be displayed when the user clicks the 'Last' button. Note that the last page in the wizard is not necessarily the last page in the model.

Returns:
The page specified as last in the wizard.
See Also:
hasLast()

getCurrentPage

public WizardPage getCurrentPage()
Gets the current page.

Returns:
The current page or null if there isn't current page yet.

getSteps

public java.lang.String[] getSteps()
Gets a String array providing the current list of steps.

Returns:
A String array providing the current list of steps or null if the list of steps is not available.

getCurrentStep

public java.lang.String getCurrentStep()
Gets the current step in the wizard.

Returns:
The current step in the wizard or null if there is no current step.

addStep

public void addStep(java.lang.String step)
Adds a step that corresponds to one wizard page.

Parameters:
step - The step title.

addStep

public void addStep(java.lang.String step,
                    int pageCount)
Adds a step to this model.

Parameters:
step - The step title.
pageCount - The number of pages this step corresponds to.

juife
v0.1a

Copyright © 2005 Grigor Iliev. All rights reserved. SourceForge.net Logo