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.chart.customizer;
24
25 import java.awt.GridBagConstraints;
26 import java.awt.GridBagLayout;
27 import java.awt.Insets;
28 import java.awt.LayoutManager;
29 import java.beans.Customizer;
30
31 import javax.swing.JLabel;
32 import javax.swing.JPanel;
33 import de.desy.acop.chart.Acop;
34 import de.desy.acop.chart.AcopAveragingMode;
35 import de.desy.acop.chart.AcopConst;
36 import de.desy.acop.chart.AcopDisplayMode;
37 import de.desy.acop.chart.AcopFFTEnum;
38
39 public class DisplayCustomizerPanel extends JPanel implements Customizer
40 {
41
42 public static final String[] DISPLAY_PROPERTIES = new String[]{
43 "displayMode", "invert", "FFT", "wrapAround", "tagging", "XExtent", "YExtent",
44 "colorFilled", "randomData", "averagingMode", "averagingDepth", "screenDepth",
45 "reuseScreen"
46 };
47 private Acop acopBean;
48 private JLabel displayLabel = null;
49 private JLabel modeLabel = null;
50 private AcopJComBox displayModeBox;
51 private JLabel fftLabel = null;
52 private AcopJComBox fftBox;
53 private AcopJRadioButton acopReverseY, Wraparound, Tagging, colorFill, randomData, reuseScreen;
54 private JLabel extendXLabel, extendYLabel;
55 private AcopJFormattedTextField extXText, extYText;
56 private JLabel averageLabel = null;
57 private JLabel averModeLabel = null;
58 private AcopJComBox averModeBox;
59 private JLabel averageDepthLabel;
60 private AcopJFormattedTextField averDepthText;
61 private JLabel screenLabel = null;
62 private JLabel screenDepthLabel;
63 private AcopJFormattedTextField screenDepthText;
64 public DisplayCustomizerPanel(LayoutManager layout, boolean isDoubleBuffered)
65 {
66 super(layout, isDoubleBuffered);
67
68 initialize();
69 }
70 public DisplayCustomizerPanel(LayoutManager layout)
71 {
72 super(layout);
73
74 initialize();
75 }
76 public DisplayCustomizerPanel(boolean isDoubleBuffered)
77 {
78 super(isDoubleBuffered);
79
80 initialize();
81 }
82 public DisplayCustomizerPanel()
83 {
84 super();
85
86 initialize();
87 }
88
89
90
91 public static void main(String[] args)
92 {
93
94 }
95
96
97
98
99
100 private void initialize()
101 {
102
103
104 int offX, offY;
105 GridBagConstraints gCon;
106 setLayout(new GridBagLayout());
107 if (displayLabel == null)
108 {
109 displayLabel = new JLabel("-- Display Parameters --");
110 }
111 if (modeLabel == null)
112 {
113 modeLabel = new JLabel("Mode:");
114 }
115 if (fftLabel == null)
116 {
117 fftLabel = new JLabel("FFT:");
118 }
119 if (extendXLabel == null)
120 {
121 extendXLabel = new JLabel("Extent-X:");
122 }
123 if (extendYLabel == null)
124 {
125 extendYLabel = new JLabel("Extent-Y:");
126 }
127 if (averageLabel == null)
128 {
129 averageLabel = new JLabel("-- Averagin Parameters --");
130 }
131 if (averModeLabel == null)
132 {
133 averModeLabel = new JLabel("AverMode:");
134 }
135 if (averageDepthLabel == null)
136 {
137 averageDepthLabel = new JLabel("AverDepth:");
138 }
139 if (screenLabel == null)
140 {
141 screenLabel = new JLabel("-- Screen Parameters --");
142 }
143 if (screenDepthLabel == null)
144 {
145 screenDepthLabel = new JLabel("#Screen Buffers:");
146 }
147 add(displayLabel, new GridBagConstraints(0, 0, 4, 1, 1.0, 1.0, GridBagConstraints.CENTER,
148 GridBagConstraints.CENTER, new Insets(4, 4, 4, 4), 0, 0));
149
150
151
152
153
154 add(modeLabel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.EAST,
155 GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 0, 0));
156 displayModeBox = new AcopJComBox("DisplayMode", AcopDisplayMode.values());
157 add(displayModeBox, new GridBagConstraints(1, 1, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER,
158 GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
159 add(fftLabel, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.EAST,
160 GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 0, 0));
161 fftBox = new AcopJComBox("FFT", AcopFFTEnum.values());
162 add(fftBox, new GridBagConstraints(1, 2, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER,
163 GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
164 gCon = new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
165 new Insets(4, 4, 4, 4), 0, 0);
166 acopReverseY = new AcopJRadioButton("1/y", "Invert", "invert");
167 add(acopReverseY, gCon);
168 gCon.gridx = 1;
169 Wraparound = new AcopJRadioButton("wrapAround", "WrapAround", "wrapAround");
170 add(Wraparound, gCon);
171 gCon.gridx = 2;
172 gCon.gridwidth = 1;
173 Tagging = new AcopJRadioButton("tagging", "Tagging", "tagging");
174 add(Tagging, gCon);
175 add(extendXLabel, new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0, GridBagConstraints.EAST,
176 GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 0, 0));
177 extXText = new AcopJFormattedTextField("1", "XExtent", double.class);
178 add(extXText, new GridBagConstraints(1, 4, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
179 GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
180 add(extendYLabel, new GridBagConstraints(2, 4, 1, 1, 1.0, 1.0, GridBagConstraints.EAST,
181 GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 0, 0));
182 extYText = new AcopJFormattedTextField("1", "YExtent", double.class);
183 add(extYText, new GridBagConstraints(3, 4, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
184 GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
185 gCon = new GridBagConstraints(1, 5, 1, 1, 1.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
186 new Insets(4, 4, 4, 4), 0, 0);
187 colorFill = new AcopJRadioButton("Color Fill", "ColorFilled", "colorFilled");
188 add(colorFill, gCon);
189 gCon.gridx = 3;
190 randomData = new AcopJRadioButton("Random Data", "RandomData", "randomData");
191 add(randomData, gCon);
192
193 offX = 4;
194 add(averageLabel, new GridBagConstraints(offX + 0, 0, 4, 1, 1.0, 1.0, GridBagConstraints.CENTER,
195 GridBagConstraints.CENTER, new Insets(4, 4, 4, 4), 0, 0));
196 add(averModeLabel, new GridBagConstraints(offX + 0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.EAST,
197 GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 0, 0));
198 averModeBox = new AcopJComBox("AveragingMode", AcopAveragingMode.values());
199 add(averModeBox, new GridBagConstraints(offX + 1, 1, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER,
200 GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
201 add(averageDepthLabel, new GridBagConstraints(offX + 0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.EAST,
202 GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 0, 0));
203 averDepthText = new AcopJFormattedTextField("1", "AveragingDepth", int.class, true, 0,
204 AcopConst.N_DEF_DISPLAY);
205 add(averDepthText, new GridBagConstraints(offX + 1, 2, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER,
206 GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
207 add(screenLabel, new GridBagConstraints(offX + 0, 3, 4, 1, 1.0, 1.0, GridBagConstraints.CENTER,
208 GridBagConstraints.CENTER, new Insets(4, 4, 4, 4), 0, 0));
209 add(screenDepthLabel, new GridBagConstraints(offX + 0, 4, 1, 1, 1.0, 1.0, GridBagConstraints.EAST,
210 GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 0, 0));
211 screenDepthText = new AcopJFormattedTextField("1", "ScreenDepth", int.class, true, 1,
212 AcopConst.MAX_DISPLAY);
213 add(screenDepthText, new GridBagConstraints(offX + 1, 4, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER,
214 GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
215 reuseScreen = new AcopJRadioButton("Reuse Screen", "ReuseScreen", "reuseScreen");
216 add(reuseScreen, new GridBagConstraints(offX + 0, 5, 3, 1, 1.0, 1.0, GridBagConstraints.EAST,
217 GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 0, 0));
218 this.setSize(478, 297);
219 }
220 public void setAcopBean(Acop acopBean)
221 {
222 this.acopBean = acopBean;
223 displayModeBox.setAcopBean(acopBean);
224 fftBox.setAcopBean(acopBean);
225 acopReverseY.setAcopBean(acopBean);
226 Wraparound.setAcopBean(acopBean);
227 Tagging.setAcopBean(acopBean);
228 extXText.setAcopBean(acopBean);
229 extYText.setAcopBean(acopBean);
230 colorFill.setAcopBean(acopBean);
231 randomData.setAcopBean(acopBean);
232 averModeBox.setAcopBean(acopBean);
233 averDepthText.setAcopBean(acopBean);
234 screenDepthText.setAcopBean(acopBean);
235 reuseScreen.setAcopBean(acopBean);
236 }
237 public void setObject(Object bean) {
238 setAcopBean((Acop)bean);
239
240 }
241 }