fr.lifl.jedi.gui.control.graphicalControl.view
Class GraphicalSimulationControlGUI

java.lang.Object
  extended by java.util.Observable
      extended by fr.lifl.jedi.gui.control.graphicalControl.view.GraphicalSimulationControlGUI
All Implemented Interfaces:
ISimulationGUI, java.awt.event.ActionListener, java.awt.event.WindowListener, java.util.EventListener, javax.swing.event.ChangeListener

public class GraphicalSimulationControlGUI
extends java.util.Observable
implements ISimulationGUI, java.awt.event.ActionListener, java.awt.event.WindowListener, javax.swing.event.ChangeListener

A GUI that defines buttons that rule simulation control. These buttons make possible to initialize, pause, run or abort the simulation.

Version:
JEDI V 2.2
Created the 2nd april 2009
Modified the 5th may 2009
Author:
Yoann Kubera
SMAC Team (Systèmes Multi-Agents et Comportement)
LIFL (Laboratoire d'Informatique Fondamentale de Lille)
University of Lille, France

Field Summary
static int DEFAUT_DELAY_VALUE
          The default minimal time elapsing between two simulation steps.
static java.util.Map<IconIdentifier,javax.swing.ImageIcon> ICONS
          The Map that contains all icons used in the GUI
 
Constructor Summary
GraphicalSimulationControlGUI(java.lang.String title)
          Constructor of the simulation control GUI.
GraphicalSimulationControlGUI(java.lang.String title, int x, int y)
          Constructor of the simulation control GUI.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 javax.swing.JButton getAbortButton()
          Gets the button used to abort the simulation.
 javax.swing.JFrame getControlFrame()
          Gets the frame that displays all the control buttons.
 javax.swing.JLabel getCurrentStepLabel()
          Gets the label that displays the current simulation step.
 javax.swing.JSlider getDelayBar()
          Gets the slider that defines the minimal time that has to elapse between two simulation time steps.
 javax.swing.JButton getInitializationButton()
          Gets the button used to initialize the simulation.
 javax.swing.JButton getRunOrPauseButton()
          Gets the button used either to run the simulation, or pause the simulation.
 javax.swing.JButton getSingleStepButton()
          Gets the button used to perform a single simulation step.
 void notifyObservers(ISimulationEvent m)
          Notifies a message to all observers registered to this GUI.
 void removeObserver(java.util.Observer o)
          Removes an observer from this GUI
 void stateChanged(javax.swing.event.ChangeEvent arg0)
           
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.lifl.jedi.gui.ISimulationGUI
addObserver
 

Field Detail

ICONS

public static final java.util.Map<IconIdentifier,javax.swing.ImageIcon> ICONS
The Map that contains all icons used in the GUI


DEFAUT_DELAY_VALUE

public static final int DEFAUT_DELAY_VALUE
The default minimal time elapsing between two simulation steps.

See Also:
Constant Field Values
Constructor Detail

GraphicalSimulationControlGUI

public GraphicalSimulationControlGUI(java.lang.String title)
Constructor of the simulation control GUI.

The GUI is place at the center of the screen.

Parameters:
title - The title of the window that displays this control gui.

GraphicalSimulationControlGUI

public GraphicalSimulationControlGUI(java.lang.String title,
                                     int x,
                                     int y)
Constructor of the simulation control GUI.

Parameters:
title - The title of the window that displays this control gui.
x - The x position of this frame.
y - The y position of this frame.
Method Detail

getCurrentStepLabel

public javax.swing.JLabel getCurrentStepLabel()
Gets the label that displays the current simulation step.

Returns:
The label that displays the current simulation step.

getAbortButton

public javax.swing.JButton getAbortButton()
Gets the button used to abort the simulation.

Returns:
the button used to abort the simulation.

getRunOrPauseButton

public javax.swing.JButton getRunOrPauseButton()
Gets the button used either to run the simulation, or pause the simulation.

Returns:
the button used either to run the simulation, or pause the simulation.

getSingleStepButton

public javax.swing.JButton getSingleStepButton()
Gets the button used to perform a single simulation step.

Returns:
the button used to perform a single simulation step.

getInitializationButton

public javax.swing.JButton getInitializationButton()
Gets the button used to initialize the simulation.

Returns:
the button used to initialize the simulation.

getDelayBar

public javax.swing.JSlider getDelayBar()
Gets the slider that defines the minimal time that has to elapse between two simulation time steps.

Returns:
the slider that defines the minimal time that has to elapse between two simulation time steps.

getControlFrame

public javax.swing.JFrame getControlFrame()
Gets the frame that displays all the control buttons.

Returns:
the frame that displays all the control buttons.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener
See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)

notifyObservers

public void notifyObservers(ISimulationEvent m)
Description copied from interface: ISimulationGUI
Notifies a message to all observers registered to this GUI.

Specified by:
notifyObservers in interface ISimulationGUI
Parameters:
m - The notified event.
See Also:
ISimulationGUI.notifyObservers(fr.lifl.jedi.gui.ISimulationEvent)

removeObserver

public void removeObserver(java.util.Observer o)
Description copied from interface: ISimulationGUI
Removes an observer from this GUI

Specified by:
removeObserver in interface ISimulationGUI
Parameters:
o - The observer to add to the GUI
See Also:
ISimulationGUI.removeObserver(java.util.Observer)

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener
See Also:
WindowListener.windowActivated(java.awt.event.WindowEvent)

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener
See Also:
WindowListener.windowClosed(java.awt.event.WindowEvent)

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener
See Also:
WindowListener.windowClosing(java.awt.event.WindowEvent)

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener
See Also:
WindowListener.windowDeactivated(java.awt.event.WindowEvent)

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener
See Also:
WindowListener.windowDeiconified(java.awt.event.WindowEvent)

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener
See Also:
WindowListener.windowIconified(java.awt.event.WindowEvent)

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener
See Also:
WindowListener.windowOpened(java.awt.event.WindowEvent)

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent arg0)
Specified by:
stateChanged in interface javax.swing.event.ChangeListener
See Also:
ChangeListener.stateChanged(javax.swing.event.ChangeEvent)