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
70 this.simulator = simulator;
71 this.otsModel = otsModel;
72
73 this.setLayout(new BorderLayout());
74
75
76 this.otsControlPanel = new OTSControlPanel(simulator, otsModel);
77 this.add(this.otsControlPanel, BorderLayout.NORTH);
78
79
80 this.add(this.tabbedPane, BorderLayout.CENTER);
81
82
83
84
85 }
86
87
88
89
90 public final void addConsoleTab()
91 {
92
93 JScrollPane cons = new JScrollPane(this.console);
94 cons.setBorder(null);
95 this.tabbedPane.addTab("console", cons);
96 }
97
98
99
100
101
102 public final void addPropertiesTab() throws InputParameterException
103 {
104
105 }
106
107
108
109
110 public final TabbedContentPane getTabbedPane()
111 {
112 return this.tabbedPane;
113 }
114
115
116
117
118 public final DEVSSimulatorInterface.TimeDoubleUnit getSimulator()
119 {
120 return this.simulator;
121 }
122
123
124
125
126 public final StatusBar getStatusBar()
127 {
128 return this.statusBar;
129 }
130
131
132
133
134
135 public final OTSControlPanel getOtsControlPanel()
136 {
137 return this.otsControlPanel;
138 }
139
140
141
142
143 public final Console getConsole()
144 {
145 return this.console;
146 }
147
148
149
150
151 public final OTSModelInterface getOtsModel()
152 {
153 return this.otsModel;
154 }
155
156
157 @Override
158 public final String toString()
159 {
160 return "OTSSimulationPanel [simulatorTime=" + this.simulator.getSimulatorTime() + "]";
161 }
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176 static class AppearanceControlTabbedContentPane extends TabbedContentPane implements AppearanceControl
177 {
178
179 private static final long serialVersionUID = 20180206L;
180
181
182
183
184 AppearanceControlTabbedContentPane(final int tabPlacement)
185 {
186 super(tabPlacement);
187 }
188
189
190 @Override
191 public String toString()
192 {
193 return "AppearanceControlTabbedContentPane []";
194 }
195
196 }
197
198 }