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.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
The property issued for cancelling the wizardstatic final int
Return value if Cancel is chosenprotected static final String
The property issued when finishing wizard processingstatic final int
Return value if Finish is chosenprotected static final String
The property issued for showing helpprotected static final String
The 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_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, 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
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 TypeMethodDescriptionvoid
addButtonPanelElement
(Component comp, int gap) Inserts an element into the wizard button panel just to the left of the "Back" button.protected void
Registers the given listener so that it receives aCANCEL
PropertyChangeEvent event when a cancel has occurredprotected void
Registers the given listener so that it receives aCANCEL
VetoableChangeEvent before a cancel occursprotected void
Registers the given listener so that it receives aFINISH
PropertyChangeEvent event when a finish has occurredprotected void
Registers the given listener so that it receives aFINISH
VetoableChangeEvent before a finish occursprotected void
Registers the given listener so that it receives aHELP
PropertyChangeEvent event when a cancel has occurredvoid
void
Adds a page to the wizardprotected void
Registers the given listener so that it receives aPAGE_SWITCH
PropertyChangeEvent event when a page switch has occurred.protected void
Registers the given listener so that it receives aPAGE_SWITCH
VetoableChangeEvent before a page switch occurs.getPageAt
(int i) For the given index, retrieves the associated pageint
Returns the total number of pages in the wizardRetrieves the currently visible pageint
Retrieves the index of the currently visible pageReturns the wizard dialogint
For the given page, retrieves the associated index.void
Moves to the previous page in the wizard.void
Cancels wizard processing.void
Finishes wizard processing.void
Displays wizard help.void
Moves to the next visible page in the wizard.protected void
Removes the visual cancel command (button) from the wizardprotected void
Removes the PropertyChangeListener for theCANCEL
propertyprotected void
Removes the VetoableChangeListener for theCANCEL
propertyprotected void
Removes the visual cancel command (button) from the wizardprotected void
Removes the PropertyChangeListener for theFINISH
propertyprotected void
Removes the VetoableChangeListener for theFINISH
propertyprotected void
Removes the visual help command (button) from the wizardprotected void
Removes the PropertyChangeListener for theHELP
propertyvoid
protected void
Removes the PropertyChangeListener for thePAGE_SWITCH
property.protected void
Removes the VetoableChangeListener for thePAGE_SWITCH
propertyvoid
setFinishButtonEnabled
(boolean b) Gives the user control over the finish buttonvoid
setPageEnabled
(Component p, boolean b) Enables or disables the passed-in page and its navigator button if the navigator is present.void
setVisible
(boolean b) Shows or hides the wizard dialog.void
setVisiblePage
(int index) Switches to the page at the specified index.int
Shows the dialog containing the wizard panel.void
showWizardPage
(int index, boolean force) Switches the wizard to the page having the passed-in index.void
showWizardPage
(String page, boolean force) Switches the wizard to the passed-in page.void
Updates the wizard controlsMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods 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, update
Methods 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, validateTree
Methods 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_OPTION
if exiting after the Finish button was pressed orCANCEL_OPTION
if exiting after the Cancel button was pressed.
-
addNotify
public void addNotify()- Overrides:
addNotify
in classJComponent
-
removeNotify
public void removeNotify()- Overrides:
removeNotify
in 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:
setVisible
in 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
-true
to 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
-true
to 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 ifp
is the currently selected page.- Parameters:
p
- The page whose button is to be enabled or disabled.b
-true
to attempt to enable the page and button;false
to 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_SWITCH
PropertyChangeEvent event when a page switch has occurred.- Parameters:
p
- The listener
-
removePageSwitchListener
Removes the PropertyChangeListener for thePAGE_SWITCH
property.- Parameters:
p
- The listener
-
addPageSwitchVetoableListener
Registers the given listener so that it receives aPAGE_SWITCH
VetoableChangeEvent before a page switch occurs.- Parameters:
v
- The VetoableChangeListener
-
removePageSwitchVetoableListener
Removes the VetoableChangeListener for thePAGE_SWITCH
property- Parameters:
v
- The listener
-
addCancelListener
Registers the given listener so that it receives aCANCEL
PropertyChangeEvent event when a cancel has occurred- Parameters:
p
- The listener
-
removeCancelListener
Removes the PropertyChangeListener for theCANCEL
property- Parameters:
p
- The listener
-
addCancelVetoableListener
Registers the given listener so that it receives aCANCEL
VetoableChangeEvent before a cancel occurs- Parameters:
v
- The VetoableChangeListener
-
removeCancelVetoableListener
Removes the VetoableChangeListener for theCANCEL
property- Parameters:
v
- The listener
-
addFinishListener
Registers the given listener so that it receives aFINISH
PropertyChangeEvent event when a finish has occurred- Parameters:
p
- The listener
-
removeFinishListener
Removes the PropertyChangeListener for theFINISH
property- Parameters:
p
- The listener
-
addFinishVetoableListener
Registers the given listener so that it receives aFINISH
VetoableChangeEvent before a finish occurs- Parameters:
v
- The VetoableChangeListener
-
removeFinishVetoableListener
Removes the VetoableChangeListener for theFINISH
property- Parameters:
v
- The listener
-
addHelpListener
Registers the given listener so that it receives aHELP
PropertyChangeEvent event when a cancel has occurred- Parameters:
p
- The listener
-
removeHelpListener
Removes the PropertyChangeListener for theHELP
property- Parameters:
p
- The listener
-