finish()
method implements actions to be done at the end of the wizard.
getPreviousScreen()
and getNextScreen()
have to return previous or next screen class. Example:
public Class getNextScreen(Class screen) {
if (ActionSelectionPanel.class.equals(getCurrentScreen())){
String sAction = (String)data.get(KEY_ACTION);
if (ActionSelectionPanel.ACTION_CREATION.equals(sAction)){
return TypeSelectionPanel.class;
}
else if (ActionSelectionPanel.ACTION_DELETE.equals(sAction)){
return RemovePanel.class;
}
}
}
Screen creation
For each wizard page, create a public Screen class.
You have to implement initUI(),
getDescription()
and getName()
abstract methods.
getName() method should return the step name and
getDescription() the step description (return null if no description
needed).
initUI() method contains graphical code for your screen. This method is
automatically called from screen constructor so don't call it.
General use
Set errors using the setProblem(String)
method. The error will be displayed in red to the user at the bottom of
the screen. When error is fixed, use a setProblem(null).
Get and set wizard data using the data object
available from wizard and screen classes.
Use setCanFinish(true)method in a screen to set the fact that the screen is
the last one (user can click on Finish button). You can actually call this function at anytime the user has completed enough of the wizard steps to warrent enabling the Finish button..
By default, QDwizard keeps screens into memory so user can go previous or next and keep typed values. If you want
to clear this cache, just make your screen(s) implement ClearPoint interface.
When user will reach a screen that implements this interface, cache is cleaned up.
The Screen class contains two empty methods onEnter() and onNext() which are called by the wizard on entering and respectively before leaving the screen.
You can override them if you want your screens to be notified on enter or leave.
Note that this happens only in forwardmode, which means onEnter won't be called when you return to
a screen via the previous button and onLeave won't be called when you leave
the screen via the previous button.
You can implement a onCancel()method in your wizard,
which will be called when the user presses the Cancel button. Return TRUE if the wizard should close Return FALSE if the wizard should remain open..
Internationalization
QDWizard supports at the moment following locales: English, French, German, Dutch, Spanish and Catalan. You can extend
the i18n support for any locale xx by placing a qdwizard_xx.properties file in your classpath containing entries for
Finish, Cancel, Previous and Next.
Download
QDWizard distribution includes API binaries,
sources and doc for any system supporting Java 1.5+. Download
it here.