JIDE 3.5.15

com.jidesoft.wizard
Class WizardDialogPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.jidesoft.dialog.StandardDialogPane
                      extended by com.jidesoft.wizard.WizardDialogPane
All Implemented Interfaces:
ButtonNames, ImageObserver, MenuContainer, Serializable, Accessible

public class WizardDialogPane
extends StandardDialogPane

Wizard is a well-known user interface that is ideal to guide user through for complex and unfamiliar tasks. A typical usage of it is project wizard - which asks user a couple questions and generate source code of a project automatically for user.

There are several wizard standards. The most famous two are Microsoft Wizard 97 standard and Java Wizard standard. Please see references for details. I strongly suggest you read those chapters before designing any wizards since those documents are also the specs for our wizard component. Both documents are very well-written.

Micrsoft Wizard 97 Standard
Java LookAndFeel Wizard Standard

Correspondingly, there are two styles as you can set to WizardDialog - WIZARD97_STYLE and JAVA_STYLE. Because those two styles are not compatible completely, I suggest you only support one of the styles in your application. Some major differences are

See Also:
Serialized Form

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
 
Fields inherited from class com.jidesoft.dialog.StandardDialogPane
_bannerPanel, _buttonPanel, _contentPanel, PROPERTY_CANCEL_ACTION, PROPERTY_DEFAULT_ACTION
 
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.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.jidesoft.dialog.ButtonNames
APPLY, BACK, BROWSE, CANCEL, CLEAR, CLOSE, DETAILS, EDIT, EXIT, FIND, FIND_NEXT, FINISH, FORWARD, HELP, NEW, NEXT, NO, OK, OPEN, PRINT, REPLACE, RESET, RETRY, RUN, SAVE, SAVE_AS, STOP, YES
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
WizardDialogPane()
          Creates a wizard dialog with no owner.
 
Method Summary
 boolean closeCurrentPage()
          Close current dialog page.
protected  boolean closeCurrentPage(AbstractDialogPage newPage, Object source)
          Close current dialog page.
 boolean closeCurrentPage(Object source)
          Close current dialog page with an optional source object.
protected  void createActions()
          Subclass can override to create actions for buttons.
 JComponent createBannerPanel()
          Implements createBannerPanel() in StandardDialog.
 ButtonPanel createButtonPanel()
          Implements createButtonPanel() in StandardDialog.
 JComponent createContentPanel()
          Implements createContentPanel() in StandardDialog.
 JComponent createEmptyPane()
          Creates the graphic panel.
 JComponent createGraphicPane()
          Creates the graphic panel.
protected  JComponent createHelpPane()
          Creates the help pane.
protected  JComponent createLeftTabbedPane()
          Creates tabbed pane to hold both steps and help pane in left pane.
protected  JComponent createPagesPanel()
          Creates JPanel with CardLayout ot put all wizard pages.
protected  StepsPane createStepsPane()
           
protected  JComponent createStepsPane(List<String> list, int index)
          Creates the steps pane.
 AbstractAction getBackAction()
          Get the back action.
 AbstractAction getCancelAction()
          Gets the cancel action.
 Dimension getContentLargerSize()
          Gets the larger standard size of content pane when the standard size is not enough.
 Dimension getContentSize()
          Gets the content pane size.
 Dimension getContentStandardSize()
          Gets the standard size of content pane.
 AbstractDialogPage getCurrentPage()
          Gets the current selected page.
 Image getDefaultGraphic()
          Gets the default graphic that will be displayed in left pane.
 AbstractAction getFinishAction()
          Gets the finish action.
 JavaHelpPane getHelpPane()
          Gets the help pane if help pane is used.
 int getLargerLeftPaneWidth()
          Gets the larger standard width of left pane when the larger standard size is used.
 JComponent getLeftPanel()
          Gets the left pane.
 int getLeftPanelWidth()
          Gets the width of left panel.
 AbstractAction getNextAction()
          Get the next action.
 AbstractDialogPage getNextPage()
          Gets the default next page.
 AbstractDialogPage getPageByTitle(String title)
          Gets the page by the full title.
 PageList getPageList()
          Gets the page list which have all the wizard pages.
 JComponent getPagesPanel()
          Gets the pages panel.
protected  AbstractDialogPage getPossibleNextPage()
           
 int getStandardLeftPaneWidth()
          Gets the standard width of left pane.
 StepsPane getStepsPane()
          Gets the steps pane if steps pane is used.
 List<AbstractPage> getVisitedPages()
          Gets list of visited pages.
 boolean isResizable()
          Override to return false.
 boolean isStepsPaneNavigable()
          Checks if the steps pane can be clicked to navigate to the corresponding page.
 void setBackAction(AbstractAction backAction)
          Changes the default back action.
 void setCancelAction(AbstractAction cancelAction)
          Changes the default cancel action.
 void setContentSize(Dimension contentSize)
          Sets the content size.
protected  boolean setCurrentPage(AbstractDialogPage currentPage, boolean isBack)
          Sets the current selected page.
protected  boolean setCurrentPage(AbstractDialogPage newCurrentPage, boolean isBack, Object source)
          Sets the current selected page.
 boolean setCurrentPage(String pageTitle)
          Sets the current selected page.
protected  boolean setCurrentPage(String pageTitle, boolean isBack)
          Sets the current selected page.
 void setDefaultGraphic(Image defaultGraphic)
          Sets the default graphic that will be displayed in left pane.
 void setFinishAction(AbstractAction finishAction)
          Changes the default finish action.
 void setLeftPanelWidth(int leftPanelWidth)
          Sets the left panel width.
 void setNextAction(AbstractAction nextAction)
          Changes the default next action.
 void setNextPage(AbstractDialogPage nextPage)
          Sets the next page.
 void setPageList(PageList pageList)
          Sets the page list to wizard dialog pane.
 void setStepsPaneNavigable(boolean stepsPaneNavigable)
          Sets the steps pane navigable.
protected  void updateBannerPanel(JComponent bannerPanel, AbstractDialogPage page)
          Updates the banner panel based on current page.
 
Methods inherited from class com.jidesoft.dialog.StandardDialogPane
getBannerPanel, getButtonPanel, getContentPanel, getDefaultAction, getDefaultCancelAction, getInitFocusedComponent, initComponents, layoutComponents, setDefaultAction, setDefaultCancelAction, setInitFocusedComponent
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WizardDialogPane

public WizardDialogPane()
                 throws HeadlessException
Creates a wizard dialog with no owner.

Throws:
HeadlessException - when the keyboard or mouse event is not processable
Method Detail

createBannerPanel

public JComponent createBannerPanel()
Implements createBannerPanel() in StandardDialog.

Specified by:
createBannerPanel in class StandardDialogPane
Returns:
banner panel.

updateBannerPanel

protected void updateBannerPanel(JComponent bannerPanel,
                                 AbstractDialogPage page)
Updates the banner panel based on current page. Banner panel is used to display the title, subtitle or icon of current page. If you use the default banner panel we provided, all these are done automatically. However if you provide your own banner panel and didn't use BannerPanel as the base class, you need to override this method to update title, subtitle, or icon by yourself.

Parameters:
bannerPanel - the banner panel
page - the dialog page

createContentPanel

public JComponent createContentPanel()
Implements createContentPanel() in StandardDialog.

Specified by:
createContentPanel in class StandardDialogPane
Returns:
content panel.

createButtonPanel

public ButtonPanel createButtonPanel()
Implements createButtonPanel() in StandardDialog.

By default it will create four buttons and corresponding actions - NEXT, BACK, FINISH and CANCEL.

Specified by:
createButtonPanel in class StandardDialogPane
Returns:
button panel.
See Also:
ButtonPanel

createActions

protected void createActions()
Subclass can override to create actions for buttons.


getPossibleNextPage

protected AbstractDialogPage getPossibleNextPage()

setBackAction

public void setBackAction(AbstractAction backAction)
Changes the default back action.

Parameters:
backAction - the action

getBackAction

public AbstractAction getBackAction()
Get the back action.

Returns:
the back action.

setNextAction

public void setNextAction(AbstractAction nextAction)
Changes the default next action.

Parameters:
nextAction - the action

getNextAction

public AbstractAction getNextAction()
Get the next action.

Returns:
the next action.

setCancelAction

public void setCancelAction(AbstractAction cancelAction)
Changes the default cancel action.

Parameters:
cancelAction - the action

setFinishAction

public void setFinishAction(AbstractAction finishAction)
Changes the default finish action.

Parameters:
finishAction - the action

getCancelAction

public AbstractAction getCancelAction()
Gets the cancel action.

Returns:
the cancel action.

getFinishAction

public AbstractAction getFinishAction()
Gets the finish action.

Returns:
the finish action.

createPagesPanel

protected JComponent createPagesPanel()
Creates JPanel with CardLayout ot put all wizard pages.

Returns:
JPanel with CardLayout which have all wizard pages.

setPageList

public void setPageList(PageList pageList)
Sets the page list to wizard dialog pane. The page list should contain a list of all wizard pages. Once page list is set to wizard, you should not change the page list.

Please note the pages in the page list should have an unique title so that the wizard can uniquely identify each page by its title. Otherwise, IllegalArgumentException will be thrown.

Parameters:
pageList - the page list
Throws:
IllegalArgumentException - if the pages have duplicated titles.

getPageList

public PageList getPageList()
Gets the page list which have all the wizard pages.

Returns:
the page list.

getCurrentPage

public AbstractDialogPage getCurrentPage()
Gets the current selected page.

Returns:
the current selected page.

setCurrentPage

public boolean setCurrentPage(String pageTitle)
Sets the current selected page. Make it private since no class outside should call this method.

Parameters:
pageTitle - new page title.
Returns:
true if it is executed correctly. Otherwise false.

setCurrentPage

protected boolean setCurrentPage(String pageTitle,
                                 boolean isBack)
Sets the current selected page. Make it private since no class outside should call this method.

Parameters:
pageTitle - new page title.
isBack - is this caused by BACK button.
Returns:
true if it is executed correctly. Otherwise false.

setCurrentPage

protected boolean setCurrentPage(AbstractDialogPage currentPage,
                                 boolean isBack)
Sets the current selected page. Make it private since no class outside should call this method.

Parameters:
currentPage - new page.
isBack - is this caused by BACK button.
Returns:
true if it is executed correctly. Otherwise false.

closeCurrentPage

public boolean closeCurrentPage()
Close current dialog page.

Returns:
false if current page doesn't allow it to be closed; true if the current page is close successfully.

closeCurrentPage

public boolean closeCurrentPage(Object source)
Close current dialog page with an optional source object.

Parameters:
source - the source of the PageEvent that will be fired when closing the current page
Returns:
false if current page doesn't allow it to be closed; true if the current page is close successfully.

closeCurrentPage

protected boolean closeCurrentPage(AbstractDialogPage newPage,
                                   Object source)
Close current dialog page.

Parameters:
newPage - the new page. If current page is the same as nwe page, nothing will be done. It you will close the page and will not open any new page, for example, when finish or cancel button is pressed, you can pass in null.
source - the source that will be used in event.
Returns:
false if current page doesn't allow it to be closed; true if the current page is close successfully.

setCurrentPage

protected boolean setCurrentPage(AbstractDialogPage newCurrentPage,
                                 boolean isBack,
                                 Object source)
Sets the current selected page. Make it private since no class outside should call this method.

Parameters:
newCurrentPage - new page.
isBack - is this caused by BACK button.
source - source for the event
Returns:
false if current page doesn't allow it to be closed; true if the current page is close successfully.

createLeftTabbedPane

protected JComponent createLeftTabbedPane()
Creates tabbed pane to hold both steps and help pane in left pane. Subclass can override to create its own tabbed pane or whatever container as long as it can display two panes.

Returns:
tabbed pane.

createStepsPane

protected JComponent createStepsPane(List<String> list,
                                     int index)
Creates the steps pane.

Parameters:
list - the page title list
index - selected page.
Returns:
the steps pane.

createStepsPane

protected StepsPane createStepsPane()

createHelpPane

protected JComponent createHelpPane()
Creates the help pane.

Returns:
the steps pane.

getLeftPanel

public JComponent getLeftPanel()
Gets the left pane.

Returns:
the left pane

getPagesPanel

public JComponent getPagesPanel()
Gets the pages panel.

Returns:
the pages panel.

getLeftPanelWidth

public int getLeftPanelWidth()
Gets the width of left panel.

Returns:
the width of left panel.

setLeftPanelWidth

public void setLeftPanelWidth(int leftPanelWidth)
Sets the left panel width.

Parameters:
leftPanelWidth - the width of the left panel

getContentSize

public Dimension getContentSize()
Gets the content pane size. The content pane is the wizard except button panel and banner panel.

Returns:
the content pane size.

setContentSize

public void setContentSize(Dimension contentSize)
Sets the content size.

Parameters:
contentSize - the size of the content

getContentStandardSize

public Dimension getContentStandardSize()
Gets the standard size of content pane.

Returns:
the standard size of content pane.

getStandardLeftPaneWidth

public int getStandardLeftPaneWidth()
Gets the standard width of left pane.

Returns:
the standard width of left pane.

getContentLargerSize

public Dimension getContentLargerSize()
Gets the larger standard size of content pane when the standard size is not enough.

Returns:
the larger standard size of content pane.

getLargerLeftPaneWidth

public int getLargerLeftPaneWidth()
Gets the larger standard width of left pane when the larger standard size is used.

Returns:
the larger standard width of left pane.

getPageByTitle

public AbstractDialogPage getPageByTitle(String title)
Gets the page by the full title.

Parameters:
title - the title
Returns:
the page with the title.

getNextPage

public AbstractDialogPage getNextPage()
Gets the default next page. In most case it will return null unless you set it. If the next page is null, it means default next page will be used which is usually the next page to current one in the page list

Returns:
next page.

setNextPage

public void setNextPage(AbstractDialogPage nextPage)
Sets the next page. It will jump to this page when NEXT button is pressed.

Parameters:
nextPage - next dialog page

getVisitedPages

public List<AbstractPage> getVisitedPages()
Gets list of visited pages.

Returns:
list of visited pages.

createGraphicPane

public JComponent createGraphicPane()
Creates the graphic panel.

Returns:
the graphic panel.

createEmptyPane

public JComponent createEmptyPane()
Creates the graphic panel.

Returns:
the graphic panel.

getDefaultGraphic

public Image getDefaultGraphic()
Gets the default graphic that will be displayed in left pane.

Returns:
the default graphic

setDefaultGraphic

public void setDefaultGraphic(Image defaultGraphic)
Sets the default graphic that will be displayed in left pane.

Parameters:
defaultGraphic - the default graphic image

getStepsPane

public StepsPane getStepsPane()
Gets the steps pane if steps pane is used.

Returns:
the steps pane if steps pane is used. Otherwise null.

getHelpPane

public JavaHelpPane getHelpPane()
Gets the help pane if help pane is used.

Returns:
the help pane if help pane is used. Otherwise null.

isResizable

public boolean isResizable()
Override to return false. Wizard dialog should not be resizable in most case. However you can always override it to return true.

Returns:
false

isStepsPaneNavigable

public boolean isStepsPaneNavigable()
Checks if the steps pane can be clicked to navigate to the corresponding page.

Returns:
true or false.

setStepsPaneNavigable

public void setStepsPaneNavigable(boolean stepsPaneNavigable)
Sets the steps pane navigable. If true, user can click on the steps pane to navigate to the corresponding page.

Parameters:
stepsPaneNavigable - true or false.

JIDE 3.5.15