Language

The Free and Open Productivity Suite
Released: Apache OpenOffice 4.1.15

API

SDK

Tips ‘n’ Tricks

Miscellaneous


:: com :: sun :: star :: ui :: dialogs ::

interface XWizard
Base Interfaces
XWizardXExecutableDialog

XExecutableDialog
(referenced interface's summary:)
Specifies an interface for an executable dialog.
Description
is the main interface implemented by the Wizard services.

A wizard is a dialog which guides the user through a number of tasks (usually input of data), which the user can accomplish either sequentially or out-of-order. For this, a wizard is comprised of a number of tab pages, each page representing a single step.

Sequential navigation in a wizard is done via a Next and a Back button. Non-sequential navigation is done via a roadmap, which is displayed on the left hand side of the wizard dialog, lists all available steps, and allows jumping to a certain step (where the creator of the wizard can restrict the available steps depending on the current situation in the wizard, see below).

A sequence of steps in a wizard dialog is called a path. A given wizard can support one or multiple paths, which are declared at the time of construction of the wizard.

In the simplest case, where the wizard supports only one path, all available steps are displayed in the roadmap, and the user can simply travel through them as desired.

If the wizard is more complex, and supports multiple paths, things become more complicated. In a given situation of the wizard, where the user is at step k of the current path, the potential or conflicting paths are those whose first k steps are the same as in the current path. Obviously, there's at least one potential path in every situation: the current one. If there is more than one, then the future steps in the dialog are not finally decided. In such a case, the roadmap will display future steps up to the point where the potential paths diverge, and then an item ... indicating that the order of steps is undecided.

An XWizardController can declare a certain path as active path by calling the activatePath method. Usually, this is done depending on user input. For instance, your wizard could have radio buttons on the first page which effectively decide about which path to take in the wizard.

Single steps in the wizard can be freely enabled and disabled, using the enablePage method. Disabled pages are skipped during sequential traveling, and not selectable in the roadmap.

The state of the Next button in the dialog will be automatically maintained in most situations, depending on the results of calls to the XWizardController::canAdvance and XWizardPage::canAdvance methods. More sophisticated wizard logic, however, will need manual calls to the enableButton method. Also, the Finish button needs to be maintained by the wizard's controller, too, as it cannot be decided generically in which situations it should be enabled or disabled.

See also
XWizardController, XWizardPage

Methods' Summary
getCurrentPage provides access to the current page of the wizard  
enableButton enables or disables a certain button in the wizard  
setDefaultButton sets a button in the wizard as default button  
travelNext travels to the next page, if possible  
travelPrevious travels to the next page, if possible  
enablePage enables or disables the given page  
updateTravelUI updates the wizard elements which are related to traveling.  
advanceTo advances to the given page, if possible.  
goBackTo goes back to the given page, if possible.  
activatePath activates a path  
Attributes' Summary
HelpURL is the help URL of the wizard's main window.  
DialogWindow  
Methods' Details
getCurrentPage
XWizardPage
getCurrentPage();

Description
provides access to the current page of the wizard
enableButton
void
enableButton( [in] short  WizardButton,
[in] boolean  Enable );

Description
enables or disables a certain button in the wizard

Normally, you will want to use this method for the Finish button only: The Next and Back buttons are usually maintained automatically, the Help and Cancel buttons are unlikely to ever being disabled.

Parameter WizardButton
denotes the button to enable or disable, as one of the WizardButton constants. Must not be WizardButton::NONE.
Parameter Enable
specifies whether the button should be enabled (true) or disabled (false)
setDefaultButton
void
setDefaultButton( [in] short  WizardButton );

Description
sets a button in the wizard as default button

In general, the default button in a wizard is the one which is activated when the user presses the return key while the focus is in a control which does not handle this key itself (such as ordinary input controls).

You can use this method, for instance, to make the Next button the default button on all pages except the last one, where Finish should be defaulted.

travelNext
boolean
travelNext();

Description
travels to the next page, if possible

Calling this method is equivalent to the user pressing the Next button in the wizard. Consequently, the method will fail if in the current state of the wizard, it is not allowed to advance to a next page.

travelPrevious
boolean
travelPrevious();

Description
travels to the next page, if possible

Calling this method is equivalent to the user pressing the Back button in the wizard.

enablePage
void
enablePage( [in] short  PageID,
[in] boolean  Enable )
raises( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::util::InvalidStateException );

Description
enables or disables the given page

You can use this method when not all pages of your wizard are necessarily needed in all cases. For instance, assume that your first wizard page contains a check box, which the user can check to enter additional data. If you place this data on the second page, then you will want to enable this second page if and only if the checkbox is checked.

If a page is disabled, it can reached neither by clicking the respective item in the wizard's roadmap, nor by sequential traveling. Still, the page's item is displayed in the roadmap, though disabled.

Throws
::com::sun::star::container::NoSuchElementException if there is no page with the given ID
Throws
::com::sun::star::util::InvalidStateException if the page shall be disabled, but is active currently.
updateTravelUI
void
updateTravelUI();

Description
updates the wizard elements which are related to traveling.

For instance, the Next button is disabled if the current page's XWizardPage::canAdvance method returns false.

You usually call this method from within a wizard page whose state changed in a way that it affects the user's ability to reach other pages.

advanceTo
boolean
advanceTo( [in] short  PageId );

Description
advances to the given page, if possible.

Calling this method is equivalent to the user repeatedly pressing the Next button, until the given page is reached. Consequently, the method will fail if one of the intermediate pages does not allow advancing to the next page.

goBackTo
boolean
goBackTo( [in] short  PageId );

Description
goes back to the given page, if possible.

Calling this method is equivalent to the user repeatedly pressing the Back button, until the given page is reached.

activatePath
void
activatePath( [in] short  PathIndex,
[in] boolean  Final )
raises( ::com::sun::star::container::NoSuchElementException,
::com::sun::star::util::InvalidStateException );

Description
activates a path

If the wizard has been created with multiple paths of control flow, then this method allows switching to another path.

You can only activate a path which shares the first k pages with the path which is previously active (if any), where k is the index of the current page within the current path.

Example: Say you have paths, (0,1,2,5) and (0,1,4,5) (with the numbers denoting page IDs). This means that after page 1, you either continue with page 2 or state 4,and after this, you finish in state 5.
Now if the first path is active, and your current state is 1, then you can easily switch to the second path, since both paths start with (0,1).
However, if your current state is 2, then you can not switch to the second path anymore.

Parameter PathIndex
the index of the path, as used in the Wizard::createMultiplePathsWizard constructor.
Parameter Final

If true, the path will be completely activated, even if it is a conflicting path (i.e. there is another path which shares the first k states with the to-be-activated path.)

If false, then the new path is checked for conflicts with other paths. If such conflicts exists, the path is not completely activated, but only up to the point where it does not conflict.

In this latter case, you need another activatePath method (usually triggered by the user doing some decisions and entering some data on the reachable pages) before the wizard can actually be finished.

With the paths in the example above, if you activate the second path, then only steps 0 and 1 are activated, since they are common to both paths. Steps 2, 4, and 5 are not reachable, yet.

Throws
::com::sun::star::container::NoSuchElementException if there is no path with the given index
Throws
::com::sun::star::util::InvalidStateException if the path cannot be activated in the current state of the wizard.
Attributes' Details
HelpURL
string HelpURL;
Description
is the help URL of the wizard's main window.
DialogWindow
[ readonly ] ::com::sun::star::awt::XWindow DialogWindow;
Top of Page

Apache Software Foundation

Copyright & License | Privacy | Contact Us | Donate | Thanks

Apache, OpenOffice, OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. The Apache feather logo is a trademark of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.