package nl.tudelft.simulation.dsol.swing.gui.test; import java.io.Serializable; import java.rmi.RemoteException; import javax.naming.NamingException; import org.pmw.tinylog.Level; import nl.tudelft.simulation.dsol.SimRuntimeException; import nl.tudelft.simulation.dsol.experiment.ReplicationInterface; import nl.tudelft.simulation.dsol.experiment.SingleReplication; import nl.tudelft.simulation.dsol.model.AbstractDSOLModel; import nl.tudelft.simulation.dsol.simulators.DEVSSimulator; import nl.tudelft.simulation.dsol.swing.gui.DSOLApplication; import nl.tudelft.simulation.dsol.swing.gui.DSOLPanel; import nl.tudelft.simulation.dsol.swing.gui.control.DEVSControlPanel; /** * SwingApplication.java. *

* Copyright (c) 2020-2022 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See * for project information DSOL Manual. The DSOL * project is distributed under a three-clause BSD-style license, which can be found at * DSOL License. *

* @author Alexander Verbraeck */ public class SwingApplication extends DSOLApplication { /** */ private static final long serialVersionUID = 1L; /** * @param panel the panel with the controls and tabbed pane for content */ public SwingApplication(final DSOLPanel panel) { super(panel, "Swing test appication"); panel.enableSimulationControlButtons(); } /** * @param args String[]; not used * @throws NamingException on error with the context * @throws RemoteException on error with remote components */ public static void main(final String[] args) throws NamingException, RemoteException { DEVSSimulator.TimeDouble simulator = new DEVSSimulator.TimeDouble("simulator"); MyModel model = new MyModel(simulator); ReplicationInterface.TimeDouble replication = new SingleReplication.TimeDouble("rep1", 0.0, 0.0, 1000.0); simulator.initialize(model, replication); DEVSControlPanel.TimeDouble controlPanel = new DEVSControlPanel.TimeDouble(model, simulator); DSOLPanel panel = new DSOLPanel(controlPanel); panel.addConsoleLogger(Level.INFO); new SwingApplication(panel); } /** */ static class MyModel extends AbstractDSOLModel.TimeDouble { /** */ private static final long serialVersionUID = 1L; /** * @param simulator the simulator */ MyModel(final DEVSSimulator.TimeDouble simulator) { super(simulator); } /** {@inheritDoc} */ @Override public void constructModel() throws SimRuntimeException { // } /** {@inheritDoc} */ @Override public Serializable getSourceId() { return "MyModel"; } } }