source: osm/applications/editors/josm/plugins/toms/src/toms/dialogs/SmpDialogAction.java@ 23109

Last change on this file since 23109 was 23109, checked in by malcolmh, 14 years ago

more lights

File size: 46.4 KB
Line 
1//License: GPL. For details, see LICENSE file.
2// Copyright (c) 2009 / 2010 by Werner Koenig & Malcolm Herring
3
4package toms.dialogs;
5
6// necessary adaption to my environment 04.09.2010 kg
7
8import static org.openstreetmap.josm.tools.I18n.tr;
9
10import java.awt.Dimension;
11import java.awt.Font;
12import java.awt.Rectangle;
13import java.awt.SystemColor;
14import java.awt.event.ActionEvent;
15import java.awt.event.ActionListener;
16import java.awt.event.ItemListener;
17import java.awt.event.ItemEvent;
18import java.awt.event.FocusAdapter;
19import java.awt.event.FocusEvent;
20import java.awt.event.KeyEvent;
21import java.awt.event.WindowEvent;
22import java.util.Collection;
23import java.util.Iterator;
24import java.util.Map;
25
26import javax.swing.ImageIcon;
27import javax.swing.JButton;
28import javax.swing.JRadioButton;
29import javax.swing.ButtonGroup;
30import javax.swing.JCheckBox;
31import javax.swing.JComboBox;
32import javax.swing.JDialog;
33import javax.swing.JLabel;
34import javax.swing.JMenuItem;
35import javax.swing.JPanel;
36import javax.swing.JTextField;
37import javax.swing.SwingUtilities;
38import javax.swing.WindowConstants;
39
40import org.openstreetmap.josm.Main;
41import org.openstreetmap.josm.actions.JosmAction;
42import org.openstreetmap.josm.command.ChangePropertyCommand;
43import org.openstreetmap.josm.command.Command;
44import org.openstreetmap.josm.data.SelectionChangedListener;
45import org.openstreetmap.josm.data.osm.DataSet;
46import org.openstreetmap.josm.data.osm.Node;
47import org.openstreetmap.josm.data.osm.OsmPrimitive;
48import org.openstreetmap.josm.tools.Shortcut;
49
50import toms.Messages;
51import toms.seamarks.SeaMark;
52import toms.seamarks.buoys.Buoy;
53import toms.seamarks.buoys.BuoyCard;
54import toms.seamarks.buoys.BuoyLat;
55import toms.seamarks.buoys.BuoySaw;
56import toms.seamarks.buoys.BuoyUkn;
57import toms.seamarks.buoys.BuoyIsol;
58import toms.seamarks.buoys.BuoySpec;
59import toms.seamarks.buoys.BuoyNota;
60
61public class SmpDialogAction extends JosmAction {
62 private static final long serialVersionUID = -2976230949744302905L;
63
64 /**
65 * lokale Variable, private
66 */
67 private SmpDialogAction dia = null; // Variable für den Handle von
68 // SmpDialogAction
69 private Buoy buoy = null; // Variable für Objekte des Typs "Tonne" //
70 // @jve:decl-index=0:
71 private boolean isOpen = false; // zeigt den Status des Dialogs an
72 private Node onode = null; // gemerkter Knoten
73 private Buoy obuoy = null; // gemerkte Tonne // @jve:decl-index=0:
74 private JMenuItem SmpItem = null; // Info über item in der Werkzeugleiste
75 private String smt = ""; // value vom key "seamark:type" // @jve:decl-index=0: //$NON-NLS-1$
76 private String smb = ""; // value vom key "seamark" // @jve:decl-index=0: //$NON-NLS-1$
77 private Collection<? extends OsmPrimitive> Selection = null; // @jve:decl-index=0:
78 private OsmPrimitive SelNode = null;
79 private String Os = ""; // @jve:decl-index=0: //$NON-NLS-1$
80 private String UserHome = ""; // @jve:decl-index=0: //$NON-NLS-1$
81
82 // SelectionChangedListner der in die Eventqueue von josm eingehängt wird
83 private SelectionChangedListener SmpListener = new SelectionChangedListener() {
84 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
85 Node node;
86 Selection = newSelection;
87
88 // System.out.println("hello");
89 for (OsmPrimitive osm : Selection) {
90 if (osm instanceof Node) {
91 node = (Node) osm;
92 if (Selection.size() == 1)
93 // Absicherung gegen Doppelevents
94 if (node.compareTo(SelNode) != 0) {
95 SelNode = node;
96 parseSeaMark();
97 buoy.paintSign();
98 }
99 }
100 }
101
102 Selection = null;
103
104 }
105 };
106
107 /**
108 * lokale Variable der Maske
109 */
110 private JDialog dM01SeaMap = null;
111 private JPanel pM01SeaMap = null;
112 private JLabel lM01Head = null;
113 private JLabel lM01Region = null;
114 private JLabel lM02Region = null;
115 public ButtonGroup bgM01Region = null;
116 public JRadioButton rbM01RegionA = null;
117 public JRadioButton rbM01RegionB = null;
118 public JLabel lM01Icon = null; // Shape
119 public JLabel lM02Icon = null; // Light
120 public JLabel lM03Icon = null; // Reflector
121 public JLabel lM04Icon = null; // Racon
122 public JLabel lM05Icon = null; // Fog
123 public JLabel lM01FireMark = null;
124 private JLabel lM01TypeOfMark = null;
125 public JComboBox cbM01TypeOfMark = null;
126 public JLabel lM01CatOfMark = null;
127 public JComboBox cbM01CatOfMark = null;
128 public JLabel lM01StyleOfMark = null;
129 public JComboBox cbM01StyleOfMark = null;
130 private JLabel lM01Name = null;
131 public JTextField tfM01Name = null;
132 private JLabel lM01Props02 = null;
133 public JCheckBox cM01TopMark = null;
134 public JComboBox cbM01TopMark = null;
135 public JCheckBox cM01Radar = null;
136 public JCheckBox cM01Racon = null;
137 public JComboBox cbM01Racon = null;
138 public JTextField tfM01Racon = null;
139 public JLabel lM01Racon = null;
140 public JCheckBox cM01Fog = null;
141 public JComboBox cbM01Fog = null;
142 public JLabel lM01FogGroup = null;
143 public JTextField tfM01FogGroup = null;
144 public JLabel lM01FogPeriod = null;
145 public JTextField tfM01FogPeriod = null;
146 public JCheckBox cM01Fired = null;
147 public ButtonGroup bgM01Fired = null;
148 public JRadioButton rbM01Fired1 = null;
149 public JRadioButton rbM01FiredN = null;
150 public JLabel lM01Kennung = null;
151 public JComboBox cbM01Kennung = null;
152 public JLabel lM01Height = null;
153 public JTextField tfM01Height = null;
154 public JLabel lM01Range = null;
155 public JTextField tfM01Range = null;
156 public JLabel lM01Group = null;
157 public JTextField tfM01Group = null;
158 public JLabel lM01RepeatTime = null;
159 public JTextField tfM01RepeatTime = null;
160 public JLabel lM01Sector = null;
161 public JComboBox cbM01Sector = null;
162 public JLabel lM01Colour = null;
163 public JComboBox cbM01Colour = null;
164 public JLabel lM01Bearing = null;
165 public JTextField tfM01Bearing = null;
166 public JTextField tfM02Bearing = null;
167 public JTextField tfM01Radius = null;
168 public JButton bM01Save = null;
169 public JButton bM01Close = null;
170 public JCheckBox cM01IconVisible = null;
171 public JTextField sM01StatusBar = null;
172
173 public boolean paintlock = false;
174
175 public JMenuItem getSmpItem() {
176 return SmpItem;
177 }
178
179 public void setSmpItem(JMenuItem smpItem) {
180 SmpItem = smpItem;
181 }
182
183 public boolean isOpen() {
184 return isOpen;
185 }
186
187 public void setOpen(boolean isOpen) {
188 this.isOpen = isOpen;
189 }
190
191 public String getOs() {
192 return Os;
193 }
194
195 public void setOs(String os) {
196 Os = os;
197 }
198
199 public String getUserHome() {
200 return UserHome;
201 }
202
203 public void setUserHome(String userHome) {
204 UserHome = userHome;
205 }
206
207 public SmpDialogAction() {
208 super(
209 Messages.getString("SmpDialogAction.4"), "Smp", Messages.getString("SmpDialogAction.0"), Shortcut //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
210 .registerShortcut(
211 "tools:Semarks", //$NON-NLS-1$
212 tr("Tool: {0}", Messages.getString("SmpDialogAction.9")), KeyEvent.VK_S, //$NON-NLS-1$ //$NON-NLS-2$
213 Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true);
214
215 dia = this;
216 String str = Main.pref.get("mappaint.style.sources"); //$NON-NLS-1$
217 if (!str.contains("dev.openseamap.org")) { //$NON-NLS-1$
218 if (!str.isEmpty()) //$NON-NLS-1$
219 str += new String(new char[] { 0x1e });
220 Main.pref.put("mappaint.style.sources", str //$NON-NLS-1$
221 + "http://dev.openseamap.org/josm/seamark_styles.xml"); //$NON-NLS-1$
222 }
223 str = Main.pref.get("color.background"); //$NON-NLS-1$
224 if (str.equals("#000000") || str.isEmpty()) //$NON-NLS-1$ //$NON-NLS-2$
225 Main.pref.put("color.background", "#606060"); //$NON-NLS-1$ //$NON-NLS-2$
226 }
227
228 public void CloseDialog() {
229 onode = null;
230 DataSet.removeSelectionListener(SmpListener);
231 Selection = null;
232
233 if (isOpen)
234 dM01SeaMap.dispose();
235 isOpen = false;
236
237 }
238
239 public void actionPerformed(ActionEvent e) {
240
241 /*
242 * int option = JOptionPane.showConfirmDialog(Main.parent,
243 * tr("THIS IS EXPERIMENTAL. Save your work and verify before uploading.\n"
244 * + "Are you really sure to continue?"),
245 * tr("Please abort if you are not sure"), JOptionPane.YES_NO_OPTION,
246 * JOptionPane.WARNING_MESSAGE);
247 *
248 * if (option != JOptionPane.YES_OPTION) { return; }
249 */
250
251 onode = null;
252 obuoy = null;
253
254 SwingUtilities.invokeLater(new Runnable() {
255 public void run() {
256 JDialog dialog = getDM01SeaMap();
257
258 if (SmpItem == null) {
259 }
260 dialog.setVisible(true);
261 }
262 });
263
264 setOpen(true);
265
266 if (SmpItem == null) {
267 return;
268 }
269 SmpItem.setEnabled(false);
270
271 // Ausprobe: Möglichkeit der Benachrichtigung, wenn etwas neu
272 // selektiert wird (ueber SelectionChangedListener)
273 // private Collection<? extends OsmPrimitive> sel;
274 // siehe org.openstreetmap.josm.plugins.osb -> OsbLayer.java
275 // Einhängen des Listeners in die Eventqueue von josm
276 DataSet.addSelectionListener(SmpListener);
277 }
278
279 private void PicRebuild() {
280
281 DataSet ds = Main.main.getCurrentDataSet();
282
283 if (obuoy == null) {
284 return;
285 }
286
287 Node n = obuoy.getNode();
288
289 if (n != null) {
290 Command c;
291
292 if (smb != "") { //$NON-NLS-1$
293
294 c = new ChangePropertyCommand(n, "seamark", smb); //$NON-NLS-1$
295 c.executeCommand();
296 ds.fireSelectionChanged();
297
298 smb = ""; //$NON-NLS-1$
299 }
300
301 if (smt != "") { //$NON-NLS-1$
302
303 c = new ChangePropertyCommand(n, "seamark:type", smt); //$NON-NLS-1$
304 c.executeCommand();
305 ds.fireSelectionChanged();
306
307 smt = ""; //$NON-NLS-1$
308 }
309 }
310
311 obuoy = null;
312
313 }
314
315 private void parseSeaMark() {
316
317 int nodes = 0;
318 Node node = null;
319 Collection<Node> selection = null;
320 Map<String, String> keys;
321 DataSet ds;
322
323 ds = Main.main.getCurrentDataSet();
324
325 if (ds == null) {
326 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.26")); //$NON-NLS-1$
327 buoy.setNode(null);
328 return;
329 }
330
331 selection = ds.getSelectedNodes();
332 nodes = selection.size();
333
334 if (nodes == 0) {
335 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.27")); //$NON-NLS-1$
336 buoy.setNode(null);
337 return;
338 }
339
340 if (nodes > 1) {
341 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.28")); //$NON-NLS-1$
342 buoy.setNode(null);
343 return;
344 }
345
346 Iterator<Node> it = selection.iterator();
347 node = it.next();
348
349 if (onode != null)
350 if (node.equals(onode))
351 return;
352
353 // Knoten wurde gewechselt -> die alten tags (benutzt zum Ausblenden der
354 // Pictogramme) wiederherstellen
355 if (obuoy != null)
356 PicRebuild();
357
358 onode = node;
359
360 cM01IconVisible.setEnabled(true);
361 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource(
362 "/images/Auge.png"))); //$NON-NLS-1$
363
364 cbM01TypeOfMark.setEnabled(true);
365
366 // Soweit das Vorspiel. Ab hier beginnt das Parsen
367 String type = ""; //$NON-NLS-1$
368 String str = ""; //$NON-NLS-1$
369
370 keys = node.getKeys();
371
372 // vorsorglich den Namen holen und verwenden, wenn es ein
373 // Seezeichen ist. Name kann durch die weiteren Tags ueber-
374 // schrieben werden
375
376 if (keys.containsKey("seamark:type")) //$NON-NLS-1$
377 type = keys.get("seamark:type"); //$NON-NLS-1$
378
379 if (type.equals("buoy_lateral") || type.equals("beacon_lateral") //$NON-NLS-1$ //$NON-NLS-2$
380 || keys.containsKey("seamark:buoy_lateral:category") //$NON-NLS-1$
381 || keys.containsKey("seamark:buoy_lateral:shape") //$NON-NLS-1$
382 || keys.containsKey("seamark:buoy_lateral:colour") //$NON-NLS-1$
383 || keys.containsKey("seamark:beacon_lateral:category") //$NON-NLS-1$
384 || keys.containsKey("seamark:beacon_lateral:shape") //$NON-NLS-1$
385 || keys.containsKey("seamark:beacon_lateral:colour")) { //$NON-NLS-1$
386 buoy = new BuoyLat(this, node);
387 return;
388
389 } else if (type.equals("buoy_cardinal") || type.equals("beacon_cardinal") //$NON-NLS-1$ //$NON-NLS-2$
390 || keys.containsKey("seamark:buoy_cardinal:category") //$NON-NLS-1$
391 || keys.containsKey("seamark:buoy_cardinal:shape") //$NON-NLS-1$
392 || keys.containsKey("seamark:buoy_cardinal:colour") //$NON-NLS-1$
393 || keys.containsKey("seamark:beacon_cardinal:category") //$NON-NLS-1$
394 || keys.containsKey("seamark:beacon_cardinal:shape") //$NON-NLS-1$
395 || keys.containsKey("seamark:beacon_cardinal:colour")) { //$NON-NLS-1$
396 buoy = new BuoyCard(this, node);
397 return;
398
399 } else if (type.equals("buoy_safe_water") //$NON-NLS-1$
400 || type.equals("beacon_safe_water") //$NON-NLS-1$
401 || keys.containsKey("seamark:buoy_safe_water:shape") //$NON-NLS-1$
402 || keys.containsKey("seamark:buoy_safe_water:colour") //$NON-NLS-1$
403 || keys.containsKey("seamark:beacon_safe_water:shape") //$NON-NLS-1$
404 || keys.containsKey("seamark:beacon_safe_water:colour")) { //$NON-NLS-1$
405 buoy = new BuoySaw(this, node);
406 return;
407
408 } else if (type.equals("buoy_special_purpose") //$NON-NLS-1$
409 || type.equals("beacon_special_purpose") //$NON-NLS-1$
410 || keys.containsKey("seamark:buoy_special_purpose:shape") //$NON-NLS-1$
411 || keys.containsKey("seamark:buoy_special_purpose:colour") //$NON-NLS-1$
412 || keys.containsKey("seamark:beacon_special_purpose:shape") //$NON-NLS-1$
413 || keys.containsKey("seamark:beacon_special_purpose:colour")) { //$NON-NLS-1$
414 buoy = new BuoySpec(this, node);
415 return;
416
417 } else if (type.equals("buoy_isolated_danger") //$NON-NLS-1$
418 || type.equals("beacon_isolated_danger") //$NON-NLS-1$
419 || keys.containsKey("seamark:buoy_isolated_danger:shape") //$NON-NLS-1$
420 || keys.containsKey("seamark:buoy_isolated_danger:colour") //$NON-NLS-1$
421 || keys.containsKey("seamark:beacon_isolated_danger:shape") //$NON-NLS-1$
422 || keys.containsKey("seamark:beacon_isolated_danger:colour")) { //$NON-NLS-1$
423 buoy = new BuoyIsol(this, node);
424 return;
425
426 } else if (type.equals("light_float")) { //$NON-NLS-1$
427 if (keys.containsKey("seamark:light_float:colour")) { //$NON-NLS-1$
428 str = keys.get("seamark:light_float:colour"); //$NON-NLS-1$
429 if (str.equals("red") || str.equals("green") //$NON-NLS-1$ //$NON-NLS-2$
430 || str.equals("red;green;red") || str.equals("green;red;green")) { //$NON-NLS-1$ //$NON-NLS-2$
431 buoy = new BuoyLat(this, node);
432 return;
433 } else if (str.equals("black;yellow") //$NON-NLS-1$
434 || str.equals("black;yellow;black") || str.equals("yellow;black") //$NON-NLS-1$ //$NON-NLS-2$
435 || str.equals("yellow;black;yellow")) { //$NON-NLS-1$
436 buoy = new BuoyCard(this, node);
437 return;
438 } else if (str.equals("black;red;black")) { //$NON-NLS-1$
439 buoy = new BuoyIsol(this, node);
440 return;
441 } else if (str.equals("red;white")) { //$NON-NLS-1$
442 buoy = new BuoySaw(this, node);
443 return;
444 } else if (str.equals("yellow")) { //$NON-NLS-1$
445 buoy = new BuoySaw(this, node);
446 return;
447 }
448 } else if (keys.containsKey("seamark:light_float:topmark:shape")) { //$NON-NLS-1$
449 str = keys.get("seamark:light_float:topmark:shape"); //$NON-NLS-1$
450 if (str.equals("cylinder") || str.equals("cone, point up")) { //$NON-NLS-1$ //$NON-NLS-2$
451 buoy = new BuoyLat(this, node);
452 return;
453 }
454 } else if (keys.containsKey("seamark:light_float:topmark:colour")) { //$NON-NLS-1$
455 str = keys.get("seamark:light_float:topmark:colour"); //$NON-NLS-1$
456 if (str.equals("red") || str.equals("green")) { //$NON-NLS-1$ //$NON-NLS-2$
457 buoy = new BuoyLat(this, node);
458 return;
459 }
460 }
461 }
462
463 buoy = new BuoyUkn(this, Messages.getString("SmpDialogAction.91")); //$NON-NLS-1$
464 buoy.setNode(node);
465 return;
466 }
467
468 private JDialog getDM01SeaMap() {
469
470 if (dM01SeaMap == null) {
471 dM01SeaMap = new JDialog();
472 dM01SeaMap.setSize(new Dimension(400, 400));
473 dM01SeaMap.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
474 dM01SeaMap.setModal(false);
475 dM01SeaMap.setResizable(false);
476 dM01SeaMap.setContentPane(getPM01SeaMap());
477 dM01SeaMap.setTitle(Messages.getString("SmpDialogAction.9")); //$NON-NLS-1$
478 dM01SeaMap.setVisible(false);
479 dM01SeaMap.setAlwaysOnTop(true);
480 dM01SeaMap.addWindowListener(new java.awt.event.WindowAdapter() {
481 public void windowClosing(java.awt.event.WindowEvent e) {
482
483 // Pictogramme wiederherstellen und aufraeumen
484 if (obuoy != null)
485 PicRebuild();
486 // Deaktivierung des Listeners
487 DataSet.removeSelectionListener(SmpListener);
488 Selection = null;
489
490 SmpItem.setEnabled(true);
491 }
492
493 public void windowActivated(WindowEvent arg0) {
494 parseSeaMark();
495 buoy.paintSign();
496 }
497 });
498 }
499 return dM01SeaMap;
500 }
501
502 private JPanel getPM01SeaMap() {
503 if (pM01SeaMap == null) {
504
505 lM01Icon = new JLabel();
506 lM01Icon.setBounds(new Rectangle(210, 20, 150, 200));
507 lM01Icon.setIcon(null);
508 lM01Icon.setText(""); //$NON-NLS-1$
509
510 lM02Icon = new JLabel();
511 lM02Icon.setBounds(new Rectangle(210, 20, 150, 200));
512 lM02Icon.setIcon(null);
513 lM02Icon.setText(""); //$NON-NLS-1$
514
515 lM03Icon = new JLabel();
516 lM03Icon.setBounds(new Rectangle(210, -50, 150, 200));
517 lM03Icon.setIcon(null);
518 lM03Icon.setText(""); //$NON-NLS-1$
519
520 lM04Icon = new JLabel();
521 lM04Icon.setBounds(new Rectangle(210, 20, 150, 200));
522 lM04Icon.setIcon(null);
523 lM04Icon.setText(""); //$NON-NLS-1$
524
525 lM05Icon = new JLabel();
526 lM05Icon.setBounds(new Rectangle(210, 20, 150, 200));
527 lM05Icon.setIcon(null);
528 lM05Icon.setText(""); //$NON-NLS-1$
529
530 lM01FireMark = new JLabel();
531 lM01FireMark.setBounds(new Rectangle(300, 85, 95, 20));
532 lM01FireMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
533 lM01FireMark.setText(""); //$NON-NLS-1$
534
535 lM01Head = new JLabel();
536 lM01Head.setBounds(new Rectangle(5, 3, 316, 16));
537 lM01Head.setText(Messages.getString("SmpDialogAction.97")); //$NON-NLS-1$
538
539 lM01Region = new JLabel();
540 lM01Region.setBounds(new Rectangle(220, 7, 120, 16));
541 lM01Region.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
542 lM01Region.setText(Messages.getString("SmpDialogAction.99")); //$NON-NLS-1$
543
544 lM02Region = new JLabel();
545 lM02Region.setBounds(new Rectangle(270, 7, 120, 16));
546 lM02Region.setFont(new Font("Dialog", Font.BOLD, 12)); //$NON-NLS-1$
547 lM02Region.setText(Messages.getString("SmpDialogAction.101")); //$NON-NLS-1$
548
549 lM01TypeOfMark = new JLabel();
550 lM01TypeOfMark.setBounds(new Rectangle(5, 28, 120, 16));
551 lM01TypeOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
552 lM01TypeOfMark.setText(Messages.getString("SmpDialogAction.103")); //$NON-NLS-1$
553
554 lM01CatOfMark = new JLabel();
555 lM01CatOfMark.setBounds(new Rectangle(5, 58, 120, 16));
556 lM01CatOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
557 lM01CatOfMark.setText(Messages.getString("SmpDialogAction.1")); //$NON-NLS-1$
558
559 lM01StyleOfMark = new JLabel();
560 lM01StyleOfMark.setBounds(new Rectangle(5, 88, 148, 16));
561 lM01StyleOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
562 lM01StyleOfMark.setText(Messages.getString("SmpDialogAction.107")); //$NON-NLS-1$
563
564 lM01Name = new JLabel();
565 lM01Name.setBounds(new Rectangle(5, 120, 82, 16));
566 lM01Name.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
567 lM01Name.setText(Messages.getString("SmpDialogAction.109")); //$NON-NLS-1$
568
569 lM01Props02 = new JLabel();
570 lM01Props02.setBounds(new Rectangle(5, 150, 172, 16));
571 lM01Props02.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
572 lM01Props02.setText(Messages.getString("SmpDialogAction.111")); //$NON-NLS-1$
573
574 lM01Racon = new JLabel();
575 lM01Racon.setBounds(new Rectangle(335, 195, 65, 20));
576 lM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
577 lM01Racon.setText(Messages.getString("SmpDialogAction.113")); //$NON-NLS-1$
578
579 lM01FogGroup = new JLabel();
580 lM01FogGroup.setBounds(new Rectangle(190, 220, 100, 20));
581 lM01FogGroup.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
582 lM01FogGroup.setText(Messages.getString("SmpDialogAction.115")); //$NON-NLS-1$
583
584 lM01FogPeriod = new JLabel();
585 lM01FogPeriod.setBounds(new Rectangle(300, 220, 100, 20));
586 lM01FogPeriod.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
587 lM01FogPeriod.setText(Messages.getString("SmpDialogAction.117")); //$NON-NLS-1$
588
589 lM01Kennung = new JLabel();
590 lM01Kennung.setBounds(new Rectangle(240, 245, 60, 20));
591 lM01Kennung.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
592 lM01Kennung.setText(Messages.getString("SmpDialogAction.119")); //$NON-NLS-1$
593
594 lM01Height = new JLabel();
595 lM01Height.setBounds(new Rectangle(10, 270, 100, 20));
596 lM01Height.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
597 lM01Height.setText(Messages.getString("SmpDialogAction.121")); //$NON-NLS-1$
598
599 lM01Range = new JLabel();
600 lM01Range.setBounds(new Rectangle(108, 270, 100, 20));
601 lM01Range.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
602 lM01Range.setText(Messages.getString("SmpDialogAction.123")); //$NON-NLS-1$
603
604 lM01Group = new JLabel();
605 lM01Group.setBounds(new Rectangle(204, 270, 100, 20));
606 lM01Group.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
607 lM01Group.setText(Messages.getString("SmpDialogAction.125")); //$NON-NLS-1$
608
609 lM01RepeatTime = new JLabel();
610 lM01RepeatTime.setBounds(new Rectangle(300, 270, 100, 20));
611 lM01RepeatTime.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
612 lM01RepeatTime.setText(Messages.getString("SmpDialogAction.127")); //$NON-NLS-1$
613
614 lM01Sector = new JLabel();
615 lM01Sector.setBounds(new Rectangle(10, 295, 180, 20));
616 lM01Sector.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
617 lM01Sector.setText(Messages.getString("SmpDialogAction.129")); //$NON-NLS-1$
618
619 lM01Colour = new JLabel();
620 lM01Colour.setBounds(new Rectangle(120, 295, 180, 20));
621 lM01Colour.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
622 lM01Colour.setText(Messages.getString("SmpDialogAction.131")); //$NON-NLS-1$
623
624 lM01Bearing = new JLabel();
625 lM01Bearing.setBounds(new Rectangle(228, 295, 180, 20));
626 lM01Bearing.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
627 lM01Bearing.setText(Messages.getString("SmpDialogAction.133")); //$NON-NLS-1$
628
629 rbM01RegionA = new JRadioButton(
630 Messages.getString("SmpDialogAction.134"), Main.pref.get("tomsplugin.IALA") //$NON-NLS-1$ //$NON-NLS-2$
631 .equals("A")); //$NON-NLS-1$
632 rbM01RegionA.setBounds(new Rectangle(305, 0, 50, 30));
633 rbM01RegionB = new JRadioButton("-B", Main.pref.get("tomsplugin.IALA") //$NON-NLS-1$ //$NON-NLS-2$
634 .equals("B")); //$NON-NLS-1$
635 rbM01RegionB.setBounds(new Rectangle(352, 0, 50, 30));
636 bgM01Region = new ButtonGroup();
637 bgM01Region.add(rbM01RegionA);
638 bgM01Region.add(rbM01RegionB);
639
640 ActionListener alM01Region = new ActionListener() {
641 public void actionPerformed(java.awt.event.ActionEvent e) {
642 if (buoy instanceof BuoyLat) {
643 buoy.setRegion(rbM01RegionB.isSelected());
644 buoy.setLightColour();
645 buoy.paintSign();
646 }
647 }
648 };
649 rbM01RegionA.addActionListener(alM01Region);
650 rbM01RegionB.addActionListener(alM01Region);
651
652 rbM01Fired1 = new JRadioButton(
653 Messages.getString("SmpDialogAction.140"), true); //$NON-NLS-1$
654 rbM01Fired1.setBounds(new Rectangle(85, 240, 70, 30));
655 rbM01FiredN = new JRadioButton(
656 Messages.getString("SmpDialogAction.141"), false); //$NON-NLS-1$
657 rbM01FiredN.setBounds(new Rectangle(155, 240, 80, 30));
658 bgM01Fired = new ButtonGroup();
659 bgM01Fired.add(rbM01Fired1);
660 bgM01Fired.add(rbM01FiredN);
661
662 ActionListener alM01Fired = new ActionListener() {
663 public void actionPerformed(java.awt.event.ActionEvent e) {
664 buoy.setSectored(rbM01FiredN.isSelected());
665 if (rbM01Fired1.isSelected()) buoy.setSectorIndex(0);
666 buoy.paintSign();
667 }
668 };
669 rbM01Fired1.addActionListener(alM01Fired);
670 rbM01FiredN.addActionListener(alM01Fired);
671
672 pM01SeaMap = new JPanel();
673 pM01SeaMap.setLayout(null);
674 pM01SeaMap.add(lM01Head, null);
675 pM01SeaMap.add(rbM01RegionA, null);
676 pM01SeaMap.add(rbM01RegionB, null);
677 pM01SeaMap.add(lM01Region, null);
678 pM01SeaMap.add(lM02Region, null);
679 pM01SeaMap.add(lM01Icon, null);
680 pM01SeaMap.add(lM02Icon, null);
681 pM01SeaMap.add(lM03Icon, null);
682 pM01SeaMap.add(lM04Icon, null);
683 pM01SeaMap.add(lM05Icon, null);
684 pM01SeaMap.add(getCbM01TypeOfMark(), null);
685 pM01SeaMap.add(lM01TypeOfMark, null);
686 pM01SeaMap.add(getCbM01CatOfMark(), null);
687 pM01SeaMap.add(lM01CatOfMark, null);
688 pM01SeaMap.add(getCbM01StyleOfMark(), null);
689 pM01SeaMap.add(lM01StyleOfMark, null);
690 pM01SeaMap.add(lM01Name, null);
691 pM01SeaMap.add(getTfM01Name(), null);
692 pM01SeaMap.add(lM01Props02, null);
693 pM01SeaMap.add(getCM01TopMark(), null);
694 pM01SeaMap.add(getCbM01TopMark(), null);
695 pM01SeaMap.add(getCM01Radar(), null);
696 pM01SeaMap.add(getCM01Racon(), null);
697 pM01SeaMap.add(getCbM01Racon(), null);
698 pM01SeaMap.add(getTfM01Racon(), null);
699 pM01SeaMap.add(lM01Racon, null);
700 pM01SeaMap.add(getCM01Fog(), null);
701 pM01SeaMap.add(getCbM01Fog(), null);
702 pM01SeaMap.add(getTfM01FogGroup(), null);
703 pM01SeaMap.add(lM01FogGroup, null);
704 pM01SeaMap.add(getTfM01FogPeriod(), null);
705 pM01SeaMap.add(lM01FogPeriod, null);
706 pM01SeaMap.add(getCM01Fired(), null);
707 pM01SeaMap.add(rbM01Fired1, null);
708 pM01SeaMap.add(rbM01FiredN, null);
709 pM01SeaMap.add(getTfM01RepeatTime(), null);
710 pM01SeaMap.add(lM01RepeatTime, null);
711 pM01SeaMap.add(getCbM01Kennung(), null);
712 pM01SeaMap.add(lM01Kennung, null);
713 pM01SeaMap.add(lM01Group, null);
714 pM01SeaMap.add(getTfM01Group(), null);
715 pM01SeaMap.add(lM01Sector, null);
716 pM01SeaMap.add(getCbM01Sector(), null);
717 pM01SeaMap.add(lM01Colour, null);
718 pM01SeaMap.add(getCbM01Colour(), null);
719 pM01SeaMap.add(lM01Bearing, null);
720 pM01SeaMap.add(getTfM01Bearing(), null);
721 pM01SeaMap.add(getTfM02Bearing(), null);
722 pM01SeaMap.add(getTfM01Radius(), null);
723 pM01SeaMap.add(lM01Height, null);
724 pM01SeaMap.add(getTfM01Height(), null);
725 pM01SeaMap.add(lM01Range, null);
726 pM01SeaMap.add(getTfM01Range(), null);
727 pM01SeaMap.add(lM01FireMark, null);
728 pM01SeaMap.add(getBM01Save(), null);
729 pM01SeaMap.add(getSM01StatusBar(), null);
730 pM01SeaMap.add(getBM01Close(), null);
731 pM01SeaMap.add(getCM01IconVisible(), null);
732 }
733 return pM01SeaMap;
734 }
735
736 private JComboBox getCbM01TypeOfMark() {
737
738 if (cbM01TypeOfMark == null) {
739
740 cbM01TypeOfMark = new JComboBox();
741
742 // Inhalt der ComboBox
743 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.142")); //$NON-NLS-1$
744 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.143")); //$NON-NLS-1$
745 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.144")); //$NON-NLS-1$
746 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.145")); //$NON-NLS-1$
747 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.146")); //$NON-NLS-1$
748 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.147")); //$NON-NLS-1$
749 cbM01TypeOfMark.addItem(Messages.getString("SmpDialogAction.148")); //$NON-NLS-1$
750
751 cbM01TypeOfMark.setBounds(new Rectangle(45, 25, 165, 25));
752 // cbM01TypeOfMark.setEditable(false);
753 cbM01TypeOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
754 cbM01TypeOfMark.setEnabled(true);
755
756 cbM01TypeOfMark.addActionListener(new ActionListener() {
757 public void actionPerformed(java.awt.event.ActionEvent e) {
758 int type = cbM01TypeOfMark.getSelectedIndex();
759
760 if (buoy == null) {
761 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$
762 return;
763 }
764
765 Node n = buoy.getNode();
766 if (n == null)
767 return;
768
769 paintlock = true;
770 switch (type) {
771
772 case SeaMark.UNKNOWN_TYPE:
773 if (!(buoy instanceof BuoyUkn))
774 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$
775 buoy.setBuoyIndex(type);
776 break;
777
778 case SeaMark.LATERAL:
779 if (!(buoy instanceof BuoyLat)) {
780 buoy = new BuoyLat(dia, n);
781 buoy.setBuoyIndex(0);
782 cbM01CatOfMark.removeAllItems();
783 cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.152")); //$NON-NLS-1$
784 cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.153")); //$NON-NLS-1$
785 cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.154")); //$NON-NLS-1$
786 cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.155")); //$NON-NLS-1$
787 cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.156")); //$NON-NLS-1$
788 }
789 break;
790
791 case SeaMark.CARDINAL:
792 if (!(buoy instanceof BuoyCard)) {
793 buoy = new BuoyCard(dia, n);
794 buoy.setBuoyIndex(0);
795 cbM01CatOfMark.removeAllItems();
796 cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.157")); //$NON-NLS-1$
797 cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.158")); //$NON-NLS-1$
798 cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.159")); //$NON-NLS-1$
799 cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.160")); //$NON-NLS-1$
800 cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.161")); //$NON-NLS-1$
801 }
802 break;
803
804 case SeaMark.SAFE_WATER:
805 if (!(buoy instanceof BuoySaw)) {
806 buoy = new BuoySaw(dia, n);
807 }
808 buoy.setBuoyIndex(type);
809 break;
810
811 case SeaMark.ISOLATED_DANGER:
812 if (!(buoy instanceof BuoyIsol)) {
813 buoy = new BuoyIsol(dia, n);
814 }
815 buoy.setBuoyIndex(type);
816 break;
817
818 case SeaMark.SPECIAL_PURPOSE:
819 if (!(buoy instanceof BuoySpec)) {
820 buoy = new BuoySpec(dia, n);
821 cbM01TopMark.removeAllItems();
822 cbM01TopMark.addItem(Messages.getString("SmpDialogAction.212"));
823 cbM01TopMark.addItem(Messages.getString("SmpDialogAction.210")); //$NON-NLS-1$
824 cbM01TopMark.addItem(Messages.getString("SmpDialogAction.211")); //$NON-NLS-1$
825 }
826 buoy.setBuoyIndex(type);
827 break;
828
829 case SeaMark.LIGHT:
830 if (!(buoy instanceof BuoyNota)) {
831 buoy = new BuoyNota(dia, n);
832 buoy.setBuoyIndex(0);
833 cbM01CatOfMark.removeAllItems();
834 cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.157")); //$NON-NLS-1$
835 cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.206")); //$NON-NLS-1$
836 cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.207")); //$NON-NLS-1$
837 cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.208")); //$NON-NLS-1$
838 cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.209")); //$NON-NLS-1$
839 }
840 break;
841 }
842
843 buoy.refreshStyles();
844 buoy.refreshLights();
845 buoy.setLightColour();
846 paintlock = false;
847 buoy.paintSign();
848 }
849 });
850 }
851 return cbM01TypeOfMark;
852 }
853
854 private JComboBox getCbM01CatOfMark() {
855 if (cbM01CatOfMark == null) {
856 cbM01CatOfMark = new JComboBox();
857 cbM01CatOfMark.setBounds(new Rectangle(60, 55, 150, 25));
858 cbM01CatOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
859 cbM01CatOfMark.setEnabled(true);
860
861 cbM01CatOfMark.addActionListener(new ActionListener() {
862 public void actionPerformed(ActionEvent e) {
863 int cat = cbM01CatOfMark.getSelectedIndex();
864
865 if (buoy == null) {
866 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$
867 return;
868 }
869
870 Node n = buoy.getNode();
871 if (n == null)
872 return;
873
874 if (cbM01TypeOfMark.getSelectedIndex() == SeaMark.LATERAL) {
875 if (!(buoy instanceof BuoyLat))
876 buoy = new BuoyLat(dia, n);
877 buoy.setBuoyIndex(cat);
878 }
879 if (cbM01TypeOfMark.getSelectedIndex() == SeaMark.CARDINAL) {
880 if (!(buoy instanceof BuoyCard))
881 buoy = new BuoyCard(dia, n);
882 buoy.setBuoyIndex(cat);
883 }
884 if (cbM01TypeOfMark.getSelectedIndex() == SeaMark.LIGHT) {
885 if (!(buoy instanceof BuoyNota))
886 buoy = new BuoyNota(dia, n);
887 buoy.setBuoyIndex(cat);
888 }
889
890 buoy.refreshStyles();
891 buoy.refreshLights();
892 buoy.setLightColour();
893 buoy.paintSign();
894 }
895 });
896 }
897 return cbM01CatOfMark;
898 }
899
900 private JComboBox getCbM01StyleOfMark() {
901 if (cbM01StyleOfMark == null) {
902 cbM01StyleOfMark = new JComboBox();
903 cbM01StyleOfMark.setBounds(new Rectangle(45, 85, 165, 25));
904 cbM01StyleOfMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
905 cbM01StyleOfMark.addActionListener(new ActionListener() {
906 public void actionPerformed(ActionEvent e) {
907 int style = cbM01StyleOfMark.getSelectedIndex();
908 if (buoy != null && style != buoy.getStyleIndex()) {
909 buoy.setStyleIndex(style);
910 buoy.paintSign();
911 }
912 }
913 });
914 }
915 return cbM01StyleOfMark;
916 }
917
918 private JTextField getTfM01Name() {
919 if (tfM01Name == null) {
920 tfM01Name = new JTextField();
921 tfM01Name.setBounds(new Rectangle(50, 120, 150, 20));
922 tfM01Name.addFocusListener(new FocusAdapter() {
923 public void focusLost(FocusEvent e) {
924 buoy.setName(tfM01Name.getText());
925 }
926 });
927 }
928
929 return tfM01Name;
930 }
931
932 private JCheckBox getCM01TopMark() {
933 if (cM01TopMark == null) {
934 cM01TopMark = new JCheckBox();
935 cM01TopMark.setBounds(new Rectangle(10, 170, 100, 20));
936 cM01TopMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
937 cM01TopMark.setText(Messages.getString("SmpDialogAction.166")); //$NON-NLS-1$
938 cM01TopMark.addItemListener(new ItemListener() {
939 public void itemStateChanged(ItemEvent e) {
940 if (buoy == null) {
941 return;
942 }
943 buoy.setTopMark(cM01TopMark.isSelected());
944 buoy.paintSign();
945 }
946 });
947 }
948 return cM01TopMark;
949 }
950
951 private JComboBox getCbM01TopMark() {
952 if (cbM01TopMark == null) {
953 cbM01TopMark = new JComboBox();
954 cbM01TopMark.setBounds(new Rectangle(110, 170, 80, 20));
955 cbM01TopMark.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
956 cbM01TopMark.addActionListener(new ActionListener() {
957 public void actionPerformed(ActionEvent e) {
958 int top = cbM01TopMark.getSelectedIndex();
959 buoy.paintSign();
960 }
961 });
962 }
963 return cbM01TopMark;
964 }
965
966 private JCheckBox getCM01Radar() {
967 if (cM01Radar == null) {
968 cM01Radar = new JCheckBox();
969 cM01Radar.setBounds(new Rectangle(10, 195, 120, 20));
970 cM01Radar.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
971 cM01Radar.setText(Messages.getString("SmpDialogAction.169")); //$NON-NLS-1$
972 cM01Radar.addActionListener(new ActionListener() {
973 public void actionPerformed(ActionEvent e) {
974 if (cM01Radar.isSelected()) {
975 buoy.setRadar(true);
976 buoy.setRacon(false);
977 cM01Racon.setSelected(false);
978 } else {
979 buoy.setRadar(false);
980 }
981 buoy.paintSign();
982 }
983 });
984 }
985 return cM01Radar;
986 }
987
988 private JCheckBox getCM01Racon() {
989 if (cM01Racon == null) {
990 cM01Racon = new JCheckBox();
991 cM01Racon.setBounds(new Rectangle(130, 195, 110, 20));
992 cM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
993 cM01Racon.setText(Messages.getString("SmpDialogAction.171")); //$NON-NLS-1$
994 cM01Racon.addActionListener(new ActionListener() {
995 public void actionPerformed(ActionEvent e) {
996 if (cM01Racon.isSelected()) {
997 buoy.setRacon(true);
998 buoy.setRadar(false);
999 cM01Radar.setSelected(false);
1000 } else {
1001 buoy.setRacon(false);
1002 }
1003 buoy.paintSign();
1004 }
1005 });
1006 }
1007 return cM01Racon;
1008 }
1009
1010 private JComboBox getCbM01Racon() {
1011 if (cbM01Racon == null) {
1012 cbM01Racon = new JComboBox();
1013 cbM01Racon.setBounds(new Rectangle(240, 195, 80, 20));
1014 cbM01Racon.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
1015 cbM01Racon.removeAllItems();
1016 cbM01Racon.addItem("Any");
1017 cbM01Racon.addItem("Racon");
1018 cbM01Racon.addItem("Ramark");
1019 cbM01Racon.addItem("Leading");
1020 cbM01Racon.addActionListener(new ActionListener() {
1021 public void actionPerformed(ActionEvent e) {
1022 int rac = cbM01Racon.getSelectedIndex();
1023 buoy.setRaType(rac);
1024 buoy.paintSign();
1025 }
1026 });
1027 }
1028 return cbM01Racon;
1029 }
1030
1031 private JTextField getTfM01Racon() {
1032 if (tfM01Racon == null) {
1033 tfM01Racon = new JTextField();
1034 tfM01Racon.setBounds(new Rectangle(345, 195, 30, 20));
1035 tfM01Racon.addFocusListener(new FocusAdapter() {
1036 public void focusLost(FocusEvent e) {
1037 buoy.setRaconGroup(tfM01Racon.getText().trim());
1038 }
1039 });
1040 }
1041 return tfM01Racon;
1042 }
1043
1044 private JCheckBox getCM01Fog() {
1045 if (cM01Fog == null) {
1046 cM01Fog = new JCheckBox();
1047 cM01Fog.setBounds(new Rectangle(10, 220, 90, 20));
1048 cM01Fog.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
1049 cM01Fog.setText(Messages.getString("SmpDialogAction.174")); //$NON-NLS-1$
1050 cM01Fog.addActionListener(new ActionListener() {
1051 public void actionPerformed(ActionEvent e) {
1052 buoy.setFog(cM01Fog.isSelected());
1053 buoy.paintSign();
1054 }
1055 });
1056 }
1057 return cM01Fog;
1058 }
1059
1060 private JComboBox getCbM01Fog() {
1061 if (cbM01Fog == null) {
1062 cbM01Fog = new JComboBox();
1063 cbM01Fog.setBounds(new Rectangle(100, 220, 70, 20));
1064 cbM01Fog.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
1065 cbM01Fog.removeAllItems();
1066 cbM01Fog.addItem("Any");
1067 cbM01Fog.addItem("Horn");
1068 cbM01Fog.addItem("Siren");
1069 cbM01Fog.addItem("Dia");
1070 cbM01Fog.addItem("Bell");
1071 cbM01Fog.addItem("Whis");
1072 cbM01Fog.addItem("Gong");
1073 cbM01Fog.addItem("Explos");
1074 cbM01Fog.addActionListener(new ActionListener() {
1075 public void actionPerformed(ActionEvent e) {
1076 if (cbM01Fog.getSelectedIndex() > 0)
1077 buoy.setFogSound(cbM01Fog.getSelectedIndex());
1078 else
1079 buoy.setFogSound(0);
1080 buoy.paintSign();
1081 }
1082 });
1083 }
1084 return cbM01Fog;
1085 }
1086
1087 private JTextField getTfM01FogGroup() {
1088 if (tfM01FogGroup == null) {
1089 tfM01FogGroup = new JTextField();
1090 tfM01FogGroup.setBounds(new Rectangle(243, 220, 30, 20));
1091 tfM01FogGroup.addFocusListener(new FocusAdapter() {
1092 public void focusLost(FocusEvent e) {
1093 buoy.setFogGroup(tfM01FogGroup.getText().trim());
1094 }
1095 });
1096 }
1097 return tfM01FogGroup;
1098 }
1099
1100 private JTextField getTfM01FogPeriod() {
1101 if (tfM01FogPeriod == null) {
1102 tfM01FogPeriod = new JTextField();
1103 tfM01FogPeriod.setBounds(new Rectangle(345, 220, 30, 20));
1104 tfM01FogPeriod.addFocusListener(new FocusAdapter() {
1105 public void focusLost(FocusEvent e) {
1106 buoy.setFogPeriod(tfM01FogPeriod.getText().trim());
1107 }
1108 });
1109 }
1110 return tfM01FogPeriod;
1111 }
1112
1113 private JCheckBox getCM01Fired() {
1114 if (cM01Fired == null) {
1115 cM01Fired = new JCheckBox();
1116 cM01Fired.setBounds(new Rectangle(10, 245, 75, 20));
1117 cM01Fired.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
1118 cM01Fired.setText(Messages.getString("SmpDialogAction.177")); //$NON-NLS-1$
1119 cM01Fired.addItemListener(new ItemListener() {
1120 public void itemStateChanged(ItemEvent e) {
1121 if (buoy == null) {
1122 return;
1123 }
1124 buoy.setFired(cM01Fired.isSelected());
1125 buoy.setLightColour();
1126 buoy.paintSign();
1127 }
1128 });
1129 }
1130
1131 return cM01Fired;
1132 }
1133
1134 private JComboBox getCbM01Kennung() {
1135 if (cbM01Kennung == null) {
1136 cbM01Kennung = new JComboBox();
1137 cbM01Kennung.setBounds(new Rectangle(305, 245, 70, 20));
1138 cbM01Kennung.addActionListener(new ActionListener() {
1139 public void actionPerformed(ActionEvent e) {
1140 int i1, i2;
1141 String g = "", c = ""; //$NON-NLS-1$ //$NON-NLS-2$
1142 String it = (String) cbM01Kennung.getSelectedItem();
1143
1144 if (it == null)
1145 return;
1146 if (it.compareTo("Not set") == 0) //$NON-NLS-1$
1147 return;
1148 if (buoy == null)
1149 return;
1150
1151 i1 = it.indexOf("("); //$NON-NLS-1$
1152 i2 = it.indexOf(")", i1); //$NON-NLS-1$
1153 tfM01Group.setText(""); //$NON-NLS-1$
1154 tfM01Group.setEnabled(false);
1155 if (i1 >= 0) {
1156 c = it.substring(0, i1);
1157 if (i1 >= 0) {
1158 g = it.substring(i1 + 1, i2);
1159 if (g.isEmpty()) //$NON-NLS-1$
1160 tfM01Group.setEnabled(true);
1161 }
1162 }
1163 if (it.contains("+")) { //$NON-NLS-1$
1164 i1 = it.indexOf("+"); //$NON-NLS-1$
1165 i2 = it.length();
1166 if (c.isEmpty()) //$NON-NLS-1$
1167 c = it;
1168 else
1169 c = c + it.substring(i1, i2);
1170 }
1171 if (c.isEmpty()) //$NON-NLS-1$
1172 c = it;
1173 buoy.setLightChar(c);
1174 buoy.setLightGroup(g);
1175 buoy.paintSign();
1176 }
1177 });
1178 }
1179 return cbM01Kennung;
1180 }
1181
1182 private JTextField getTfM01Height() {
1183 if (tfM01Height == null) {
1184 tfM01Height = new JTextField();
1185 tfM01Height.setBounds(new Rectangle(54, 270, 30, 20));
1186 tfM01Height.addFocusListener(new FocusAdapter() {
1187 public void focusLost(FocusEvent e) {
1188 buoy.setHeight(tfM01Height.getText().trim());
1189 }
1190 });
1191 }
1192 return tfM01Height;
1193 }
1194
1195 private JTextField getTfM01Range() {
1196 if (tfM01Range == null) {
1197 tfM01Range = new JTextField();
1198 tfM01Range.setBounds(new Rectangle(151, 270, 30, 20));
1199 tfM01Range.addFocusListener(new FocusAdapter() {
1200 public void focusLost(FocusEvent e) {
1201 buoy.setRange(tfM01Range.getText().trim());
1202 }
1203 });
1204 }
1205 return tfM01Range;
1206 }
1207
1208 private JTextField getTfM01Group() {
1209 if (tfM01Group == null) {
1210 tfM01Group = new JTextField();
1211 tfM01Group.setBounds(new Rectangle(255, 270, 30, 20));
1212 tfM01Group.addFocusListener(new FocusAdapter() {
1213 public void focusLost(FocusEvent e) {
1214 buoy.setLightGroup(tfM01Group.getText().trim());
1215 buoy.paintSign();
1216 }
1217 });
1218 }
1219 return tfM01Group;
1220 }
1221
1222 private JTextField getTfM01RepeatTime() {
1223 if (tfM01RepeatTime == null) {
1224 tfM01RepeatTime = new JTextField();
1225 tfM01RepeatTime.setBounds(new Rectangle(345, 270, 30, 20));
1226 tfM01RepeatTime.addActionListener(new ActionListener() {
1227 public void actionPerformed(ActionEvent e) {
1228 buoy.setLightPeriod(tfM01RepeatTime.getText().trim());
1229 buoy.paintSign();
1230 }
1231 });
1232
1233 tfM01RepeatTime.addFocusListener(new FocusAdapter() {
1234 public void focusLost(FocusEvent e) {
1235 buoy.setLightPeriod(tfM01RepeatTime.getText().trim());
1236 buoy.paintSign();
1237 }
1238 });
1239 }
1240 return tfM01RepeatTime;
1241 }
1242
1243 private JComboBox getCbM01Colour() {
1244 if (cbM01Colour == null) {
1245 cbM01Colour = new JComboBox();
1246 cbM01Colour.setBounds(new Rectangle(165, 295, 40, 20));
1247 cbM01Colour.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
1248 cbM01Colour.addItem(""); //$NON-NLS-1$
1249 cbM01Colour.addItem(Messages.getString("SmpDialogAction.190")); //$NON-NLS-1$
1250 cbM01Colour.addItem(Messages.getString("SmpDialogAction.191")); //$NON-NLS-1$
1251 cbM01Colour.addItem(Messages.getString("SmpDialogAction.192")); //$NON-NLS-1$
1252 cbM01Colour.addActionListener(new ActionListener() {
1253 public void actionPerformed(ActionEvent e) {
1254 buoy.setLightColour((String)cbM01Colour.getSelectedItem());
1255 buoy.paintSign();
1256 }
1257 });
1258 }
1259 return cbM01Colour;
1260 }
1261
1262 private JComboBox getCbM01Sector() {
1263 if (cbM01Sector == null) {
1264 cbM01Sector = new JComboBox();
1265 cbM01Sector.setBounds(new Rectangle(55, 295, 50, 20));
1266 cbM01Sector.setFont(new Font("Dialog", Font.PLAIN, 12)); //$NON-NLS-1$
1267 cbM01Sector.addItem(Messages.getString("SmpDialogAction.194")); //$NON-NLS-1$
1268 cbM01Sector.addItem(Messages.getString("SmpDialogAction.195")); //$NON-NLS-1$
1269 cbM01Sector.addItem(Messages.getString("SmpDialogAction.196")); //$NON-NLS-1$
1270 cbM01Sector.addItem(Messages.getString("SmpDialogAction.197")); //$NON-NLS-1$
1271 cbM01Sector.addItem(Messages.getString("SmpDialogAction.198")); //$NON-NLS-1$
1272 cbM01Sector.addItem(Messages.getString("SmpDialogAction.199")); //$NON-NLS-1$
1273 cbM01Sector.addItem(Messages.getString("SmpDialogAction.200")); //$NON-NLS-1$
1274 cbM01Sector.addItem(Messages.getString("SmpDialogAction.201")); //$NON-NLS-1$
1275 cbM01Sector.addItem(Messages.getString("SmpDialogAction.202")); //$NON-NLS-1$
1276 cbM01Sector.addItem(Messages.getString("SmpDialogAction.203")); //$NON-NLS-1$
1277 cbM01Sector.addActionListener(new ActionListener() {
1278 public void actionPerformed(ActionEvent e) {
1279 buoy.setSectorIndex(cbM01Sector.getSelectedIndex());
1280 buoy.paintSign();
1281 }
1282 });
1283 }
1284 return cbM01Sector;
1285 }
1286
1287 private JTextField getTfM01Bearing() {
1288 if (tfM01Bearing == null) {
1289 tfM01Bearing = new JTextField();
1290 tfM01Bearing.setBounds(new Rectangle(255, 295, 30, 20));
1291 tfM01Bearing.addFocusListener(new FocusAdapter() {
1292 public void focusLost(FocusEvent e) {
1293 }
1294 });
1295 }
1296 return tfM01Bearing;
1297 }
1298
1299 private JTextField getTfM02Bearing() {
1300 if (tfM02Bearing == null) {
1301 tfM02Bearing = new JTextField();
1302 tfM02Bearing.setBounds(new Rectangle(300, 295, 30, 20));
1303 tfM02Bearing.addFocusListener(new FocusAdapter() {
1304 public void focusLost(FocusEvent e) {
1305 }
1306 });
1307 }
1308 return tfM02Bearing;
1309 }
1310
1311 private JTextField getTfM01Radius() {
1312 if (tfM01Radius == null) {
1313 tfM01Radius = new JTextField();
1314 tfM01Radius.setBounds(new Rectangle(355, 295, 30, 20));
1315 tfM01Radius.addFocusListener(new FocusAdapter() {
1316 public void focusLost(FocusEvent e) {
1317 }
1318 });
1319 }
1320 return tfM01Radius;
1321 }
1322
1323 private JButton getBM01Close() {
1324 if (bM01Close == null) {
1325 bM01Close = new JButton();
1326 bM01Close.setBounds(new Rectangle(20, 325, 110, 20));
1327 bM01Close.setText(tr("Close"));
1328 bM01Close.addActionListener(new ActionListener() {
1329 public void actionPerformed(ActionEvent e) {
1330 // aufraeumen
1331 if (obuoy != null)
1332 PicRebuild();
1333 // Deaktivierung des Listeners
1334 DataSet.removeSelectionListener(SmpListener);
1335 Selection = null;
1336 SmpItem.setEnabled(true);
1337 onode = null;
1338
1339 dM01SeaMap.dispose();
1340 }
1341 });
1342 }
1343
1344 return bM01Close;
1345 }
1346
1347 private JButton getBM01Save() {
1348 if (bM01Save == null) {
1349 bM01Save = new JButton();
1350 bM01Save.setBounds(new Rectangle(150, 325, 110, 20));
1351 bM01Save.setText(tr("Save"));
1352 bM01Save.setEnabled(false);
1353
1354 bM01Save.addActionListener(new ActionListener() {
1355 public void actionPerformed(ActionEvent e) {
1356 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource(
1357 "/images/Auge.png"))); //$NON-NLS-1$
1358 cM01IconVisible.setSelected(true);
1359
1360 buoy.saveSign();
1361 }
1362 });
1363 }
1364
1365 return bM01Save;
1366 }
1367
1368 private JCheckBox getCM01IconVisible() {
1369 if (cM01IconVisible == null) {
1370 cM01IconVisible = new JCheckBox();
1371 cM01IconVisible.setBounds(new Rectangle(310, 325, 30, 21));
1372 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource(
1373 "/images/AugeN.png"))); //$NON-NLS-1$
1374 cM01IconVisible.setSelected(false);
1375 cM01IconVisible.addActionListener(new ActionListener() {
1376 public void actionPerformed(ActionEvent e) {
1377 Command c;
1378 Node n = null;
1379 DataSet ds = Main.main.getCurrentDataSet();
1380
1381 if (buoy != null)
1382 n = buoy.getNode();
1383
1384 if (cM01IconVisible.isSelected()) {
1385 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource(
1386 "/images/AugeN.png"))); //$NON-NLS-1$
1387 if (n != null) {
1388 // seamark loeschen, wenn notwendig
1389 if (n.getKeys().containsKey("seamark")) { //$NON-NLS-1$
1390 smb = n.getKeys().get("seamark"); // smb merken //$NON-NLS-1$
1391
1392 c = new ChangePropertyCommand(n, "seamark", null); //$NON-NLS-1$
1393 c.executeCommand();
1394 ds.fireSelectionChanged();
1395 obuoy = buoy;
1396 }
1397
1398 // seamark:type loeschen, wenn notwendig
1399 if (n.getKeys().containsKey("seamark:type")) { //$NON-NLS-1$
1400 smt = n.getKeys().get("seamark:type"); // smt merken //$NON-NLS-1$
1401
1402 c = new ChangePropertyCommand(n, "seamark:type", null); //$NON-NLS-1$
1403 c.executeCommand();
1404 ds.fireSelectionChanged();
1405 obuoy = buoy;
1406 }
1407
1408 }
1409 } else {
1410 cM01IconVisible.setIcon(new ImageIcon(getClass().getResource(
1411 "/images/Auge.png"))); //$NON-NLS-1$
1412 PicRebuild();
1413 obuoy = null;
1414 }
1415 buoy.paintSign();
1416 }
1417 });
1418 }
1419 return cM01IconVisible;
1420 }
1421
1422 private JTextField getSM01StatusBar() {
1423 if (sM01StatusBar == null) {
1424 sM01StatusBar = new JTextField();
1425 sM01StatusBar.setBounds(new Rectangle(7, 355, 385, 20));
1426 sM01StatusBar.setBackground(SystemColor.activeCaptionBorder);
1427 }
1428 return sM01StatusBar;
1429 }
1430
1431}
Note: See TracBrowser for help on using the repository browser.