kiwi.ui
Class WizardView

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bykiwi.ui.KPanel
                      extended bykiwi.ui.WizardView
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class WizardView
extends KPanel

A wizard-style component. WizardView essentially displays a sequence of panels (or "cards") to the user; each panel typically contains messages and/or input elements. A WizardPanelSequence object functions as the source of these panels, and determines the order in which the panels are presented to the user, and the conditions under which forward and backward movement is allowed between consecutive panels.

This component is arranged as follows. The leftmost portion of the component is used to display an image (which for best results should be transparent). Animated GIFs are acceptable. The bottom portion of the component displays the Back, Next, and Cancel buttons. The remaining space is occupied by the current WizardPanel provided by the WizardPanelSequence object.

The WizardPanelSequence determines when the user may move to the next or previous panel. Whenever these conditions change, the WizardPanelSequence fires a ChangeEvent to notify the WizardView, which responds by dimming or undimming the Next and Back buttons, as appropriate. When the final panel in the sequence is reached, the Next button changes to a Finish button.

If the Cancel button is pressed, an ActionEvent is fired with an action command of "cancel". If the Finish button is pressed, an ActionEvent is fired with an action command of "finish".

The goal of the Wizard family of classes was to provide a framework for creating wizards that was as flexible as possible, without creating a large amount of classes and interfaces to achieve that goal. Therefore the APIs for these classes may at first appear counterintuitive or inelegant. If they are found to be too cumbersome, they will be changed in a future release of Kiwi.


An example WizardView.

Author:
Mark Lindner, PING Software Group
See Also:
ChangeEvent, WizardPanelSequence, Serialized Form

Nested Class Summary
private  class WizardView._ActionListener
           
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  WizardView._ActionListener actionListener
           
private  KButton b_cancel
           
private  KButton b_next
           
private  KButton b_prev
           
private  KPanel content
           
private  int count
           
private  WizardPanel curPanel
           
private  boolean finish
           
private  javax.swing.Icon i_next
           
private  KLabel iconLabel
           
private  ButtonPanel p_buttons
           
private  int pos
           
private  java.lang.String s_back
           
private  java.lang.String s_cancel
           
private  java.lang.String s_finish
           
private  java.lang.String s_next
           
private  WizardPanelSequence sequence
           
private  ActionSupport support
           
 
Fields inherited from class kiwi.ui.KPanel
 
Fields inherited from class javax.swing.JPanel
 
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.Container
 
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
WizardView(WizardPanelSequence sequence)
          Construct a new WizardView.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener listener)
          Add an ActionListener to this component's list of listeners.
 void addButton(javax.swing.JButton button, int pos)
          Add a button to the WizardView at the specified position.
 javax.swing.JButton getCancelButton()
          Get a reference to the Cancel button.
 javax.swing.JButton getFinishButton()
          Get a reference to the Finish button.
private  void refresh()
           
 void removeActionListener(java.awt.event.ActionListener listener)
          Add an ActionListener to this component's list of listeners.
 void removeButton(int pos)
          Remove a button from the specified position in the ButtonPanel.
 void reset()
          Reset the WizardView.
 void setIcon(javax.swing.Icon icon)
          Set the component's icon.
private  void showPanel(WizardPanel panel)
           
 
Methods inherited from class kiwi.ui.KPanel
getComponentByName, paintComponent, setFocusOrder, setTexture
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

b_prev

private KButton b_prev

b_next

private KButton b_next

b_cancel

private KButton b_cancel

iconLabel

private KLabel iconLabel

sequence

private WizardPanelSequence sequence

content

private KPanel content

curPanel

private WizardPanel curPanel

pos

private int pos

count

private int count

i_next

private javax.swing.Icon i_next

finish

private boolean finish

support

private ActionSupport support

s_next

private java.lang.String s_next

s_back

private java.lang.String s_back

s_finish

private java.lang.String s_finish

s_cancel

private java.lang.String s_cancel

actionListener

private WizardView._ActionListener actionListener

p_buttons

private ButtonPanel p_buttons
Constructor Detail

WizardView

public WizardView(WizardPanelSequence sequence)
Construct a new WizardView.

Parameters:
sequence - The WizardPanelSequence that will provide WizardPanels for the wizard.
Method Detail

getCancelButton

public javax.swing.JButton getCancelButton()
Get a reference to the Cancel button.

Returns:
The Cancel button.

getFinishButton

public javax.swing.JButton getFinishButton()
Get a reference to the Finish button.

Returns:
The Finish button.

addButton

public void addButton(javax.swing.JButton button,
                      int pos)
               throws java.lang.IllegalArgumentException
Add a button to the WizardView at the specified position.

Parameters:
button - The button to add.
pos - The position at which to add the button. The value 0 denotes the first position, and -1 denotes the last position.
Throws:
java.lang.IllegalArgumentException - If the value of pos is invalid.

removeButton

public void removeButton(int pos)
                  throws java.lang.IllegalArgumentException
Remove a button from the specified position in the ButtonPanel.

Parameters:
pos - The position of the button to remove, where 0 denotes the first position.
Throws:
java.lang.IllegalArgumentException - If an attempt is made to remove one of the predefined wizard buttons.

setIcon

public void setIcon(javax.swing.Icon icon)
Set the component's icon. Animated and/or transparent GIF images add a professional touch when used with WizardViews.

Parameters:
icon - The new icon to use, or null if no icon is needed.

showPanel

private void showPanel(WizardPanel panel)

reset

public void reset()
Reset the WizardView. Resets the component so that the first panel is displayed. This method also calls the WizardPanelSequence's reset() method.

See Also:
WizardPanelSequence.reset()

refresh

private void refresh()

addActionListener

public void addActionListener(java.awt.event.ActionListener listener)
Add an ActionListener to this component's list of listeners.

Parameters:
listener - The listener to add.

removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
Add an ActionListener to this component's list of listeners.

Parameters:
listener - The listener to add.