Packages
 In this topic

*Constructors

*Methods

*Fields

 

Packages   PreviousThis PackageNext
Package com.ms.ui   Previous This
Package
Next

 


Class UIWizard

public class UIWizard extends UIDialog
{
  // Fields
  public final static int CENTER;
  public final static int LEFT;
  public final static int RIGHT;

  // Constructors
  public UIWizard(UIFrame frame, String title);

  // Methods
  public boolean action(Event e, Object o);
  public void addNotify();
  public void addStep(IUIWizardStep page);
  public void doBackAction(Event e, Object o);
  public boolean doCancelAction(Event e, Object o);
  public boolean doFinishAction(Event e, Object o);
  public Object doModal();
  public void doNextAction(Event e, Object o);
  public IUIWizardStep getBeingShown();
  public int getButtonAlignment();
  public IUIWizardStep getFirstStep();
  public Insets getInsets();
  public IUIWizardStep getNextStep();
  public IUIWizardStep getPreviousStep();
  public IUIWizardStep getVisibleStep();
  public boolean isFinishStep();
  public boolean isLastStep();
  public void setButtonAlignment(int Align);
  public void setForcedBounds(String name, Dimension dim);
  public void setVisibleStep(IUIWizardStep page);
}

This class implements a wizard dialog box that maintains a history. A UIWizard object maintains and organizes a series of UIWizardStep pages that each contain an image and content.

Returning null from getPreviousStep will cause the undo stack to be used. When the wizard transitions from one page to the next, the previous page is added to the undo stack. If the current page is returned from getNextStep, the pages do not change and this page is not added to the undo stack. If null is returned from getNextStep, the next page is transitioned to provided one exists.

Also see getNextStep, getPreviousStep

UIComponent
  |
  +--UIContainer
    |
    +--UIStateContainer
      |
      +--UIPanel
        |
        +--UIRoot
          |
          +--UIWindow
            |
            +--UIDialog
              |
              +--UIWizard

Constructors

UIWizard

public UIWizard(UIFrame frame, String title);

Creates an empty wizard, with no content and default dimensions for images and content.

ParameterDescription
frame The parent frame associated with the wizard dialog window.
title The title of the wizard dialog window.

Remarks:

The default dimension set for images is 50 x 150 pixels, and the default dimension set for content is 200 x 150 pixels.

Methods

action

public boolean action(Event e, Object o);

Performs operations depending on which button was pushed inside the wizard.

Note When cancelling the dialog box, this method calls UIDialog.dispose.

Return Value:

Returns true if the action was successfully executed; otherwise, returns false.

ParameterDescription
e The event, such as a KEY_RELEASE or MOUSE_UP, generated within the message box.
o The button that was pushed.

See Also: doNextAction, doBackAction, doCancelAction, doFinishAction

addNotify

public void addNotify();

Called to perform initialization when the graphics context is first available.

Return Value:

No return value.

Remarks:

This method creates the wizard's buttons.

addStep

public void addStep(IUIWizardStep page);

Adds a page to the wizard.

Return Value:

No return value.

ParameterDescription
page The page to add.

Remarks:

You must add the wizard's pages before calling the doModal method.

doBackAction

public void doBackAction(Event e, Object o);

Handles a selection of the Back button. This method is called by the action method to retrieve the previous page in the wizard.

Return Value:

No return value.

ParameterDescription
e The event received by the handleEvent method.
o The object that posted the event.

doCancelAction

public boolean doCancelAction(Event e, Object o);

This method is called by the action method to handle a selection of the Cancel button.

Return Value:

Returns true to allow the cancel; returns false to prevent the cancel.

ParameterDescription
e The event received by the handleEvent method.
o The object received by the handleEvent method.

doFinishAction

public boolean doFinishAction(Event e, Object o);

Handles a click on the Finish button. This method is called by the action method to perform the Finish action for the wizard.

Return Value:

Returns true to dismiss the wizard.

ParameterDescription
e The event received by the handleEvent method.
o The object that posted the event.

Remarks:

Override this to skip steps in the wizard or to complete the steps in the wizard.

doModal

public Object doModal();

Displays the wizard and its pages and only returns when the user has pressed a button or cancelled the message box.

Return Value:

Returns the button pressed; returns null if cancelled.

Remarks:

A modal wizard requires the user to interact with the wizard before continuing in any other of the application's windows. This method is called only after the wizard is created and all the pages have been added.

doNextAction

public void doNextAction(Event e, Object o);

Handles a selection of the Next button. This method is called by the action method to retrieve the next page in the wizard.

Return Value:

No return value.

ParameterDescription
e The event received by the handleEvent method.
o The object that posted the event.

getBeingShown

public IUIWizardStep getBeingShown();

Retrieves the page that is in the process of being shown.

Return Value:

Returns the page to be shown.

See Also: getVisibleStep

getButtonAlignment

public int getButtonAlignment();

Retrieves the current button alignment.

Return Value:

Returns either RIGHT, LEFT, or CENTER.

See Also: setButtonAlignment

getFirstStep

public IUIWizardStep getFirstStep();

Retrieves the first page in the series of pages managed by the wizard.

Return Value:

Returns the wizard's first page.

getInsets

public Insets getInsets();

Retrieves the insets for the wizard relative to its parent component, in pixels.

Return Value:

Returns an Insets object containing the wizard's insets.

Remarks:

This method is used internally by the layout method.

getNextStep

public IUIWizardStep getNextStep();

Retrieves the next page in the series of pages managed by the wizard.

Return Value:

Returns the wizard's next page.

Remarks:

If null is returned, the next page is transitioned to, and the previous page is put on the undo stack.

Return the current page (use getVisibleStep) to stay on the same page. This is used when the content on the page is validated but is missing information. Typically, a message box is displayed to the user indicating the missing or incorrect information and the user is returned to the current page. This page is not added to the undo stack.

getPreviousStep

public IUIWizardStep getPreviousStep();

Retrieves the previous page in the series of pages managed by the wizard.

Return Value:

Returns the wizard's previous page; otherwise, returns null.

Remarks:

Return null to use the undo stack.

getVisibleStep

public IUIWizardStep getVisibleStep();

Retrieves the page that is currently being viewed.

Return Value:

Returns s the wizard's currently visible page.

isFinishStep

public boolean isFinishStep();

Determines if the currently viewed page allows a valid selection of the Finish button.

Return Value:

Returns true if the current page is a Finish step; otherwise, returns false.

Remarks:

A Finish step is not necessarily the last step, as a user may be able to press the Finish button on some previous page and allow the wizard to set default values for the remaining pages in the series. The last step is the last logical page managed by the wizard, where the Next button is not a valid choice.

See Also: isLastStep

isLastStep

public boolean isLastStep();

Determines if the currently viewed page is the last page in the series.

Return Value:

Returns true if the page is the last step; the Next button is shaded.

setButtonAlignment

public void setButtonAlignment(int Align);

Sets the alignment of the buttons in the wizard.

Return Value:

No return value.

ParameterDescription
Align The button alignment. This can be either RIGHT, LEFT, or CENTER.

See Also: getButtonAlignment

setForcedBounds

public void setForcedBounds(String name, Dimension dim);

Sets the dimensions of a component within the wizard.

Return Value:

No return value.

ParameterDescription
name The name of the component to set the dimensions for. This can be one of the following:
"image"
The image to be displayed to the left of content.
"content"
The content for the wizard.
"buttons"
The buttons to be used.
dim The Dimension to set for the component.

setVisibleStep

public void setVisibleStep(IUIWizardStep page);

Displays the specified page.

Return Value:

No return value.

ParameterDescription
page The page to be viewed.

See Also: getVisibleStep

Fields

CENTER
The buttons in the wizard are centered.
LEFT
The buttons in the wizard are aligned on the left side of the dialog box.
RIGHT
The buttons in the wizard are aligned on the right side of the dialog box.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.