Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.customcontrols.wizard
Class Wizard

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by net.java.sip.communicator.util.swing.SIPCommDialog
                          extended by net.java.sip.communicator.impl.gui.customcontrols.wizard.Wizard
All Implemented Interfaces:
WindowListener, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, WizardContainer
Direct Known Subclasses:
AccountRegWizardContainerImpl, CreateChatRoomWizard, JoinChatRoomWizard

public class Wizard
extends SIPCommDialog
implements WindowListener, WizardContainer, PropertyChangeListener

This class implements a basic wizard dialog, where the programmer can insert one or more Components to act as panels. These panels can be navigated through arbitrarily using the 'Next' or 'Back' buttons, or the dialog itself can be closed using the 'Cancel' button. Note that even though the dialog uses a CardLayout manager, the order of the panels is not linear. Each panel determines at runtime what its next and previous panel will be.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class net.java.sip.communicator.util.swing.SIPCommDialog
SIPCommDialog.DialogWindowAdapter
 
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
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
static String BACK_BUTTON_ACTION_COMMAND
          The String-based action command for the 'Back' button.
static String CANCEL_BUTTON_ACTION_COMMAND
          The String-based action command for the 'Cancel' button.
static int CANCEL_RETURN_CODE
          Indicates that the 'Cancel' button was pressed to close the dialog, or the user pressed the close box in the corner of the window.
static int ERROR_RETURN_CODE
          Indicates that the dialog closed due to an internal error.
static int FINISH_RETURN_CODE
          Indicates that the 'Finish' button was pressed to close the dialog.
static String NEXT_BUTTON_ACTION_COMMAND
          The String-based action command for the 'Next' button.
(package private)  ResourceManagementService resources
          The i18n text used for the buttons.
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPE
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Wizard(Dialog owner)
          This method accepts a java.awt.Dialog object as the javax.swing.JDialog's parent.
Wizard(Frame owner)
          This method accepts a java.awt.Frame object as the javax.swing.JDialog's parent.
 
Method Summary
 void addWizardListener(WizardListener l)
           
protected  void close(boolean isEscaped)
          Implements the SIPCommDialog close method.
(package private)  void close(int code)
          Closes the dialog and sets the return code to the integer parameter.
 boolean containsPage(Object id)
          Checks whether a page with the given id exists in the wizard.
 JButton getBackButton()
          Returns the back wizard button.
 String getBackButtonDefaultText()
          Returns the default text of the back wizard button.
 String getCancelButtonDefaultText()
          Returns the default text of the cancel wizard button.
 JDialog getDialog()
          Returns an instance of the JDialog that this class created.This is useful in the event that you want to change any of the JDialog parameters manually.
 String getFinishButtonDefaultText()
          Returns the default text of the finish wizard button.
 WizardModel getModel()
          Returns the current model of the wizard dialog.
 JButton getNextButton()
          Returns the next wizard button.
 String getNextButtonDefaultText()
          Returns the default text of the next wizard button.
 boolean isBackButtonEnabled()
          Mirrors the WizardModel method of the same name.
 boolean isCancelButtonEnabled()
          Mirrors the WizardModel method of the same name.
 boolean isNextFinishButtonEnabled()
          Mirrors the WizardModel method of the same name.
 void propertyChange(PropertyChangeEvent evt)
          Method used to listen for property change events from the model and update the dialog's graphical components as necessary.
 void refresh()
          Refreshes this wizard dialog.
 void registerWizardPage(Object id, WizardPage page)
          Adds the given WizardPage in this wizard.
 void removeWizardListener(WizardListener l)
           
 void removeWizzardIcon()
           
(package private)  void setBackButtonDefaultText(String backButtonDefaultText)
          Sets the back button default text.
 void setBackButtonEnabled(boolean newValue)
          Mirrors the WizardModel method of the same name.
(package private)  void setCancelButtonDefaultText(String cancelButtonDefaultText)
          Sets the cancel button default text.
 void setCancelButtonEnabled(boolean newValue)
          Mirrors the WizardModel method of the same name.
 void setCurrentPage(Object id)
          Displays the panel identified by the object passed in.
(package private)  void setFinishButtonDefaultText(String finishButtonDefaultText)
          Sets the finish button default text.
 void setFinishButtonText(String text)
          Sets the text label of the "Finish" wizard button.
(package private)  void setNextButtonDefaultText(String nextButtonDefaultText)
          Sets the next button default text.
 void setNextFinishButtonEnabled(boolean newValue)
          Mirrors the WizardModel method of the same name.
 void setWizzardIcon(BufferedImage wizardIcon)
           
 void showDialog(boolean modal)
          Convenience method that displays a modal wizard dialog and blocks until the dialog has completed.
(package private)  void startCommittingPage()
          Changes cursor and status label, informing user we are in process of connecting.
(package private)  void stopCommittingPage()
          Changes cursor and status label, informing user we finished the process of connecting.
 void unregisterWizardPage(Object id)
          Removes from the wizard the WizardPage corresponding to the given identifier.
 void windowActivated(WindowEvent e)
           
 void windowClosed(WindowEvent e)
           
 void windowClosing(WindowEvent e)
          If the user presses the close box on the dialog's window, treat it as a cancel.
 void windowDeactivated(WindowEvent e)
           
 void windowDeiconified(WindowEvent e)
           
 void windowIconified(WindowEvent e)
           
 void windowOpened(WindowEvent e)
           
 
Methods inherited from class net.java.sip.communicator.util.swing.SIPCommDialog
addKeyBinding, dispose, setVisible
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setModalityType, setResizable, setTitle, setUndecorated, show, toBack
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FINISH_RETURN_CODE

public static final int FINISH_RETURN_CODE
Indicates that the 'Finish' button was pressed to close the dialog.

See Also:
Constant Field Values

CANCEL_RETURN_CODE

public static final int CANCEL_RETURN_CODE
Indicates that the 'Cancel' button was pressed to close the dialog, or the user pressed the close box in the corner of the window.

See Also:
Constant Field Values

ERROR_RETURN_CODE

public static final int ERROR_RETURN_CODE
Indicates that the dialog closed due to an internal error.

See Also:
Constant Field Values

NEXT_BUTTON_ACTION_COMMAND

public static final String NEXT_BUTTON_ACTION_COMMAND
The String-based action command for the 'Next' button.

See Also:
Constant Field Values

BACK_BUTTON_ACTION_COMMAND

public static final String BACK_BUTTON_ACTION_COMMAND
The String-based action command for the 'Back' button.

See Also:
Constant Field Values

CANCEL_BUTTON_ACTION_COMMAND

public static final String CANCEL_BUTTON_ACTION_COMMAND
The String-based action command for the 'Cancel' button.

See Also:
Constant Field Values

resources

ResourceManagementService resources
The i18n text used for the buttons. Loaded from a property resource file.

Constructor Detail

Wizard

public Wizard(Dialog owner)
This method accepts a java.awt.Dialog object as the javax.swing.JDialog's parent.

Parameters:
owner - The java.awt.Dialog object that is the owner of this dialog.

Wizard

public Wizard(Frame owner)
This method accepts a java.awt.Frame object as the javax.swing.JDialog's parent.

Parameters:
owner - The java.awt.Frame object that is the owner of the javax.swing.JDialog.
Method Detail

getDialog

public JDialog getDialog()
Returns an instance of the JDialog that this class created.This is useful in the event that you want to change any of the JDialog parameters manually.

Returns:
The JDialog instance that this class created.

showDialog

public void showDialog(boolean modal)
Convenience method that displays a modal wizard dialog and blocks until the dialog has completed.

Parameters:
modal - whether to show a modal dialog

getModel

public WizardModel getModel()
Returns the current model of the wizard dialog.

Returns:
A WizardModel instance, which serves as the model for the wizard dialog.

registerWizardPage

public void registerWizardPage(Object id,
                               WizardPage page)
Adds the given WizardPage in this wizard. Each WizardPage is identified by a unique Object-based identifier (often a String), which can be used by the setCurrentPanel() method to display the panel at runtime.

Parameters:
id - An Object-based identifier used to identify the WizardPage object
page - The WizardPage object to register in this wizard

unregisterWizardPage

public void unregisterWizardPage(Object id)
Removes from the wizard the WizardPage corresponding to the given identifier.

Parameters:
id - The identifier of the wizard page.

containsPage

public boolean containsPage(Object id)
Checks whether a page with the given id exists in the wizard.

Parameters:
id - the identifier of the searched page
Returns:
TRUE if the page with the given id exists in the wizard, FALSE otherwise.

setCurrentPage

public void setCurrentPage(Object id)
Displays the panel identified by the object passed in. This is the same Object-based identified used when registering the panel.

Parameters:
id - The Object-based identifier of the panel to be displayed.

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Method used to listen for property change events from the model and update the dialog's graphical components as necessary.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
evt - PropertyChangeEvent passed from the model to signal that one of its properties has changed value.

isBackButtonEnabled

public boolean isBackButtonEnabled()
Mirrors the WizardModel method of the same name.

Specified by:
isBackButtonEnabled in interface WizardContainer
Returns:
A boolean indicating if the button is enabled.

setBackButtonEnabled

public void setBackButtonEnabled(boolean newValue)
Mirrors the WizardModel method of the same name.

Specified by:
setBackButtonEnabled in interface WizardContainer
Parameters:
newValue - The new enabled status of the button.

isNextFinishButtonEnabled

public boolean isNextFinishButtonEnabled()
Mirrors the WizardModel method of the same name.

Specified by:
isNextFinishButtonEnabled in interface WizardContainer
Returns:
A boolean indicating if the button is enabled.

setNextFinishButtonEnabled

public void setNextFinishButtonEnabled(boolean newValue)
Mirrors the WizardModel method of the same name.

Specified by:
setNextFinishButtonEnabled in interface WizardContainer
Parameters:
newValue - The new enabled status of the button.

isCancelButtonEnabled

public boolean isCancelButtonEnabled()
Mirrors the WizardModel method of the same name.

Specified by:
isCancelButtonEnabled in interface WizardContainer
Returns:
A boolean indicating if the button is enabled.

setCancelButtonEnabled

public void setCancelButtonEnabled(boolean newValue)
Mirrors the WizardModel method of the same name.

Specified by:
setCancelButtonEnabled in interface WizardContainer
Parameters:
newValue - The new enabled status of the button.

close

void close(int code)
Closes the dialog and sets the return code to the integer parameter.

Parameters:
code - The return code.

windowClosing

public void windowClosing(WindowEvent e)
If the user presses the close box on the dialog's window, treat it as a cancel.

Specified by:
windowClosing in interface WindowListener
Parameters:
e - The event passed in from AWT.

setWizzardIcon

public void setWizzardIcon(BufferedImage wizardIcon)

removeWizzardIcon

public void removeWizzardIcon()

addWizardListener

public void addWizardListener(WizardListener l)

removeWizardListener

public void removeWizardListener(WizardListener l)

close

protected void close(boolean isEscaped)
Implements the SIPCommDialog close method.

Overrides:
close in class SIPCommDialog
Parameters:
isEscaped - indicates if this frame has been closed by pressing the Esc key; otherwise, false

windowActivated

public void windowActivated(WindowEvent e)
Specified by:
windowActivated in interface WindowListener

windowClosed

public void windowClosed(WindowEvent e)
Specified by:
windowClosed in interface WindowListener

windowDeactivated

public void windowDeactivated(WindowEvent e)
Specified by:
windowDeactivated in interface WindowListener

windowDeiconified

public void windowDeiconified(WindowEvent e)
Specified by:
windowDeiconified in interface WindowListener

windowIconified

public void windowIconified(WindowEvent e)
Specified by:
windowIconified in interface WindowListener

windowOpened

public void windowOpened(WindowEvent e)
Specified by:
windowOpened in interface WindowListener

getNextButton

public JButton getNextButton()
Returns the next wizard button.

Returns:
the next wizard button

getBackButton

public JButton getBackButton()
Returns the back wizard button.

Returns:
the back wizard button

refresh

public void refresh()
Refreshes this wizard dialog.

Specified by:
refresh in interface WizardContainer

getBackButtonDefaultText

public String getBackButtonDefaultText()
Returns the default text of the back wizard button.

Returns:
the default text of the back wizard button

setBackButtonDefaultText

void setBackButtonDefaultText(String backButtonDefaultText)
Sets the back button default text.

Parameters:
backButtonDefaultText - the text to set

getNextButtonDefaultText

public String getNextButtonDefaultText()
Returns the default text of the next wizard button.

Returns:
the default text of the next wizard button.

setNextButtonDefaultText

void setNextButtonDefaultText(String nextButtonDefaultText)
Sets the next button default text.

Parameters:
nextButtonDefaultText - the text to set

getFinishButtonDefaultText

public String getFinishButtonDefaultText()
Returns the default text of the finish wizard button.

Returns:
the default text of the finish wizard button.

setFinishButtonDefaultText

void setFinishButtonDefaultText(String finishButtonDefaultText)
Sets the finish button default text.

Parameters:
finishButtonDefaultText - the text to set

getCancelButtonDefaultText

public String getCancelButtonDefaultText()
Returns the default text of the cancel wizard button.

Returns:
the default text of the cancel wizard button.

setCancelButtonDefaultText

void setCancelButtonDefaultText(String cancelButtonDefaultText)
Sets the cancel button default text.

Parameters:
cancelButtonDefaultText - the text to set

setFinishButtonText

public void setFinishButtonText(String text)
Sets the text label of the "Finish" wizard button.

Specified by:
setFinishButtonText in interface WizardContainer
Parameters:
text - the new label of the button

startCommittingPage

void startCommittingPage()
Changes cursor and status label, informing user we are in process of connecting.


stopCommittingPage

void stopCommittingPage()
Changes cursor and status label, informing user we finished the process of connecting.


Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.