info.aduna.swing.wizard
Class WizardSheet
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
info.aduna.swing.wizard.WizardSheet
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible
- Direct Known Subclasses:
- ExportSheet, SourceSheet
public abstract class WizardSheet
- extends JPanel
WizardSheet is the base class of the components that constitute the various
sheets in a Wizard.
WizardSheet defines a lot of abstract methods that allow the Wizard to get
hold of information about the state the WizardSheet is in (e.g. whether it is
filled in), what the next sheet is, etc.
Objects can register themselves as WizardSheetListener on a WizardSheet. They
are then notified when the state of the components within the WizardSheet
have changed, e.g. when the user has entered some text in a text field.
- See Also:
Wizard,
WizardSheetListener,
Serialized Form
|
Method Summary |
void |
addWizardSheetListener(WizardSheetListener listener)
Add a WizardSheetListener to this WizardSheet. |
abstract void |
clear()
A WizardSheet is cleared by the Wizard that contains it when the Wizard
is reset to its initial sheet. |
boolean |
finish()
Invoked when the user wants to finish the Wizard. |
Set<WizardSheet> |
getAllSheets(Set<WizardSheet> sheets)
Adds this sheets and all sheets that may follow it to the specified Set
and returns the resulting Set. |
protected abstract Set<? extends WizardSheet> |
getSubsequentSheets()
Returns a List that contains all WizardSheet instances that may possibly
be returned by the next() method of this WizardSheet. |
Wizard |
getWizard()
|
abstract boolean |
hasNext()
Determines whether there is a next WizardSheet coming after this
WizardSheet. |
abstract void |
initialize()
This method is invoked just before the WizardSheet is shown, so that it
can initialize itself. |
boolean |
isCloseable()
Returns true when the user should be able to finish the Wizard at this
point. |
abstract boolean |
isComplete()
Determine whether the current state of the input components of this
WizardSheet should allow the user to proceed to the next sheet or allow
the wizard to finish. |
void |
madeVisible()
This method is invoked after is has been made visible, so that it can
adapt e.g. |
abstract WizardSheet |
next()
Returns the next sheet that should be displayed. |
protected void |
notifyStateChanged()
Sends a stateChanged event with this as argument to all
WizardSheetListeners. |
abstract boolean |
prepareForNext()
This method is called just before next() is invoked. |
void |
removeWizardSheetListener(WizardSheetListener listener)
Remove a WizardSheetListener from this WizardSheet. |
void |
undoIntermediateSettings()
Undoes possible settings applied so far by this WizardSheet. |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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, setVisible, 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, transferFocusBackward, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, transferFocusUpCycle |
WizardSheet
public WizardSheet(Wizard wizard)
- Creates a new WizardSheet.
getWizard
public Wizard getWizard()
getAllSheets
public Set<WizardSheet> getAllSheets(Set<WizardSheet> sheets)
- Adds this sheets and all sheets that may follow it to the specified Set
and returns the resulting Set.
getSubsequentSheets
protected abstract Set<? extends WizardSheet> getSubsequentSheets()
- Returns a List that contains all WizardSheet instances that may possibly
be returned by the next() method of this WizardSheet. This is used in the
initialization of the Wizard, when it needs to gather all WizardSheets it
may encounter.
This method and its intended use imply that, before a WizardSheet is
shown to the user, all possible WizardSheets are created in advance.
initialize
public abstract void initialize()
- This method is invoked just before the WizardSheet is shown, so that it
can initialize itself.
madeVisible
public void madeVisible()
- This method is invoked after is has been made visible, so that it can
adapt e.g. the focused component. This default implementation does
nothing.
isComplete
public abstract boolean isComplete()
- Determine whether the current state of the input components of this
WizardSheet should allow the user to proceed to the next sheet or allow
the wizard to finish.
hasNext
public abstract boolean hasNext()
- Determines whether there is a next WizardSheet coming after this
WizardSheet.
The outcome of this method is only applicable when isComplete returns
true, since the appropriateness of a subsequent WizardSheet may depend on
the input entered in this WizardSheet (e.g. depending on the selection of
a button in a set of radio buttons, this may or may not be the last
WizardSheet).
prepareForNext
public abstract boolean prepareForNext()
- This method is called just before next() is invoked. This may result in
certain settings being applied to the underlying component managed by the
Wizard or to subsequent WizardSheets when traversing from one WizardSheet
to the next (e.g. a file whose location has just been entered may be
loaded when the "Next" button is pressed).
This method returns false when something went wrong while applying these
intermediate settings (e.g. when the file just entered did not exist).
The Wizard should not move to the next WizardSheet when this happens. The
WizardSheet itself however is still responsible for taking appropriate
actions when this happens (e.g. for reporting the error to the user). The
Wizard should respond to this case by not progressing to the next
WizardSheet.
The undoIntermediateSettings method of this WizardSheet is required to
undo the settings to the underlying component and subsequent WizardSheets
that result from the invocation of this method. Of course, the settings
done in subsequent WizardSheet may be neglected when they will be
overwritten by the next invocation of prepareForNext on this WizardSheet.
Be aware that prepareForNext is never invoked on the last WizardSheet in
the Wizard (it is "finish"-ed);
next
public abstract WizardSheet next()
- Returns the next sheet that should be displayed. This should only be
invoked when isComplete, hasNext and prepareForNext all have returned
true and in the mean time no changes have occurred in the contents of the
WizardSheet.
Note that this method is never invoked on the last WizardSheet in the
Wizard.
isCloseable
public boolean isCloseable()
- Returns true when the user should be able to finish the Wizard at this
point. This default implementation returns false.
finish
public boolean finish()
- Invoked when the user wants to finish the Wizard. Returns true when this
wizard sheet was properly finished. The Wizard should not be closed when
this method returns false.
This default implementation simply throws an
UnsupportedOperationException.
undoIntermediateSettings
public void undoIntermediateSettings()
- Undoes possible settings applied so far by this WizardSheet. These
settings may be the result of the invocation of prepareForNext, but may
also have been the result of a specific user interaction inside the
WizardSheet, e.g. pressing a button in the WizardSheet.
This method is invoked on all WizardSheets, starting from the current
WizardSheet to the first WizardSheet when the entire Wizard is cancelled,
or only on the current WizardSheet when the "back" button is used.
This default implementation does nothing.
clear
public abstract void clear()
- A WizardSheet is cleared by the Wizard that contains it when the Wizard
is reset to its initial sheet. This allows the sheets to release any
objects no longer necessary.
addWizardSheetListener
public void addWizardSheetListener(WizardSheetListener listener)
- Add a WizardSheetListener to this WizardSheet. It is not checked if the
specified WizardSheetListener was already registered, so adding a
WizardSheetListener twice results in possible events being send twice to
it.
removeWizardSheetListener
public void removeWizardSheetListener(WizardSheetListener listener)
- Remove a WizardSheetListener from this WizardSheet. Nothing happens when
the WizardSheetListener was not registered as such.
notifyStateChanged
protected void notifyStateChanged()
- Sends a stateChanged event with this as argument to all
WizardSheetListeners.
Copyright © 1997-2008 Aduna. All Rights Reserved.