org.xwiki.gwt.user.client.ui.wizard
Class Wizard

java.lang.Object
  extended by org.xwiki.gwt.user.client.ui.wizard.Wizard
All Implemented Interfaces:
com.google.gwt.event.logical.shared.CloseHandler<CompositeDialogBox>, com.google.gwt.event.shared.EventHandler, NavigationListener

public class Wizard
extends java.lang.Object
implements NavigationListener, com.google.gwt.event.logical.shared.CloseHandler<CompositeDialogBox>

Wizard to handle the loading and navigation in a list of chained dialogs.

Version:
$Id: Wizard.java 28843 2010-05-12 12:46:22Z mflorea $

Nested Class Summary
protected  class Wizard.AbstractDefaultAsyncCallback<T>
          Asynchronous callback adapter to handle the callback fails by displaying the error inside the dialog.
 
Nested classes/interfaces inherited from interface org.xwiki.gwt.user.client.ui.wizard.NavigationListener
NavigationListener.NavigationDirection
 
Field Summary
protected  WizardStep currentStep
          The current step of the wizard.
protected  WizardDialog dialog
          The dialog in which the wizard steps are loaded.
protected  java.util.Stack<java.lang.String> navigationStack
          Navigation stack to store the user's path through the chain of wizard steps.
protected  WizardStepProvider provider
          The wizard step provider to get the steps for the next wizard dialogs.
protected  java.util.List<WizardListener> wizardListeners
          The list of wizard listeners to be notified by this wizard on events.
 
Constructor Summary
Wizard(java.lang.String wizardTitle, com.google.gwt.user.client.ui.Image wizardIcon)
          Builds a wizard from the passed title and with the specified icon.
 
Method Summary
 void addWizardListener(WizardListener listener)
          Adds a wizard listener to the list notified by this wizard.
 WizardStepProvider getProvider()
           
protected  java.lang.Object getResult()
           
 void hideDialog()
          Helper function to hide the dialog and mark that it's a programmatic close not a user close.
protected  void initAndDisplayCurrentStep(java.lang.Object data)
          Initializes and displays the current wizard step, with the passed data.
protected  void onCancel()
          Handle cancel of the whole wizard.
 void onClose(com.google.gwt.event.logical.shared.CloseEvent<CompositeDialogBox> event)
          
 void onDirection(NavigationListener.NavigationDirection direction)
          Triggered when a navigation event takes place.
protected  void onFinish()
          Handle commanding the finish of the whole wizard.
protected  void onNext()
          Handle advancing to the next step.
protected  void onPrevious()
          Handle going to the previous step.
 void removeWizardListener(WizardListener listener)
          Removes the specified wizard listener from the list notified by this wizard.
 void setProvider(WizardStepProvider provider)
           
 void start(java.lang.String startStep, java.lang.Object data)
          Shows the wizard from the starting step, with the passed data.
protected  void unloadCurrentStep()
          Prepares the current step to be unloaded (remove all listeners, etc.), to be executed before loading a next (or previous) step.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wizardListeners

protected final java.util.List<WizardListener> wizardListeners
The list of wizard listeners to be notified by this wizard on events.


navigationStack

protected final java.util.Stack<java.lang.String> navigationStack
Navigation stack to store the user's path through the chain of wizard steps.


provider

protected WizardStepProvider provider
The wizard step provider to get the steps for the next wizard dialogs.


dialog

protected final WizardDialog dialog
The dialog in which the wizard steps are loaded.


currentStep

protected WizardStep currentStep
The current step of the wizard.

Constructor Detail

Wizard

public Wizard(java.lang.String wizardTitle,
              com.google.gwt.user.client.ui.Image wizardIcon)
Builds a wizard from the passed title and with the specified icon.

Parameters:
wizardTitle - the title of this wizard
wizardIcon - the icon of this wizard
Method Detail

getProvider

public WizardStepProvider getProvider()
Returns:
the wizard step provider

setProvider

public void setProvider(WizardStepProvider provider)
Parameters:
provider - the wizard step provider to set

start

public void start(java.lang.String startStep,
                  java.lang.Object data)
Shows the wizard from the starting step, with the passed data.

Parameters:
startStep - the name of the start step for this wizard
data - the input data for this wizard, to pass to the start step

initAndDisplayCurrentStep

protected void initAndDisplayCurrentStep(java.lang.Object data)
Initializes and displays the current wizard step, with the passed data.

Parameters:
data - the data to initialize the current step with

unloadCurrentStep

protected void unloadCurrentStep()
Prepares the current step to be unloaded (remove all listeners, etc.), to be executed before loading a next (or previous) step.


onDirection

public void onDirection(NavigationListener.NavigationDirection direction)
Triggered when a navigation event takes place.

Specified by:
onDirection in interface NavigationListener
Parameters:
direction - the direction of the navigation event
See Also:
NavigationListener.onDirection(NavigationDirection)

onCancel

protected void onCancel()
Handle cancel of the whole wizard.


onPrevious

protected void onPrevious()
Handle going to the previous step.


onNext

protected void onNext()
Handle advancing to the next step.


onFinish

protected void onFinish()
Handle commanding the finish of the whole wizard.


getResult

protected java.lang.Object getResult()
Returns:
the result of this wizard

addWizardListener

public void addWizardListener(WizardListener listener)
Adds a wizard listener to the list notified by this wizard.

Parameters:
listener - the listener to add

removeWizardListener

public void removeWizardListener(WizardListener listener)
Removes the specified wizard listener from the list notified by this wizard.

Parameters:
listener - the listener to remove

onClose

public void onClose(com.google.gwt.event.logical.shared.CloseEvent<CompositeDialogBox> event)

Specified by:
onClose in interface com.google.gwt.event.logical.shared.CloseHandler<CompositeDialogBox>
See Also:
CloseHandler.onClose(CloseEvent)

hideDialog

public void hideDialog()
Helper function to hide the dialog and mark that it's a programmatic close not a user close.



Copyright © 2004-2010 XWiki. All Rights Reserved.