org.openswing.swing.wizard.client
Class WizardPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.openswing.swing.wizard.client.WizardPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class WizardPanel
extends javax.swing.JPanel
implements java.awt.event.ActionListener

Title: OpenSwing Framework

Description: Panel that contains two areas: - a list of panels showed alternatively and - a buttons panel, that typically contains a back, next and cancel buttons. A panel may optionally have at the left an image. As default setting, three buttons are showed in the panel: "Back", "Next" and "Cancel". The "Cancel" button is automatically renamed to "Finish" when the wizard shows the last panel. A programmer must add a list of WizardInnerPanel objects though the addPanel() method and could define navigation logic through the method setNavigationLogic(). If this method is not called then a default navigation logic is defined: shows panels from the first added to the last added. When user clicks on the "Next" button the WizardController.getNextPanelId() is called and the related panel is showed. If null is returned then no panel is showed (the current panel is still visible). When user clicks on the "Back" button the WizardController.getBackPanelId() is called and the related panel is showed. If null is returned then no panel is showed (the current panel is still visible). "Back" and "Next" buttons are enabled/disabled automatically, according to WizardController.getFirstPanelId() and WizardController.getLastPanelId() return values. When a panel is showed the init() method is automatically invoked (after "Back"/"Next" buttons abilitations).

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
WizardPanel()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent actionEvent)
          Listen for additional buttons clicks.
 void addActionListener(java.awt.event.ActionListener listener)
          Add a listener of buttons clicking events.
 void addButton(javax.swing.JButton button, int pos)
          Add a button in the specified position.
 void addNotify()
          Method called when the this panel is set to visible: it calls commitColumnContainer method.
 void addPanel(WizardInnerPanel panel)
          Register a panel that must be showed inside the wizard panel.
 javax.swing.JButton getBackButton()
           
 java.lang.String getBackImageName()
           
 javax.swing.JPanel getButtonsPanel()
           
 javax.swing.JButton getCancelButton()
           
 java.lang.String getCancelImageName()
           
 WizardInnerPanel getCurrentVisiblePanel()
           
 java.lang.String getFinishImageName()
           
 java.lang.String getImageName()
           
 WizardController getNavigationLogic()
           
 javax.swing.JButton getNextButton()
           
 java.lang.String getNextImageName()
           
 WizardInnerPanel getPanel(java.lang.String panelId)
           
 WizardInnerPanel[] getPanels()
           
 void removeActionListener(java.awt.event.ActionListener listener)
          Remove a listener of buttons clicking events.
 void removeButton(javax.swing.JButton button)
          Remove a button already added.
 void setBackImageName(java.lang.String backImageName)
          Set image name for "Back" button.
 void setCancelImageName(java.lang.String cancelImageName)
          Set image name for "Cancel" button.
 void setFinishImageName(java.lang.String finishImageName)
          Set image name for "Finish" button.
 void setImageName(java.lang.String imageName)
          This method allows to define an image that will be showed at the left of each inner panel This setting is overrided by the getImageName() method defined for each inner panel.
 void setNavigationLogic(WizardController wizardController)
          Define a navigation logic.
 void setNextImageName(java.lang.String nextImageName)
          Set image name for "Next" button.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, 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, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, 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, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WizardPanel

public WizardPanel()
Method Detail

addNotify

public final void addNotify()
Method called when the this panel is set to visible: it calls commitColumnContainer method.


getButtonsPanel

public final javax.swing.JPanel getButtonsPanel()
Returns:
buttons panel

addButton

public final void addButton(javax.swing.JButton button,
                            int pos)
Add a button in the specified position.

Parameters:
button - button to add
pos - position inside the buttons panel

removeButton

public final void removeButton(javax.swing.JButton button)
Remove a button already added.

Parameters:
button - button to remove

addActionListener

public final void addActionListener(java.awt.event.ActionListener listener)
Add a listener of buttons clicking events.

Parameters:
listener - action listener

removeActionListener

public final void removeActionListener(java.awt.event.ActionListener listener)
Remove a listener of buttons clicking events.

Parameters:
listener - action listener to remove

actionPerformed

public final void actionPerformed(java.awt.event.ActionEvent actionEvent)
Listen for additional buttons clicks.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

getBackButton

public final javax.swing.JButton getBackButton()
Returns:
"Back" button

getCancelButton

public final javax.swing.JButton getCancelButton()
Returns:
"Cancel/Finish" button

getNextButton

public final javax.swing.JButton getNextButton()
Returns:
"Next" button

addPanel

public final void addPanel(WizardInnerPanel panel)
Register a panel that must be showed inside the wizard panel.

Parameters:
panel - panel to add

setNavigationLogic

public final void setNavigationLogic(WizardController wizardController)
Define a navigation logic. If this method is not defined, then panels are showed in the same order used to add them to this.


getNavigationLogic

public final WizardController getNavigationLogic()
Returns:
panes nagitation controller

getPanels

public WizardInnerPanel[] getPanels()
Returns:
list of WizardInnerPanel currently registered.

getCurrentVisiblePanel

public final WizardInnerPanel getCurrentVisiblePanel()
Returns:
WizardInnerPanel panel currently showed

getPanel

public final WizardInnerPanel getPanel(java.lang.String panelId)
Parameters:
panelId - panel identifier
Returns:
WizardInnerPanel panel identified by the first argument

setImageName

public final void setImageName(java.lang.String imageName)
This method allows to define an image that will be showed at the left of each inner panel This setting is overrided by the getImageName() method defined for each inner panel.

Parameters:
imageName - image name; null if no image is required

getImageName

public final java.lang.String getImageName()
Returns:
image name

getCancelImageName

public final java.lang.String getCancelImageName()
Returns:
image name for "Cancel" button

setCancelImageName

public final void setCancelImageName(java.lang.String cancelImageName)
Set image name for "Cancel" button.

Parameters:
cancelImageName - image name for "Cancel" button

getBackImageName

public final java.lang.String getBackImageName()
Returns:
image name for "Back" button

setBackImageName

public final void setBackImageName(java.lang.String backImageName)
Set image name for "Back" button.

Parameters:
backImageName - image name for "Back" button

getFinishImageName

public final java.lang.String getFinishImageName()
Returns:
image name for "Finish" button

setFinishImageName

public final void setFinishImageName(java.lang.String finishImageName)
Set image name for "Finish" button.

Parameters:
finishImageName - image name for "Finish" button

getNextImageName

public final java.lang.String getNextImageName()
Returns:
image name for "Next" button

setNextImageName

public final void setNextImageName(java.lang.String nextImageName)
Set image name for "Next" button.

Parameters:
nextImageName - image name for "Next" button