fr.lip6.sma.simulacion.server.http
Class HTTPSetupFrame

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by fr.lip6.sma.simulacion.app.LocalizedWindow
                          extended by fr.lip6.sma.simulacion.server.http.HTTPSetupFrame
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class HTTPSetupFrame
extends LocalizedWindow

Classe pour la fenêtre de connexion au serveur Simulación HTTP.

Version:
$Revision: 5 $
Author:
Paul Guyot
See Also:
"aucun test défini.", Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
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.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private static String HIDEURL_PROPERTY
          Property to mention that the URL should be hidden.
private  JPanel mButtonsLayout
          Panel to lay out the buttons.
private  JPanel mButtonsPanel
          Panel with the buttons.
private  HTTPClient mClient
          Reference on the HTTP client.
private  JButton mConnectButton
          "Connect" button.
private  String mHTTPFile
          HTTP directory (currently ignored, maintained here for esthetic purposes).
private  JPanel mImagePanel
          Panel with the background image.
private  HTTPMDNSBrowser mMDNSBrowser
          mDNS browser or null if we don't browse for existing HTTP servers.
private  JProgressBar mProgressBar
          Progress bar for the connection.
private  JButton mQuitButton
          "Quit" button.
private  JComboBox mServerURLCombo
          Combo box with the URL.
private  JTextField mServerURLTextField
          Text field with the URL.
private  JPanel mSetupPanel
          Panel with the setup controls.
private static String NOSETUP_PROPERTY
          Property to mention that we don't display any frame.
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
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, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
HTTPSetupFrame(HTTPClient inClient, Configuration inConfiguration)
          Constructeur à partir du client et de la configuration.
 
Method Summary
private  void browserListUpdated()
          Method called when the browser list was updated.
static void displaySetupFrame(HTTPClient inClient, Configuration inConfiguration)
          Display the frame (or not).
private  void doBrowserListUpdated()
          Method called when the browser list was updated.
private  boolean doConfigure()
          Actually configure the connection.
private  void doShake()
          Méthode pour secouer la fenêtre.
private  void finishComponentsSetup(Configuration inConfiguration)
          Méthode pour terminer l'initialisation des composants.
private static String getDefaultURL(Configuration inConfiguration)
          Determine the default URL from the configuration.
private  void initComponents()
          Méthode pour initialiser les composants au démarrage de l'application.
private  void mConnectButtonActionPerformed(ActionEvent inEvent)
          Méthode invoquée lorsque le bouton Connexion est cliqué.
private  void mQuitButtonActionPerformed(ActionEvent inEvent)
          Méthode invoquée lorsque le bouton Quitter est cliqué.
private  void shake()
          Méthode pour secouer la fenêtre.
protected  void thisWindowClosing(WindowEvent inEvent)
          Méthode appelée lorsque la case de fermeture est cliquée.
(package private)  void waitAndSetup()
          Attente jusqu'à ce que l'utilisateur ait choisi une URL.
 
Methods inherited from class fr.lip6.sma.simulacion.app.LocalizedWindow
addNotify, centerWindow, doQuit, localizeAbstractButton, localizeComponent, localizeCompoundBorder, localizeContainer, localizeFrame, localizeJComponent, localizeJProgressBar, localizeLabel, localizeMenuElement, localizeString, localizeTextComponent, pack, resetDefaultLocale, thisWindowClosing
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, 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, paint, 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, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, 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, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

NOSETUP_PROPERTY

private static final String NOSETUP_PROPERTY
Property to mention that we don't display any frame. Useful for pure CLI applications.

See Also:
Constant Field Values

HIDEURL_PROPERTY

private static final String HIDEURL_PROPERTY
Property to mention that the URL should be hidden.

See Also:
Constant Field Values

mClient

private final HTTPClient mClient
Reference on the HTTP client.


mHTTPFile

private final String mHTTPFile
HTTP directory (currently ignored, maintained here for esthetic purposes).


mMDNSBrowser

private final HTTPMDNSBrowser mMDNSBrowser
mDNS browser or null if we don't browse for existing HTTP servers.


mImagePanel

private final JPanel mImagePanel
Panel with the background image.


mSetupPanel

private final JPanel mSetupPanel
Panel with the setup controls.


mServerURLTextField

private final JTextField mServerURLTextField
Text field with the URL.


mServerURLCombo

private final JComboBox mServerURLCombo
Combo box with the URL.


mButtonsPanel

private final JPanel mButtonsPanel
Panel with the buttons.


mProgressBar

private final JProgressBar mProgressBar
Progress bar for the connection.


mButtonsLayout

private final JPanel mButtonsLayout
Panel to lay out the buttons.


mQuitButton

private final JButton mQuitButton
"Quit" button.


mConnectButton

private final JButton mConnectButton
"Connect" button.

Constructor Detail

HTTPSetupFrame

HTTPSetupFrame(HTTPClient inClient,
               Configuration inConfiguration)
Constructeur à partir du client et de la configuration.

Parameters:
inClient - le client.
inConfiguration - la configuration de l'application.
Method Detail

initComponents

private void initComponents()
Méthode pour initialiser les composants au démarrage de l'application.


finishComponentsSetup

private void finishComponentsSetup(Configuration inConfiguration)
Méthode pour terminer l'initialisation des composants.

Parameters:
inConfiguration - la configuration de l'application.

mConnectButtonActionPerformed

private void mConnectButtonActionPerformed(ActionEvent inEvent)
Méthode invoquée lorsque le bouton Connexion est cliqué.

Parameters:
inEvent - l'événement du clic.

mQuitButtonActionPerformed

private void mQuitButtonActionPerformed(ActionEvent inEvent)
Méthode invoquée lorsque le bouton Quitter est cliqué.

Parameters:
inEvent - l'événement du clic.

thisWindowClosing

protected final void thisWindowClosing(WindowEvent inEvent)
Méthode appelée lorsque la case de fermeture est cliquée. On quitte.

Parameters:
inEvent - l'événement du clic.

waitAndSetup

final void waitAndSetup()
Attente jusqu'à ce que l'utilisateur ait choisi une URL.


doConfigure

private boolean doConfigure()
Actually configure the connection.

Returns:
true if the connection was properly configured.

shake

private void shake()
Méthode pour secouer la fenêtre. Appelle doShake (dans le processus léger de l'interface).


doShake

private void doShake()
Méthode pour secouer la fenêtre. Doit être appelée dans le processus léger de l'interface.

See Also:
shake()

browserListUpdated

private void browserListUpdated()
Method called when the browser list was updated.


doBrowserListUpdated

private void doBrowserListUpdated()
Method called when the browser list was updated.


getDefaultURL

private static String getDefaultURL(Configuration inConfiguration)
Determine the default URL from the configuration.

Parameters:
inConfiguration - configuration file.
Returns:
the default URL or "" if no default URL could be built.

displaySetupFrame

public static void displaySetupFrame(HTTPClient inClient,
                                     Configuration inConfiguration)
Display the frame (or not).

Parameters:
inClient - le client.
inConfiguration - la configuration de l'application.