1 package org.opentrafficsim.swing.gui;
2
3 import java.awt.BorderLayout;
4 import java.awt.Insets;
5 import java.rmi.RemoteException;
6
7 import javax.swing.JPanel;
8 import javax.swing.JScrollPane;
9 import javax.swing.SwingConstants;
10 import javax.swing.UIManager;
11
12 import org.opentrafficsim.core.dsol.OTSModelInterface;
13
14 import nl.tudelft.simulation.dsol.model.inputparameters.InputParameterException;
15 import nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface;
16 import nl.tudelft.simulation.dsol.swing.gui.Console;
17 import nl.tudelft.simulation.dsol.swing.gui.StatusBar;
18 import nl.tudelft.simulation.dsol.swing.gui.TabbedContentPane;
19
20
21
22
23
24
25
26
27
28
29
30
31 public class OTSSimulationPanel extends JPanel
32 {
33
34 private static final long serialVersionUID = 20150617L;
35
36
37 private final DEVSSimulatorInterface.TimeDoubleUnit simulator;
38
39
40 private final Console console = new Console();
41
42
43 private final OTSControlPanel otsControlPanel;
44
45
46 private final OTSModelInterface otsModel;
47
48 static
49 {
50
51 UIManager.put("TabbedPane.contentBorderInsets", new Insets(1, 1, 1, 1));
52 }
53
54
55 private final TabbedContentPane tabbedPane = new AppearanceControlTabbedContentPane(SwingConstants.BOTTOM);
56
57
58 private final StatusBar statusBar = null;
59
60
61
62
63
64
65
66 public OTSSimulationPanel(final DEVSSimulatorInterface.TimeDoubleUnit simulator, final OTSModelInterface otsModel)
67 throws RemoteException
68 {
69 this.simulator = simulator;
70 this.otsModel = otsModel;
71
72 this.setLayout(new BorderLayout());
73
74
75 this.otsControlPanel = new OTSControlPanel(simulator, otsModel, (OTSAnimationPanel) this);
76 this.add(this.otsControlPanel, BorderLayout.NORTH);
77
78
79 this.add(this.tabbedPane, BorderLayout.CENTER);
80
81
82
83
84 }
85
86
87
88
89 public final void addConsoleTab()
90 {
91
92 JScrollPane cons = new JScrollPane(this.console);
93 cons.setBorder(null);
94 this.tabbedPane.addTab("console", cons);
95 }
96
97
98
99
100
101 public final void addPropertiesTab() throws InputParameterException
102 {
103
104 }
105
106
107
108
109 public final TabbedContentPane getTabbedPane()
110 {
111 return this.tabbedPane;
112 }
113
114
115
116
117 public final DEVSSimulatorInterface.TimeDoubleUnit getSimulator()
118 {
119 return this.simulator;
120 }
121
122
123
124
125 public final StatusBar getStatusBar()
126 {
127 return this.statusBar;
128 }
129
130
131
132
133
134 public final OTSControlPanel getOtsControlPanel()
135 {
136 return this.otsControlPanel;
137 }
138
139
140
141
142 public final Console getConsole()
143 {
144 return this.console;
145 }
146
147
148
149
150 public final OTSModelInterface getOtsModel()
151 {
152 return this.otsModel;
153 }
154
155
156 @Override
157 public final String toString()
158 {
159 return "OTSSimulationPanel [simulatorTime=" + this.simulator.getSimulatorTime() + "]";
160 }
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175 static class AppearanceControlTabbedContentPane extends TabbedContentPane implements AppearanceControl
176 {
177
178 private static final long serialVersionUID = 20180206L;
179
180
181
182
183 AppearanceControlTabbedContentPane(final int tabPlacement)
184 {
185 super(tabPlacement);
186 }
187
188
189 @Override
190 public String toString()
191 {
192 return "AppearanceControlTabbedContentPane []";
193 }
194
195 }
196
197 }