1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package de.desy.acop.demo;
24
25 import java.awt.ComponentOrientation;
26 import java.awt.GridBagConstraints;
27 import java.awt.GridBagLayout;
28 import java.awt.Insets;
29
30 import javax.swing.JComponent;
31 import javax.swing.JFrame;
32 import javax.swing.JPanel;
33
34 import com.cosylab.gui.components.util.IconHelper;
35 import com.cosylab.gui.plugins.VitragePlugIn;
36
37 import de.desy.acop.displayers.AcopChart;
38 import de.desy.acop.displayers.AcopDialKnob;
39 import de.desy.acop.displayers.AcopGauger;
40 import de.desy.acop.displayers.AcopIcon;
41 import de.desy.acop.displayers.AcopNumberLabel;
42 import de.desy.acop.displayers.AcopSlider;
43 import de.desy.acop.displayers.AcopSpider;
44 import de.desy.acop.displayers.AcopWheelswitch;
45 import de.desy.acop.displayers.tools.AcopGraphParameters;
46 import de.desy.acop.displayers.AcopLabel;
47 import de.desy.acop.transport.AcopTransport;
48 import de.desy.acop.transport.ConnectionParameters;
49 import de.desy.acop.transport.AccessMode;
50 import java.awt.Color;
51
52
53
54
55
56 public class AcopDisplayersDemo extends JFrame {
57
58 private JPanel jContentPane = null;
59 private AcopNumberLabel acopNumberLabel = null;
60 private AcopGauger acopGauger = null;
61 private AcopChart acopChart = null;
62 private AcopDialKnob acopDialKnob = null;
63 private AcopWheelswitch acopWheelswitch = null;
64 private AcopSlider acopSlider = null;
65 private AcopIcon acopIcon = null;
66 private AcopSpider spiderBean = null;
67 private AcopLabel acopLabel = null;
68 private AcopTransport acopTransport = null;
69
70
71
72
73
74 private AcopNumberLabel getAcopNumberLabel() {
75 if (acopNumberLabel == null) {
76 try {
77 acopNumberLabel = new AcopNumberLabel();
78 } catch (java.lang.Throwable e) {
79 e.printStackTrace();
80 }
81 }
82 return acopNumberLabel;
83 }
84
85
86
87
88
89
90 private AcopGauger getAcopGauger() {
91 if (acopGauger == null) {
92 try {
93 acopGauger = new AcopGauger();
94 acopGauger.setMaximum(1000.0D);
95 acopGauger.setMinimum(0.0D);
96 acopGauger.setTitle("TINE/DORIS/DORISDATA/V2 Rlf/DoArcTemp");
97 acopGauger.setConnectionParameters(new ConnectionParameters("TINE/DORIS/DORISDATA/V2 Rlf/DoArcTemp", AccessMode.POLL, 1000, -1));
98 acopGauger.setUnits("bozos");
99 } catch (java.lang.Throwable e) {
100 e.printStackTrace();
101 }
102 }
103 return acopGauger;
104 }
105
106
107
108
109
110
111 private AcopChart getAcopChart() {
112 if (acopChart == null) {
113 try {
114 acopChart = new AcopChart();
115 acopChart.setYBestScale(true);
116 } catch (java.lang.Throwable e) {
117 e.printStackTrace();
118 }
119 }
120 return acopChart;
121 }
122
123
124
125
126
127
128 private AcopDialKnob getAcopDialKnob() {
129 if (acopDialKnob == null) {
130 try {
131 acopDialKnob = new AcopDialKnob();
132 } catch (java.lang.Throwable e) {
133 e.printStackTrace();
134 }
135 }
136 return acopDialKnob;
137 }
138
139
140
141
142
143
144 private AcopWheelswitch getAcopWheelswitch() {
145 if (acopWheelswitch == null) {
146 try {
147 acopWheelswitch = new AcopWheelswitch();
148 } catch (java.lang.Throwable e) {
149 e.printStackTrace();
150 }
151 }
152 return acopWheelswitch;
153 }
154
155
156
157
158
159
160 private AcopSlider getAcopSlider() {
161 if (acopSlider == null) {
162 try {
163 acopSlider = new AcopSlider();
164 } catch (java.lang.Throwable e) {
165 e.printStackTrace();
166 }
167 }
168 return acopSlider;
169 }
170
171
172
173
174
175
176 private AcopIcon getAcopIcon() {
177 if (acopIcon == null) {
178 try {
179 acopIcon = new AcopIcon();
180 acopIcon.setBounds(new java.awt.Rectangle(342,239,115,92));
181 acopIcon.setSize(new java.awt.Dimension(115,92));
182 acopIcon.setLocation(new java.awt.Point(342,239));
183 acopIcon.setTitle("");
184 acopIcon.setDefaultIconName("ilc_kollision_ger.jpg");
185 acopIcon.setMinimumSize(new java.awt.Dimension(2,2));
186 } catch (java.lang.Throwable e) {
187 e.printStackTrace();
188 }
189 }
190 return acopIcon;
191 }
192
193
194
195
196
197
198 private AcopLabel getAcopLabel() {
199 if (acopLabel == null) {
200 try {
201 acopLabel = new AcopLabel();
202 } catch (java.lang.Throwable e) {
203 e.printStackTrace();
204 }
205 }
206 return acopLabel;
207 }
208
209
210
211
212
213
214 private AcopTransport getAcopTransport() {
215 if (acopTransport == null) {
216 try {
217 acopTransport = new AcopTransport();
218 } catch (java.lang.Throwable e) {
219
220 }
221 }
222 return acopTransport;
223 }
224
225
226
227
228 public static void main(String[] args) {
229 AcopDisplayersDemo demo= new AcopDisplayersDemo();
230 new VitragePlugIn((JComponent)demo.getContentPane());
231 demo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
232 demo.setVisible(true);
233 }
234
235
236
237
238 public AcopDisplayersDemo() {
239 super();
240 initialize();
241 }
242
243
244
245
246
247
248 private void initialize() {
249 this.setSize(566, 481);
250 this.setContentPane(getJContentPane());
251 this.setTitle("ACOP Demo Panel");
252 }
253
254
255
256
257
258
259 private JPanel getJContentPane() {
260 if (jContentPane == null) {
261 GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
262 gridBagConstraints7.gridx = 0;
263 gridBagConstraints7.fill = GridBagConstraints.BOTH;
264 gridBagConstraints7.gridwidth = 2;
265 gridBagConstraints7.gridy = 6;
266 GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
267 gridBagConstraints6.gridx = 1;
268 gridBagConstraints6.anchor = GridBagConstraints.WEST;
269 gridBagConstraints6.weighty = 1.0D;
270 gridBagConstraints6.weightx = 1.0D;
271 gridBagConstraints6.fill = GridBagConstraints.BOTH;
272 gridBagConstraints6.insets = new Insets(4, 4, 4, 4);
273 gridBagConstraints6.ipady = 20;
274 gridBagConstraints6.gridy = 0;
275 spiderBean = new AcopSpider();
276 spiderBean.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
277 GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
278 gridBagConstraints5.gridx = 1;
279 gridBagConstraints5.weighty = 1.0D;
280 gridBagConstraints5.gridheight = 2;
281 gridBagConstraints5.fill = GridBagConstraints.BOTH;
282 gridBagConstraints5.weightx = 1.0D;
283 gridBagConstraints5.insets = new Insets(4, 4, 4, 4);
284 gridBagConstraints5.gridy = 3;
285 GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
286 gridBagConstraints4.gridx = 0;
287 gridBagConstraints4.fill = java.awt.GridBagConstraints.BOTH;
288 gridBagConstraints4.insets = new java.awt.Insets(4,4,4,4);
289 gridBagConstraints4.weightx = 1.0D;
290 gridBagConstraints4.weighty = 0.1D;
291 gridBagConstraints4.gridy = 4;
292 GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
293 gridBagConstraints3.gridx = 0;
294 gridBagConstraints3.gridwidth = 2;
295 gridBagConstraints3.weightx = 1.0D;
296 gridBagConstraints3.weighty = 0.1D;
297 gridBagConstraints3.insets = new java.awt.Insets(4,4,4,4);
298 gridBagConstraints3.fill = java.awt.GridBagConstraints.BOTH;
299 gridBagConstraints3.gridy = 5;
300 GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
301 gridBagConstraints2.gridx = 0;
302 gridBagConstraints2.insets = new java.awt.Insets(4,4,4,4);
303 gridBagConstraints2.weightx = 1.0D;
304 gridBagConstraints2.weighty = 0.1D;
305 gridBagConstraints2.fill = java.awt.GridBagConstraints.BOTH;
306 gridBagConstraints2.gridy = 3;
307 GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
308 gridBagConstraints12.gridx = 1;
309 gridBagConstraints12.weightx = 1.0D;
310 gridBagConstraints12.weighty = 1.0D;
311 gridBagConstraints12.fill = java.awt.GridBagConstraints.BOTH;
312 gridBagConstraints12.insets = new java.awt.Insets(4,4,4,4);
313 gridBagConstraints12.gridy = 2;
314 GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
315 gridBagConstraints11.gridx = 0;
316 gridBagConstraints11.fill = java.awt.GridBagConstraints.BOTH;
317 gridBagConstraints11.weightx = 1.0D;
318 gridBagConstraints11.weighty = 1.0D;
319 gridBagConstraints11.gridwidth = 2;
320 gridBagConstraints11.ipady = 150;
321 gridBagConstraints11.gridy = 1;
322 GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
323 gridBagConstraints1.gridx = 0;
324 gridBagConstraints1.insets = new java.awt.Insets(4,4,4,4);
325 gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
326 gridBagConstraints1.weighty = 1.0D;
327 gridBagConstraints1.weightx = 1.0D;
328 gridBagConstraints1.ipadx = 100;
329 gridBagConstraints1.ipady = 0;
330 gridBagConstraints1.gridy = 2;
331 jContentPane = new JPanel();
332 jContentPane.setLayout(new GridBagLayout());
333 jContentPane.add(getAcopGauger(), gridBagConstraints1);
334 jContentPane.add(getAcopChart(), gridBagConstraints11);
335 jContentPane.add(getAcopDialKnob(), gridBagConstraints12);
336 jContentPane.add(getAcopWheelswitch(), gridBagConstraints2);
337 jContentPane.add(getAcopSlider(), gridBagConstraints3);
338 jContentPane.add(getAcopNumberLabel(), gridBagConstraints4);
339 jContentPane.add(getAcopIcon(), gridBagConstraints5);
340 jContentPane.add(spiderBean, gridBagConstraints6);
341 jContentPane.add(getAcopLabel(), gridBagConstraints7);
342 }
343 return jContentPane;
344 }
345
346 }