source: osm/applications/editors/josm/plugins/smed/src/panels/PanelLights.java@ 29894

Last change on this file since 29894 was 29894, checked in by malcolmh, 11 years ago

clean

File size: 24.5 KB
Line 
1package panels;
2
3import java.awt.event.*;
4import java.awt.*;
5
6import javax.swing.*;
7
8import java.util.*;
9
10import messages.Messages;
11import smed.SmedAction;
12import seamarks.SeaMark.*;
13
14public class PanelLights extends JPanel {
15
16 private SmedAction 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(SmedAction 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_OMNI);
399 addROItem(Messages.getString("DirectionalBeacon"), Cat.ROS_DIRL);
400 addROItem(Messages.getString("RotatingBeacon"), Cat.ROS_ROTP);
401 addROItem(Messages.getString("ConsolBeacon"), Cat.ROS_CNSL);
402 addROItem(Messages.getString("DirectionFinding"), Cat.ROS_RDF);
403 addROItem(Messages.getString("QTGService"), Cat.ROS_QTG);
404 addROItem(Messages.getString("AeronaticalBeacon"), Cat.ROS_AERO);
405 addROItem(Messages.getString("Decca"), Cat.ROS_DECA);
406 addROItem(Messages.getString("LoranC"), Cat.ROS_LORN);
407 addROItem(Messages.getString("DGPS"), Cat.ROS_DGPS);
408 addROItem(Messages.getString("Toran"), Cat.ROS_TORN);
409 addROItem(Messages.getString("Omega"), Cat.ROS_OMGA);
410 addROItem(Messages.getString("Syledis"), Cat.ROS_SYLD);
411 addROItem(Messages.getString("Chiaka"), Cat.ROS_CHKA);
412 addROItem(Messages.getString("PublicCommunication"), Cat.ROS_PCOM);
413 addROItem(Messages.getString("CommercialBroadcast"), Cat.ROS_COMB);
414 addROItem(Messages.getString("Facsimile"), Cat.ROS_FACS);
415 addROItem(Messages.getString("TimeSignal"), Cat.ROS_TIME);
416 addROItem(Messages.getString("AIS"), Cat.ROS_PAIS);
417 addROItem(Messages.getString("S-AIS"), Cat.ROS_SAIS);
418 addROItem(Messages.getString("V-AIS"), Cat.ROS_VAIS);
419 addROItem(Messages.getString("V-AISNC"), Cat.ROS_VANC);
420 addROItem(Messages.getString("V-AISSC"), Cat.ROS_VASC);
421 addROItem(Messages.getString("V-AISEC"), Cat.ROS_VAEC);
422 addROItem(Messages.getString("V-AISWC"), Cat.ROS_VAWC);
423 addROItem(Messages.getString("V-AISPL"), Cat.ROS_VAPL);
424 addROItem(Messages.getString("V-AISSL"), Cat.ROS_VASL);
425 addROItem(Messages.getString("V-AISID"), Cat.ROS_VAID);
426 addROItem(Messages.getString("V-AISSW"), Cat.ROS_VASW);
427 addROItem(Messages.getString("V-AISSP"), Cat.ROS_VASP);
428 addROItem(Messages.getString("V-AISWK"), Cat.ROS_VAWK);
429 radioCatBox.setVisible(false);
430
431 radarCatBox = new JComboBox();
432 radarCatBox.setBounds(new Rectangle(5, 140, 160, 20));
433 add(radarCatBox);
434 radarCatBox.addActionListener(alRadarCatBox);
435 addRAItem("", Cat.NOCAT);
436 addRAItem(Messages.getString("Surveillance"), Cat.RAS_SRV);
437 addRAItem(Messages.getString("CoastRadar"), Cat.RAS_CST);
438 radarCatBox.setVisible(false);
439
440 chLabel = new JLabel("Ch:", SwingConstants.CENTER);
441 chLabel.setBounds(new Rectangle(140, 32, 30, 15));
442 add(chLabel);
443 chBox = new JTextField();
444 chBox.setBounds(new Rectangle(140, 45, 30, 20));
445 chBox.setHorizontalAlignment(SwingConstants.CENTER);
446 add(chBox);
447 chBox.addFocusListener(flCh);
448 }
449
450 public void syncPanel() {
451 functionLabel.setVisible(false);
452 functionBox.setVisible(false);
453 categoryLabel.setVisible(false);
454 landCatBox.setVisible(false);
455 trafficCatBox.setVisible(false);
456 warningCatBox.setVisible(false);
457 platformCatBox.setVisible(false);
458 pilotCatBox.setVisible(false);
459 rescueCatBox.setVisible(false);
460 radioCatBox.setVisible(false);
461 radarCatBox.setVisible(false);
462 chLabel.setVisible(false);
463 chBox.setVisible(false);
464 chBox.setText(dlg.panelMain.mark.getChannel());
465 if ((dlg.panelMain.mark.getObject() == Obj.LNDMRK) && ((dlg.panelMain.mark.getCategory() != Cat.NOCAT) || (dlg.panelMain.mark.getFunc() != Fnc.UNKFNC))) {
466 functionLabel.setVisible(true);
467 categoryLabel.setVisible(true);
468 functionBox.setVisible(true);
469 landCatBox.setVisible(true);
470 for (Fnc fnc : functions.keySet()) {
471 int item = functions.get(fnc);
472 if (dlg.panelMain.mark.getFunc() == fnc)
473 functionBox.setSelectedIndex(item);
474 }
475 for (Cat cat : landCats.keySet()) {
476 int item = landCats.get(cat);
477 if (dlg.panelMain.mark.getCategory() == cat)
478 landCatBox.setSelectedIndex(item);
479 }
480 } else if (dlg.panelMain.mark.getObject() == Obj.SISTAT) {
481 categoryLabel.setVisible(true);
482 trafficCatBox.setVisible(true);
483 for (Cat cat : trafficCats.keySet()) {
484 int item = trafficCats.get(cat);
485 if (dlg.panelMain.mark.getCategory() == cat)
486 trafficCatBox.setSelectedIndex(item);
487 }
488 chLabel.setVisible(true);
489 chBox.setVisible(true);
490 } else if (dlg.panelMain.mark.getObject() == Obj.SISTAW) {
491 categoryLabel.setVisible(true);
492 warningCatBox.setVisible(true);
493 for (Cat cat : warningCats.keySet()) {
494 int item = warningCats.get(cat);
495 if (dlg.panelMain.mark.getCategory() == cat)
496 warningCatBox.setSelectedIndex(item);
497 }
498 chLabel.setVisible(true);
499 chBox.setVisible(true);
500 } else if (dlg.panelMain.mark.getObject() == Obj.OFSPLF) {
501 categoryLabel.setVisible(true);
502 platformCatBox.setVisible(true);
503 for (Cat cat : platformCats.keySet()) {
504 int item = platformCats.get(cat);
505 if (dlg.panelMain.mark.getCategory() == cat)
506 platformCatBox.setSelectedIndex(item);
507 }
508 } else if (dlg.panelMain.mark.getObject() == Obj.PILBOP) {
509 categoryLabel.setVisible(true);
510 pilotCatBox.setVisible(true);
511 for (Cat cat : pilotCats.keySet()) {
512 int item = pilotCats.get(cat);
513 if (dlg.panelMain.mark.getCategory() == cat)
514 pilotCatBox.setSelectedIndex(item);
515 }
516 chLabel.setVisible(true);
517 chBox.setVisible(true);
518 } else if (dlg.panelMain.mark.getObject() == Obj.RSCSTA) {
519 categoryLabel.setVisible(true);
520 rescueCatBox.setVisible(true);
521 for (Cat cat : rescueCats.keySet()) {
522 int item = rescueCats.get(cat);
523 if (dlg.panelMain.mark.getCategory() == cat)
524 rescueCatBox.setSelectedIndex(item);
525 }
526 } else if (dlg.panelMain.mark.getObject() == Obj.RDOSTA) {
527 categoryLabel.setVisible(true);
528 radioCatBox.setVisible(true);
529 for (Cat cat : radioCats.keySet()) {
530 int item = radioCats.get(cat);
531 if (dlg.panelMain.mark.getCategory() == cat)
532 radioCatBox.setSelectedIndex(item);
533 }
534 chLabel.setVisible(true);
535 chBox.setVisible(true);
536 } else if (dlg.panelMain.mark.getObject() == Obj.RADSTA) {
537 categoryLabel.setVisible(true);
538 radarCatBox.setVisible(true);
539 for (Cat cat : radarCats.keySet()) {
540 int item = radarCats.get(cat);
541 if (dlg.panelMain.mark.getCategory() == cat)
542 radarCatBox.setSelectedIndex(item);
543 }
544 chLabel.setVisible(true);
545 chBox.setVisible(true);
546 }
547 for (Obj obj : objects.keySet()) {
548 JRadioButton button = objects.get(obj);
549 button.setBorderPainted(dlg.panelMain.mark.getObject() == obj);
550 }
551 dlg.panelMain.mark.testValid();
552 }
553
554 private void addLCItem(String str, Cat cat) {
555 landCats.put(cat, landCatBox.getItemCount());
556 landCatBox.addItem(str);
557 }
558
559 private void addTCItem(String str, Cat cat) {
560 trafficCats.put(cat, trafficCatBox.getItemCount());
561 trafficCatBox.addItem(str);
562 }
563
564 private void addWCItem(String str, Cat cat) {
565 warningCats.put(cat, warningCatBox.getItemCount());
566 warningCatBox.addItem(str);
567 }
568
569 private void addPLItem(String str, Cat cat) {
570 platformCats.put(cat, platformCatBox.getItemCount());
571 platformCatBox.addItem(str);
572 }
573
574 private void addPTItem(String str, Cat cat) {
575 pilotCats.put(cat, pilotCatBox.getItemCount());
576 pilotCatBox.addItem(str);
577 }
578
579 private void addRSItem(String str, Cat cat) {
580 rescueCats.put(cat, rescueCatBox.getItemCount());
581 rescueCatBox.addItem(str);
582 }
583
584 private void addROItem(String str, Cat cat) {
585 radioCats.put(cat, radioCatBox.getItemCount());
586 radioCatBox.addItem(str);
587 }
588
589 private void addRAItem(String str, Cat cat) {
590 radarCats.put(cat, radarCatBox.getItemCount());
591 radarCatBox.addItem(str);
592 }
593
594 private void addLFItem(String str, Fnc fnc) {
595 functions.put(fnc, functionBox.getItemCount());
596 functionBox.addItem(str);
597 }
598
599 private JRadioButton getObjButton(JRadioButton button, int x, int y, int w, int h, String tip, Obj obj) {
600 button.setBounds(new Rectangle(x, y, w, h));
601 button.setBorder(BorderFactory.createLoweredBevelBorder());
602 button.setToolTipText(Messages.getString(tip));
603 button.addActionListener(alObj);
604 objButtons.add(button);
605 objects.put(obj, button);
606 return button;
607 }
608
609}
Note: See TracBrowser for help on using the repository browser.