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