org.eclipse.ohf.stem.ui.ge
Class GEInterface

java.lang.Object
  extended by org.eclipse.ohf.stem.ui.ge.GEInterface
All Implemented Interfaces:
ISimulationListener, ISimulationManagerListener

public class GEInterface
extends java.lang.Object
implements ISimulationListener, ISimulationManagerListener


Constructor Summary
GEInterface(GEView geView)
          Constructor.
 
Method Summary
 boolean displayArea(java.lang.String adminFile, java.lang.String search, boolean clear)
          called by GEView to display the current map for a specific admin area.
 boolean displayMap(ISimulation simulation)
          called by GEView to display the current map This version sets a switch to cause a display on the next cycle if simulation or now if paused.
 void displayStatus()
          display status.
 void dispose()
          Called by GEView.dispose()
 Aspect getAspectToDisplay(ISimulation sim)
          Get the SEIR value to be displayed from user.
 int getCycle(ISimulation sim)
           
 Aspect getDefaultAspect()
           
 java.lang.String getErrorMessage()
           
static java.lang.String getSimulationId(ISimulation simulation)
          Get the ID to use for getting the GESimEntry instance
 boolean init()
          called by GEView to do any initialization after we have setup the GUI environment It will startup the servlet web server if possible
 boolean isActive(ISimulation sim)
          Check if the specified simulation is actively being listened to.
 boolean isActiveView(ISimulation sim)
          Check if the specified simulation is the simulation being viewed by GoogleEarth
 boolean restartGE()
          called by GEView when the GoogleEarth application is being restarted.
 boolean runGE(java.lang.String folder)
          called by GEView to display the KML files on GE via the Servlet API
 boolean setActive(ISimulation sim, boolean active)
          Set the logging for the specified simulation.
 void setAspectToDisplay(ISimulation sim, Aspect aspect)
          Set the SEIR value that wwe want displayed.
 void setDefaultAspect(Aspect defaultAspect)
           
 void setErrorMessage(java.lang.String msg)
          Set an error message to display
 void simulationChanged(SimulationEvent event)
          Listener for events that happen in a specific Simulation.
 void simulationsChanged(SimulationManagerEvent event)
          We get here because we are listening for SimulationsChanged events from the Simulation Manager and one occured.
 boolean startGE()
          called by GEView to start the GoogleEarth application if not already started
 boolean stopGE()
          called by GEView to stop the current display the KML files on GE via the Servlet API
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GEInterface

public GEInterface(GEView geView)
Constructor. - setup to listen for SimulationManager events - check if existing simulations.

Parameters:
geView - GUI class that is invoking us.
Method Detail

init

public boolean init()
called by GEView to do any initialization after we have setup the GUI environment It will startup the servlet web server if possible

Returns:
true if initialization is successful

simulationsChanged

public void simulationsChanged(SimulationManagerEvent event)
We get here because we are listening for SimulationsChanged events from the Simulation Manager and one occured. We will check for a Simulation being removed and if so check if it is one of our active simulation and if so remove it. If a simulation is being added, it will be added to the list of active simulations.

Specified by:
simulationsChanged in interface ISimulationManagerListener
Parameters:
event - the event that records what happened to the manager.

dispose

public void dispose()
Called by GEView.dispose()


simulationChanged

public void simulationChanged(SimulationEvent event)
Listener for events that happen in a specific Simulation. This gets called for the following event states SimulationState: RUNNING COMPLETED_CYCLE PAUSED We are interested in Completed_Cycle

Specified by:
simulationChanged in interface ISimulationListener
Parameters:
event - the event that records what happened to the manager.

displayArea

public boolean displayArea(java.lang.String adminFile,
                           java.lang.String search,
                           boolean clear)
called by GEView to display the current map for a specific admin area.

Parameters:
adminFile - File that contains desired data
search - String that is matched against area id
clear - If true then clear the existing map
Returns:
true if able to display map or false if could not.

displayMap

public boolean displayMap(ISimulation simulation)
called by GEView to display the current map This version sets a switch to cause a display on the next cycle if simulation or now if paused.

Parameters:
simulation - The currently selected Simulation
Returns:
true if able to display map or false if could not.

runGE

public boolean runGE(java.lang.String folder)
called by GEView to display the KML files on GE via the Servlet API

Parameters:
folder -
Returns:
true if able to display map or false if could not.

startGE

public boolean startGE()
called by GEView to start the GoogleEarth application if not already started

Returns:
true if able to display map or false if could not.

restartGE

public boolean restartGE()
called by GEView when the GoogleEarth application is being restarted.

Returns:
true if able to reset or false if could not.

stopGE

public boolean stopGE()
called by GEView to stop the current display the KML files on GE via the Servlet API

Returns:
true

isActive

public boolean isActive(ISimulation sim)
Check if the specified simulation is actively being listened to. A simulation is active if it is listed in the map of active simulations and can therefore be manually displayed.

Parameters:
sim -
Returns:
true if active, false in not active or non existant

isActiveView

public boolean isActiveView(ISimulation sim)
Check if the specified simulation is the simulation being viewed by GoogleEarth

Parameters:
sim -
Returns:
true if activeView

setActive

public boolean setActive(ISimulation sim,
                         boolean active)
Set the logging for the specified simulation. This creates the GESimEntry which is used to collect information about the ISimulation instance to used to build KML files.

Parameters:
sim - Simulation instance being activated (or deactivated)
active - set true to write file, set false to bypass write
Returns:
true if ok, false in failed with errorMessage

setAspectToDisplay

public void setAspectToDisplay(ISimulation sim,
                               Aspect aspect)
Set the SEIR value that wwe want displayed.

Parameters:
sim - Simulation instance
aspect - the sEIRValue to set

getAspectToDisplay

public Aspect getAspectToDisplay(ISimulation sim)
Get the SEIR value to be displayed from user.

Parameters:
sim - Simulation instance
Returns:
the sEIRValue to display

displayStatus

public void displayStatus()
display status. This will display on the console a lot of information about the environment. Currently it displays the status on the console. At some point the important status may be placed into a dialog box and displayed. The main purpose of this is to have a way to display interesting stuff. It can be used as a problem reporting aid since one can take the output and use it in the problem description. So it is important that information that is needed in diagnosing problems with the STEM-GE interface be displayed here.


getSimulationId

public static java.lang.String getSimulationId(ISimulation simulation)
Get the ID to use for getting the GESimEntry instance

Parameters:
simulation -
Returns:
"SIM[sequenceNumber"]"

getDefaultAspect

public Aspect getDefaultAspect()
Returns:
the defaultAspect

setDefaultAspect

public void setDefaultAspect(Aspect defaultAspect)
Parameters:
defaultAspect - the defaultAspect to set

setErrorMessage

public void setErrorMessage(java.lang.String msg)
Set an error message to display

Parameters:
msg -

getErrorMessage

public java.lang.String getErrorMessage()
Returns:
the errorMessage

getCycle

public int getCycle(ISimulation sim)
Parameters:
sim - Simulation that is being processed.
Returns:
the cycle