Package org.eclipse.birt.core.ui.frameworks.taskwizard

# Class WizardBase

java.lang.Object
org.eclipse.birt.core.ui.frameworks.taskwizard.WizardBase

All Implemented Interfaces:
  `IRegistrationListener`

public class WizardBase extends Object implements IRegistrationListener

## Field Summary

Fields
Modifier and Type
Field
Description
`protected IWizardContext`
`context`

## Constructor Summary

Constructors
Constructor
Description
`WizardBase()`
`WizardBase(String sID)`
`WizardBase(String sID, int iInitialWidth, int iInitialHeight, String strTitle, org.eclipse.swt.graphics.Image imgTitle, String strHeader, org.eclipse.swt.graphics.Image imgHeader)`
Deprecated.
To use `WizardBase(Shell, String, int, int, String, Image, String, Image)`
`WizardBase(org.eclipse.swt.widgets.Shell parentShell, String sID, int iInitialWidth, int iInitialHeight, String strTitle, org.eclipse.swt.graphics.Image imgTitle, String strHeader, org.eclipse.swt.graphics.Image imgHeader)`
Creates an instance of the wizard.

## Method Summary

Modifier and Type
Method
Description
`void`
`addCustomButton(IButtonHandler buttonHandler)`
Adds a custom button after built-in buttons.
`void`
`addTabToolButton(IButtonHandler buttonHandler)`
Adds tab tool button.
`void`
`addTask(String sTaskID)`
`protected boolean`
`applyCustomPack()`
The method makes user can do custom pack actions for current dialog.
`void`
`attachPopup(String sPopupTitle, int iWidth, int iHeight)`
Attaches the popup window.
`void`
`clearCache()`
Clears the cached task instances.
`protected WizardBaseDialog`
`createDialog(org.eclipse.swt.widgets.Shell shell, int initialWidth, int initialHeight, String strTitle, org.eclipse.swt.graphics.Image imgTitle)`
`org.eclipse.swt.widgets.Shell`
`createPopupContainer()`
`void`
`detachPopup()`
`void`
`displayError(String[] sErrors, String[] sFixes, String[] sTaskIDs, IWizardContext currentContext, Object[] hints)`
Displays the errors in a common Error Display UI mechanism.
`static void`
`displayException(Throwable t)`
Displays the exception in a common Error Display UI mechanism.
`void`
`dispose()`
`void`
`firePageChanged(org.eclipse.jface.dialogs.IDialogPage taskPage)`
`ITask`
`getCurrentTask()`
`protected List<IButtonHandler>`
`getCustomButtons()`
`protected org.eclipse.jface.dialogs.TitleAreaDialog`
`getDialog()`
`static String`
`getErrors()`
`org.eclipse.swt.widgets.Shell`
`getPopupContainer()`
`List<IButtonHandler>`
`getTabToolButtons()`
Returns all tab tool buttons.
`protected String`
`getTitle()`
`boolean`
`isDisposed()`
`IWizardContext`
`open(String[] sTasks, String topTaskId, IWizardContext initialContext)`
Launches the wizard with the specified tasks in 'Available' state...and the specified task sets as the 'Active' task.
`IWizardContext`
`open(IWizardContext initialContext)`
Launches the wizard with the first tasks in 'Available' state.
`void`
`packWizard()`
Packs the wizard to display enough size
`static void`
`removeException()`
Remove the error message in the dialog.
`void`
`removeTask(String sTaskID)`
`void`
`setMinimumSize(int iWidth, int iHeight)`
Sets the minimum size of the wizard
`protected void`
`setTitle(String wizardTitle)`
`void`
`setWizardClosedWhenEnterPressed(boolean bClosed)`
Sets if wizard should be closed when Enter key is pressed.
`static void`
`showException(String errorMessage)`
Displays the exception in an Eclipse error mechanism.
`void`
`switchTo(String sTaskID)`
`void`
`taskDeregistered(String sTaskID)`
Notification method called by the org.eclipse.birt.frameworks.taskwizard.interfaces.TasksManager instance when an existing ITask instance is successfully deregistered.
`void`
`taskRegistered(String sTaskID)`
Notification method called by the org.eclipse.birt.frameworks.taskwizard.interfaces.TasksManager instance when a new ITask instance is successfully registered.
`void`
`updateContext(IWizardContext wizardcontext)`
`protected String[]`
`validate()`
Validates before pressing OK.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### context

protected transient IWizardContext context

## Constructor Details

### WizardBase

public WizardBase(String sID)

### WizardBase

@Deprecated public WizardBase(String sID, int iInitialWidth, int iInitialHeight, String strTitle, org.eclipse.swt.graphics.Image imgTitle, String strHeader, org.eclipse.swt.graphics.Image imgHeader)
Deprecated.
To use `WizardBase(Shell, String, int, int, String, Image, String, Image)`
Creates an instance of the wizard. Needs to invoke `open` method to create the wizard dialog.

Parameters:
  `sID` - wizard id
  `iInitialWidth` - width minimum
  `iInitialHeight` - height minimum
  `strTitle` - wizard title
  `imgTitle` - wizard image
  `strHeader` - the header description
  `imgHeader` - image displayed in the task bar. If null, leave blank. *

### WizardBase

public WizardBase(org.eclipse.swt.widgets.Shell parentShell, String sID, int iInitialWidth, int iInitialHeight, String strTitle, org.eclipse.swt.graphics.Image imgTitle, String strHeader, org.eclipse.swt.graphics.Image imgHeader)
Creates an instance of the wizard. Needs to invoke `open` method to create the wizard dialog.

Parameters:
  `parentShell` - parent shell
  `sID` - wizard id
  `iInitialWidth` - width minimum
  `iInitialHeight` - height minimum
  `strTitle` - wizard title
  `imgTitle` - wizard image
  `strHeader` - the header description
  `imgHeader` - image displayed in the task bar. If null, leave blank.
Since:
  2.1.1

### WizardBase

public WizardBase()

## Method Details

### open

public IWizardContext open(String[] sTasks, String topTaskId, IWizardContext initialContext)
Launches the wizard with the specified tasks in 'Available' state...and the specified task sets as the 'Active' task.

Parameters:
  `sTasks` - Array of task IDs to add. Null indicates nothing added.
  `topTaskId` - Task to open at first. Null indicates the first task will be the top.
  `initialContext` - Initial Context for the wizard
Returns:
  Wizard Context

### open

public IWizardContext open(IWizardContext initialContext)
Launches the wizard with the first tasks in 'Available' state. Ensure the task is registered at first.

Parameters:
  `initialContext` - Initial Context for the wizard
Returns:
  Wizard Context

### setMinimumSize

public void setMinimumSize(int iWidth, int iHeight)
Sets the minimum size of the wizard

Parameters:
  `iWidth` - width minimum
  `iHeight` - height minimum

### firePageChanged

public void firePageChanged(org.eclipse.jface.dialogs.IDialogPage taskPage)

### setWizardClosedWhenEnterPressed

public void setWizardClosedWhenEnterPressed(boolean bClosed)
Sets if wizard should be closed when Enter key is pressed. Default value is true.

Parameters:
  `bClosed` - true then close wizard when Enter key is pressed
Since:
  2.3.1 and 2.5

### addCustomButton

public void addCustomButton(IButtonHandler buttonHandler)
Adds a custom button after built-in buttons. This method must be invoked before invoking `open(String[], String, IWizardContext)`

Parameters:
  `buttonHandler` - Custom button handler

### getCustomButtons

protected List<IButtonHandler> getCustomButtons()

### addTabToolButton

public void addTabToolButton(IButtonHandler buttonHandler)
Adds tab tool button.

Parameters:
  `buttonHandler` -

### getTabToolButtons

public List<IButtonHandler> getTabToolButtons()
Returns all tab tool buttons.

Returns:
  all tab tool buttons.

### addTask

public void addTask(String sTaskID)

### removeTask

public void removeTask(String sTaskID)

### getCurrentTask

public ITask getCurrentTask()

### switchTo

public void switchTo(String sTaskID)

### createPopupContainer

public org.eclipse.swt.widgets.Shell createPopupContainer()

### getPopupContainer

public org.eclipse.swt.widgets.Shell getPopupContainer()

### attachPopup

public void attachPopup(String sPopupTitle, int iWidth, int iHeight)
Attaches the popup window.

Parameters:
  `sPopupTitle` - popup title

### detachPopup

public void detachPopup()

### updateContext

public void updateContext(IWizardContext wizardcontext)

### createDialog

protected WizardBaseDialog createDialog(org.eclipse.swt.widgets.Shell shell, int initialWidth, int initialHeight, String strTitle, org.eclipse.swt.graphics.Image imgTitle)

### clearCache

public void clearCache()
Clears the cached task instances. This can be used between invocations when a wizard instance is being reused in an application. Calling this will cause fresh instances of tasks to be fetched from the TasksManager when the wizard is invoked.

### displayException

public static void displayException(Throwable t)
Displays the exception in a common Error Display UI mechanism.

Parameters:
  `t` - exception to be displayed to the user

### showException

public static void showException(String errorMessage)
Displays the exception in an Eclipse error mechanism.

Parameters:
  `t` - exception to be displayed to the user

### removeException

public static void removeException()
Remove the error message in the dialog.

### getErrors

public static String getErrors()

### displayError

public void displayError(String[] sErrors, String[] sFixes, String[] sTaskIDs, IWizardContext currentContext, Object[] hints)
Displays the errors in a common Error Display UI mechanism. Also displayed are possible solutions to the problems. The user can also be given the option of switching to a different task where the fix needs to be made. (This is not implemented yet).

Parameters:
  `sErrors` - Array of error strings
  `sFixes` - Array of strings listing possible solutions to above errors
  `sTaskIDs` - Array of task IDs which the user can switch to. The appropriate task labels should be indicated in the solutions to allow users to make the connection
  `currentContext` - Updated IWizardContext instance...this instance will include the erroneous settings
  `hints` - Object array that will be passed to the target task...which can be used to indicate specific problems or to customize behavior of the task UI

### taskRegistered

public void taskRegistered(String sTaskID)
Notification method called by the org.eclipse.birt.frameworks.taskwizard.interfaces.TasksManager instance when a new ITask instance is successfully registered. Default behavior is to do nothing.

Specified by:
  `taskRegistered` in interface `IRegistrationListener`
Parameters:
  `sTaskID` - The ID for the newly registered task

### taskDeregistered

public void taskDeregistered(String sTaskID)
Notification method called by the org.eclipse.birt.frameworks.taskwizard.interfaces.TasksManager instance when an existing ITask instance is successfully deregistered. Default behavior is to do nothing. This can be overridden by individual wizards to handle deregistration of tasks currently available in the wizard.

Specified by:
  `taskDeregistered` in interface `IRegistrationListener`
Parameters:
  `sTaskID` - The ID for the deregistered task

### validate

protected String[] validate()
Validates before pressing OK.

Returns:
  validation results

### dispose

public void dispose()

### isDisposed

public boolean isDisposed()

### getDialog

protected org.eclipse.jface.dialogs.TitleAreaDialog getDialog()

### setTitle

protected void setTitle(String wizardTitle)

### getTitle

protected String getTitle()

### packWizard

public void packWizard()
Packs the wizard to display enough size

### applyCustomPack

protected boolean applyCustomPack()
The method makes user can do custom pack actions for current dialog.

Returns:
  `true` means custom pack has been done.