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