org.infai.emo.matcher.editor.wizard
Class Wizard

java.lang.Object
  extended by org.infai.emo.matcher.editor.wizard.Wizard
Direct Known Subclasses:
ModOpWizard

public abstract class Wizard
extends java.lang.Object

This is an abstract class for creating a custom wizard within the eclipse-ide.

Version:
1.0.0
Author:
Stanley Hillner

Field Summary
private  int activePageIndex
          The index of the currently activated page.
private  org.eclipse.swt.widgets.Button back
          The Back-Button.
private  org.eclipse.swt.widgets.Composite buttonContainer
          The Container for the buttons.
private  org.eclipse.swt.widgets.Button cancel
          The Cancel-Button.
private  boolean canFinish
          This flag indicates if the wizard is able to finish and close.
private  org.eclipse.swt.widgets.Display d
          The Display the wizard is shown on.
private  org.eclipse.swt.widgets.Button finish
          The Finish-Button.
private  org.eclipse.swt.widgets.Composite header
          This is the Composite that contains the header of the wizard with the image, title and description.
private  org.eclipse.swt.graphics.Image image
          This is the wizard-icon.
private  org.eclipse.swt.widgets.Button next
          The Next-Button.
private  org.eclipse.swt.widgets.Composite pageContainer
          The Composite that contains the wizard-pages.
private  java.lang.String pageDescription
          The Description of the currently activated page.
private  java.util.Vector<WizardPage> pages
          The Vector that caches the wizard-pages in the order they are added.
private  java.lang.String pageTitle
          The Title of the currently activated page.
private  org.eclipse.swt.widgets.Shell shell
          The Shell which contains the wizard.
 
Constructor Summary
Wizard(java.lang.String title)
          A new Wizard with a custom title.
 
Method Summary
 void addPage(WizardPage page)
          Add a new WizardPage to the wizard.
abstract  boolean computeCancel()
          This method is the central action to be executed after clicking the cancel-button.
abstract  boolean computeFinish()
          This method is the central action to be executed after clicking the finish-button.
private  void createButtons(org.eclipse.swt.widgets.Composite parent)
          This method creates the button-Container including the four standard-buttons.
private  void createGUI(java.lang.String title)
          creates the user-interface of the wizard.
private  void createHeader()
          This method creates the header containing the icon, the title of the currently active page and its description.
 void disableBack()
          Disables the back-button.
 void disableFinish()
          Disables the finish-button.
 void disableNext()
          Disables the next-button.
 void enableBack()
          Enables the back-button.
 void enableFinish()
          Enables the finish-button.
 void enableNext()
          Enables the next-button or the finish-button if there is no other page.
 org.eclipse.swt.widgets.Display getDisplay()
           
 java.util.Vector<WizardPage> getPages()
           
 org.eclipse.swt.widgets.Shell getShell()
           
private  void nextPage()
          Disables current and enables next page.
 void openWizard()
          Method opens the pre-built wizard if the number of pages is different from 0.
private  void previousPage()
          Disables current and enables previous page.
 void setPage(WizardPage page)
          This method switches to another Page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

d

private org.eclipse.swt.widgets.Display d
The Display the wizard is shown on.

See Also:
Display

shell

private org.eclipse.swt.widgets.Shell shell
The Shell which contains the wizard.

See Also:
Shell

back

private org.eclipse.swt.widgets.Button back
The Back-Button.

See Also:
Button

next

private org.eclipse.swt.widgets.Button next
The Next-Button.

See Also:
Button

finish

private org.eclipse.swt.widgets.Button finish
The Finish-Button.

See Also:
Button

cancel

private org.eclipse.swt.widgets.Button cancel
The Cancel-Button.

See Also:
Button

pages

private java.util.Vector<WizardPage> pages
The Vector that caches the wizard-pages in the order they are added.

See Also:
Vector, WizardPage

pageTitle

private java.lang.String pageTitle
The Title of the currently activated page.


pageDescription

private java.lang.String pageDescription
The Description of the currently activated page.


canFinish

private boolean canFinish
This flag indicates if the wizard is able to finish and close.


header

private org.eclipse.swt.widgets.Composite header
This is the Composite that contains the header of the wizard with the image, title and description.

See Also:
Composite

pageContainer

private org.eclipse.swt.widgets.Composite pageContainer
The Composite that contains the wizard-pages.

See Also:
Composite

buttonContainer

private org.eclipse.swt.widgets.Composite buttonContainer
The Container for the buttons.

See Also:
Composite

image

private org.eclipse.swt.graphics.Image image
This is the wizard-icon.
It is intended to set the icon new within the page.

See Also:
Image

activePageIndex

private int activePageIndex
The index of the currently activated page.

Constructor Detail

Wizard

public Wizard(java.lang.String title)
A new Wizard with a custom title.

Parameters:
title - the title for the wizard.
Method Detail

createGUI

private void createGUI(java.lang.String title)
creates the user-interface of the wizard.

Parameters:
title - the title of the wizard.

createHeader

private void createHeader()
This method creates the header containing the icon, the title of the currently active page and its description.


createButtons

private void createButtons(org.eclipse.swt.widgets.Composite parent)
This method creates the button-Container including the four standard-buttons.

Parameters:
parent - the composite the container shall be on.
See Also:
Composite

setPage

public void setPage(WizardPage page)
This method switches to another Page.

Parameters:
page - the page to activate.
See Also:
WizardPage

addPage

public void addPage(WizardPage page)
Add a new WizardPage to the wizard.

Parameters:
page - the new page.
See Also:
WizardPage

enableNext

public void enableNext()
Enables the next-button or the finish-button if there is no other page.


disableNext

public void disableNext()
Disables the next-button.


enableBack

public void enableBack()
Enables the back-button.


disableBack

public void disableBack()
Disables the back-button.


enableFinish

public void enableFinish()
Enables the finish-button.


disableFinish

public void disableFinish()
Disables the finish-button.


computeFinish

public abstract boolean computeFinish()
This method is the central action to be executed after clicking the finish-button.
Users must implement this method.
Note: After executing this method the wizard will be closed automatically.

Returns:
true if this method finished without errors.

computeCancel

public abstract boolean computeCancel()
This method is the central action to be executed after clicking the cancel-button.
Users must implement this method.
Note: After executing this method the wizard will be closed automatically.

Returns:
true if this method finished without errors.

openWizard

public void openWizard()
Method opens the pre-built wizard if the number of pages is different from 0.


nextPage

private void nextPage()
Disables current and enables next page.


previousPage

private void previousPage()
Disables current and enables previous page.


getPages

public java.util.Vector<WizardPage> getPages()
Returns:
a Vector containing the pages of the wizard in the order they were set.
See Also:
Vector, WizardPage

getDisplay

public org.eclipse.swt.widgets.Display getDisplay()
Returns:
the display of the wizard.
See Also:
Display

getShell

public org.eclipse.swt.widgets.Shell getShell()
Returns:
the shell of the wizard.
See Also:
Shell