concept IWizardPage in category java

appears as: IWizardPage
Swt/Jface in Action: GUI Design with Eclipse 3.0

This is an excerpt from Manning's book Swt/Jface in Action: GUI Design with Eclipse 3.0.

Figure 11.1 shows how the classes and interfaces of the wizard framework fit together. The most important thing to take away is that the concrete classes at each level, WizardDialog and Wizard, depend only on the interface of the next level down, not the default implementation. This same property holds when traversing the other direction—although IWizardPage makes use of IWizard, it doesn’t matter whether IWizard is implemented by Wizard or by some other class. We’ll start at the bottom of the diagram and work our way upward through the hierarchy, discussing each of these classes in turn. We’ll then show you how they work together.

JFace uses the IWizardPage interface to represent a single page in a wizard. A variety of methods are defined in this interface; the most important ones are summarized in table 11.1.

Table 11.1. Important methods defined by IWizardPage

Method

Description

getName() Each page must have a unique name. This method is often used to retrieve a particular page from the wizard.
getNextPage(), getPreviousPage() These methods are called when the user clicks the Next or Previous button to move to another page. The proper page to move to (which may vary depending on selections the user has made) must be returned.
isPageComplete() Indicates whether the user has filled out everything that is necessary on this page.
canFlipToNextpage() Indicates whether the Next button should be available for use. This method typically returns true if the page is complete and at least one page is left in the wizard.

Several other straightforward getter and setter methods are also defined in IWizardPage. Implementing all of them could quickly become tedious. Luckily, JFace comes to your rescue with a default implementation—the WizardPage class.