Class OTSWebServer

java.lang.Object
nl.tudelft.simulation.dsol.jetty.sse.OTSWebServer
All Implemented Interfaces:
java.util.EventListener, EventListenerInterface
Direct Known Subclasses:
CircularModelWeb, TJunctionDemo

public abstract class OTSWebServer
extends java.lang.Object
implements EventListenerInterface
DSOLWebServer.java.

Copyright (c) 2003-2019 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information www.simulation.tudelft.nl. The source code and binary code of this software is proprietary information of Delft University of Technology.
Author:
Alexander Verbraeck
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  OTSWebServer.XHRHandler
    Answer handles the events from the web-based user interface.
  • Constructor Summary

    Constructors 
    Constructor Description
    OTSWebServer​(java.lang.String title, OTSSimulatorInterface simulator, java.awt.geom.Rectangle2D.Double extent)  
  • Method Summary

    Modifier and Type Method Description
    HTMLAnimationPanel getAnimationPanel()  
    OTSSimulatorInterface getSimulator()  
    java.lang.String getTitle()  
    void notify​(EventInterface event)
    protected void setSpeedFactor​(double speedFactor)  
    protected boolean startSimulator()
    Try to start the simulator, and return whether the simulator has been started.
    protected boolean stopSimulator()
    Try to stop the simulator, and return whether the simulator has been stopped.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OTSWebServer

      public OTSWebServer​(java.lang.String title, OTSSimulatorInterface simulator, java.awt.geom.Rectangle2D.Double extent) throws java.lang.Exception
      Parameters:
      title - String; the title for the model window
      simulator - SimulatorInterface<?,?,?>; the simulator
      extent - Rectangle2D.Double; the extent to use for the graphics (min/max coordinates)
      Throws:
      java.lang.Exception - in case jetty crashes
  • Method Details

    • getTitle

      public final java.lang.String getTitle()
      Returns:
      title
    • getSimulator

      public final OTSSimulatorInterface getSimulator()
      Returns:
      simulator
    • getAnimationPanel

      public final HTMLAnimationPanel getAnimationPanel()
      Returns:
      animationPanel
    • startSimulator

      protected boolean startSimulator()
      Try to start the simulator, and return whether the simulator has been started.
      Returns:
      whether the simulator has been started or not
    • stopSimulator

      protected boolean stopSimulator()
      Try to stop the simulator, and return whether the simulator has been stopped.
      Returns:
      whether the simulator has been stopped or not
    • setSpeedFactor

      protected void setSpeedFactor​(double speedFactor)
      Parameters:
      speedFactor - double; the new speed factor
    • notify

      public void notify​(EventInterface event) throws java.rmi.RemoteException
      Specified by:
      notify in interface EventListenerInterface
      Throws:
      java.rmi.RemoteException