Oracle JEWT API Reference
Release 4.2.24.0.0
B12199-01

oracle.bali.ewt.wizard.dWizard
Class DWizard

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--oracle.bali.ewt.painter.PaintContextComponent
                          |
                          +--oracle.bali.ewt.LWComponent
                                |
                                +--oracle.bali.ewt.wizard.BaseWizard
                                      |
                                      +--oracle.bali.ewt.wizard.Wizard
                                            |
                                            +--oracle.bali.ewt.wizard.dWizard.DWizard
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class DWizard
extends Wizard

DWizards delegate navigation to a user-supplied object implementing the WizardSequence interface. While most simple wizards can easily be written using the normal wizard functionality, very complex wizards, especially wizards composed of several sub-wizards, may be more easily implemented with this model.

Clients that need to pick a sequence dynamically at runtime may find the DynamicSequence class useful.

A small caveat: in a DWizard, pages are added and removed from the Wizard dynamically. Because of this, the meaning of WizardPage.getIndex() is undefined when used in a DWizard. Clients that need to know the number of the current page (to display, for example, a "Page n of m" title) should use DWizard.getCurrentPageIndex().

Some Sequence Examples

A few examples showing page-flow may be helpful. In all these examples, numbers represent pages, and the artistic lines connecting them represent potential "flows" among the pages. All the examples start on the left and end on the right.

 1 -- 2 -- 3 -- 4 -- end
 

In this case, you'd probably just use a single ArraySequence with 4 elements. But if the pages came from multiple sources in your code, it might be easier to have each source give you a WizardSequence for their pages, and compose them together in a SequenceSeries.

         3 -- 4
        /      \
       /        \
 1 -- 2          7 -- 8 -- end
       \        /
        \      /
         5 -- 6
 

OK - this one's a lot more complicated. First, you'll want to form several ArraySequences: [1,2], [3, 4], [5, 6], and [7, 8].

Now, how do we get that fork to work? Presumably, page 2 has some UI widgets on it that let the use choose which path to go down. Subclass DynamicSequence, and override chooseSequence() to return either [3, 4] or [5, 6] based on the state of those widgets on page 2. The DynamicSequence subclass should also add listeners to those widgets and, whenever their state changes, call two methods:

Finally, put [1,2], the DynamicSequence subclass, and [7, 8] into a SequenceSeries.

         3 -- 4
        /      \
       /        \
 1 -- 2 -------- 5 -- 6 -- end
 

This is almost the same as the previous example, but instead of allowing the user to choose one of two paths, the user can choose to take a path or ignore it. The solution is almost the same as in the previous example, but your DynamicSequence subclass needs a small change. Instead of returning one of two ArraySequences, your DynamicSequence should return either the ArraySequence [3, 4] or a NullSequence. NullSequences are a special sequence class that implement an empty sequence, i.e., a sequence without any pages.

Again, put the two array sequences and your DynamicSequence subclass into a SequenceSeries.

See Also:
WizardSequence, ArraySequence, SequenceSeries, DynamicSequence, NullSequence, Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Fields inherited from class oracle.bali.ewt.wizard.BaseWizard
MNEMONIC_APPLY, MNEMONIC_CANCEL, MNEMONIC_FINISH, MNEMONIC_HELP, MNEMONIC_NEXT, MNEMONIC_PREVIOUS
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DWizard()
          Creates an empty DWizard using NullSequence.
DWizard(WizardSequence sequence)
          Creates a DWizard.
 
Method Summary
 void dispose()
          Override to free an memory.
protected  void doNext()
          Handles presses on the "Next" button.
protected  void doPrevious()
          Handles presses on the "Previous" button.
 void enableButtons()
          Updates the enabled state of the buttons in the wizard.
 int getCurrentPageIndex()
          Returns the zero-based index of the currently selected page.
 WizardPage getNextPage(WizardPage page)
          An override that delegates to the sequence.
 int getPageCount()
          Returns the number of pages in the wizard.
 WizardPage getPreviousPage(WizardPage page)
          An override that delegates to the sequence.
 WizardSequence getSequence()
          Returns the sequence used by the wizard
 void goBackwards()
          Moves the wizard to the previous page, if one exists.
 void goForward()
          Advances the wizard to the next page, if one exists.
 void restart()
          Restarts the wizard at the beginning of the current sequence
 void selectPage(WizardPage page)
          Override to always throw an exception.
 void setSequence(WizardSequence sequence)
          Sets the sequence used by the wizard.
 
Methods inherited from class oracle.bali.ewt.wizard.Wizard
addPage, getMustFinish, pagePropertyChange, removeAllPages, removePage, setMustFinish, setSelectedPage, updateUI
 
Methods inherited from class oracle.bali.ewt.wizard.BaseWizard
addCustomButton, addImpl, addNotify, addPage, addPageImpl, addPages, addWizardListener, disable, doApply, doCancel, doFinish, doHelp, enable, getAccessibleContext, getButtonMnemonic, getCanAdvance, getCanApply, getCanGoBack, getFinishMnemonic, getFinishText, getPageAt, getPreferredSize, getReservedButtonSpaces, getSelectedPage, getUIClassID, isHelpAvailable, paramString, processEventImpl, processWizardEvent, removeCustomButton, removeWizardListener, resetFocus, selectPage, setCanApply, setCurrentPageIndex, setFinishMnemonic, setFinishText, setHelpAvailable, setLocale, setReservedButtonSpaces, updateReadingDirection, validateSelectedPage
 
Methods inherited from class oracle.bali.ewt.LWComponent
clipToParents, freezeRepaints, getActualAlignment, getActualReadingDirection, getAlignment, getBorderInsets, getDocumentSize, getFill, getPageBounds, getPrintPaintContext, isFocusTraversable, paintChildren, paintComponent, paintImmediateInterior, paintImmediateInterior, paintImmediately, paintOverChildren, printPage, processEvent, repaint, repaintInterior, repaintInterior, setAlignment, setFill, unfreezeRepaints
 
Methods inherited from class oracle.bali.ewt.painter.PaintContextComponent
getBorderContext, getPaintContext, getPaintData, getPaintState, getUIDefaults, setUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DWizard

public DWizard()
Creates an empty DWizard using NullSequence.

DWizard

public DWizard(WizardSequence sequence)
Creates a DWizard.
Parameters:
sequence - an object implementing the WizardSequence inteface.
Method Detail

restart

public void restart()
Restarts the wizard at the beginning of the current sequence
Overrides:
restart in class BaseWizard

getSequence

public WizardSequence getSequence()
Returns the sequence used by the wizard

selectPage

public void selectPage(WizardPage page)
Override to always throw an exception. DWizards do not allow free navigation.
Overrides:
selectPage in class BaseWizard
Following copied from class: oracle.bali.ewt.wizard.BaseWizard
Parameters:
page - the page to select
See Also:
BaseWizard.getSelectedPage()

getCurrentPageIndex

public int getCurrentPageIndex()
Returns the zero-based index of the currently selected page. By default, just calls getIndex() on the currently selected page. However, in a DWizard, getIndex() is meaningless, so users must call this function instead. Returns -1 if no page is selected.
Overrides:
getCurrentPageIndex in class BaseWizard
See Also:
WizardPage.getIndex()

getPageCount

public int getPageCount()
Returns the number of pages in the wizard. In a DWizard, defers to the sequence, which may not return an accurate value if it is expensive to determine the correct number of pages.
Overrides:
getPageCount in class BaseWizard

setSequence

public void setSequence(WizardSequence sequence)
Sets the sequence used by the wizard. Also restarts the wizard.

goForward

public void goForward()
Advances the wizard to the next page, if one exists.

goBackwards

public void goBackwards()
Moves the wizard to the previous page, if one exists.

enableButtons

public void enableButtons()
Updates the enabled state of the buttons in the wizard. Re-queries the sequence for current state information. Call this method if, as a result of some event, the existance of a next or previous page may have changed, so that the Wizard can enable or disable any buttons.
Overrides:
enableButtons in class BaseWizard

getNextPage

public WizardPage getNextPage(WizardPage page)
An override that delegates to the sequence.
Overrides:
getNextPage in class BaseWizard
Following copied from class: oracle.bali.ewt.wizard.BaseWizard
Parameters:
page - the base page

getPreviousPage

public WizardPage getPreviousPage(WizardPage page)
An override that delegates to the sequence.
Overrides:
getPreviousPage in class BaseWizard
Following copied from class: oracle.bali.ewt.wizard.BaseWizard
Parameters:
page - the base page

dispose

public void dispose()
Override to free an memory.
Overrides:
dispose in class Wizard

doNext

protected void doNext()
Handles presses on the "Next" button.
Overrides:
doNext in class BaseWizard

doPrevious

protected void doPrevious()
Handles presses on the "Previous" button.
Overrides:
doPrevious in class BaseWizard

Oracle JEWT 4.2.24

Copyright © [xxxx],2003, Oracle. All Rights Reserved.