net.sf.doolin.gui.wizard.state
Class WizardState<B>

java.lang.Object
  extended by net.sf.doolin.bus.bean.Bean
      extended by net.sf.doolin.gui.wizard.state.WizardState<B>
Type Parameters:
B - Type of bean for the wizard
All Implemented Interfaces:
Serializable, IBean

public class WizardState<B>
extends Bean

Definition of the current state of a wizard.

Author:
Damien Coraboeuf
See Also:
Serialized Form

Field Summary
static String CURRENT_VIEW
          Property name for the current view: "currentView"
 
Constructor Summary
WizardState(B model, WizardRules<B> wizardRules, String initialView)
          Constructor.
 
Method Summary
 boolean canFinish()
          Checks if the wizard can be finished
 boolean canNext()
          Checks if the wizard can be navigated to the next view.
 boolean canPrevious()
          Checks if the wizard can be navigated to the previous view.
 void doNext(ActionContext actionContext)
          Actually navigates to the next view in the wizard.
 void doPrevious(ActionContext actionContext)
          Actually navigates to the previous view.
 String getCurrentView()
          Gets the current view
 B getWizardModel()
          Gets the bean for the wizard
 void setCurrentView(String currentView)
          Navigates to the given view.
 
Methods inherited from class net.sf.doolin.bus.bean.Bean
getBeanNotificationSupport, getParentBean, notify, setParentBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENT_VIEW

public static final String CURRENT_VIEW
Property name for the current view: "currentView"

See Also:
Constant Field Values
Constructor Detail

WizardState

public WizardState(B model,
                   WizardRules<B> wizardRules,
                   String initialView)
Constructor.

Parameters:
model - Wizard bean
wizardRules - Wizard navigation rules
initialView - Name of the initial view
Method Detail

canFinish

public boolean canFinish()
Checks if the wizard can be finished

Returns:
Finish-enabled status
See Also:
WizardRules.canFinish(String, Object)

canNext

public boolean canNext()
Checks if the wizard can be navigated to the next view. The WizardRules.getNext(String, Object) is called and "Next" is enabled if the returned view is different than null.

Returns:
Next-enabled status
See Also:
WizardRules.getNext(String, Object)

canPrevious

public boolean canPrevious()
Checks if the wizard can be navigated to the previous view. It is possible if the stack of navigated views if not empty.

Returns:
Previous-enabled status

doNext

public void doNext(ActionContext actionContext)
Actually navigates to the next view in the wizard. Before the navigation is actually done, any transaction action for the next view is executed. Then, the next view becomes the current view and this change is notified on the bus.

Parameters:
actionContext - Action context
See Also:
WizardRules.getNext(String, Object), setCurrentView(String)

doPrevious

public void doPrevious(ActionContext actionContext)
Actually navigates to the previous view. The current view name is popped for the stack of navigated views and the new stack top becomes the current view. No action is executed.

Parameters:
actionContext - Action context
See Also:
setCurrentView(String)

getCurrentView

public String getCurrentView()
Gets the current view

Returns:
Current view name

getWizardModel

public B getWizardModel()
Gets the bean for the wizard

Returns:
Bean

setCurrentView

public void setCurrentView(String currentView)
Navigates to the given view. The new name is notified on the bus.

Parameters:
currentView - View name


Copyright © 2011. All Rights Reserved.