Class OTSWebModel
java.lang.Object
nl.tudelft.simulation.dsol.jetty.sse.OTSWebModel
- All Implemented Interfaces:
java.util.EventListener
,EventListenerInterface
public class OTSWebModel extends java.lang.Object implements EventListenerInterface
OTSWebModel.java.
Copyright (c) 2003-2018 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.
Copyright (c) 2003-2018 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
-
Constructor Summary
Constructors Constructor Description OTSWebModel(java.lang.String title, OTSSimulatorInterface simulator)
-
Method Summary
Modifier and Type Method Description HTMLAnimationPanel
getAnimationPanel()
OTSSimulatorInterface
getSimulator()
java.lang.String
getTitle()
void
handle(java.lang.String target, org.eclipse.jetty.server.Request baseRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Delegate handle method from the main web server for this particular model.boolean
isKilled()
void
notify(EventInterface event)
void
setKilled(boolean killed)
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.
-
Constructor Details
-
OTSWebModel
public OTSWebModel(java.lang.String title, OTSSimulatorInterface simulator) throws java.lang.Exception- Parameters:
title
- String; the title for the model windowsimulator
- SimulatorInterface<?,?,?>; the simulator- Throws:
java.lang.Exception
- in case jetty crashes
-
-
Method Details
-
getTitle
public final java.lang.String getTitle()- Returns:
- title
-
getSimulator
- Returns:
- simulator
-
getAnimationPanel
- Returns:
- animationPanel
-
isKilled
public final boolean isKilled()- Returns:
- killed
-
setKilled
public final void setKilled(boolean killed)- Parameters:
killed
- set killed
-
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
- Specified by:
notify
in interfaceEventListenerInterface
- Throws:
java.rmi.RemoteException
-
handle
public void handle(java.lang.String target, org.eclipse.jetty.server.Request baseRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletExceptionDelegate handle method from the main web server for this particular model.- Parameters:
target
- tbaseRequest
- brrequest
- rresponse
- re- Throws:
java.io.IOException
- on errorjavax.servlet.ServletException
- on error
-