sk.uniba.euromath.editor.wizards
Class OnePageWizard<P extends BaseWizardPage>

java.lang.Object
  extended by sk.uniba.euromath.editor.wizards.OnePageWizard<P>
Type Parameters:
P - page type.
All Implemented Interfaces:
IWizard

public class OnePageWizard<P extends BaseWizardPage>
extends Object
implements IWizard

Wraps given wizard page into a one-paged wizard. Intended to be used with MultiWizard. Does nothing when finished.

Author:
Martin Vysny

Field Summary
protected  P page
          The represented page.
protected  String wizardName
          Returned as a wizard name.
 
Constructor Summary
OnePageWizard(P page, String wizardName)
          Constructor.
 
Method Summary
 boolean canFinish()
          Returns whether this wizard could be finished without further user interaction.
 BaseWizardPage current()
          Fetches the current page.
 void dispose()
          Disposes of this wizard.
 String getName()
          Returns name of this wizard.
 P getPage()
          Returns the page that this wizard represents.
 RGB getTitleBarColor()
          Returns the title bar color for this wizard.
 boolean hasNext()
          Checks if there is next page.
 boolean hasPrevious()
          Checks if there is previous page.
 BaseWizardPage next()
          Fetches the next page.
 boolean performCancel()
          Performs any actions appropriate in response to the user having pressed the Cancel button, or refuse if canceling now is not permitted.
 boolean performFinish()
          Performs any actions appropriate in response to the user having pressed the Finish button, or refuse if finishing now is not permitted.
 BaseWizardPage previous()
          Fetches the previous page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

page

protected final P extends BaseWizardPage page
The represented page. Stored here to avoid warning in getPage() function.


wizardName

protected final String wizardName
Returned as a wizard name.

Constructor Detail

OnePageWizard

public OnePageWizard(P page,
                     String wizardName)
Constructor.

Parameters:
page - represent this page.
wizardName - a name returned as a wizard name.
Method Detail

getPage

public P getPage()
Returns the page that this wizard represents.

Returns:
the page.

canFinish

public boolean canFinish()
Description copied from interface: IWizard
Returns whether this wizard could be finished without further user interaction.

The result of this method is typically used by the wizard container to enable or disable the Finish button.

Specified by:
canFinish in interface IWizard
Returns:
true if the wizard could be finished, and false otherwise

current

public BaseWizardPage current()
Description copied from interface: IWizard
Fetches the current page.

Specified by:
current in interface IWizard
Returns:
current page. May return null only if the provider provides no pages.

dispose

public void dispose()
Description copied from interface: IWizard
Disposes of this wizard. All SWT resources are freed automatically when this method finishes.

Specified by:
dispose in interface IWizard

getTitleBarColor

public RGB getTitleBarColor()
Description copied from interface: IWizard
Returns the title bar color for this wizard.

Specified by:
getTitleBarColor in interface IWizard
Returns:
the title bar color, or null if default should be used.

hasNext

public boolean hasNext()
Description copied from interface: IWizard
Checks if there is next page. This method must return false if current page contains errors.

Specified by:
hasNext in interface IWizard
Returns:
true if there is next wizard or false if next() will fail.

hasPrevious

public boolean hasPrevious()
Description copied from interface: IWizard
Checks if there is previous page.

Specified by:
hasPrevious in interface IWizard
Returns:
true if there is previous wizard or false if previous() will fail.

next

public BaseWizardPage next()
                    throws ProviderException
Description copied from interface: IWizard
Fetches the next page. Function may fail even when hasNext() returned true - it may throw ProviderException.

Specified by:
next in interface IWizard
Returns:
next page. The page does not have to be initialized - MultiWizard initializes it for you. Never null.
Throws:
ProviderException - if next page instance cannot be constructed because of to some unexpected error. In such case, wizard stays at current page, exception is logged and an error dialog is shown.

performCancel

public boolean performCancel()
Description copied from interface: IWizard
Performs any actions appropriate in response to the user having pressed the Cancel button, or refuse if canceling now is not permitted.

Specified by:
performCancel in interface IWizard
Returns:
true to indicate the cancel request was accepted, and false to indicate that the cancel request was refused

performFinish

public boolean performFinish()
Description copied from interface: IWizard
Performs any actions appropriate in response to the user having pressed the Finish button, or refuse if finishing now is not permitted. Normally this method is only called on the container's current wizard. However if the current wizard is a nested wizard this method will also be called on all wizards in its parent chain. Such parents may use this notification to save state etc. However, the value the parents return from this method is ignored.

Specified by:
performFinish in interface IWizard
Returns:
true to indicate the finish request was accepted, and false to indicate that the finish request was refused

previous

public BaseWizardPage previous()
Description copied from interface: IWizard
Fetches the previous page. Current page is automatically disposed.

Specified by:
previous in interface IWizard
Returns:
previous page.

getName

public String getName()
Description copied from interface: IWizard
Returns name of this wizard. Describes this wizard. Shown in the dialog.

Specified by:
getName in interface IWizard
Returns:
displayable wizard name, like 'New element contents'.


Copyright © 2003-2006 null. All Rights Reserved.