public abstract class PValidatingWizard extends PWizard implements PValidatingWizardContext, SharedDataManager, WizardValidationManager, PropertyChangeListener, VetoableChangeListener
When a page switch occurs, validateWizardPage
is called
on each page (each wizard page must extend PWizardPage
)
to give it the opportunity to validate its data. (If
a page wants to it can call convenience methods on the
WizardValidationManager
to have the wizard framework
do default validation and related error handling. If the page
wishes it can have the framework do Portal validation on its data
but elect to do error handling itself. The abstract method
validateData
in this class will need to be overridden
to provide any such Portal validation.)
If validation is successful, leavingPage
is called on the
page about to be left. The leavingPage
method is a
convenient place for the page being left to share out any data which
might be of use to other pages. (To facilitate sharing of data among
wizard pages, subclasses of this base class may wish to make use of
SharedData
.)
When the "Finish" button is pressed, the wizard collects data from all
wizard pages and commits new data to the database by calling the
commitData
method. This abstract method should be
overridden in a derived class to carry out the appropriate storing of
data. If the account is successfully created, finished
is called. This method may be overridden in a derived class to
carry out additional processing. If a commit-time error occurs,
handleWizardCommitError
is called on each page until
one is encoutered which claims ownership of the error. (Again, the
page claiming the error can call commit-time convenience methods on
WizardValidationManager
to have the wizard framework
do default error handling.)
If the "Cancel" button is pressed and the user confirms the request,
cancelled
is called. This method may be overridden
in a derived class to carry out additional processing.
During recycling (after the wizard is cancelled or after
successfuly creating the account) data sharing is disabled,
recycle
is called on each wizard page so that it may
reinitialize itself, and then any data that may have been placed in the
shared data area is discarded.
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
CANCEL, CANCEL_OPTION, FINISH, FINISH_OPTION, HELP, PAGE_SWITCH
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
LESSSPACE, MAXIMIZE, MINIMIZE, MORESPACE, NORMALIZE
VALIDATION_FIXERROR, VALIDATION_IGNOREERROR, VALIDATION_NOMATCH
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
PValidatingWizard(JFrame owner,
String wizardName,
String wizardType,
boolean useNavigator)
Builds a wizard based upon wizard name and wizard type tags.
|
Modifier and Type | Method and Description |
---|---|
void |
addActions(Vector tools)
No op
|
void |
addContextChangedListener(PContextChangedListener l)
No op
|
void |
addFinishVetoListener(VetoableChangeListener veto)
To Add FinishVetoListners from various pages in the Wizard.
|
void |
addNotify() |
void |
addSharedDataListener(String propertyName,
PropertyChangeListener listener)
Adds a shared data listener (a
PropertyChangeListener ) for
a specific property. |
void |
addSharedDataVetoableListener(String propertyName,
VetoableChangeListener listener)
Adds a shared data listener (a VetoableChangeListener) for a specific
property.
|
protected boolean |
cancelled()
Displays a cancel wizard confirmation box and if the response is Yes,
hides the wizard.
|
void |
changeSize(Component comp,
int spaceNeeded)
No op
|
protected abstract Object |
commitData(PModelHandle model)
Commits the data in the passed-in model handle
|
void |
displayCommitError(String str,
Component comp)
Puts up a commit-time error message.
|
void |
displayMessage(String str,
String title,
int messageType,
String property)
Puts up a simple message with a dismiss button unless the message has
been flagged as wanting to be ingnored.
|
int |
displayYesNoMessage(String str,
String title,
int messageType,
String property)
Puts up a Yes/No message and returns a value corresponding to the
way the message is dismissed unless the message has been flagged
as wanting to be ingnored.
|
int |
displayYesNoValidateError(String str)
Puts up a Yes/No validate-time error message and returns a
JOptionPane value corresponding to the
way the dialog was dismissed. |
protected void |
finished(PModelHandle model)
Reports that the wizard finished successfully (the commit attempt
was successful).
|
boolean |
fireContextChangedEvent(PContextChangedEvent event)
No op, always returns true
|
void |
fireSharedDataChangedNotification(String propertyName,
Object oldValue,
Object newValue)
Reports a bound property update to any registered listeners.
|
void |
fireSharedDataVetoableNotification(String propertyName,
Object oldValue,
Object newValue)
Fires pre-notification for a bound property change to any registered
listeners.
|
protected boolean |
firstChanceHandleCommitError(com.portal.app.util.CustomerError customerError)
Called before page-wise commit-time error handling is attempted.
|
void |
focusOn(Component comp)
No op
|
String |
getAppName()
Returns "ValidatingWizard"
|
SharedData |
getSharedData()
Returns the shared data.
|
SharedDataManager |
getSharedDataManager()
Returns the shared data manager.
|
String |
getWizardName()
Returns the name of the wizard.
|
WizardValidationManager |
getWizardValidationManager()
Returns the wizard validation manager.
|
boolean |
handleCommitError(com.portal.app.util.CustomerError customerError,
Component comp)
Alerts the user if the passed in component is capable of handling the
passed-in commit-time error.
|
int |
handleValidateError(com.portal.app.util.CustomerError customerError,
Component comp,
boolean alertOnlyIfMatch)
Handles a validate-time error on the current page and returns
information about the user's response.
|
boolean |
hasListeners(String propertyName)
Checks if there are any listeners for a specific property.
|
boolean |
hasVetoListeners(String propertyName)
Checks if there are any veto listeners for a specific property.
|
protected void |
lastChanceHandleCommitError(com.portal.app.util.CustomerError customerError)
Called if page-wise commit-time error handling has completed with no
page claiming the error.
|
protected void |
loadPages(String wizardPages)
Adds pages to the wizard based upon the passed-in tag.
|
void |
propertyChange(PropertyChangeEvent e)
Page switch, cancel, and finish processing.
|
protected void |
recycle()
Performs any needed cleanup before this wizard is reused.
|
void |
removeActions(Vector tools)
No op
|
void |
removeContextChangedListener(PContextChangedListener l)
No op
|
void |
removeSharedDataListener(String propertyName,
PropertyChangeListener listener)
Removes a shared data listener (a PropertyChangeListener) for a
specific property.
|
void |
removeSharedDataVetoableListener(String propertyName,
VetoableChangeListener listener)
Removes the vetoable listener.
|
void |
setEnabled(PWizardPage page,
boolean b)
Enables or disables the specified top-level wizard page.
|
void |
setOverlay(Component comp)
No op
|
void |
setStatus(String status)
No op
|
void |
setVisible(boolean b)
Shows or hides the wizard dialog.
|
protected abstract Object |
validateData(PModelHandle model)
Validates the data in the passed-in model handle
|
Object |
validateModel(PModelHandle model)
Validates the model handle passed in.
|
void |
validatePage()
Collects data from the currently visible page (by calling
collectData on the page) and validates it using
default validation. |
void |
vetoableChange(PropertyChangeEvent e)
Does page validation when a page switch is about to occur in the
wizard.
|
addButtonPanelElement, addCancelListener, addCancelVetoableListener, addFinishListener, addFinishVetoableListener, addHelpListener, addPage, addPageSwitchListener, addPageSwitchVetoableListener, getPageAt, getPageCount, getVisiblePage, getVisiblePageIndex, getWizardDialog, pageToIndex, processBack, processCancel, processFinish, processHelp, processNext, removeCancelCommand, removeCancelListener, removeCancelVetoableListener, removeFinishCommand, removeFinishListener, removeFinishVetoableListener, removeHelpCommand, removeHelpListener, removeNotify, removePageSwitchListener, removePageSwitchVetoableListener, setFinishButtonEnabled, setPageEnabled, setVisiblePage, showWizard, showWizardPage, showWizardPage, updateWizardControls
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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
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
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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public PValidatingWizard(JFrame owner, String wizardName, String wizardType, boolean useNavigator)
frame
- The frame to be used to host the wizardwizardName
- The properties tag identifying the wizard to be
created.wizardType
- The properties tag identifying the type of the the
wizard. Used to specify the shared data class and
to locate resource strings for wizard messages.useNavigator
- true
for the wizard to include a
navigator allowing for random page selection.
false
to omit the navigator.protected void loadPages(String wizardPages)
<wizardPages>.pages=<pageName1> <pageName2> ...
<pageName1>.class=<class name (including package)>
<pageName2>.class=<class name (including package)>
...
The format of the related entries in the resource bundle should be as
follows:
<pageName1>.label=<label for page page>
<pageName2>.label=<label for page page>
...
The individual pages to be added to the wizard need to be implementations
of PWizardPage
.
wizardPages
- The tag identifying the pages to be addedpublic void setVisible(boolean b)
setVisible
in class PWizard
b
- If true
, shows the dialog; otherwise, hides it.public void propertyChange(PropertyChangeEvent e)
propertyChange
in interface PropertyChangeListener
e
- The property change event.protected void finished(PModelHandle model)
model
- The model handle returned from a successful
commit attempt.protected void recycle()
protected boolean cancelled()
true
if cancellation was approved; otherwise
false
.protected abstract Object validateData(PModelHandle model) throws RemoteException
model
- The model handle for the data to be validatednull
if the validation succeeds, otherwise a
CustomerError
.RemoteException
protected abstract Object commitData(PModelHandle model) throws RemoteException
model
- The model for the data to be committedCustomerError
RemoteException
public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException
PropertyVetoException
is
thrown. If it succeeds, leavingPage
is called on the page
being left. (In leavingPage
, a wizard page could elect to
share data out that other pages might want to make use of.)vetoableChange
in interface VetoableChangeListener
e
- The property change eventPropertyVetoException
public Object validateModel(PModelHandle model) throws RemoteException
validateModel
in interface WizardValidationManager
model
- Model handle to be validated.CustomerError
if the validation fails, otherwise
null
.RemoteException
handleValidateError
,
PWizardPage.validateWizardPage
public void validatePage() throws PValidationException
collectData
on the page) and validates it using
default validation. If an error is encountered, then if it contains
enough information to auto-locate the field associated with the error,
the field is marked. If there is error text associated with the error,
it is displayed in a message box. If there is no error text
associated with the error, a generic validation error message is
displayed. If the user elects to fix the error then this method
throws a PValidationException
.validatePage
in interface WizardValidationManager
PValidationException
PWizardPage.validateWizardPage
public int handleValidateError(com.portal.app.util.CustomerError customerError, Component comp, boolean alertOnlyIfMatch)
alertOnlyIfMatch
flag is set, then only if
a field matching the error is found will an error message be displayed.
displayYesNoValidateError
to
display the error message.handleValidateError
in interface WizardValidationManager
customerError
- A customer error object describing the error.comp
- The Component
in which to start the search for
the error.alertOnlyIfMatch
- See return
description.VALIDATION_IGNOREERROR
if the user chooses to
ignore the validation error or VALIDATION_FIXERROR
if the user chooses to fix the error. If the
alertOnlyIfMatch
flag is set, then if no matching
error field is found VALIDATION_NOMATCH
is
returned.validateModel
,
PWizardPage.validateWizardPage
public int displayYesNoValidateError(String str)
JOptionPane
value corresponding to the
way the dialog was dismissed.displayYesNoValidateError
in interface WizardValidationManager
str
- Error message to display. If null
,
then a default error message is used.JOptionPane.YES_OPTION
,
JOptionPane.NO_OPTION
, or
JOptionPane.CLOSED_OPTION
depending on
the user action.public void displayMessage(String str, String title, int messageType, String property)
property
is used to track whether the user wishes to see the message box again.)displayMessage
in interface WizardValidationManager
str
- The message to display. If the string is
null
, a default validation failure
message is displayed.title
- The title to be displayed. If the string is
null
, a default validation failure
title is displayed.messageType
- A JOptionPane
message type.property
- If null
the message is displayed in a
normal message dialog. If non-null
the message is displayed in a
PDisplayOnRequestOptionMsgDlg
.PDisplayOnRequestOptionMsgDlg
public boolean handleCommitError(com.portal.app.util.CustomerError customerError, Component comp)
displayCommitError
to
display the error message.handleCommitError
in interface WizardValidationManager
customerError
- A customer error object describing the error.comp
- The Component
in which to start the search for
the error. If the auto-locate search attempt is
successful, the (top-level) wizard page containing
comp
is switched to before the error message
is displayed.true
if a message has been displayed indicating that
the page is capable of handling the error; otherwise
false
.PWizardPage.handleWizardCommitError
public void displayCommitError(String str, Component comp)
displayCommitError
in interface WizardValidationManager
str
- The error string to be displayed. If the string is
null
, a default commit failure message
is displayed.comp
- The (top-level) wizard page containing comp
will be switched to before the error is displayed. If
null
, no page switch will occur.public int displayYesNoMessage(String str, String title, int messageType, String property)
property
is used to
track whether the user wishes to see the message box again.)displayYesNoMessage
in interface WizardValidationManager
str
- Message to display.title
- Message box title.messageType
- A JOptionPane
message type.property
- If null
the message is displayed in a normal
message dialog. If non-null
the
message is displayed in a
PDisplayOnRequestOptionMsgDlg
.property
is null
,
JOptionPane.YES_OPTION
,
JOptionPane.NO_OPTION
, or
JOptionPane.CLOSED_OPTION
is returned depending on
the user action. If property
is
non-null
,
PDisplayOnRequestOptionMsgDlg.HIDE_DIALOG
is an
additional possible return value.PDisplayOnRequestOptionMsgDlg
protected boolean firstChanceHandleCommitError(com.portal.app.util.CustomerError customerError)
true
the error is considered to have
claimed and no further error processing will be done. This base
implementation simply returns false
.customerError
- A customer error object describing the error.true
to signal that the error has been handled;
false
if the error has not been handled.protected void lastChanceHandleCommitError(com.portal.app.util.CustomerError customerError)
customerError
- A customer error object describing the error.public void setOverlay(Component comp)
setOverlay
in interface PAppContext
comp
- the component to add to the applicationpublic void changeSize(Component comp, int spaceNeeded)
changeSize
in interface PAppContext
comp
- the component to changespaceNeeded
- a constant that describes how to change the
component's sizepublic void setStatus(String status)
setStatus
in interface PAppContext
status
- the new status textpublic void addActions(Vector tools)
addActions
in interface PAppContext
tools
- a Vector
of PBASAction
objectspublic void removeActions(Vector tools)
removeActions
in interface PAppContext
tools
- a Vector
of PBASAction
objectspublic void focusOn(Component comp)
focusOn
in interface PAppContext
comp
- the component that gets focuspublic void addContextChangedListener(PContextChangedListener l)
addContextChangedListener
in interface PAppContext
l
- a PContextChangedListener
public void removeContextChangedListener(PContextChangedListener l)
removeContextChangedListener
in interface PAppContext
l
- a PContextChangedListener
public boolean fireContextChangedEvent(PContextChangedEvent event)
fireContextChangedEvent
in interface PAppContext
event
- a PContextChangedEvent
eventokToExit
event, true otherwise.public String getAppName()
getAppName
in interface PAppContext
String
that contains the application's name.public void setEnabled(PWizardPage page, boolean b)
page
is the currently-visible page or if
page
is not a top-level wizard page.setEnabled
in interface PValidatingWizardContext
page
- Top-level wizard page to be enabled or disabled.b
- true
to attempt to enable; false
to
attempt to disable.public String getWizardName()
getWizardName
in interface PValidatingWizardContext
public SharedDataManager getSharedDataManager()
getSharedDataManager
in interface PValidatingWizardContext
public WizardValidationManager getWizardValidationManager()
getWizardValidationManager
in interface PValidatingWizardContext
public SharedData getSharedData()
getSharedData
in interface SharedDataManager
public void addSharedDataListener(String propertyName, PropertyChangeListener listener)
PropertyChangeListener
) for
a specific property. The listener will be invoked only when a call on
fireSharedDataChangedNotification
names that specific
property.addSharedDataListener
in interface SharedDataManager
propertyName
- The name of the property to listen on.listener
- The PropertyChangeListener
to be added.public boolean hasListeners(String propertyName)
hasListeners
in interface SharedDataManager
propertyName
- the property name.public void removeSharedDataListener(String propertyName, PropertyChangeListener listener)
removeSharedDataListener
in interface SharedDataManager
propertyName
- The name of the property that was listened on.listener
- The PropertyChangeListener
to be removed.public void fireSharedDataChangedNotification(String propertyName, Object oldValue, Object newValue)
fireSharedDataChangedNotification
in interface SharedDataManager
propertyName
- The programmatic name of the property that was
changed.oldValue
- The old value of the property.newValue
- The new value of the property.public void addSharedDataVetoableListener(String propertyName, VetoableChangeListener listener)
fireSharedDataVetoabledNotification
names that specific
property.addSharedDataVetoableListener
in interface SharedDataManager
propertyName
- The name of the property to listen on.listener
- The VetoableChangeListener
to be added.public void removeSharedDataVetoableListener(String propertyName, VetoableChangeListener listener)
removeSharedDataVetoableListener
in interface SharedDataManager
propertyName
- The name of the property to listen on.listener
- The VetoableChangeListener
to be added.public boolean hasVetoListeners(String propertyName)
hasVetoListeners
in interface SharedDataManager
propertyName
- the property name.public void fireSharedDataVetoableNotification(String propertyName, Object oldValue, Object newValue) throws PropertyVetoException
fireSharedDataVetoableNotification
in interface SharedDataManager
propertyName
- The programmatic name of the property that was
changed.oldValue
- The old value of the property.newValue
- The new value of the property.PropertyVetoException
public void addFinishVetoListener(VetoableChangeListener veto)
veto
- The VetoableChangeListenerCopyright © 2003, 2023, Oracle and/or its affiliates.