fr.lip6.sma.simulacion.app.map
Class MapTest

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.map.MapTest
All Implemented Interfaces:
MapPanelListener, ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public abstract class MapTest
extends JFrame
implements MapPanelListener

Classe pour la fenêtre principale du test de la carte.

Version:
$Revision: 3 $
Author:
Paul Guyot
See Also:
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  Map mAgents
          Configuration des agents qui sont des joueurs.
private  MapTestApp mApplication
          Application de test.
private  JPanel mBlackFrame
          Background frame.
private  Configuration mConfiguration
          Configuration.
private  Map mLocalAgentConfig
          Configuration du joueur local (choisi au hasard).
private  String mLocalAgentName
          Nom de l'agent local (choisi au hasard).
private  JPanel mMapLayout
          Panel with the map.
private  MapPanel mMapPanel
          Référence sur la carte.
 
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
MapTest(String inConfigPath)
          Constructeur à partir du chemin du fichier de configuration.
 
Method Summary
protected  void addMapPanel(MapPanel inMapPanel)
          Ajoute la carte au cadre.
protected  void centerWindow()
          Méthode pour centrer la fenêtre.
protected  Map getAgents()
          Accesseur sur le tableau des joueurs.
protected  MapTestApp getApplication()
          Accesseur sur l'application.
protected  Configuration getConfiguration()
          Accesseur sur la configuration.
protected  Map getLocalAgentConfig()
          Accesseur sur la configuration du joueur local.
protected  String getLocalAgentName()
          Accesseur sur le nom du joueur local.
 void homeClicked()
          Méthode invoquée à chaque fois que la maison du joueur local est cliquée (sans la touche majuscule).
 void houseClicked(String inAgentName)
          Méthode invoquée à chaque fois que la maison d'un autre joueur est cliquée (sans la touche majuscule).
protected  void initComponents()
          Méthode pour initialiser les composants au démarrage de l'application.
 String localizeString(String inKeyString)
          Traduit une chaîne.
 void selectionChanged()
          Méthode invoquée lorsque l'ensemble des joueurs choisis sur la carte change.
private  void thisWindowClosing(WindowEvent inEvent)
          Méthode invoquée lorsque la case de fermeture est cliquée.
 
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
addNotify, 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, pack, 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

mApplication

private final MapTestApp mApplication
Application de test.


mConfiguration

private final Configuration mConfiguration
Configuration.


mAgents

private final Map mAgents
Configuration des agents qui sont des joueurs.


mLocalAgentName

private final String mLocalAgentName
Nom de l'agent local (choisi au hasard).


mLocalAgentConfig

private final Map mLocalAgentConfig
Configuration du joueur local (choisi au hasard).


mMapPanel

private MapPanel mMapPanel
Référence sur la carte.


mBlackFrame

private final JPanel mBlackFrame
Background frame.


mMapLayout

private final JPanel mMapLayout
Panel with the map.

Constructor Detail

MapTest

public MapTest(String inConfigPath)
Constructeur à partir du chemin du fichier de configuration.

Parameters:
inConfigPath - chemin du fichier de configuration.
Method Detail

initComponents

protected void initComponents()
Méthode pour initialiser les composants au démarrage de l'application. Elle est essentiellement générée par MW. Ensuite, on ajoute les listes.


addMapPanel

protected final void addMapPanel(MapPanel inMapPanel)
Ajoute la carte au cadre. Enregistre la référence sur la carte et redimensionne mBlackFrame.

Parameters:
inMapPanel - référence sur la carte.

getApplication

protected final MapTestApp getApplication()
Accesseur sur l'application.

Returns:
une référence sur l'application.

getConfiguration

protected final Configuration getConfiguration()
Accesseur sur la configuration.

Returns:
une référence sur la configuration.

getAgents

protected final Map getAgents()
Accesseur sur le tableau des joueurs.

Returns:
une référence sur le tableau des joueurs.

getLocalAgentConfig

protected final Map getLocalAgentConfig()
Accesseur sur la configuration du joueur local.

Returns:
une référence sur la configuration du joueur local.

getLocalAgentName

protected final String getLocalAgentName()
Accesseur sur le nom du joueur local.

Returns:
le nom du joueur local.

thisWindowClosing

private void thisWindowClosing(WindowEvent inEvent)
Méthode invoquée lorsque la case de fermeture est cliquée. On quitte le programme.

Parameters:
inEvent - l'événement de fermeture de la fenêtre (ignoré).

localizeString

public final String localizeString(String inKeyString)
Traduit une chaîne.

Specified by:
localizeString in interface MapPanelListener
Parameters:
inKeyString - chaîne à traduire.
Returns:
la chaîne traduite ou la chaîne à traduire si aucune traduction existe.

selectionChanged

public final void selectionChanged()
Méthode invoquée lorsque l'ensemble des joueurs choisis sur la carte change.

Specified by:
selectionChanged in interface MapPanelListener

homeClicked

public final void homeClicked()
Méthode invoquée à chaque fois que la maison du joueur local est cliquée (sans la touche majuscule). Au besoin, selectionChanged sera appelée juste après.

Specified by:
homeClicked in interface MapPanelListener
See Also:
selectionChanged(), houseClicked(java.lang.String)

houseClicked

public final void houseClicked(String inAgentName)
Méthode invoquée à chaque fois que la maison d'un autre joueur est cliquée (sans la touche majuscule). Au besoin, selectionChanged sera appelée juste après.

Specified by:
houseClicked in interface MapPanelListener
Parameters:
inAgentName - nom du joueur à qui appartient la maison.
See Also:
selectionChanged(), homeClicked()

centerWindow

protected final void centerWindow()
Méthode pour centrer la fenêtre.