org.shaker.dwu
Class SetupDialog

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Dialog
                          |
                          +--javax.swing.JDialog
                                |
                                +--org.shaker.dwu.SetupDialog
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants

final class SetupDialog
extends javax.swing.JDialog
implements java.awt.event.ActionListener, java.awt.event.FocusListener

This class visually helps the user with the mail setup process. It contains different steps that ask for aspects of the configuration.

Author:
Philipp Bartsch (codeshaker@gmx.net), GPL License
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
 
Inner classes inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog
 
Inner classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
private static java.lang.String CMD_DISPOSE
          ActionCommand: Disposes the wizard
private static java.lang.String CMD_FINISH
          ActionCommand: apply settings
private static java.lang.String CMD_IMPORT
          ActionCommand: import settings
private static java.lang.String CMD_NEXT_STEP
          ActionCommand: next step
private static java.lang.String CMD_PREV_STEP
          ActionCommand: previous step
private  javax.swing.JPanel controlContainer
          The controlbar
private  int currentStep
          Keeps the current step in mind
private  javax.swing.JButton nextButton
          Next step button
private  javax.swing.JTextField popField
          POP-Server textfield
private  javax.swing.JTextField popPortField
          POP-Server port textfield
private  javax.swing.JButton prevButton
          Previous step button
private static int SERVER_STEP
          Index of the server data step
private  javax.swing.JPanel serverPanel
          Container for the server settings step
private  javax.swing.JTextField smtpField
          SMTP-Server textfield
private  javax.swing.JTextField smtpPortField
          SMTP-Server port textfield
private  javax.swing.JLabel statusLabel
          The statusbar
private  javax.swing.JPanel stepContainer
          Container for the single steps
private static int USER_DATA_STEP
          Index of the user data step
private  javax.swing.JPanel userDataPanel
          Container for the user settings step
private  javax.swing.JTextField userMailField
          User`s mail address textfield
private  javax.swing.JTextField userNameField
          Mail account textfield
private static int WELCOME_STEP
          Index of the welcome step
private  javax.swing.JPanel welcomePanel
          Container for the welcome step
 
Fields inherited from class javax.swing.JDialog
accessibleContext, defaultCloseOperation, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Dialog
base, keepBlocking, modal, nameCounter, resizable, serialVersionUID, title
 
Fields inherited from class java.awt.Window
active, dbg, focusMgr, inputContext, inputContextLock, OPENED, ownedWindowList, showWithParent, state, warningString, weakThis, windowListener, windowSerializedDataVersion
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SetupDialog(java.awt.Dialog parent)
          Creates an ready-to-use instance of the SetupWizard.
SetupDialog(java.awt.Frame parent)
          Creates an ready-to-use instance of the SetupWizard.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ae)
          This method handles occuring events, like button usage etc.
private  boolean checkStep(int step)
          Checks wheter the current step has all needed informations.
 void focusGained(java.awt.event.FocusEvent fe)
          Unused
 void focusLost(java.awt.event.FocusEvent fe)
          Applies entries, when textfields lose focus.
private  void importSettings()
          Calls the ImportEngine.
private  javax.swing.JPanel initButtonPanel()
          Inits the button control panel.
private  void initControlContainer()
          Inits the lower pane, thats hold the buttonpane and the statuspane.
private  void initServerStep()
          Inits the server panel.
private  void initStepContainer()
          Inits the container, that holds the single wizard steps.
private  void initUserDataStep()
          Inits the userdata panel.
private  void initWelcomeStep()
          Inits the inital welcomepane that describes the following steps.
private  void initWidgets()
          Customizes some widgets.
private  void performNextStep()
          Switches to the next wizard step.
private  void performPreviousStep()
          Switches to the previous wizard step.
private  void resetStatusLabel(java.lang.String dictKey)
          Resets the statusbar.
private  void setNewStep(javax.swing.JPanel step)
          Switches the wizard to a new step.
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, createRootPaneException, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setLocationRelativeTo, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Dialog
, addNotify, conditionalShow, constructComponentName, dispose, disposeImpl, getTitle, hide, hideAndDisposeHandler, initIDs, interruptBlocking, isModal, isResizable, setModal, setResizable, setTitle, show
 
Methods inherited from class java.awt.Window
addOwnedWindow, addWindowListener, adjustListeningChildren, applyResourceBundle, applyResourceBundle, connectOwnedWindow, dispatchEventImpl, eventEnabled, finalize, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, isActive, isShowing, nextFocus, ownedInit, pack, postEvent, postProcessKeyEvent, postWindowEvent, preProcessKeyEvent, processEvent, readObject, removeOwnedWindow, removeWindowListener, resetGC, setCursor, setFocusOwner, setWarningString, toBack, toFront, transferFocus, writeObject
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventToSelf, doLayout, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, numListening, paint, paintComponents, paintHeavyweightComponents, postsOldMouseEvents, preferredSize, print, printComponents, printHeavyweightComponents, processContainerEvent, proxyEnableEvents, proxyRequestFocus, remove, removeAll, removeContainerListener, removeNotify, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, 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, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

CMD_DISPOSE

private static final java.lang.String CMD_DISPOSE
ActionCommand: Disposes the wizard

CMD_FINISH

private static final java.lang.String CMD_FINISH
ActionCommand: apply settings

CMD_IMPORT

private static final java.lang.String CMD_IMPORT
ActionCommand: import settings

CMD_NEXT_STEP

private static final java.lang.String CMD_NEXT_STEP
ActionCommand: next step

CMD_PREV_STEP

private static final java.lang.String CMD_PREV_STEP
ActionCommand: previous step

SERVER_STEP

private static final int SERVER_STEP
Index of the server data step

USER_DATA_STEP

private static final int USER_DATA_STEP
Index of the user data step

WELCOME_STEP

private static final int WELCOME_STEP
Index of the welcome step

controlContainer

private final javax.swing.JPanel controlContainer
The controlbar

currentStep

private int currentStep
Keeps the current step in mind

nextButton

private final javax.swing.JButton nextButton
Next step button

popField

private final javax.swing.JTextField popField
POP-Server textfield

popPortField

private final javax.swing.JTextField popPortField
POP-Server port textfield

prevButton

private final javax.swing.JButton prevButton
Previous step button

serverPanel

private final javax.swing.JPanel serverPanel
Container for the server settings step

smtpField

private final javax.swing.JTextField smtpField
SMTP-Server textfield

smtpPortField

private final javax.swing.JTextField smtpPortField
SMTP-Server port textfield

statusLabel

private final javax.swing.JLabel statusLabel
The statusbar

stepContainer

private final javax.swing.JPanel stepContainer
Container for the single steps

userDataPanel

private final javax.swing.JPanel userDataPanel
Container for the user settings step

userMailField

private final javax.swing.JTextField userMailField
User`s mail address textfield

userNameField

private final javax.swing.JTextField userNameField
Mail account textfield

welcomePanel

private final javax.swing.JPanel welcomePanel
Container for the welcome step
Constructor Detail

SetupDialog

public SetupDialog(java.awt.Dialog parent)
Creates an ready-to-use instance of the SetupWizard.
Parameters:
parent - parental Dialog
See Also:
Dialog.Dialog(Dialog)

SetupDialog

public SetupDialog(java.awt.Frame parent)
Creates an ready-to-use instance of the SetupWizard.
Parameters:
parent - parental Frame
See Also:
Window.Window(Frame)
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
This method handles occuring events, like button usage etc.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
ae - an ActionEvent

checkStep

private boolean checkStep(int step)
Checks wheter the current step has all needed informations. Example: Userdata-step requests at least a valid mail address to switch to the following step.
Parameters:
step - the current step
Returns:
boolean "valid" flag

focusGained

public void focusGained(java.awt.event.FocusEvent fe)
Unused
Specified by:
focusGained in interface java.awt.event.FocusListener
Parameters:
fe - the event object
See Also:
FocusListener.focusGained(java.awt.event.FocusEvent)

focusLost

public void focusLost(java.awt.event.FocusEvent fe)
Applies entries, when textfields lose focus.
Specified by:
focusLost in interface java.awt.event.FocusListener
Parameters:
fe - the event object
See Also:
FocusListener.focusLost(java.awt.event.FocusEvent)

importSettings

private void importSettings()
Calls the ImportEngine.
See Also:
for a closer view

initButtonPanel

private javax.swing.JPanel initButtonPanel()
Inits the button control panel. Contains a previous, next and cancel button.
Returns:
JPanel the button panel

initControlContainer

private void initControlContainer()
Inits the lower pane, thats hold the buttonpane and the statuspane.

initServerStep

private void initServerStep()
Inits the server panel. Its part of the "complex way". Contains a smtpserver textfield and a popserver textfield.

initStepContainer

private void initStepContainer()
Inits the container, that holds the single wizard steps.

initUserDataStep

private void initUserDataStep()
Inits the userdata panel. Its part of the "complex way". Contains a mailaddress- and a username textfield.

initWelcomeStep

private void initWelcomeStep()
Inits the inital welcomepane that describes the following steps.

initWidgets

private void initWidgets()
Customizes some widgets. If it`s not the first time the wizard gets started, the single widgets get the custom values.

performNextStep

private void performNextStep()
Switches to the next wizard step.

performPreviousStep

private void performPreviousStep()
Switches to the previous wizard step.

resetStatusLabel

private void resetStatusLabel(java.lang.String dictKey)
Resets the statusbar.
Parameters:
dictKey - the error`s dictionary key

setNewStep

private void setNewStep(javax.swing.JPanel step)
Switches the wizard to a new step.
Parameters:
step - the new step panel that has to be displayed