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

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

more of the same

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