Package com.portal.app.comp
Class PWizard
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.portal.app.comp.PWizard
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible
- Direct Known Subclasses:
PValidatingWizard
An Portal-aware wizard framework hosted in a dialog. An optional navigator is provided
as a means of randomly moving between pages of the wizard.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringThe property issued for cancelling the wizardstatic final intReturn value if Cancel is chosenprotected static final StringThe property issued when finishing wizard processingstatic final intReturn value if Finish is chosenprotected static final StringThe property issued for showing helpprotected static final StringThe property issued when a page changesFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionPWizard()Create an instance of the wizard with no owner that is modeless and which contains a navigatorCreates an instance of the wizard with the specified owner that is optionally modeless and which optionally contains a navigator -
Method Summary
Modifier and TypeMethodDescriptionvoidaddButtonPanelElement(Component comp, int gap) Inserts an element into the wizard button panel just to the left of the "Back" button.protected voidRegisters the given listener so that it receives aCANCELPropertyChangeEvent event when a cancel has occurredprotected voidRegisters the given listener so that it receives aCANCELVetoableChangeEvent before a cancel occursprotected voidRegisters the given listener so that it receives aFINISHPropertyChangeEvent event when a finish has occurredprotected voidRegisters the given listener so that it receives aFINISHVetoableChangeEvent before a finish occursprotected voidRegisters the given listener so that it receives aHELPPropertyChangeEvent event when a cancel has occurredvoidvoidAdds a page to the wizardprotected voidRegisters the given listener so that it receives aPAGE_SWITCHPropertyChangeEvent event when a page switch has occurred.protected voidRegisters the given listener so that it receives aPAGE_SWITCHVetoableChangeEvent before a page switch occurs.getPageAt(int i) For the given index, retrieves the associated pageintReturns the total number of pages in the wizardRetrieves the currently visible pageintRetrieves the index of the currently visible pageReturns the wizard dialogintFor the given page, retrieves the associated index.voidMoves to the previous page in the wizard.voidCancels wizard processing.voidFinishes wizard processing.voidDisplays wizard help.voidMoves to the next visible page in the wizard.protected voidRemoves the visual cancel command (button) from the wizardprotected voidRemoves the PropertyChangeListener for theCANCELpropertyprotected voidRemoves the VetoableChangeListener for theCANCELpropertyprotected voidRemoves the visual cancel command (button) from the wizardprotected voidRemoves the PropertyChangeListener for theFINISHpropertyprotected voidRemoves the VetoableChangeListener for theFINISHpropertyprotected voidRemoves the visual help command (button) from the wizardprotected voidRemoves the PropertyChangeListener for theHELPpropertyvoidprotected voidRemoves the PropertyChangeListener for thePAGE_SWITCHproperty.protected voidRemoves the VetoableChangeListener for thePAGE_SWITCHpropertyvoidsetFinishButtonEnabled(boolean b) Gives the user control over the finish buttonvoidsetPageEnabled(Component p, boolean b) Enables or disables the passed-in page and its navigator button if the navigator is present.voidsetVisible(boolean b) Shows or hides the wizard dialog.voidsetVisiblePage(int index) Switches to the page at the specified index.intShows the dialog containing the wizard panel.voidshowWizardPage(int index, boolean force) Switches the wizard to the page having the passed-in index.voidshowWizardPage(String page, boolean force) Switches the wizard to the passed-in page.voidUpdates the wizard controlsMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
CANCEL_OPTION
public static final int CANCEL_OPTIONReturn value if Cancel is chosen- See Also:
-
FINISH_OPTION
public static final int FINISH_OPTIONReturn value if Finish is chosen- See Also:
-
HELP
The property issued for showing help- See Also:
-
PAGE_SWITCH
The property issued when a page changes- See Also:
-
CANCEL
The property issued for cancelling the wizard- See Also:
-
FINISH
The property issued when finishing wizard processing- See Also:
-
-
Constructor Details
-
PWizard
public PWizard()Create an instance of the wizard with no owner that is modeless and which contains a navigator -
PWizard
Creates an instance of the wizard with the specified owner that is optionally modeless and which optionally contains a navigator- Parameters:
owner- the Frame that owns the wizardmodal- true for a modal wizard; false for one that allows others windows to be active at the same timeuseNavigator- true for the wizard to contain a navigator allowing for random page selection; false otherwise
-
-
Method Details
-
showWizard
public int showWizard()Shows the dialog containing the wizard panel.- Returns:
FINISH_OPTIONif exiting after the Finish button was pressed orCANCEL_OPTIONif exiting after the Cancel button was pressed.
-
addNotify
public void addNotify()- Overrides:
addNotifyin classJComponent
-
removeNotify
public void removeNotify()- Overrides:
removeNotifyin classJComponent
-
getWizardDialog
Returns the wizard dialog- Returns:
- The dialog hosting the wizard panel
-
setFinishButtonEnabled
public void setFinishButtonEnabled(boolean b) Gives the user control over the finish button- Parameters:
b- Sets the enabled state of the finish button
-
setVisible
public void setVisible(boolean b) Shows or hides the wizard dialog.- Overrides:
setVisiblein classJComponent- Parameters:
b- Iftrue, shows the dialog; otherwise, hides it.
-
removeHelpCommand
protected void removeHelpCommand()Removes the visual help command (button) from the wizard -
removeCancelCommand
protected void removeCancelCommand()Removes the visual cancel command (button) from the wizard -
removeFinishCommand
protected void removeFinishCommand()Removes the visual cancel command (button) from the wizard -
addButtonPanelElement
Inserts an element into the wizard button panel just to the left of the "Back" button.- Parameters:
comp- Element to add to the left of the "Back" button.gap- Padding to separate the new element from the "Back" button.
-
addPage
Adds a page to the wizard- Parameters:
page- Page to add to the wizard
-
setVisiblePage
public void setVisiblePage(int index) Switches to the page at the specified index. If the index is out of bounds, nothing happens.- Parameters:
index- The index of the page to display.
-
processNext
public void processNext()Moves to the next visible page in the wizard. Fires a vetoable change event before attempting the page change. If it's not vetoed, a property change event is fired. Local vetoable change and property change support is used. The property used isPAGE_SWITCH.- See Also:
-
processBack
public void processBack()Moves to the previous page in the wizard. Fires a vetoable change event before attempting the page change. If it's not vetoed, a property change event is fired. Local vetoable change and property change support is used. The property used isPAGE_SWITCH.- See Also:
-
showWizardPage
Switches the wizard to the passed-in page. Fires a vetoable change event before attempting the page change. If it's not vetoed, a property change event is fired. Local vetoable change and property change support is used. The property used isPAGE_SWITCH.- Parameters:
page- Name of page to switch toforce-trueto force a redisplay even if the page hasn't changed; false otherwise.- See Also:
-
showWizardPage
public void showWizardPage(int index, boolean force) Switches the wizard to the page having the passed-in index. Fires a vetoable change event before attempting the page change. If it's not vetoed, a property change event is fired. Local vetoable change and property change support is used. The property used isPAGE_SWITCH.- Parameters:
index- Index of page to switch toforce-trueto force a redisplay even if the page hasn't changed; false otherwise- See Also:
-
setPageEnabled
Enables or disables the passed-in page and its navigator button if the navigator is present. Does nothing ifpis the currently selected page.- Parameters:
p- The page whose button is to be enabled or disabled.b-trueto attempt to enable the page and button;falseto attempt to disable them.
-
processFinish
public void processFinish()Finishes wizard processing. Fires a vetoable change event and if it's not vetoed, a property change event is then fired. Local vetoable change and property change support is used. The property used isFINISH.- See Also:
-
processCancel
public void processCancel()Cancels wizard processing. Fires a vetoable change event and if it's not vetoed, a property change event is then fired. Local vetoable change and property change support is used. The property used isCANCEL.- See Also:
-
processHelp
Displays wizard help. -
getPageCount
public int getPageCount()Returns the total number of pages in the wizard -
getPageAt
For the given index, retrieves the associated page- Parameters:
i- The index to look up- Returns:
- The component found or null if not found
-
pageToIndex
For the given page, retrieves the associated index.- Parameters:
c- The page to look up- Returns:
- The index of the page found or -1 if not found
-
getVisiblePage
Retrieves the currently visible page- Returns:
- The component found or null if not found
-
getVisiblePageIndex
public int getVisiblePageIndex()Retrieves the index of the currently visible page- Returns:
- The index of the currently visible page
-
updateWizardControls
public void updateWizardControls()Updates the wizard controls -
addPageSwitchListener
Registers the given listener so that it receives aPAGE_SWITCHPropertyChangeEvent event when a page switch has occurred.- Parameters:
p- The listener
-
removePageSwitchListener
Removes the PropertyChangeListener for thePAGE_SWITCHproperty.- Parameters:
p- The listener
-
addPageSwitchVetoableListener
Registers the given listener so that it receives aPAGE_SWITCHVetoableChangeEvent before a page switch occurs.- Parameters:
v- The VetoableChangeListener
-
removePageSwitchVetoableListener
Removes the VetoableChangeListener for thePAGE_SWITCHproperty- Parameters:
v- The listener
-
addCancelListener
Registers the given listener so that it receives aCANCELPropertyChangeEvent event when a cancel has occurred- Parameters:
p- The listener
-
removeCancelListener
Removes the PropertyChangeListener for theCANCELproperty- Parameters:
p- The listener
-
addCancelVetoableListener
Registers the given listener so that it receives aCANCELVetoableChangeEvent before a cancel occurs- Parameters:
v- The VetoableChangeListener
-
removeCancelVetoableListener
Removes the VetoableChangeListener for theCANCELproperty- Parameters:
v- The listener
-
addFinishListener
Registers the given listener so that it receives aFINISHPropertyChangeEvent event when a finish has occurred- Parameters:
p- The listener
-
removeFinishListener
Removes the PropertyChangeListener for theFINISHproperty- Parameters:
p- The listener
-
addFinishVetoableListener
Registers the given listener so that it receives aFINISHVetoableChangeEvent before a finish occurs- Parameters:
v- The VetoableChangeListener
-
removeFinishVetoableListener
Removes the VetoableChangeListener for theFINISHproperty- Parameters:
v- The listener
-
addHelpListener
Registers the given listener so that it receives aHELPPropertyChangeEvent event when a cancel has occurred- Parameters:
p- The listener
-
removeHelpListener
Removes the PropertyChangeListener for theHELPproperty- Parameters:
p- The listener
-