1   /*
2    * Copyright (c) 2006 Stiftung Deutsches Elektronen-Synchroton,
3    * Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY.
4    *
5    * THIS SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "../AS IS" BASIS.
6    * WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
7    * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR PARTICULAR PURPOSE AND
8    * NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
9    * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
10   * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
11   * THE USE OR OTHER DEALINGS IN THE SOFTWARE. SHOULD THE SOFTWARE PROVE DEFECTIVE
12   * IN ANY RESPECT, THE USER ASSUMES THE COST OF ANY NECESSARY SERVICING, REPAIR OR
13   * CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
14   * NO USE OF ANY SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
15   * DESY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
16   * OR MODIFICATIONS.
17   * THE FULL LICENSE SPECIFYING FOR THE SOFTWARE THE REDISTRIBUTION, MODIFICATION,
18   * USAGE AND OTHER RIGHTS AND OBLIGATIONS IS INCLUDED WITH THE DISTRIBUTION OF THIS
19   * PROJECT IN THE FILE LICENSE.HTML. IF THE LICENSE IS NOT INCLUDED YOU MAY FIND A COPY
20   * AT HTTP://WWW.DESY.DE/LEGAL/LICENSE.HTM
21   */
22  
23  package debugTest;
24  
25  import javax.swing.JPanel;
26  import javax.swing.JFrame;
27  import java.awt.Dimension;
28  import java.awt.GridBagLayout;
29  import de.desy.acop.displayers.AcopChart;
30  import java.awt.GridBagConstraints;
31  import de.desy.acop.displayers.AcopDialKnob;
32  import de.desy.acop.displayers.AcopGauger;
33  import de.desy.acop.displayers.AcopLabel;
34  import de.desy.acop.displayers.AcopNumberLabel;
35  import de.desy.acop.displayers.AcopSlider;
36  import de.desy.acop.displayers.AcopTable;
37  import de.desy.acop.displayers.AcopWheelswitch;
38  import de.desy.acop.displayers.tools.AcopGraphParameters;
39  import de.desy.acop.transport.ConnectionParameters;
40  import de.desy.acop.transport.AccessMode;
41  import java.awt.Color;
42  import com.cosylab.gui.adapters.ConverterChain;
43  import com.cosylab.gui.adapters.Converter;
44  import com.cosylab.gui.adapters.MultiplierConverter;
45  import com.cosylab.gui.adapters.LogarithmicConverter;
46  import com.cosylab.gui.adapters.PotentialConverter;
47  import com.cosylab.gui.adapters.LinearConverter;
48  import com.cosylab.gui.adapters.IdentityConverter;
49  
50  public class AcopBeansTest extends JFrame {
51  
52  	private static final long serialVersionUID = 1L;
53  
54  	private JPanel jContentPane = null;
55  
56  	private AcopChart acopChart = null;
57  
58  	private AcopDialKnob acopDialKnob = null;
59  
60  	private AcopGauger acopGauger = null;
61  
62  	private AcopLabel acopLabel = null;
63  
64  	private AcopNumberLabel acopNumberLabel = null;
65  
66  	private AcopSlider acopSlider = null;
67  
68  	private AcopTable acopTable = null;
69  
70  	private AcopWheelswitch acopWheelswitch = null;
71  
72  	/**
73  	 * This method initializes acopChart	
74  	 * 	
75  	 * @return de.desy.acop.displayers.AcopChart	
76  	 */
77  	private AcopChart getAcopChart() {
78  		if (acopChart == null) {
79  			try {
80  				acopChart = new AcopChart();
81  				acopChart.setMinimumSize(new Dimension(100, 100));
82  				acopChart.setMaximumSize(new Dimension(400, 400));
83  				acopChart.setDisplayerParameters(new AcopGraphParameters[] {new AcopGraphParameters(new ConnectionParameters("TINE/TEST/JWKSINE/Device 1/Sine", AccessMode.POLL, 1000, -1), new Color(-10027213), 0, 0, 0, 1, false, 100, new ConverterChain(new Converter[] {new MultiplierConverter(2.0), new LogarithmicConverter(2.7199999999999998)})), new AcopGraphParameters(new ConnectionParameters("TINE/TEST/JWKSINE/Device 0/Sine", AccessMode.POLL, 1000, -1), new Color(-16777216), 0, 0, 0, 1, false, 100, new MultiplierConverter(2.0))});
84  				acopChart.setYAxisLabel("dva");
85  				acopChart.setCaption("TINE/TEST/JWKSINE/Device 1/Sine");
86  				acopChart.setName("TINE/TEST/JWKSINE/Device 1/Sine");
87  				acopChart.setYFineTicks(14);
88  				acopChart.setXScale(8.0D);
89  				acopChart.setXMin(1.0D);
90  				acopChart.setSecondaryYAxisOn(true);
91  				acopChart.setXBestScale(true);
92  				acopChart.setYBestScale(true);
93  				acopChart.setXShift(7.0D);
94  				acopChart.setYShift(9.0D);
95  				acopChart.setXTicks(11);
96  				acopChart.setSecondaryYTicks(15);
97  				acopChart.setYMin(17.0D);
98  				acopChart.setXAxisLabel("ena");
99  				acopChart.setSecondaryYTickText(false);
100 				acopChart.setYScale(10.0D);
101 				acopChart.setSecondaryYMax(6.0D);
102 				acopChart.setSecondaryYBestScale(true);
103 				acopChart.setYMax(18.0D);
104 				acopChart.setSecondaryYFineTicks(16);
105 				acopChart.setSecondaryYLogOn(true);
106 				acopChart.setYTicks(13);
107 				acopChart.setXFineTicks(12);
108 				acopChart.setSecondaryYAxisLabel("tri");
109 				acopChart.setXMax(2.0D);
110 				acopChart.setSecondaryYMin(17.0D);
111 				acopChart.setCursorMarkerColor(new Color(204, 255, 51));
112 				acopChart.setTagging(true);
113 				acopChart.setFFT(1);
114 				acopChart.setYExtent(3.0D);
115 				acopChart.setReuseScreen(true);
116 				acopChart.setColorFilled(false);
117 				acopChart.setInvert(true);
118 				acopChart.setScreenDepth(4);
119 				acopChart.setDisplayMode(3);
120 				acopChart.setAveragingMode(1);
121 				acopChart.setWrapAround(true);
122 				acopChart.setRandomData(false);
123 				acopChart.setXExtent(2.0D);
124 				acopChart.setReuseText(true);
125 				acopChart.setFrameRightOffset(6);
126 				acopChart.setPrintTextStickyAttribute(1);
127 				acopChart.setTextDepth(2);
128 				acopChart.setFrameLeftOffset(5);
129 				acopChart.setPrintTextLocation(1);
130 				acopChart.setFrameTopOffset(3);
131 				acopChart.setFrameBottomOffset(4);
132 				acopChart.setFrameWidth(1);
133 				acopChart.setXGrid(true);
134 				acopChart.setYGrid(true);
135 				acopChart.setGraphStyle(1);
136 				acopChart.setDrawStyle(3);
137 				acopChart.setGridWidth(4);
138 				acopChart.setDrawWidth(5);
139 				acopChart.setGridStyle(3);
140 				acopChart.setMarkerWidth(5);
141 				acopChart.setLeadingEdgeYExtent(12.0D);
142 				acopChart.setLeadingEdgeMode(1);
143 				acopChart.setLeadingEdgeStyle(3);
144 				acopChart.setMarkerMode(2);
145 				acopChart.setMarkerYExtent(11.0D);
146 				acopChart.setLeadingEdgeXExtent(9.0D);
147 				acopChart.setLeadingEdgeWidth(6);
148 				acopChart.setMarkerXExtent(8.0D);
149 				acopChart.setMarkerStyle(2);
150 				acopChart.setZooming(1);
151 				acopChart.setLeadingEdgeGapSize(3);
152 				acopChart.setHistogramPosition(2);
153 				acopChart.setPreferredSize(new Dimension(300, 300));
154 			} catch (java.lang.Throwable e) {
155 				// TODO: Something
156 			}
157 		}
158 		return acopChart;
159 	}
160 
161 	/**
162 	 * This method initializes acopDialKnob	
163 	 * 	
164 	 * @return de.desy.acop.displayers.AcopDialKnob	
165 	 */
166 	private AcopDialKnob getAcopDialKnob() {
167 		if (acopDialKnob == null) {
168 			try {
169 				acopDialKnob = new AcopDialKnob();
170 				acopDialKnob.setMinimumSize(new Dimension(100, 100));
171 				acopDialKnob.setMaximumSize(new Dimension(400, 400));
172 				acopDialKnob.setPreferredSize(new Dimension(200, 200));
173 			} catch (java.lang.Throwable e) {
174 				// TODO: Something
175 			}
176 		}
177 		return acopDialKnob;
178 	}
179 
180 	/**
181 	 * This method initializes acopGauger	
182 	 * 	
183 	 * @return de.desy.acop.displayers.AcopGauger	
184 	 */
185 	private AcopGauger getAcopGauger() {
186 		if (acopGauger == null) {
187 			try {
188 				acopGauger = new AcopGauger();
189 				acopGauger.setMinimumSize(new Dimension(100, 30));
190 				acopGauger.setMaximumSize(new Dimension(400, 400));
191 				acopGauger.setPreferredSize(new Dimension(200, 50));
192 			} catch (java.lang.Throwable e) {
193 				// TODO: Something
194 			}
195 		}
196 		return acopGauger;
197 	}
198 
199 	/**
200 	 * This method initializes acopLabel	
201 	 * 	
202 	 * @return de.desy.acop.displayers.AcopLabel	
203 	 */
204 	private AcopLabel getAcopLabel() {
205 		if (acopLabel == null) {
206 			try {
207 				acopLabel = new AcopLabel();
208 				acopLabel.setConnectionParameters(new ConnectionParameters("TINE/TEST/JWKSINE/Device 1/Sine", AccessMode.POLL, 1000, -1));
209 				acopLabel.setTitle("TINE/TEST/JWKSINE/Device 0/Sine");
210 			} catch (java.lang.Throwable e) {
211 				// TODO: Something
212 			}
213 		}
214 		return acopLabel;
215 	}
216 
217 	/**
218 	 * This method initializes acopNumberLabel	
219 	 * 	
220 	 * @return de.desy.acop.displayers.AcopNumberLabel	
221 	 */
222 	private AcopNumberLabel getAcopNumberLabel() {
223 		if (acopNumberLabel == null) {
224 			try {
225 				acopNumberLabel = new AcopNumberLabel();
226 				acopNumberLabel.setConverter(new ConverterChain(new Converter[] {new PotentialConverter(8.0), new PotentialConverter(1.0)}));
227 				acopNumberLabel.setMaximum(45.0D);
228 				acopNumberLabel.setResizable(false);
229 				acopNumberLabel.setTitle("TINE/TEST/JWKSINE/Device 1/Sine");
230 				acopNumberLabel.setTitleMinimumFontSize(20);
231 				acopNumberLabel.setBoundsVisible(true);
232 				acopNumberLabel.setUnits("kh");
233 				acopNumberLabel.setConnectionParameters(new ConnectionParameters("TINE/TEST/JWKSINE/Device 1/Sine", AccessMode.POLL, 1000, -1));
234 				acopNumberLabel.setArrayIndex(47);
235 				acopNumberLabel.setMinimum(-9.0D);
236 			} catch (java.lang.Throwable e) {
237 				// TODO: Something
238 			}
239 		}
240 		return acopNumberLabel;
241 	}
242 
243 	/**
244 	 * This method initializes acopSlider	
245 	 * 	
246 	 * @return de.desy.acop.displayers.AcopSlider	
247 	 */
248 	private AcopSlider getAcopSlider() {
249 		if (acopSlider == null) {
250 			try {
251 				acopSlider = new AcopSlider();
252 				acopSlider.setConnectionParameters(new ConnectionParameters("TINE/TEST/JWKSINE/Device 0/Amplitude", AccessMode.POLL, 1000, -1));
253 				acopSlider.setSmallStep(3.0D);
254 				acopSlider.setBitStep(2.0D);
255 				acopSlider.setLargeStep(4.0D);
256 				acopSlider.setBitStepRelative(false);
257 				acopSlider.setArrayIndex(1);
258 				acopSlider.setEnabled(false);
259 				acopSlider.setConverter(new IdentityConverter());
260 			} catch (java.lang.Throwable e) {
261 				// TODO: Something
262 			}
263 		}
264 		return acopSlider;
265 	}
266 
267 	/**
268 	 * This method initializes acopTable	
269 	 * 	
270 	 * @return de.desy.acop.displayers.AcopTable	
271 	 */
272 	private AcopTable getAcopTable() {
273 		if (acopTable == null) {
274 			try {
275 				acopTable = new AcopTable();
276 				acopTable.setMinimumSize(new Dimension(100, 100));
277 				acopTable.setMaximumSize(new Dimension(400, 400));
278 				acopTable.setPreferredSize(new Dimension(200, 200));
279 			} catch (java.lang.Throwable e) {
280 				// TODO: Something
281 			}
282 		}
283 		return acopTable;
284 	}
285 
286 	/**
287 	 * This method initializes acopWheelswitch	
288 	 * 	
289 	 * @return de.desy.acop.displayers.AcopWheelswitch	
290 	 */
291 	private AcopWheelswitch getAcopWheelswitch() {
292 		if (acopWheelswitch == null) {
293 			try {
294 				acopWheelswitch = new AcopWheelswitch();
295 				acopWheelswitch.setConverter(new LinearConverter(2.0, 3.0));
296 				acopWheelswitch.setMaximum(20.0D);
297 				acopWheelswitch.setTitle("TINE/TEST/JWKSINE/Device 0/Sine");
298 				acopWheelswitch.setUnits("1/2.0*null");
299 				acopWheelswitch.setConnectionParameters(new ConnectionParameters("TINE/TEST/JWKSINE/Device 0/Amplitude", AccessMode.POLL, 1000, -1));
300 				acopWheelswitch.setEnabled(false);
301 				acopWheelswitch.setMinimum(-3.0D);
302 			} catch (java.lang.Throwable e) {
303 				// TODO: Something
304 			}
305 		}
306 		return acopWheelswitch;
307 	}
308 
309 	/**
310 	 * @param args
311 	 */
312 	public static void main(String[] args) {
313 		// TODO Auto-generated method stub
314 //		SwingUtilities.invokeLater(new Runnable() {
315 //			public void run() {
316 //				AcopBeansTest thisClass = new AcopBeansTest();
317 //				thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
318 //				thisClass.setVisible(true);
319 //			}
320 //		});
321 	}
322 
323 	/**
324 	 * This is the default constructor
325 	 */
326 	public AcopBeansTest() {
327 		super();
328 		initialize();
329 	}
330 
331 	/**
332 	 * This method initializes this
333 	 * 
334 	 * @return void
335 	 */
336 	private void initialize() {
337 		this.setSize(837, 629);
338 		this.setContentPane(getJContentPane());
339 		this.setTitle("JFrames");
340 	}
341 
342 	/**
343 	 * This method initializes jContentPane
344 	 * 
345 	 * @return javax.swing.JPanel
346 	 */
347 	private JPanel getJContentPane() {
348 		if (jContentPane == null) {
349 			GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
350 			gridBagConstraints8.gridx = 1;
351 			gridBagConstraints8.gridwidth = 2;
352 			gridBagConstraints8.gridy = 2;
353 			GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
354 			gridBagConstraints7.gridx = 0;
355 			gridBagConstraints7.gridy = 2;
356 			GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
357 			gridBagConstraints6.gridx = 2;
358 			gridBagConstraints6.gridy = 1;
359 			GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
360 			gridBagConstraints5.gridx = 1;
361 			gridBagConstraints5.gridy = 1;
362 			GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
363 			gridBagConstraints4.gridx = 0;
364 			gridBagConstraints4.gridy = 1;
365 			GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
366 			gridBagConstraints2.gridx = 2;
367 			gridBagConstraints2.gridy = 0;
368 			GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
369 			gridBagConstraints1.gridx = 1;
370 			gridBagConstraints1.gridy = 0;
371 			GridBagConstraints gridBagConstraints = new GridBagConstraints();
372 			gridBagConstraints.gridx = 0;
373 			gridBagConstraints.fill = GridBagConstraints.BOTH;
374 			gridBagConstraints.weightx = 0.0;
375 			gridBagConstraints.weighty = 0.0;
376 			gridBagConstraints.gridy = 0;
377 			jContentPane = new JPanel();
378 			jContentPane.setLayout(new GridBagLayout());
379 			jContentPane.add(getAcopChart(), gridBagConstraints);
380 			jContentPane.add(getAcopDialKnob(), gridBagConstraints1);
381 			jContentPane.add(getAcopGauger(), gridBagConstraints2);
382 			jContentPane.add(getAcopLabel(), gridBagConstraints4);
383 			jContentPane.add(getAcopNumberLabel(), gridBagConstraints5);
384 			jContentPane.add(getAcopSlider(), gridBagConstraints6);
385 			jContentPane.add(getAcopTable(), gridBagConstraints7);
386 			jContentPane.add(getAcopWheelswitch(), gridBagConstraints8);
387 		}
388 		return jContentPane;
389 	}
390 
391 }  //  @jve:decl-index=0:visual-constraint="10,10"