Ignore:
Timestamp:
2010-09-21T13:35:12+02:00 (14 years ago)
Author:
malcolmh
Message:

break

Location:
applications/editors/josm/plugins/toms/src/toms
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/toms/src/toms/dialogs/SmpDialogAction.java

    r23287 r23295  
    383383                        type = keys.get("seamark:type"); //$NON-NLS-1$
    384384
    385                 if (type.equals("buoy_lateral") || type.equals("beacon_lateral") //$NON-NLS-1$ //$NON-NLS-2$
    386                                 || keys.containsKey("seamark:buoy_lateral:category") //$NON-NLS-1$
    387                                 || keys.containsKey("seamark:buoy_lateral:shape") //$NON-NLS-1$
    388                                 || keys.containsKey("seamark:buoy_lateral:colour") //$NON-NLS-1$
    389                                 || keys.containsKey("seamark:beacon_lateral:category") //$NON-NLS-1$
    390                                 || keys.containsKey("seamark:beacon_lateral:shape") //$NON-NLS-1$
    391                                 || keys.containsKey("seamark:beacon_lateral:colour")) { //$NON-NLS-1$
     385                if (type.equals("buoy_lateral") || type.equals("beacon_lateral")) { //$NON-NLS-1$ //$NON-NLS-2$
    392386                        buoy = new BuoyLat(this, node);
    393387                        return;
    394388
    395                 } else if (type.equals("buoy_cardinal") || type.equals("beacon_cardinal") //$NON-NLS-1$ //$NON-NLS-2$
    396                                 || keys.containsKey("seamark:buoy_cardinal:category") //$NON-NLS-1$
    397                                 || keys.containsKey("seamark:buoy_cardinal:shape") //$NON-NLS-1$
    398                                 || keys.containsKey("seamark:buoy_cardinal:colour") //$NON-NLS-1$
    399                                 || keys.containsKey("seamark:beacon_cardinal:category") //$NON-NLS-1$
    400                                 || keys.containsKey("seamark:beacon_cardinal:shape") //$NON-NLS-1$
    401                                 || keys.containsKey("seamark:beacon_cardinal:colour")) { //$NON-NLS-1$
     389                } else if (type.equals("buoy_cardinal") || type.equals("beacon_cardinal")) { //$NON-NLS-1$ //$NON-NLS-2$
    402390                        buoy = new BuoyCard(this, node);
    403391                        return;
    404392
    405                 } else if (type.equals("buoy_safe_water") //$NON-NLS-1$
    406                                 || type.equals("beacon_safe_water") //$NON-NLS-1$
    407                                 || keys.containsKey("seamark:buoy_safe_water:shape") //$NON-NLS-1$
    408                                 || keys.containsKey("seamark:buoy_safe_water:colour") //$NON-NLS-1$
    409                                 || keys.containsKey("seamark:beacon_safe_water:shape") //$NON-NLS-1$
    410                                 || keys.containsKey("seamark:beacon_safe_water:colour")) { //$NON-NLS-1$
     393                } else if (type.equals("buoy_safe_water") || type.equals("beacon_safe_water")) { //$NON-NLS-1$
    411394                        buoy = new BuoySaw(this, node);
    412395                        return;
    413396
    414                 } else if (type.equals("buoy_special_purpose") //$NON-NLS-1$
    415                                 || type.equals("beacon_special_purpose") //$NON-NLS-1$
    416                                 || keys.containsKey("seamark:buoy_special_purpose:shape") //$NON-NLS-1$
    417                                 || keys.containsKey("seamark:buoy_special_purpose:colour") //$NON-NLS-1$
    418                                 || keys.containsKey("seamark:beacon_special_purpose:shape") //$NON-NLS-1$
    419                                 || keys.containsKey("seamark:beacon_special_purpose:colour")) { //$NON-NLS-1$
     397                } else if (type.equals("buoy_special_purpose") || type.equals("beacon_special_purpose")) { //$NON-NLS-1$
    420398                        buoy = new BuoySpec(this, node);
    421399                        return;
    422400
    423                 } else if (type.equals("buoy_isolated_danger") //$NON-NLS-1$
    424                                 || type.equals("beacon_isolated_danger") //$NON-NLS-1$
    425                                 || keys.containsKey("seamark:buoy_isolated_danger:shape") //$NON-NLS-1$
    426                                 || keys.containsKey("seamark:buoy_isolated_danger:colour") //$NON-NLS-1$
    427                                 || keys.containsKey("seamark:beacon_isolated_danger:shape") //$NON-NLS-1$
    428                                 || keys.containsKey("seamark:beacon_isolated_danger:colour")) { //$NON-NLS-1$
     401                } else if (type.equals("buoy_isolated_danger") || type.equals("beacon_isolated_danger")) { //$NON-NLS-1$
    429402                        buoy = new BuoyIsol(this, node);
    430403                        return;
     
    470443                                }
    471444                        }
     445                }
     446
     447                if (keys.containsKey("buoy_lateral:category") || keys.containsKey("beacon_lateral:category")) { //$NON-NLS-1$ //$NON-NLS-2$
     448                        buoy = new BuoyLat(this, node);
     449                        return;
     450                } else if (keys.containsKey("buoy_cardinal:category") || keys.containsKey("beacon_cardinal:category")) { //$NON-NLS-1$ //$NON-NLS-2$
     451                        buoy = new BuoyCard(this, node);
     452                        return;
     453                } else if (keys.containsKey("buoy_isolated_danger:category") || keys.containsKey("beacon_isolated_danger:category")) { //$NON-NLS-1$ //$NON-NLS-2$
     454                        buoy = new BuoyIsol(this, node);
     455                        return;
     456                } else if (keys.containsKey("buoy_safe_water:category") || keys.containsKey("beacon_safe_water:category")) { //$NON-NLS-1$ //$NON-NLS-2$
     457                        buoy = new BuoySaw(this, node);
     458                        return;
     459                } else if (keys.containsKey("buoy_special_purpose:category") || keys.containsKey("beacon_special_purpose:category")) { //$NON-NLS-1$ //$NON-NLS-2$
     460                        buoy = new BuoySpec(this, node);
     461                        return;
     462                }
     463
     464                if (keys.containsKey("buoy_lateral:shape") || keys.containsKey("beacon_lateral:shape")) { //$NON-NLS-1$ //$NON-NLS-2$
     465                        buoy = new BuoyLat(this, node);
     466                        return;
     467                } else if (keys.containsKey("buoy_cardinal:shape") || keys.containsKey("beacon_cardinal:shape")) { //$NON-NLS-1$ //$NON-NLS-2$
     468                        buoy = new BuoyCard(this, node);
     469                        return;
     470                } else if (keys.containsKey("buoy_isolated_danger:shape") || keys.containsKey("beacon_isolated_danger:shape")) { //$NON-NLS-1$ //$NON-NLS-2$
     471                        buoy = new BuoyIsol(this, node);
     472                        return;
     473                } else if (keys.containsKey("buoy_safe_water:shape") || keys.containsKey("beacon_safe_water:shape")) { //$NON-NLS-1$ //$NON-NLS-2$
     474                        buoy = new BuoySaw(this, node);
     475                        return;
     476                } else if (keys.containsKey("buoy_special_purpose:shape") || keys.containsKey("beacon_special_purpose:shape")) { //$NON-NLS-1$ //$NON-NLS-2$
     477                        buoy = new BuoySpec(this, node);
     478                        return;
     479                }
     480
     481                if (keys.containsKey("buoy_lateral:colour") || keys.containsKey("beacon_lateral:colour")) { //$NON-NLS-1$ //$NON-NLS-2$
     482                        buoy = new BuoyLat(this, node);
     483                        return;
     484                } else if (keys.containsKey("buoy_cardinal:colour") || keys.containsKey("beacon_cardinal:colour")) { //$NON-NLS-1$ //$NON-NLS-2$
     485                        buoy = new BuoyCard(this, node);
     486                        return;
     487                } else if (keys.containsKey("buoy_isolated_danger:colour") || keys.containsKey("beacon_isolated_danger:colour")) { //$NON-NLS-1$ //$NON-NLS-2$
     488                        buoy = new BuoyIsol(this, node);
     489                        return;
     490                } else if (keys.containsKey("buoy_safe_water:colour") || keys.containsKey("beacon_safe_water:colour")) { //$NON-NLS-1$ //$NON-NLS-2$
     491                        buoy = new BuoySaw(this, node);
     492                        return;
     493                } else if (keys.containsKey("buoy_special_purpose:colour") || keys.containsKey("beacon_special_purpose:colour")) { //$NON-NLS-1$ //$NON-NLS-2$
     494                        buoy = new BuoySpec(this, node);
     495                        return;
    472496                }
    473497
     
    877901                        cbM01CatOfMark.addActionListener(new ActionListener() {
    878902                                public void actionPerformed(ActionEvent e) {
    879                                         int cat = cbM01CatOfMark.getSelectedIndex();
    880 
    881                                         if (buoy == null) {
    882                                                 buoy = new BuoyUkn(dia, Messages.getString("SmpDialogAction.150")); //$NON-NLS-1$
    883                                                 buoy.paintSign();
    884                                                 return;
    885                                         }
    886 
    887                                         Node n = buoy.getNode();
    888                                         if (n == null)
    889                                                 return;
    890 
    891                                         buoy.setBuoyIndex(cat);
     903                                        if (buoy == null)
     904                                                return;
     905                                        buoy.setBuoyIndex(cbM01CatOfMark.getSelectedIndex());
    892906                                        buoy.refreshStyles();
    893907                                        buoy.refreshLights();
     
    907921                        cbM01StyleOfMark.addActionListener(new ActionListener() {
    908922                                public void actionPerformed(ActionEvent e) {
    909                                         int style = cbM01StyleOfMark.getSelectedIndex();
    910                                         if (buoy != null && style != buoy.getStyleIndex()) {
    911                                                 buoy.setStyleIndex(style);
    912                                                 buoy.refreshLights();
    913                                                 buoy.setLightColour();
    914                                                 buoy.paintSign();
    915                                         }
     923                                        if (buoy == null)
     924                                                return;
     925                                        buoy.setStyleIndex(cbM01StyleOfMark.getSelectedIndex());
     926                                        buoy.refreshLights();
     927                                        buoy.setLightColour();
     928                                        buoy.paintSign();
    916929                                }
    917930                        });
     
    926939                        tfM01Name.addFocusListener(new FocusAdapter() {
    927940                                public void focusLost(FocusEvent e) {
     941                                        if (buoy == null)
     942                                                return;
    928943                                        buoy.setName(tfM01Name.getText());
    929944                                        buoy.paintSign();
     
    942957                        cM01TopMark.addItemListener(new ItemListener() {
    943958                                public void itemStateChanged(ItemEvent e) {
    944                                         if (buoy == null) {
    945                                                 return;
    946                                         }
     959                                        if (buoy == null)
     960                                                return;
    947961                                        buoy.setTopMark(cM01TopMark.isSelected());
    948962                                        buoy.paintSign();
     
    960974                        cbM01TopMark.addActionListener(new ActionListener() {
    961975                                public void actionPerformed(ActionEvent e) {
     976                                        if (buoy == null)
     977                                                return;
    962978                                        buoy.setTopMarkIndex(cbM01TopMark.getSelectedIndex());
    963979                                        buoy.paintSign();
     
    976992                        cM01Radar.addActionListener(new ActionListener() {
    977993                                public void actionPerformed(ActionEvent e) {
     994                                        if (buoy == null)
     995                                                return;
    978996                                        if (cM01Radar.isSelected()) {
    979997                                                buoy.setRadar(true);
     
    9981016                        cM01Racon.addActionListener(new ActionListener() {
    9991017                                public void actionPerformed(ActionEvent e) {
     1018                                        if (buoy == null)
     1019                                                return;
    10001020                                        if (cM01Racon.isSelected()) {
    10011021                                                buoy.setRacon(true);
     
    10241044                        cbM01Racon.addActionListener(new ActionListener() {
    10251045                                public void actionPerformed(ActionEvent e) {
     1046                                        if (buoy == null)
     1047                                                return;
    10261048                                        int rac = cbM01Racon.getSelectedIndex();
    10271049                                        buoy.setRaType(rac);
     
    10391061                        tfM01Racon.addFocusListener(new FocusAdapter() {
    10401062                                public void focusLost(FocusEvent e) {
     1063                                        if (buoy == null)
     1064                                                return;
    10411065                                        buoy.setRaconGroup(tfM01Racon.getText().trim());
    10421066                                        buoy.paintSign();
     
    10551079                        cM01Fog.addActionListener(new ActionListener() {
    10561080                                public void actionPerformed(ActionEvent e) {
     1081                                        if (buoy == null)
     1082                                                return;
    10571083                                        buoy.setFog(cM01Fog.isSelected());
    10581084                                        buoy.paintSign();
     
    10791105                        cbM01Fog.addActionListener(new ActionListener() {
    10801106                                public void actionPerformed(ActionEvent e) {
     1107                                        if (buoy == null)
     1108                                                return;
    10811109                                        if (cbM01Fog.getSelectedIndex() > 0)
    10821110                                                buoy.setFogSound(cbM01Fog.getSelectedIndex());
     
    10961124                        tfM01FogGroup.addFocusListener(new FocusAdapter() {
    10971125                                public void focusLost(FocusEvent e) {
     1126                                        if (buoy == null)
     1127                                                return;
    10981128                                        buoy.setFogGroup(tfM01FogGroup.getText().trim());
    10991129                                        buoy.paintSign();
     
    11101140                        tfM01FogPeriod.addFocusListener(new FocusAdapter() {
    11111141                                public void focusLost(FocusEvent e) {
     1142                                        if (buoy == null)
     1143                                                return;
    11121144                                        buoy.setFogPeriod(tfM01FogPeriod.getText().trim());
    11131145                                        buoy.paintSign();
     
    11791211                        tfM01Height.addFocusListener(new FocusAdapter() {
    11801212                                public void focusLost(FocusEvent e) {
     1213                                        if (buoy == null)
     1214                                                return;
    11811215                                        buoy.setHeight(tfM01Height.getText().trim());
    11821216                                        buoy.paintSign();
     
    11931227                        tfM01Range.addFocusListener(new FocusAdapter() {
    11941228                                public void focusLost(FocusEvent e) {
     1229                                        if (buoy == null)
     1230                                                return;
    11951231                                        buoy.setRange(tfM01Range.getText().trim());
    11961232                                        buoy.paintSign();
     
    12071243                        tfM01Group.addFocusListener(new FocusAdapter() {
    12081244                                public void focusLost(FocusEvent e) {
     1245                                        if (buoy == null)
     1246                                                return;
    12091247                                        buoy.setLightGroup(tfM01Group.getText().trim());
    12101248                                        buoy.paintSign();
     
    12211259                        tfM01RepeatTime.addActionListener(new ActionListener() {
    12221260                                public void actionPerformed(ActionEvent e) {
     1261                                        if (buoy == null)
     1262                                                return;
    12231263                                        buoy.setLightPeriod(tfM01RepeatTime.getText().trim());
    12241264                                        buoy.paintSign();
     
    12281268                        tfM01RepeatTime.addFocusListener(new FocusAdapter() {
    12291269                                public void focusLost(FocusEvent e) {
     1270                                        if (buoy == null)
     1271                                                return;
    12301272                                        buoy.setLightPeriod(tfM01RepeatTime.getText().trim());
    12311273                                        buoy.paintSign();
     
    12471289                        cbM01Colour.addActionListener(new ActionListener() {
    12481290                                public void actionPerformed(ActionEvent e) {
     1291                                        if (buoy == null)
     1292                                                return;
    12491293                                        buoy.setLightColour((String) cbM01Colour.getSelectedItem());
    12501294                                        buoy.paintSign();
     
    12721316                        cbM01Sector.addActionListener(new ActionListener() {
    12731317                                public void actionPerformed(ActionEvent e) {
     1318                                        if (buoy == null)
     1319                                                return;
    12741320                                        buoy.setSectorIndex(cbM01Sector.getSelectedIndex());
    12751321                                        buoy.paintSign();
     
    12861332                        tfM01Bearing.addFocusListener(new FocusAdapter() {
    12871333                                public void focusLost(FocusEvent e) {
     1334                                        if (buoy == null)
     1335                                                return;
    12881336                                        buoy.setBearing1(tfM01Bearing.getText().trim());
    12891337                                }
     
    13121360                        tfM01Radius.addFocusListener(new FocusAdapter() {
    13131361                                public void focusLost(FocusEvent e) {
     1362                                        if (buoy == null)
     1363                                                return;
    13141364                                        buoy.setRadius(tfM01Radius.getText().trim());
    13151365                                }
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyCard.java

    r23269 r23295  
    2121                super(dia);
    2222
     23System.out.println("new");
    2324                String str;
    2425                Map<String, String> keys;
     
    2728
    2829                resetMask();
     30                dlg.cbM01TypeOfMark.setSelectedIndex(CARDINAL);
     31
    2932                dlg.cbM01CatOfMark.removeAllItems();
    3033                dlg.cbM01CatOfMark.addItem(Messages.getString("SmpDialogAction.157")); //$NON-NLS-1$
     
    4750                dlg.cbM01StyleOfMark.setVisible(true);
    4851                dlg.lM01StyleOfMark.setVisible(true);
    49 
    50                 dlg.cbM01TypeOfMark.setSelectedIndex(CARDINAL);
    5152
    5253                setRegion(Main.pref.get("tomsplugin.IALA").equals("B")); //$NON-NLS-1$ //$NON-NLS-2$
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyIsol.java

    r23269 r23295  
    2626
    2727                resetMask();
    28 
    2928                dlg.cbM01TypeOfMark.setSelectedIndex(ISOLATED_DANGER);
    3029
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyLat.java

    r23269 r23295  
    2525
    2626                resetMask();
     27                dlg.cbM01TypeOfMark.setSelectedIndex(LATERAL);
    2728
    2829                dlg.cbM01CatOfMark.removeAllItems();
     
    4748                dlg.cbM01StyleOfMark.addItem(Messages.getString("Buoy.07")); //$NON-NLS-1$
    4849                dlg.cbM01StyleOfMark.setEnabled(true);
    49 
    50                 dlg.cbM01TypeOfMark.setSelectedIndex(LATERAL);
    5150
    5251                if (keys.containsKey("name")) //$NON-NLS-1$
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySaw.java

    r23270 r23295  
    2626
    2727                resetMask();
    28 
    2928                dlg.cbM01TypeOfMark.setSelectedIndex(SAFE_WATER);
    3029
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySpec.java

    r23287 r23295  
    2626
    2727                resetMask();
    28 
    2928                dlg.cbM01TypeOfMark.setSelectedIndex(SPECIAL_PURPOSE);
    3029
Note: See TracChangeset for help on using the changeset viewer.