source: osm/applications/editors/josm/plugins/smed1/src/panels/PanelLights.java@ 29036

Last change on this file since 29036 was 29036, checked in by malcolmh, 13 years ago

initial

File size: 23.8 KB
Line 
1package panels;
2
3import java.awt.event.*;
4import java.awt.*;
5
6import javax.swing.*;
7
8import java.util.*;
9
10import oseam.Messages;
11import oseam.OSeaMAction;
12import seamarks.SeaMark.*;
13
14public class PanelLights extends JPanel {
15
16 private OSeaMAction dlg;
17
18 public JLabel categoryLabel;
19
20 public JComboBox landCatBox;
21 public EnumMap<Cat, Integer> landCats = new EnumMap<Cat, Integer>(Cat.class);
22 private ActionListener alLandCatBox = new ActionListener() {
23 public void actionPerformed(java.awt.event.ActionEvent e) {
24 for (Cat cat : landCats.keySet()) {
25 int idx = landCats.get(cat);
26 if (dlg.node != null && (idx == landCatBox.getSelectedIndex())) {
27 dlg.panelMain.mark.setCategory(cat);
28 dlg.panelMain.mark.testValid();
29 }
30 }
31 }
32 };
33 public JComboBox trafficCatBox;
34 public EnumMap<Cat, Integer> trafficCats = new EnumMap<Cat, Integer>(Cat.class);
35 private ActionListener alTrafficCatBox = new ActionListener() {
36 public void actionPerformed(java.awt.event.ActionEvent e) {
37 for (Cat cat : trafficCats.keySet()) {
38 int idx = trafficCats.get(cat);
39 if (dlg.node != null && (idx == trafficCatBox.getSelectedIndex())) {
40 dlg.panelMain.mark.setCategory(cat);
41 dlg.panelMain.mark.testValid();
42 }
43 }
44 }
45 };
46 public JComboBox warningCatBox;
47 public EnumMap<Cat, Integer> warningCats = new EnumMap<Cat, Integer>(Cat.class);
48 private ActionListener alWarningCatBox = new ActionListener() {
49 public void actionPerformed(java.awt.event.ActionEvent e) {
50 for (Cat cat : warningCats.keySet()) {
51 int idx = warningCats.get(cat);
52 if (dlg.node != null && (idx == warningCatBox.getSelectedIndex())) {
53 dlg.panelMain.mark.setCategory(cat);
54 dlg.panelMain.mark.testValid();
55 }
56 }
57 }
58 };
59 public JComboBox platformCatBox;
60 public EnumMap<Cat, Integer> platformCats = new EnumMap<Cat, Integer>(Cat.class);
61 private ActionListener alPlatformCatBox = new ActionListener() {
62 public void actionPerformed(java.awt.event.ActionEvent e) {
63 for (Cat cat : platformCats.keySet()) {
64 int idx = platformCats.get(cat);
65 if (dlg.node != null && (idx == platformCatBox.getSelectedIndex())) {
66 dlg.panelMain.mark.setCategory(cat);
67 dlg.panelMain.mark.testValid();
68 }
69 }
70 }
71 };
72 public JComboBox pilotCatBox;
73 public EnumMap<Cat, Integer> pilotCats = new EnumMap<Cat, Integer>(Cat.class);
74 private ActionListener alPilotCatBox = new ActionListener() {
75 public void actionPerformed(java.awt.event.ActionEvent e) {
76 for (Cat cat : pilotCats.keySet()) {
77 int idx = pilotCats.get(cat);
78 if (dlg.node != null && (idx == pilotCatBox.getSelectedIndex())) {
79 dlg.panelMain.mark.setCategory(cat);
80 dlg.panelMain.mark.testValid();
81 }
82 }
83 }
84 };
85 public JComboBox rescueCatBox;
86 public EnumMap<Cat, Integer> rescueCats = new EnumMap<Cat, Integer>(Cat.class);
87 private ActionListener alRescueCatBox = new ActionListener() {
88 public void actionPerformed(java.awt.event.ActionEvent e) {
89 for (Cat cat : rescueCats.keySet()) {
90 int idx = rescueCats.get(cat);
91 if (dlg.node != null && (idx == rescueCatBox.getSelectedIndex())) {
92 dlg.panelMain.mark.setCategory(cat);
93 dlg.panelMain.mark.testValid();
94 }
95 }
96 }
97 };
98 public JComboBox radioCatBox;
99 public EnumMap<Cat, Integer> radioCats = new EnumMap<Cat, Integer>(Cat.class);
100 private ActionListener alRadioCatBox = new ActionListener() {
101 public void actionPerformed(java.awt.event.ActionEvent e) {
102 for (Cat cat : radioCats.keySet()) {
103 int idx = radioCats.get(cat);
104 if (dlg.node != null && (idx == radioCatBox.getSelectedIndex())) {
105 dlg.panelMain.mark.setCategory(cat);
106 dlg.panelMain.mark.testValid();
107 }
108 }
109 }
110 };
111 public JComboBox radarCatBox;
112 public EnumMap<Cat, Integer> radarCats = new EnumMap<Cat, Integer>(Cat.class);
113 private ActionListener alRadarCatBox = new ActionListener() {
114 public void actionPerformed(java.awt.event.ActionEvent e) {
115 for (Cat cat : radarCats.keySet()) {
116 int idx = radarCats.get(cat);
117 if (dlg.node != null && (idx == radarCatBox.getSelectedIndex())) {
118 dlg.panelMain.mark.setCategory(cat);
119 dlg.panelMain.mark.testValid();
120 }
121 }
122 }
123 };
124 public JLabel functionLabel;
125 public JComboBox functionBox;
126 public EnumMap<Fnc, Integer> functions = new EnumMap<Fnc, Integer>(Fnc.class);
127 private ActionListener alfunctionBox = new ActionListener() {
128 public void actionPerformed(java.awt.event.ActionEvent e) {
129 for (Fnc fnc : functions.keySet()) {
130 int idx = functions.get(fnc);
131 if (dlg.node != null && (idx == functionBox.getSelectedIndex())) {
132 dlg.panelMain.mark.setFunc(fnc);
133 dlg.panelMain.mark.testValid();
134 }
135 }
136 }
137 };
138 private ButtonGroup objButtons = new ButtonGroup();
139 public JRadioButton houseButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LighthouseButton.png")));
140 public JRadioButton majorButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightMajorButton.png")));
141 public JRadioButton minorButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightMinorButton.png")));
142 public JRadioButton vesselButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightVesselButton.png")));
143 public JRadioButton floatButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LightFloatButton.png")));
144 public JRadioButton landButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/LandmarkButton.png")));
145 public JRadioButton trafficButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/TrafficButton.png")));
146 public JRadioButton warningButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/WarningButton.png")));
147 public JRadioButton platformButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/PlatformButton.png")));
148 public JRadioButton coastguardButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/CoastguardButton.png")));
149 public JRadioButton pilotButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/PilotButton.png")));
150 public JRadioButton rescueButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/RescueButton.png")));
151 public JRadioButton radioButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/RadioStationButton.png")));
152 public JRadioButton radarButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/RadarStationButton.png")));
153 public EnumMap<Obj, JRadioButton> objects = new EnumMap<Obj, JRadioButton>(Obj.class);
154 private ActionListener alObj = new ActionListener() {
155 public void actionPerformed(java.awt.event.ActionEvent e) {
156 for (Obj obj : objects.keySet()) {
157 JRadioButton button = objects.get(obj);
158 if (button.isSelected()) {
159 dlg.panelMain.mark.setObject(obj);
160 button.setBorderPainted(true);
161 } else
162 button.setBorderPainted(false);
163 }
164 if (dlg.panelMain.mark.getObject() == Obj.LITVES)
165 dlg.panelMain.mark.setShape(Shp.SUPER);
166 else if (dlg.panelMain.mark.getObject() == Obj.LITFLT)
167 dlg.panelMain.mark.setShape(Shp.FLOAT);
168 else dlg.panelMain.mark.setShape(Shp.UNKSHP);
169 functionLabel.setVisible(false);
170 categoryLabel.setVisible(false);
171 functionLabel.setVisible(false);
172 functionBox.setVisible(false);
173 landCatBox.setVisible(false);
174 trafficCatBox.setVisible(false);
175 warningCatBox.setVisible(false);
176 platformCatBox.setVisible(false);
177 pilotCatBox.setVisible(false);
178 rescueCatBox.setVisible(false);
179 radioCatBox.setVisible(false);
180 radarCatBox.setVisible(false);
181 chLabel.setVisible(false);
182 chBox.setVisible(false);
183 dlg.panelMain.mark.setCategory(Cat.NOCAT);
184 if (landButton.isSelected()) {
185 functionLabel.setVisible(true);
186 categoryLabel.setVisible(true);
187 functionBox.setVisible(true);
188 landCatBox.setVisible(true);
189 alLandCatBox.actionPerformed(null);
190 } else if (trafficButton.isSelected()) {
191 categoryLabel.setVisible(true);
192 trafficCatBox.setVisible(true);
193 chLabel.setVisible(true);
194 chBox.setVisible(true);
195 alTrafficCatBox.actionPerformed(null);
196 } else if (warningButton.isSelected()) {
197 categoryLabel.setVisible(true);
198 warningCatBox.setVisible(true);
199 chLabel.setVisible(true);
200 chBox.setVisible(true);
201 alWarningCatBox.actionPerformed(null);
202 } else if (platformButton.isSelected()) {
203 categoryLabel.setVisible(true);
204 platformCatBox.setVisible(true);
205 alPlatformCatBox.actionPerformed(null);
206 } else if (pilotButton.isSelected()) {
207 categoryLabel.setVisible(true);
208 pilotCatBox.setVisible(true);
209 chLabel.setVisible(true);
210 chBox.setVisible(true);
211 alPilotCatBox.actionPerformed(null);
212 } else if (rescueButton.isSelected()) {
213 categoryLabel.setVisible(true);
214 rescueCatBox.setVisible(true);
215 alRescueCatBox.actionPerformed(null);
216 } else if (radioButton.isSelected()) {
217 categoryLabel.setVisible(true);
218 radioCatBox.setVisible(true);
219 chLabel.setVisible(true);
220 chBox.setVisible(true);
221 alRadioCatBox.actionPerformed(null);
222 } else if (radarButton.isSelected()) {
223 categoryLabel.setVisible(true);
224 radarCatBox.setVisible(true);
225 chLabel.setVisible(true);
226 chBox.setVisible(true);
227 alRadarCatBox.actionPerformed(null);
228 }
229 dlg.panelMain.mark.testValid();
230 }
231 };
232 public JLabel chLabel;
233 public JTextField chBox;
234 private FocusListener flCh = new FocusAdapter() {
235 public void focusLost(java.awt.event.FocusEvent e) {
236 dlg.panelMain.mark.setChannel(chBox.getText());
237 }
238 };
239
240 public PanelLights(OSeaMAction dia) {
241 dlg = dia;
242 setLayout(null);
243 add(getObjButton(houseButton, 0, 0, 34, 32, "Lighthouse", Obj.LITHSE));
244 add(getObjButton(majorButton, 34, 0, 34, 32, "MajorLight", Obj.LITMAJ));
245 add(getObjButton(minorButton, 68, 0, 34, 32, "MinorLight", Obj.LITMIN));
246 add(getObjButton(landButton, 102, 0, 34, 32, "Landmark", Obj.LNDMRK));
247 add(getObjButton(platformButton, 136, 0, 34, 32, "Platform", Obj.OFSPLF));
248 add(getObjButton(vesselButton, 0, 32, 34, 32, "LightVessel", Obj.LITVES));
249 add(getObjButton(floatButton, 34, 32, 34, 32, "LightFloat", Obj.LITFLT));
250 add(getObjButton(trafficButton, 68, 32, 34, 32, "SSTraffic", Obj.SISTAT));
251 add(getObjButton(warningButton, 102, 32, 34, 32, "SSWarning", Obj.SISTAW));
252 add(getObjButton(coastguardButton, 0, 64, 34, 32, "CoastguardStation", Obj.CGUSTA));
253 add(getObjButton(pilotButton, 34, 64, 34, 32, "PilotBoarding", Obj.PILBOP));
254 add(getObjButton(rescueButton, 68, 64, 34, 32, "RescueStation", Obj.RSCSTA));
255 add(getObjButton(radioButton, 102, 64, 34, 32, "RadioStation", Obj.RDOSTA));
256 add(getObjButton(radarButton, 136, 64, 34, 32, "RadarStation", Obj.RADSTA));
257
258 functionLabel = new JLabel(Messages.getString("Function"), SwingConstants.CENTER);
259 functionLabel.setBounds(new Rectangle(5, 94, 160, 18));
260 add(functionLabel);
261 functionLabel.setVisible(false);
262
263 functionBox = new JComboBox();
264 functionBox.setBounds(new Rectangle(5, 110, 160, 18));
265 add(functionBox);
266 functionBox.addActionListener(alfunctionBox);
267 addLFItem("", Fnc.UNKFNC);
268 addLFItem(Messages.getString("Church"), Fnc.CHCH);
269 addLFItem(Messages.getString("Chapel"), Fnc.CHPL);
270 addLFItem(Messages.getString("Temple"), Fnc.TMPL);
271 addLFItem(Messages.getString("Pagoda"), Fnc.PGDA);
272 addLFItem(Messages.getString("ShintoShrine"), Fnc.SHSH);
273 addLFItem(Messages.getString("BuddhistTemple"), Fnc.BTMP);
274 addLFItem(Messages.getString("Mosque"), Fnc.MOSQ);
275 addLFItem(Messages.getString("Marabout"), Fnc.MRBT);
276 functionBox.setVisible(false);
277
278 categoryLabel = new JLabel(Messages.getString("Category"), SwingConstants.CENTER);
279 categoryLabel.setBounds(new Rectangle(5, 125, 160, 18));
280 add(categoryLabel);
281 categoryLabel.setVisible(false);
282
283 landCatBox = new JComboBox();
284 landCatBox.setBounds(new Rectangle(5, 142, 160, 18));
285 add(landCatBox);
286 landCatBox.addActionListener(alLandCatBox);
287 addLCItem("", Cat.NOCAT);
288 addLCItem(Messages.getString("Tower"), Cat.LMK_TOWR);
289 addLCItem(Messages.getString("WaterTower"), Cat.LMK_WTRT);
290 addLCItem(Messages.getString("Chimney"), Cat.LMK_CHMY);
291 addLCItem(Messages.getString("Mast"), Cat.LMK_MAST);
292 addLCItem(Messages.getString("Column"), Cat.LMK_CLMN);
293 addLCItem(Messages.getString("DishAerial"), Cat.LMK_DSHA);
294 addLCItem(Messages.getString("Flagstaff"), Cat.LMK_FLGS);
295 addLCItem(Messages.getString("FlareStack"), Cat.LMK_FLRS);
296 addLCItem(Messages.getString("Monument"), Cat.LMK_MNMT);
297 addLCItem(Messages.getString("WindMotor"), Cat.LMK_WNDM);
298 addLCItem(Messages.getString("WindSock"), Cat.LMK_WNDS);
299 addLCItem(Messages.getString("Obelisk"), Cat.LMK_OBLK);
300 addLCItem(Messages.getString("Statue"), Cat.LMK_STAT);
301 addLCItem(Messages.getString("Cross"), Cat.LMK_CROS);
302 addLCItem(Messages.getString("Dome"), Cat.LMK_DOME);
303 addLCItem(Messages.getString("RadarScanner"), Cat.LMK_SCNR);
304 addLCItem(Messages.getString("Windmill"), Cat.LMK_WNDL);
305 addLCItem(Messages.getString("Spire"), Cat.LMK_SPIR);
306 addLCItem(Messages.getString("Minaret"), Cat.LMK_MNRT);
307 addLCItem(Messages.getString("Cairn"), Cat.LMK_CARN);
308 landCatBox.setVisible(false);
309
310 trafficCatBox = new JComboBox();
311 trafficCatBox.setBounds(new Rectangle(5, 140, 160, 20));
312 add(trafficCatBox);
313 trafficCatBox.addActionListener(alTrafficCatBox);
314 addTCItem("", Cat.NOCAT);
315 addTCItem(Messages.getString("Traffic"), Cat.SIS_TRFC);
316 addTCItem(Messages.getString("PortControl"), Cat.SIS_PTCL);
317 addTCItem(Messages.getString("PortEntry"), Cat.SIS_PTED);
318 addTCItem(Messages.getString("IPT"), Cat.SIS_IPT);
319 addTCItem(Messages.getString("Berthing"), Cat.SIS_BRTH);
320 addTCItem(Messages.getString("Dock"), Cat.SIS_DOCK);
321 addTCItem(Messages.getString("Lock"), Cat.SIS_LOCK);
322 addTCItem(Messages.getString("Barrage"), Cat.SIS_FBAR);
323 addTCItem(Messages.getString("Bridge"), Cat.SIS_BRDG);
324 addTCItem(Messages.getString("Dredging"), Cat.SIS_DRDG);
325 trafficCatBox.setVisible(false);
326
327 warningCatBox = new JComboBox();
328 warningCatBox.setBounds(new Rectangle(5, 140, 160, 20));
329 add(warningCatBox);
330 warningCatBox.addActionListener(alWarningCatBox);
331 addWCItem("", Cat.NOCAT);
332 addWCItem(Messages.getString("Danger"), Cat.SIS_DNGR);
333 addWCItem(Messages.getString("Storm"), Cat.SIS_STRM);
334 addWCItem(Messages.getString("Weather"), Cat.SIS_WTHR);
335 addWCItem(Messages.getString("Obstruction"), Cat.SIS_OBST);
336 addWCItem(Messages.getString("Cable"), Cat.SIS_CABL);
337 addWCItem(Messages.getString("Distress"), Cat.SIS_DSTR);
338 addWCItem(Messages.getString("Time"), Cat.SIS_TIME);
339 addWCItem(Messages.getString("Tide"), Cat.SIS_TIDE);
340 addWCItem(Messages.getString("TidalStream"), Cat.SIS_TSTM);
341 addWCItem(Messages.getString("TideGauge"), Cat.SIS_TGAG);
342 addWCItem(Messages.getString("TideScale"), Cat.SIS_TSCL);
343 addWCItem(Messages.getString("Diving"), Cat.SIS_DIVE);
344 addWCItem(Messages.getString("Ice"), Cat.SIS_ICE);
345 addWCItem(Messages.getString("LevelGauge"), Cat.SIS_LGAG);
346 addWCItem(Messages.getString("Military"), Cat.SIS_MILY);
347 warningCatBox.setVisible(false);
348
349 platformCatBox = new JComboBox();
350 platformCatBox.setBounds(new Rectangle(5, 140, 160, 20));
351 add(platformCatBox);
352 platformCatBox.addActionListener(alPlatformCatBox);
353 addPLItem("", Cat.NOCAT);
354 addPLItem(Messages.getString("Oil"), Cat.OFP_OIL);
355 addPLItem(Messages.getString("Production"), Cat.OFP_PRD);
356 addPLItem(Messages.getString("Observation"), Cat.OFP_OBS);
357 addPLItem(Messages.getString("ALP"), Cat.OFP_ALP);
358 addPLItem(Messages.getString("SALM"), Cat.OFP_SALM);
359 addPLItem(Messages.getString("MooringTower"), Cat.OFP_MOR);
360 addPLItem(Messages.getString("ArtificialIsland"), Cat.OFP_ISL);
361 addPLItem(Messages.getString("FPSO"), Cat.OFP_FPSO);
362 addPLItem(Messages.getString("Accommodation"), Cat.OFP_ACC);
363 addPLItem(Messages.getString("NCCB"), Cat.OFP_NCCB);
364 platformCatBox.setVisible(false);
365
366 pilotCatBox = new JComboBox();
367 pilotCatBox.setBounds(new Rectangle(5, 140, 160, 20));
368 add(pilotCatBox);
369 pilotCatBox.addActionListener(alPilotCatBox);
370 addPTItem("", Cat.NOCAT);
371 addPTItem(Messages.getString("CruisingVessel"), Cat.PIL_VESS);
372 addPTItem(Messages.getString("Helicopter"), Cat.PIL_HELI);
373 addPTItem(Messages.getString("FromShore"), Cat.PIL_SHORE);
374 pilotCatBox.setVisible(false);
375
376 rescueCatBox = new JComboBox();
377 rescueCatBox.setBounds(new Rectangle(5, 140, 160, 20));
378 add(rescueCatBox);
379 rescueCatBox.addActionListener(alRescueCatBox);
380 addRSItem("", Cat.NOCAT);
381 addRSItem(Messages.getString("Lifeboat"), Cat.RSC_LFB);
382 addRSItem(Messages.getString("Rocket"), Cat.RSC_RKT);
383 addRSItem(Messages.getString("ShipwreckedRefuge"), Cat.RSC_RSW);
384 addRSItem(Messages.getString("IntertidalRefuge"), Cat.RSC_RIT);
385 addRSItem(Messages.getString("MooredLifeboat"), Cat.RSC_MLB);
386 addRSItem(Messages.getString("Radio"), Cat.RSC_RAD);
387 addRSItem(Messages.getString("FirstAid"), Cat.RSC_FAE);
388 addRSItem(Messages.getString("Seaplane"), Cat.RSC_SPL);
389 addRSItem(Messages.getString("Aircraft"), Cat.RSC_AIR);
390 addRSItem(Messages.getString("Tug"), Cat.RSC_TUG);
391 rescueCatBox.setVisible(false);
392
393 radioCatBox = new JComboBox();
394 radioCatBox.setBounds(new Rectangle(5, 140, 160, 20));
395 add(radioCatBox);
396 radioCatBox.addActionListener(alRadioCatBox);
397 addROItem("", Cat.NOCAT);
398 addROItem(Messages.getString("CircularBeacon"), Cat.ROS_BNO);
399 addROItem(Messages.getString("DirectionalBeacon"), Cat.ROS_BND);
400 addROItem(Messages.getString("RotatingBeacon"), Cat.ROS_BNR);
401 addROItem(Messages.getString("ConsolBeacon"), Cat.ROS_BNC);
402 addROItem(Messages.getString("DirectionFinding"), Cat.ROS_RDF);
403 addROItem(Messages.getString("QTGService"), Cat.ROS_QTG);
404 addROItem(Messages.getString("AeronaticalBeacon"), Cat.ROS_AER);
405 addROItem(Messages.getString("Decca"), Cat.ROS_DCA);
406 addROItem(Messages.getString("LoranC"), Cat.ROS_LRN);
407 addROItem(Messages.getString("DGPS"), Cat.ROS_DGPS);
408 addROItem(Messages.getString("Toran"), Cat.ROS_TRN);
409 addROItem(Messages.getString("Omega"), Cat.ROS_OMA);
410 addROItem(Messages.getString("Syledis"), Cat.ROS_SDS);
411 addROItem(Messages.getString("Chiaka"), Cat.ROS_CKA);
412 addROItem(Messages.getString("PublicCommunication"), Cat.ROS_PUB);
413 addROItem(Messages.getString("CommercialBroadcast"), Cat.ROS_COM);
414 addROItem(Messages.getString("Facsimile"), Cat.ROS_FAX);
415 addROItem(Messages.getString("TimeSignal"), Cat.ROS_TIM);
416 radioCatBox.setVisible(false);
417
418 radarCatBox = new JComboBox();
419 radarCatBox.setBounds(new Rectangle(5, 140, 160, 20));
420 add(radarCatBox);
421 radarCatBox.addActionListener(alRadarCatBox);
422 addRAItem("", Cat.NOCAT);
423 addRAItem(Messages.getString("Surveillance"), Cat.RAS_SRV);
424 addRAItem(Messages.getString("CoastRadar"), Cat.RAS_CST);
425 radarCatBox.setVisible(false);
426
427 chLabel = new JLabel("Ch:", SwingConstants.CENTER);
428 chLabel.setBounds(new Rectangle(140, 32, 30, 15));
429 add(chLabel);
430 chBox = new JTextField();
431 chBox.setBounds(new Rectangle(140, 45, 30, 20));
432 chBox.setHorizontalAlignment(SwingConstants.CENTER);
433 add(chBox);
434 chBox.addFocusListener(flCh);
435 }
436
437 public void syncPanel() {
438 functionLabel.setVisible(false);
439 functionBox.setVisible(false);
440 categoryLabel.setVisible(false);
441 landCatBox.setVisible(false);
442 trafficCatBox.setVisible(false);
443 warningCatBox.setVisible(false);
444 platformCatBox.setVisible(false);
445 pilotCatBox.setVisible(false);
446 rescueCatBox.setVisible(false);
447 radioCatBox.setVisible(false);
448 radarCatBox.setVisible(false);
449 chLabel.setVisible(false);
450 chBox.setVisible(false);
451 chBox.setText(dlg.panelMain.mark.getChannel());
452 if ((dlg.panelMain.mark.getObject() == Obj.LNDMRK) && ((dlg.panelMain.mark.getCategory() != Cat.NOCAT) || (dlg.panelMain.mark.getFunc() != Fnc.UNKFNC))) {
453 functionLabel.setVisible(true);
454 categoryLabel.setVisible(true);
455 functionBox.setVisible(true);
456 landCatBox.setVisible(true);
457 for (Fnc fnc : functions.keySet()) {
458 int item = functions.get(fnc);
459 if (dlg.panelMain.mark.getFunc() == fnc)
460 functionBox.setSelectedIndex(item);
461 }
462 for (Cat cat : landCats.keySet()) {
463 int item = landCats.get(cat);
464 if (dlg.panelMain.mark.getCategory() == cat)
465 landCatBox.setSelectedIndex(item);
466 }
467 } else if (dlg.panelMain.mark.getObject() == Obj.SISTAT) {
468 categoryLabel.setVisible(true);
469 trafficCatBox.setVisible(true);
470 for (Cat cat : trafficCats.keySet()) {
471 int item = trafficCats.get(cat);
472 if (dlg.panelMain.mark.getCategory() == cat)
473 trafficCatBox.setSelectedIndex(item);
474 }
475 chLabel.setVisible(true);
476 chBox.setVisible(true);
477 } else if (dlg.panelMain.mark.getObject() == Obj.SISTAW) {
478 categoryLabel.setVisible(true);
479 warningCatBox.setVisible(true);
480 for (Cat cat : warningCats.keySet()) {
481 int item = warningCats.get(cat);
482 if (dlg.panelMain.mark.getCategory() == cat)
483 warningCatBox.setSelectedIndex(item);
484 }
485 chLabel.setVisible(true);
486 chBox.setVisible(true);
487 } else if (dlg.panelMain.mark.getObject() == Obj.OFSPLF) {
488 categoryLabel.setVisible(true);
489 platformCatBox.setVisible(true);
490 for (Cat cat : platformCats.keySet()) {
491 int item = platformCats.get(cat);
492 if (dlg.panelMain.mark.getCategory() == cat)
493 platformCatBox.setSelectedIndex(item);
494 }
495 } else if (dlg.panelMain.mark.getObject() == Obj.PILBOP) {
496 categoryLabel.setVisible(true);
497 pilotCatBox.setVisible(true);
498 for (Cat cat : pilotCats.keySet()) {
499 int item = pilotCats.get(cat);
500 if (dlg.panelMain.mark.getCategory() == cat)
501 pilotCatBox.setSelectedIndex(item);
502 }
503 chLabel.setVisible(true);
504 chBox.setVisible(true);
505 } else if (dlg.panelMain.mark.getObject() == Obj.RSCSTA) {
506 categoryLabel.setVisible(true);
507 rescueCatBox.setVisible(true);
508 for (Cat cat : rescueCats.keySet()) {
509 int item = rescueCats.get(cat);
510 if (dlg.panelMain.mark.getCategory() == cat)
511 rescueCatBox.setSelectedIndex(item);
512 }
513 } else if (dlg.panelMain.mark.getObject() == Obj.RDOSTA) {
514 categoryLabel.setVisible(true);
515 radioCatBox.setVisible(true);
516 for (Cat cat : radioCats.keySet()) {
517 int item = radioCats.get(cat);
518 if (dlg.panelMain.mark.getCategory() == cat)
519 radioCatBox.setSelectedIndex(item);
520 }
521 chLabel.setVisible(true);
522 chBox.setVisible(true);
523 } else if (dlg.panelMain.mark.getObject() == Obj.RADSTA) {
524 categoryLabel.setVisible(true);
525 radarCatBox.setVisible(true);
526 for (Cat cat : radarCats.keySet()) {
527 int item = radarCats.get(cat);
528 if (dlg.panelMain.mark.getCategory() == cat)
529 radarCatBox.setSelectedIndex(item);
530 }
531 chLabel.setVisible(true);
532 chBox.setVisible(true);
533 }
534 for (Obj obj : objects.keySet()) {
535 JRadioButton button = objects.get(obj);
536 button.setBorderPainted(dlg.panelMain.mark.getObject() == obj);
537 }
538 dlg.panelMain.mark.testValid();
539 }
540
541 private void addLCItem(String str, Cat cat) {
542 landCats.put(cat, landCatBox.getItemCount());
543 landCatBox.addItem(str);
544 }
545
546 private void addTCItem(String str, Cat cat) {
547 trafficCats.put(cat, trafficCatBox.getItemCount());
548 trafficCatBox.addItem(str);
549 }
550
551 private void addWCItem(String str, Cat cat) {
552 warningCats.put(cat, warningCatBox.getItemCount());
553 warningCatBox.addItem(str);
554 }
555
556 private void addPLItem(String str, Cat cat) {
557 platformCats.put(cat, platformCatBox.getItemCount());
558 platformCatBox.addItem(str);
559 }
560
561 private void addPTItem(String str, Cat cat) {
562 pilotCats.put(cat, pilotCatBox.getItemCount());
563 pilotCatBox.addItem(str);
564 }
565
566 private void addRSItem(String str, Cat cat) {
567 rescueCats.put(cat, rescueCatBox.getItemCount());
568 rescueCatBox.addItem(str);
569 }
570
571 private void addROItem(String str, Cat cat) {
572 radioCats.put(cat, radioCatBox.getItemCount());
573 radioCatBox.addItem(str);
574 }
575
576 private void addRAItem(String str, Cat cat) {
577 radarCats.put(cat, radarCatBox.getItemCount());
578 radarCatBox.addItem(str);
579 }
580
581 private void addLFItem(String str, Fnc fnc) {
582 functions.put(fnc, functionBox.getItemCount());
583 functionBox.addItem(str);
584 }
585
586 private JRadioButton getObjButton(JRadioButton button, int x, int y, int w, int h, String tip, Obj obj) {
587 button.setBounds(new Rectangle(x, y, w, h));
588 button.setBorder(BorderFactory.createLoweredBevelBorder());
589 button.setToolTipText(Messages.getString(tip));
590 button.addActionListener(alObj);
591 objButtons.add(button);
592 objects.put(obj, button);
593 return button;
594 }
595
596}
Note: See TracBrowser for help on using the repository browser.