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

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

sync

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