fr.ifremer.isisfish.simulator
Class SimulationControl

java.lang.Object
  extended by fr.ifremer.isisfish.simulator.SimulationControl
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class SimulationControl
extends Object
implements PropertyChangeListener

Permit to communicate with user interface from simulation thread. Created: Fri Oct 6 2000

Version:
$Revision: 3124 $ Mise a jour: $Date: 2010-11-29 19:14:09 +0100 (lun., 29 nov. 2010) $ par : $Author: chatellier $
Author:
POUSSIN Benjamin

Field Summary
protected  boolean autoSaveState
          Control save mecanism each time a property is changed (default to false).
protected  Date date
           
protected  String id
           
protected  boolean inUpdateFromProperties
           
protected  PropertyChangeSupport listeners
           
protected  long progress
           
protected  long progressMax
           
protected  boolean running
           
protected  SimulationStorage simulation
           
protected  boolean started
           
protected  boolean stop
           
protected  String text
           
 
Constructor Summary
SimulationControl(String id)
          Init simulation control with simulation id.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
           
 void addPropertyChangeListener(String propName, PropertyChangeListener l)
           
 Date getDate()
          Method getDate donne la date utiliser par la simulation.
 String getId()
          Method getId donne id de la simulation.
 long getProgress()
          Get current progress.
 long getProgressMax()
           
 Properties getProperties()
          Met dans un Properties tous les champs
 SimulationStorage getSimulation()
          Retourne la simulation associe a ce control
 String getText()
           
 boolean isAutoSaveState()
          Get current auto save state.
 boolean isRunning()
          Method running.
 boolean isStarted()
           
 boolean isStopSimulationRequest()
          Is stop request been asked.
 void propertyChange(PropertyChangeEvent e)
           
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void removePropertyChangeListener(String propName, PropertyChangeListener l)
           
 void reset()
          Reset control values for job restart.
 void setAutoSaveState(boolean autoSaveState)
          Change auto save state on property change.
 void setDate(Date d)
          Modifie la date de la simulation.
 void setProgress(long progress)
          Set current progress.
 void setProgressMax(long progressMax)
          Set max progress.
 void setStarted(boolean started)
          Appelee juste avant de reellement demarrer le thread de simulation indique que cette simulation est en cours et qu'il ne faut plus la lancer
 void setStopSimulationRequest(boolean val)
          Demande l'arret de la simulation.
 void setText(String text)
           
 void startSimulation()
          Appele lors du debut de la simulation.
 void stopSimulation()
          Appele lors de la fin reelle de la simulation.
 void updateFromProperties(Properties props)
          update current object from Properties representation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

protected PropertyChangeSupport listeners

inUpdateFromProperties

protected boolean inUpdateFromProperties

simulation

protected transient SimulationStorage simulation

id

protected String id

started

protected boolean started

running

protected boolean running

stop

protected boolean stop

date

protected Date date

progressMax

protected long progressMax

progress

protected long progress

text

protected String text

autoSaveState

protected transient boolean autoSaveState
Control save mecanism each time a property is changed (default to false).

Constructor Detail

SimulationControl

public SimulationControl(String id)
Init simulation control with simulation id.

Parameters:
id - simulation id
Method Detail

setAutoSaveState

public void setAutoSaveState(boolean autoSaveState)
Change auto save state on property change. Usefull to disable autosave in simulation monitoring.

Parameters:
autoSaveState - new state

isAutoSaveState

public boolean isAutoSaveState()
Get current auto save state.

Returns:
auto save state

reset

public void reset()
Reset control values for job restart.


getSimulation

public SimulationStorage getSimulation()
Retourne la simulation associe a ce control

Returns:
retourne null si la simulation n'existe pas encore

addPropertyChangeListener

public void addPropertyChangeListener(String propName,
                                      PropertyChangeListener l)

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)

removePropertyChangeListener

public void removePropertyChangeListener(String propName,
                                         PropertyChangeListener l)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)

isStarted

public boolean isStarted()

setStarted

public void setStarted(boolean started)
Appelee juste avant de reellement demarrer le thread de simulation indique que cette simulation est en cours et qu'il ne faut plus la lancer

Parameters:
started - The running to set.

isRunning

public boolean isRunning()
Method running.

Returns:
faux une fois que stopSimulation a ete appele.

startSimulation

public void startSimulation()
Appele lors du debut de la simulation.


stopSimulation

public void stopSimulation()
Appele lors de la fin reelle de la simulation.


getText

public String getText()
Returns:
Returns the text.

setText

public void setText(String text)
Parameters:
text - The text to set.

getProgressMax

public long getProgressMax()
Returns:
Returns the progressMax.

setProgressMax

public void setProgressMax(long progressMax)
Set max progress.

Parameters:
progressMax - progressMax to set.

getProgress

public long getProgress()
Get current progress.

Returns:
the progress.

setProgress

public void setProgress(long progress)
Set current progress.

Parameters:
progress - progress to set.

setStopSimulationRequest

public void setStopSimulationRequest(boolean val)
Demande l'arret de la simulation.

Parameters:
val - true to stop

isStopSimulationRequest

public boolean isStopSimulationRequest()
Is stop request been asked.

Returns:
retourne vrai si l'arret de la simulation a ete demandee

getId

public String getId()
Method getId donne id de la simulation.

Returns:
l'id de la simulation

getDate

public Date getDate()
Method getDate donne la date utiliser par la simulation.

Returns:
donne la date utiliser par la simulation

setDate

public void setDate(Date d)
Modifie la date de la simulation.

Parameters:
d - la nouvelle date

getProperties

public Properties getProperties()
Met dans un Properties tous les champs

Returns:
un Properties avec tous les champs

updateFromProperties

public void updateFromProperties(Properties props)
update current object from Properties representation

Parameters:
props - new properties to update from

propertyChange

public void propertyChange(PropertyChangeEvent e)
Specified by:
propertyChange in interface PropertyChangeListener


Copyright © 1999-2011 CodeLutin. All Rights Reserved.