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.AcopHistogramPositionEnum;
35 import de.desy.acop.chart.AcopLeadingEdgeMotionEnum;
36 import de.desy.acop.chart.AcopZoomingStyleEnum;
37
38 public class SpecialCustomizerPanel extends JPanel implements Customizer
39 {
40 public static final String[] SPECIAL_PROPERTIES = {
41 "leadingEdgeGapSize","leadingEdgeMode", "histogramPosition", "zooming"
42 };
43 private Acop acopBean;
44 private JLabel zoomingParametersLabel = null;
45 private JLabel zoomingStyleLabel = null;
46 private AcopJComBox zoomingStyleBox;
47 private JLabel histogramParametersLabel = null;
48 private JLabel positionLabel = null;
49 private AcopJComBox positionBox;
50
51 private JLabel leadingEdgeLabel = null;
52 private JLabel motionLabel = null;
53 private AcopJComBox motionBox;
54 private JLabel gapSizeLabel = null;
55 private AcopJFormattedTextField gapSizeText;
56
57 public SpecialCustomizerPanel(LayoutManager layout, boolean isDoubleBuffered)
58 {
59 super(layout, isDoubleBuffered);
60
61 initialize();
62 }
63 public SpecialCustomizerPanel(LayoutManager layout)
64 {
65 super(layout);
66
67 initialize();
68 }
69 public SpecialCustomizerPanel(boolean isDoubleBuffered)
70 {
71 super(isDoubleBuffered);
72
73 initialize();
74 }
75 public SpecialCustomizerPanel()
76 {
77 super();
78
79 initialize();
80 }
81
82
83
84 public static void main(String[] args)
85 {
86
87 }
88
89
90
91
92
93 private void initialize()
94 {
95 GridBagConstraints gCon;
96 setLayout(new GridBagLayout());
97 if (zoomingParametersLabel == null)
98 {
99 zoomingParametersLabel = new JLabel("-- Zooming Parameters --");
100 }
101 if (zoomingStyleLabel == null)
102 {
103 zoomingStyleLabel = new JLabel("Style:");
104 }
105 if (histogramParametersLabel == null)
106 {
107 histogramParametersLabel = new JLabel("-- Histogram Parameters --");
108 }
109 if (positionLabel == null)
110 {
111 positionLabel = new JLabel("Position:");
112 }
113
114 if (leadingEdgeLabel == null)
115 {
116 leadingEdgeLabel = new JLabel("-- Leading Edge --");
117 }
118 if (motionLabel == null)
119 {
120 motionLabel = new JLabel("Motion:");
121 }
122 if (gapSizeLabel == null)
123 {
124 gapSizeLabel = new JLabel("Gap Size:");
125 }
126
127 add(zoomingParametersLabel, new GridBagConstraints(0, 0, 4, 1, 1.0, 1.0, GridBagConstraints.CENTER,
128 GridBagConstraints.CENTER, new Insets(4, 4, 4, 4), 0, 0));
129 add(zoomingStyleLabel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.EAST,
130 GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 0, 0));
131 zoomingStyleBox = new AcopJComBox("Zooming", AcopZoomingStyleEnum.values());
132 add(zoomingStyleBox, new GridBagConstraints(1, 1, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER,
133 GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
134
135 add(histogramParametersLabel, new GridBagConstraints(0, 3, 4, 1, 1.0, 1.0, GridBagConstraints.CENTER,
136 GridBagConstraints.CENTER, new Insets(4, 4, 4, 4), 0, 0));
137 add(positionLabel, new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0, GridBagConstraints.EAST,
138 GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 0, 0));
139 positionBox = new AcopJComBox("HistogramPosition", AcopHistogramPositionEnum.values());
140 add(positionBox, new GridBagConstraints(1, 4, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER,
141 GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
142
143
144 add(leadingEdgeLabel, new GridBagConstraints(4, 0, 4, 1, 1.0, 1.0, GridBagConstraints.CENTER,
145 GridBagConstraints.CENTER, new Insets(4, 4, 4, 4), 0, 0));
146 add(motionLabel, new GridBagConstraints(4, 1, 1, 1, 1.0, 1.0, GridBagConstraints.EAST,
147 GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 0, 0));
148 motionBox = new AcopJComBox("LeadingEdgeMode", AcopLeadingEdgeMotionEnum.values());
149 add(motionBox, new GridBagConstraints(5, 1, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER,
150 GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
151
152 add(gapSizeLabel, new GridBagConstraints(4, 2, 1, 1, 1.0, 1.0, GridBagConstraints.EAST,
153 GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 0, 0));
154 gapSizeText = new AcopJFormattedTextField("1", "LeadingEdgeGapSize", int.class);
155 add(gapSizeText, new GridBagConstraints(5, 2, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER,
156 GridBagConstraints.HORIZONTAL, new Insets(4, 4, 4, 4), 0, 0));
157
158 this.setSize(300, 200);
159 }
160 public void setAcopBean(Acop acopBean)
161 {
162 this.acopBean = acopBean;
163 zoomingStyleBox.setAcopBean(acopBean);
164 positionBox.setAcopBean(acopBean);
165 motionBox.setAcopBean(acopBean);
166 gapSizeText.setAcopBean(acopBean);
167 }
168
169 public void setObject(Object bean) {
170 setAcopBean((Acop)bean);
171
172 }
173 }