org.xwiki.gwt.user.client.ui.wizard
Class AbstractAutoSubmitWizardStep<T>

java.lang.Object
  extended by org.xwiki.gwt.user.client.ui.wizard.AbstractNavigationAwareWizardStep
      extended by org.xwiki.gwt.user.client.ui.wizard.AbstractAutoSubmitWizardStep<T>
Type Parameters:
T - the type of data processed by this wizard step
All Implemented Interfaces:
WizardStep
Direct Known Subclasses:
ResourceReferenceParserWizardStep, ResourceReferenceSerializerWizardStep

public abstract class AbstractAutoSubmitWizardStep<T>
extends AbstractNavigationAwareWizardStep

Abstract wizard step that is automatically submitted after it is initialized. This should be the base class for all wizard steps that don't require user input, i.e. that are non-interactive. Derived classes should overwrite onSubmit(AsyncCallback) to process the input data.


Constructor Summary
AbstractAutoSubmitWizardStep()
           
 
Method Summary
 com.google.gwt.user.client.ui.Widget display()
          This method is called right after the wizard step has been successfully initialized.
protected  T getData()
           
 Object getResult()
           
 String getStepTitle()
           
 void init(Object data, com.google.gwt.user.client.rpc.AsyncCallback<?> cb)
          Initializes the current wizard step, according to the passed data.
 boolean isAutoSubmit()
           
 void onCancel()
          Called before canceling the current wizard step.
 void onSubmit(com.google.gwt.user.client.rpc.AsyncCallback<Boolean> async)
          Called before submitting the current wizard step.
 void setStepTitle(String stepTitle)
          Sets the step title.
 
Methods inherited from class org.xwiki.gwt.user.client.ui.wizard.AbstractNavigationAwareWizardStep
getDirectionName, getNextStep, getValidDirections, setDirectionName, setNextStep, setValidDirections
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAutoSubmitWizardStep

public AbstractAutoSubmitWizardStep()
Method Detail

init

public final void init(Object data,
                       com.google.gwt.user.client.rpc.AsyncCallback<?> cb)
Initializes the current wizard step, according to the passed data. This method is called before the wizard step is displayed, on both navigation directions. The input data is either the data the wizard was started with or the data returned by the WizardStep.getResult() method of the previous step. The callback parameter should handle the asynchronous initialization of this wizard step.

Don't overwrite this method. Overwrite onSubmit(AsyncCallback) instead and use getData().

Parameters:
data - an object to pass to the wizard step, which can contain configuration data
cb - the object to be notified when the wizard step has finished initializing
See Also:
WizardStep.init(Object, AsyncCallback)

getData

protected T getData()
Returns:
the data processed by this wizard step

getStepTitle

public String getStepTitle()
Returns:
the title of the current step, as it should be displayed when the step is shown

setStepTitle

public void setStepTitle(String stepTitle)
Sets the step title.

Parameters:
stepTitle - the new step title

display

public final com.google.gwt.user.client.ui.Widget display()
Description copied from interface: WizardStep
This method is called right after the wizard step has been successfully initialized.

Returns:
the UI representation of this wizard step

getResult

public Object getResult()
Returns:
the result of the current step, in its current state. The result of the current wizard step will be used as the input for the next step in the wizard chain, either the next (as returned by WizardStep.getNextStep()) or the previous in the navigation stack.

onSubmit

public void onSubmit(com.google.gwt.user.client.rpc.AsyncCallback<Boolean> async)
Called before submitting the current wizard step. Here is the point to do validation and to compute the current result of the dialog as well as the next step name. The asynchronous callback result (true or false) will be used to determine if the submit should continue or it should be prevented.

Overwrite if you want to change the input data.

Parameters:
async - the object to be notified when the submit is done; pass true to notify that the submit was successful and the wizard can move to the next step; pass false if the user needs to adjust the submitted data
See Also:
WizardStep.onSubmit(AsyncCallback)

isAutoSubmit

public final boolean isAutoSubmit()
Returns:
true if this step should be submitted automatically, false otherwise; the WizardStep.display() method should return null if the step is submitted automatically

onCancel

public void onCancel()
Description copied from interface: WizardStep
Called before canceling the current wizard step. Here is the point to do all adjustments before the previous dialogs loaded, in the case of a chained wizard.