Changeset 32911 in osm for applications/editors


Ignore:
Timestamp:
2016-09-03T16:57:32+02:00 (8 years ago)
Author:
donvip
Message:

fix some error-prone warnings

Location:
applications/editors/josm/plugins/smed/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed/src/panels/PanelSectors.java

    r32767 r32911  
    278278    }
    279279
    280     public class ColourCellRenderer extends JPanel implements TableCellRenderer {
     280    public static class ColourCellRenderer extends JPanel implements TableCellRenderer {
    281281        private JLabel col1Label;
    282282        private JLabel col2Label;
  • applications/editors/josm/plugins/smed/src/seamarks/SeaMark.java

    r32767 r32911  
    5858    private String name = "";
    5959
     60    @Override
    6061    public String getName() {
    6162        return name;
    6263    }
    6364
     65    @Override
    6466    public void setName(String str) {
    6567        name = str.trim();
    6668        repaint();
    6769    }
    68    
     70
    6971    public enum Obj {
    7072        UNKOBJ, BCNCAR, BCNISD, BCNLAT, BCNSAW, BCNSPP,
     
    235237        ROS_PCOM, ROS_COMB, ROS_FACS, ROS_TIME, ROS_PAIS, ROS_SAIS, ROS_VAIS, ROS_VANC, ROS_VASC, ROS_VAEC, ROS_VAWC, ROS_VAPL, ROS_VASL, ROS_VAID, ROS_VASW, ROS_VASP, ROS_VAWK
    236238    }
    237          
     239
    238240    public static final EnumMap<Cat, String> CatSTR = new EnumMap<>(Cat.class);
    239241    static {
     
    321323        CatSTR.put(Cat.OFP_OIL, "oil");
    322324        CatSTR.put(Cat.OFP_PRD,  "production");
    323         CatSTR.put(Cat.OFP_OBS, "observation"); 
     325        CatSTR.put(Cat.OFP_OBS, "observation");
    324326        CatSTR.put(Cat.OFP_ALP, "alp");
    325327        CatSTR.put(Cat.OFP_SALM, "salm");
     
    374376        CatSTR.put(Cat.ROS_VASW, "v-ais_safe_water");
    375377        CatSTR.put(Cat.ROS_VASP, "v-ais_special_purpose");
    376         CatSTR.put(Cat.ROS_VAWK, "v-ais_wreck"); 
     378        CatSTR.put(Cat.ROS_VAWK, "v-ais_wreck");
    377379        CatSTR.put(Cat.NTC_A1, "no_entry");
    378380        CatSTR.put(Cat.NTC_A1a, "closed_area");
     
    519521
    520522    public void setColour(Ent ent, Col col) {
    521         if (ent == Ent.BODY)
     523        if (ent == Ent.BODY) {
    522524            setObjColour(col);
    523         else
     525        } else {
    524526            setTopColour(col);
     527        }
    525528    }
    526529
    527530    public void setColour(Ent ent, int idx, Col col) {
    528         if (ent == Ent.BODY)
     531        if (ent == Ent.BODY) {
    529532            setObjColour(idx, col);
    530         else
     533        } else {
    531534            setTopColour(idx, col);
     535        }
    532536    }
    533537
    534538    public void addColour(Ent ent, int idx, Col col) {
    535         if (ent == Ent.BODY)
     539        if (ent == Ent.BODY) {
    536540            addObjColour(idx, col);
    537         else
     541        } else {
    538542            addTopColour(idx, col);
     543        }
    539544    }
    540545
    541546    public void subColour(Ent ent, int idx) {
    542         if (ent == Ent.BODY)
     547        if (ent == Ent.BODY) {
    543548            subObjColour(idx);
    544         else
     549        } else {
    545550            subTopColour(idx);
     551        }
    546552    }
    547553
     
    562568
    563569    public void setObjColour(int i, Col col) {
    564         if (i < bodyColour.size())
     570        if (i < bodyColour.size()) {
    565571            bodyColour.set(i, col);
     572        }
    566573        repaint();
    567574    }
    568575
    569576    public void addObjColour(int i, Col col) {
    570         if (bodyColour.size() >= i)
     577        if (bodyColour.size() >= i) {
    571578            bodyColour.add(i, col);
     579        }
    572580        repaint();
    573581    }
     
    579587
    580588    public void subObjColour(int i) {
    581         if (bodyColour.size() > i)
     589        if (bodyColour.size() > i) {
    582590            bodyColour.remove(i);
     591        }
    583592        repaint();
    584593    }
     
    600609
    601610    public void setTopColour(int i, Col col) {
    602         if (topmarkColour.size() > i)
     611        if (topmarkColour.size() > i) {
    603612            topmarkColour.set(i, col);
     613        }
    604614        repaint();
    605615    }
    606616
    607617    public void addTopColour(int i, Col col) {
    608         if (topmarkColour.size() >= i)
     618        if (topmarkColour.size() >= i) {
    609619            topmarkColour.add(i, col);
     620        }
    610621        repaint();
    611622    }
     
    617628
    618629    public void subTopColour(int i) {
    619         if (topmarkColour.size() > i)
     630        if (topmarkColour.size() > i) {
    620631            topmarkColour.remove(i);
     632        }
    621633        repaint();
    622634    }
     
    746758
    747759    public void setLightAtt(int att, int i, Object obj) {
    748         if (sectors.size() == i)
     760        if (sectors.size() == i) {
    749761            addLight(i);
    750         if (sectors.size() > i)
     762        }
     763        if (sectors.size() > i) {
    751764            switch (att) {
    752765            case 4:
     
    764777                sectors.get(i)[att] = obj;
    765778            }
     779        }
    766780        repaint();
    767781    }
     
    769783    public void addLight(int i) {
    770784        if (sectors.size() >= i) {
    771             if (sectors.size() == 0)
     785            if (sectors.size() == 0) {
    772786                sectors.add(sector.clone());
    773             else
     787            } else {
    774788                sectors.add(i, sectors.get(0).clone());
     789            }
    775790        }
    776791    }
     
    785800
    786801    public void addLight() {
    787         if (sectors.size() == 0)
     802        if (sectors.size() == 0) {
    788803            sectors.add(sector.clone());
    789         else
     804        } else {
    790805            sectors.add(sectors.get(0).clone());
     806        }
    791807    }
    792808
    793809    public void delLight(int i) {
    794         if (sectors.size() > i)
     810        if (sectors.size() > i) {
    795811            sectors.remove(i);
     812        }
    796813        repaint();
    797814    }
     
    827844
    828845    public void setPattern(Ent ent, Pat pat) {
    829         if (ent == Ent.BODY)
     846        if (ent == Ent.BODY) {
    830847            setObjPattern(pat);
    831         else
     848        } else {
    832849            setTopPattern(pat);
     850        }
    833851    }
    834852
     
    11661184
    11671185    public enum Fnc {
    1168       UNKFNC, HMO, CSTM, HLTH, HOSP, POFF, HOTEL, RWSTA, POLICE, WPOL, PILO, PILL, BANK, DCHQ, TRNS, FACT, PWRS, ADMIN, EDUC, CHCH, CHPL,
    1169       TMPL, PGDA, SHSH, BTMP, MOSQ, MRBT, LOOK, COMS, TV, RADO, RADR, LSUP, MWAV, COOL, OBSV, TIMB, CLK, CTRL, AMOR, STAD, BUSS,
    1170       PRHB, RGLN, RSTN, RCMD, INFO
     1186        UNKFNC, HMO, CSTM, HLTH, HOSP, POFF, HOTEL, RWSTA, POLICE, WPOL, PILO, PILL, BANK, DCHQ, TRNS, FACT, PWRS, ADMIN, EDUC, CHCH, CHPL,
     1187        TMPL, PGDA, SHSH, BTMP, MOSQ, MRBT, LOOK, COMS, TV, RADO, RADR, LSUP, MWAV, COOL, OBSV, TIMB, CLK, CTRL, AMOR, STAD, BUSS,
     1188        PRHB, RGLN, RSTN, RCMD, INFO
    11711189    }
    11721190
     
    13231341        case BOYCAR:
    13241342        case BOYLAT:
    1325             if ((getCategory() != Cat.NOCAT) && (getShape() != Shp.UNKSHP))
     1343            if ((getCategory() != Cat.NOCAT) && (getShape() != Shp.UNKSHP)) {
    13261344                tmp = true;
     1345            }
    13271346            break;
    13281347        case BCNISD:
     
    13321351        case BOYSAW:
    13331352        case BOYSPP:
    1334             if (getShape() != Shp.UNKSHP)
     1353            if (getShape() != Shp.UNKSHP) {
    13351354                tmp = true;
     1355            }
    13361356            break;
    13371357        case FLTCAR:
     
    13401360        case FLTSAW:
    13411361        case FLTSPP:
    1342             if (getObjColour(0) != Col.UNKCOL)
     1362            if (getObjColour(0) != Col.UNKCOL) {
    13431363                tmp = true;
     1364            }
    13441365            break;
    13451366        case LITMAJ:
     
    13571378        case RDOSTA:
    13581379        case RADSTA:
    1359              tmp = true;
     1380            tmp = true;
    13601381            break;
    13611382        case NOTMRK:
    1362             if (getCategory() != Cat.NOCAT)
     1383            if (getCategory() != Cat.NOCAT) {
    13631384                tmp = true;
     1385            }
    13641386        case LNDMRK:
    1365             if ((getCategory() != Cat.NOCAT) || (getFunc() != Fnc.UNKFNC))
     1387            if ((getCategory() != Cat.NOCAT) || (getFunc() != Fnc.UNKFNC)) {
    13661388                tmp = true;
     1389            }
    13671390            break;
    13681391        }
     
    14221445    public String validDecimal(String str, float max) {
    14231446        str = validDecimal(str);
    1424         if (!(str.isEmpty()) && (new Float(str) > max)) {
     1447        if (!(str.isEmpty()) && (Float.valueOf(str) > max)) {
    14251448            PanelMain.messageBar.setText(Messages.getString("TooBig") + " (" + max + ")");
    14261449            return "";
     
    14341457        PanelMain.messageBar.setText("");
    14351458        String str = Main.pref.get("smedplugin.IALA");
    1436         if (str.equals("C"))
     1459        if (str.equals("C")) {
    14371460            setRegion(Reg.C);
    1438         else if (str.equals("B"))
     1461        } else if (str.equals("B")) {
    14391462            setRegion(Reg.B);
    1440         else
     1463        } else {
    14411464            setRegion(Reg.A);
     1465        }
    14421466
    14431467        Map<String, String> keys = node.getKeys();
    14441468
    14451469        str = "";
    1446         if (keys.containsKey("seamark:type"))
     1470        if (keys.containsKey("seamark:type")) {
    14471471            str = keys.get("seamark:type");
     1472        }
    14481473
    14491474        clrMark();
     
    14721497            setName(str);
    14731498        }
    1474        
     1499
    14751500        for (Obj obj : ObjSTR.keySet()) {
    14761501            if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":category")) {
     
    14991524        }
    15001525        if (getShape() == Shp.UNKSHP) {
    1501             if (EntMAP.get(getObject()) == Ent.BUOY)
     1526            if (EntMAP.get(getObject()) == Ent.BUOY) {
    15021527                setShape(Shp.BUOY);
    1503             if (EntMAP.get(getObject()) == Ent.BEACON)
     1528            }
     1529            if (EntMAP.get(getObject()) == Ent.BEACON) {
    15041530                setShape(Shp.BEACON);
     1531            }
    15051532            if (EntMAP.get(getObject()) == Ent.LFLOAT)
    1506                 if (getObject() == Obj.LITVES)
     1533                if (getObject() == Obj.LITVES) {
    15071534                    setShape(Shp.SUPER);
    1508                 else
     1535                } else {
    15091536                    setShape(Shp.FLOAT);
     1537                }
    15101538        }
    15111539
     
    16541682            if (keys.containsKey("seamark:" + ObjSTR.get(obj) + ":system")) {
    16551683                str = keys.get("seamark:" + ObjSTR.get(obj) + ":system");
    1656                 if (str.equals("iala-a"))
     1684                if (str.equals("iala-a")) {
    16571685                    setRegion(Reg.A);
    1658                 else if (str.equals("iala-b"))
     1686                } else if (str.equals("iala-b")) {
    16591687                    setRegion(Reg.B);
    1660                 else
     1688                } else {
    16611689                    setRegion(Reg.C);
     1690                }
    16621691            } else if (GrpMAP.get(object) == Grp.LAT) {
    16631692                switch (getCategory()) {
    16641693                case LAM_PORT:
    16651694                    if (getObjColour(0) == Col.RED) {
    1666                         if (getObjColour(1) == Col.WHITE)
     1695                        if (getObjColour(1) == Col.WHITE) {
    16671696                            setRegion(Reg.C);
    1668                         else
     1697                        } else {
    16691698                            setRegion(Reg.A);
    1670                     }
    1671                     if (getObjColour(0) == Col.GREEN)
     1699                        }
     1700                    }
     1701                    if (getObjColour(0) == Col.GREEN) {
    16721702                        setRegion(Reg.B);
     1703                    }
    16731704                    break;
    16741705                case LAM_PPORT:
    16751706                    if (getObjColour(0) == Col.RED) {
    1676                         if (getObjColour(3) == Col.GREEN)
     1707                        if (getObjColour(3) == Col.GREEN) {
    16771708                            setRegion(Reg.C);
    1678                         else
     1709                        } else {
    16791710                            setRegion(Reg.B);
    1680                     }
    1681                     if (getObjColour(0) == Col.GREEN)
     1711                        }
     1712                    }
     1713                    if (getObjColour(0) == Col.GREEN) {
    16821714                        setRegion(Reg.A);
     1715                    }
    16831716                    break;
    16841717                case LAM_STBD:
    16851718                    if (getObjColour(0) == Col.GREEN) {
    1686                         if (getObjColour(1) == Col.WHITE)
     1719                        if (getObjColour(1) == Col.WHITE) {
    16871720                            setRegion(Reg.C);
    1688                         else
     1721                        } else {
    16891722                            setRegion(Reg.A);
    1690                     }
    1691                     if (getObjColour(0) == Col.RED)
     1723                        }
     1724                    }
     1725                    if (getObjColour(0) == Col.RED) {
    16921726                        setRegion(Reg.B);
     1727                    }
    16931728                    break;
    16941729                case LAM_PSTBD:
    1695                     if (getObjColour(0) == Col.GREEN)
     1730                    if (getObjColour(0) == Col.GREEN) {
    16961731                        setRegion(Reg.B);
     1732                    }
    16971733                    if (getObjColour(0) == Col.RED) {
    1698                         if (getObjColour(3) == Col.GREEN)
     1734                        if (getObjColour(3) == Col.GREEN) {
    16991735                            setRegion(Reg.C);
    1700                         else
     1736                        } else {
    17011737                            setRegion(Reg.A);
     1738                        }
    17021739                    }
    17031740                    break;
     
    17431780                    String strs[] = str.split(";");
    17441781                    for (Col col : ColSTR.keySet())
    1745                         if ((strs.length > 1) && ColSTR.get(col).equals(strs[1]))
     1782                        if ((strs.length > 1) && ColSTR.get(col).equals(strs[1])) {
    17461783                            setLightAtt(Att.ALT, i, col);
     1784                        }
    17471785                    str = strs[0];
    17481786                }
    17491787                for (Col col : ColSTR.keySet())
    1750                     if (ColSTR.get(col).equals(str))
     1788                    if (ColSTR.get(col).equals(str)) {
    17511789                        setLightAtt(Att.COL, i, col);
     1790                    }
    17521791            }
    17531792            if (keys.containsKey("seamark:light" + secStr + ":character")) {
     
    17581797                    setLightAtt(Att.GRP, i, str.substring((i1+1), i2));
    17591798                    str = str.substring(0, i1) + str.substring((i2+1), str.length());
    1760                     }
     1799                }
    17611800                setLightAtt(Att.CHR, i, str);
    17621801            }
    1763             if (keys.containsKey("seamark:light" + secStr + ":group"))
     1802            if (keys.containsKey("seamark:light" + secStr + ":group")) {
    17641803                setLightAtt(Att.GRP, i, keys.get("seamark:light" + secStr + ":group"));
    1765             if (keys.containsKey("seamark:light" + secStr + ":sequence"))
     1804            }
     1805            if (keys.containsKey("seamark:light" + secStr + ":sequence")) {
    17661806                setLightAtt(Att.SEQ, i, keys.get("seamark:light" + secStr + ":sequence"));
    1767             if (keys.containsKey("seamark:light" + secStr + ":period"))
     1807            }
     1808            if (keys.containsKey("seamark:light" + secStr + ":period")) {
    17681809                setLightAtt(Att.PER, i, keys.get("seamark:light" + secStr + ":period"));
     1810            }
    17691811            if (keys.containsKey("seamark:light" + secStr + ":category")) {
    17701812                str = keys.get("seamark:light" + secStr + ":category");
    1771                 if (str.equals("vert"))
     1813                if (str.equals("vert")) {
    17721814                    str = "vertical";
    1773                 if (str.equals("horiz"))
     1815                }
     1816                if (str.equals("horiz")) {
    17741817                    str = "horizontal";
     1818                }
    17751819                for (Lit lit : LitSTR.keySet())
    1776                     if (LitSTR.get(lit).equals(str))
     1820                    if (LitSTR.get(lit).equals(str)) {
    17771821                        setLightAtt(Att.LIT, i, lit);
    1778             }
    1779             if (keys.containsKey("seamark:light" + secStr + ":sector_start"))
     1822                    }
     1823            }
     1824            if (keys.containsKey("seamark:light" + secStr + ":sector_start")) {
    17801825                setLightAtt(Att.BEG, i, keys.get("seamark:light" + secStr + ":sector_start"));
    1781             if (keys.containsKey("seamark:light" + secStr + ":sector_end"))
     1826            }
     1827            if (keys.containsKey("seamark:light" + secStr + ":sector_end")) {
    17821828                setLightAtt(Att.END, i, keys.get("seamark:light" + secStr + ":sector_end"));
    1783             if (keys.containsKey("seamark:light" + secStr + ":radius"))
     1829            }
     1830            if (keys.containsKey("seamark:light" + secStr + ":radius")) {
    17841831                setLightAtt(Att.RAD, i, keys.get("seamark:light" + secStr + ":radius"));
    1785             if (keys.containsKey("seamark:light" + secStr + ":height"))
     1832            }
     1833            if (keys.containsKey("seamark:light" + secStr + ":height")) {
    17861834                setLightAtt(Att.HGT, i, keys.get("seamark:light" + secStr + ":height"));
    1787             if (keys.containsKey("seamark:light" + secStr + ":range"))
     1835            }
     1836            if (keys.containsKey("seamark:light" + secStr + ":range")) {
    17881837                setLightAtt(Att.RNG, i, keys.get("seamark:light" + secStr + ":range"));
     1838            }
    17891839            if (keys.containsKey("seamark:light" + secStr + ":visibility")) {
    17901840                str = keys.get("seamark:light" + secStr + ":visibility");
    17911841                for (Vis vis : VisSTR.keySet())
    1792                     if (VisSTR.get(vis).equals(str))
     1842                    if (VisSTR.get(vis).equals(str)) {
    17931843                        setLightAtt(Att.VIS, i, vis);
     1844                    }
    17941845            }
    17951846            if (keys.containsKey("seamark:light" + secStr + ":exhibition")) {
    17961847                str = keys.get("seamark:light" + secStr + ":exhibition");
    17971848                for (Exh exh : ExhSTR.keySet())
    1798                     if (ExhSTR.get(exh).equals(str))
     1849                    if (ExhSTR.get(exh).equals(str)) {
    17991850                        setLightAtt(Att.EXH, i, exh);
    1800             }
    1801             if (keys.containsKey("seamark:light" + secStr + ":orientation"))
     1851                    }
     1852            }
     1853            if (keys.containsKey("seamark:light" + secStr + ":orientation")) {
    18021854                setLightAtt(Att.ORT, i, keys.get("seamark:light" + secStr + ":orientation"));
    1803             if (keys.containsKey("seamark:light" + secStr + ":multiple"))
     1855            }
     1856            if (keys.containsKey("seamark:light" + secStr + ":multiple")) {
    18041857                setLightAtt(Att.MLT, i, keys.get("seamark:light" + secStr + ":multiple"));
    1805            
    1806             if (sectors.size() == i)
    1807                 break;
     1858            }
     1859
     1860            if (sectors.size() == i) {
     1861                break;
     1862            }
    18081863        }
    18091864
     
    19542009    }
    19552010
     2011    @Override
    19562012    public void paintComponent(Graphics g) {
    19572013        super.paintComponent(g);
    1958        
     2014
    19592015        if (dlg.node == null) return;
    1960        
    1961     Graphics2D g2 = (Graphics2D) g;
    1962    
    1963     String colStr;
     2016
     2017        Graphics2D g2 = (Graphics2D) g;
     2018
     2019        String colStr;
    19642020        String lblStr;
    19652021        String imgStr = "/images/";
     
    21182174                    break;
    21192175                case LMK_TOWR:
    2120                     if ((getFunc() == Fnc.CHCH) || (getFunc() == Fnc.CHPL))
     2176                    if ((getFunc() == Fnc.CHCH) || (getFunc() == Fnc.CHPL)) {
    21212177                        imgStr += "ChurchTower";
    2122                     else
     2178                    } else {
    21232179                        imgStr += "LandTower";
     2180                    }
    21242181                    break;
    21252182                case LMK_WNDM:
     
    21302187                    break;
    21312188                case LMK_DOME:
    2132                     if ((getFunc() == Fnc.CHCH) || (getFunc() == Fnc.CHPL))
     2189                    if ((getFunc() == Fnc.CHCH) || (getFunc() == Fnc.CHPL)) {
    21332190                        imgStr += "ChurchDome";
    2134                     else
     2191                    } else {
    21352192                        imgStr += "Dome";
     2193                    }
    21362194                    break;
    21372195                case LMK_SPIR:
    2138                     if ((getFunc() == Fnc.CHCH) || (getFunc() == Fnc.CHPL))
     2196                    if ((getFunc() == Fnc.CHCH) || (getFunc() == Fnc.CHPL)) {
    21392197                        imgStr += "ChurchSpire";
    2140                     else
     2198                    } else {
    21412199                        imgStr += "Spire";
     2200                    }
    21422201                    break;
    21432202                case LMK_MNRT:
     
    21992258                break;
    22002259            case OFSPLF:
    2201                 if (getCategory() == Cat.OFP_FPSO)
     2260                if (getCategory() == Cat.OFP_FPSO) {
    22022261                    imgStr += "Storage";
    2203                 else
     2262                } else {
    22042263                    imgStr += "Platform";
     2264                }
    22052265                break;
    22062266            case MORFAC:
     
    23882448
    23892449        for (int i = 1; i < sectors.size(); i++) {
    2390         g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    2391         g2.setStroke(new BasicStroke(6.0f));
    2392         if (!((String)getLightAtt(Att.BEG, i)).isEmpty() && !((String)getLightAtt(Att.END, i)).isEmpty()) {
     2450            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
     2451            g2.setStroke(new BasicStroke(6.0f));
     2452            if (!((String)getLightAtt(Att.BEG, i)).isEmpty() && !((String)getLightAtt(Att.END, i)).isEmpty()) {
    23932453                if (getLightAtt(Att.COL, i) != Col.UNKCOL) {
    23942454                    g2.setPaint(ColMAP.get(getLightAtt(Att.COL, i)));
     
    24052465                    g2.draw(new Arc2D.Double(17, 20, 130, 130, a0, da, Arc2D.OPEN));
    24062466                }
    2407         } else if ((getLightAtt(Att.LIT, i) == Lit.DIR) && !((String)getLightAtt(Att.ORT, i)).isEmpty()) {
     2467            } else if ((getLightAtt(Att.LIT, i) == Lit.DIR) && !((String)getLightAtt(Att.ORT, i)).isEmpty()) {
    24082468                if (getLightAtt(Att.COL, i) != Col.UNKCOL) {
    24092469                    g2.setPaint(ColMAP.get(getLightAtt(Att.COL, i)));
     
    24182478                    g2.draw(new Arc2D.Double(17, 20, 130, 130, a0, da, Arc2D.OPEN));
    24192479                }
    2420         }
    2421         }
    2422     g2.setPaint(Color.BLACK);
     2480            }
     2481        }
     2482        g2.setPaint(Color.BLACK);
    24232483        if ((getLightAtt(Att.COL, 0) != Col.UNKCOL) || !(((String)getLightAtt(Att.CHR, 0)).isEmpty())) {
    24242484            if (sectors.size() == 1) {
     
    24512511                    c += "(" + (String) getLightAtt(Att.GRP, 0) + ")";
    24522512                }
    2453                 if (tmp != null)
     2513                if (tmp != null) {
    24542514                    c += tmp;
    2455             } else if (!((String) getLightAtt(Att.GRP, 0)).isEmpty())
     2515                }
     2516            } else if (!((String) getLightAtt(Att.GRP, 0)).isEmpty()) {
    24562517                c += "(" + (String) getLightAtt(Att.GRP, 0) + ")";
     2518            }
    24572519            switch ((Col) getLightAtt(Att.COL, 0)) {
    24582520            case WHITE:
     
    25082570            }
    25092571            tmp = (String) getLightAtt(Att.MLT, 0);
    2510             if (!tmp.isEmpty())
     2572            if (!tmp.isEmpty()) {
    25112573                c = tmp + c;
     2574            }
    25122575            if (getLightAtt(Att.LIT, 0) != Lit.UNKLIT) {
    25132576                switch ((Lit)getLightAtt(Att.LIT, 0)) {
     
    25162579                    break;
    25172580                case HORIZ:
    2518                         c += "(Horiz)";
    2519                         break;
     2581                    c += "(Horiz)";
     2582                    break;
    25202583                }
    25212584            }
    25222585            tmp = (String) getLightAtt(Att.PER, 0);
    2523             if (!tmp.isEmpty())
     2586            if (!tmp.isEmpty()) {
    25242587                c += " " + tmp + "s";
     2588            }
    25252589            g2.drawString(c, 100, 70);
    25262590        }
     
    25292593            g2.drawImage(new ImageIcon(getClass().getResource("/images/Fog_Signal.png")).getImage(), 7, -15, null);
    25302594            String str = "";
    2531             if (getFogSound() != Fog.FOGSIG)
     2595            if (getFogSound() != Fog.FOGSIG) {
    25322596                switch (getFogSound()) {
    25332597                case HORN:
     
    25532617                    break;
    25542618                }
    2555             if (!getFogGroup().isEmpty())
     2619            }
     2620            if (!getFogGroup().isEmpty()) {
    25562621                str += ("(" + getFogGroup() + ")");
    2557             else
     2622            } else {
    25582623                str += " ";
    2559             if (!getFogPeriod().isEmpty())
     2624            }
     2625            if (!getFogPeriod().isEmpty()) {
    25602626                str += getFogPeriod() + "s";
     2627            }
    25612628            g2.drawString(str, 0, 70);
    25622629        }
     
    25682635                g2.drawImage(new ImageIcon(getClass().getResource("/images/Radar_Station.png")).getImage(), 7, -15, null);
    25692636                String str = "";
    2570                 if (getRadar() == Rtb.RAMARK)
     2637                if (getRadar() == Rtb.RAMARK) {
    25712638                    str += "Ramark";
    2572                 else
     2639                } else {
    25732640                    str += "Racon";
    2574                 if (!getRaconGroup().isEmpty())
     2641                }
     2642                if (!getRaconGroup().isEmpty()) {
    25752643                    str += ("(" + getRaconGroup() + ")");
    2576                 else
     2644                } else {
    25772645                    str += " ";
    2578                 if (!getRaconPeriod().isEmpty())
     2646                }
     2647                if (!getRaconPeriod().isEmpty()) {
    25792648                    str += getRaconPeriod() + "s";
     2649                }
    25802650                g2.drawString(str, 0, 50);
    25812651            }
     
    25892659
    25902660    public void saveSign(OsmPrimitive node) {
    2591        
     2661
    25922662        if (getObject() != Obj.UNKOBJ) {
    25932663
     
    25952665
    25962666            for (String str : node.getKeys().keySet()) {
    2597                 if (str.trim().matches("^seamark:\\S+"))
     2667                if (str.trim().matches("^seamark:\\S+")) {
    25982668                    Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null));
    2599             }
    2600 
    2601             if (!getName().isEmpty())
     2669                }
     2670            }
     2671
     2672            if (!getName().isEmpty()) {
    26022673                Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:name", getName()));
     2674            }
    26032675
    26042676            String objStr = ObjSTR.get(object);
     
    26082680                if (getShape() != Shp.FLOAT) {
    26092681                    String str = CatSTR.get(getCategory());
    2610                     if (str != null)
     2682                    if (str != null) {
    26112683                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":category", str));
    2612                     if ((getShape() != Shp.BUOY) && (getShape() != Shp.BEACON))
     2684                    }
     2685                    if ((getShape() != Shp.BUOY) && (getShape() != Shp.BEACON)) {
    26132686                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":shape", ShpSTR.get(getShape())));
     2687                    }
    26142688                }
    26152689
     
    26562730            if (getTopmark() != Top.NOTOP) {
    26572731                Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:shape", TopSTR.get(getTopmark())));
    2658                 if (getTopPattern() != Pat.NOPAT)
     2732                if (getTopPattern() != Pat.NOPAT) {
    26592733                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:colour_pattern", PatSTR.get(getTopPattern())));
     2734                }
    26602735                if (getTopColour(0) != Col.UNKCOL) {
    26612736                    String str = ColSTR.get(getTopColour(0));
     
    26702745                String secStr = (i == 0) ? "" : (":" + Integer.toString(i));
    26712746                if (sectors.get(i)[0] != Col.UNKCOL)
    2672                     if ((sectors.get(i)[15] != Col.UNKCOL) && ((String)sectors.get(i)[1]).contains("Al"))
     2747                    if ((sectors.get(i)[15] != Col.UNKCOL) && ((String)sectors.get(i)[1]).contains("Al")) {
    26732748                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":colour", (ColSTR.get(sectors.get(i)[0])) + ";" + ColSTR.get(sectors.get(i)[15])));
    2674                     else
     2749                    } else {
    26752750                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":colour", ColSTR.get(sectors.get(i)[0])));
    2676                 if (!((String) sectors.get(i)[1]).isEmpty())
     2751                    }
     2752                if (!((String) sectors.get(i)[1]).isEmpty()) {
    26772753                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":character", (String) sectors.get(i)[1]));
    2678                 else if (!((String) sectors.get(0)[1]).isEmpty())
     2754                } else if (!((String) sectors.get(0)[1]).isEmpty()) {
    26792755                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":character", (String) sectors.get(0)[1]));
    2680                 if (!((String) sectors.get(i)[2]).isEmpty())
     2756                }
     2757                if (!((String) sectors.get(i)[2]).isEmpty()) {
    26812758                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":group", (String) sectors.get(i)[2]));
    2682                 else if (!((String) sectors.get(0)[2]).isEmpty())
     2759                } else if (!((String) sectors.get(0)[2]).isEmpty()) {
    26832760                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":group", (String) sectors.get(0)[2]));
    2684                 if (!((String) sectors.get(i)[3]).isEmpty())
     2761                }
     2762                if (!((String) sectors.get(i)[3]).isEmpty()) {
    26852763                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sequence", (String) sectors.get(i)[3]));
    2686                 else if (!((String) sectors.get(0)[3]).isEmpty())
     2764                } else if (!((String) sectors.get(0)[3]).isEmpty()) {
    26872765                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sequence", (String) sectors.get(0)[3]));
    2688                 if (!((String) sectors.get(i)[4]).isEmpty())
     2766                }
     2767                if (!((String) sectors.get(i)[4]).isEmpty()) {
    26892768                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":period", (String) sectors.get(i)[4]));
    2690                 else if (!((String) sectors.get(0)[4]).isEmpty())
     2769                } else if (!((String) sectors.get(0)[4]).isEmpty()) {
    26912770                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":period", (String) sectors.get(0)[4]));
    2692                 if (sectors.get(i)[5] != Lit.UNKLIT)
     2771                }
     2772                if (sectors.get(i)[5] != Lit.UNKLIT) {
    26932773                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":category", LitSTR.get(sectors.get(i)[5])));
    2694                 else if (sectors.get(0)[5] != Lit.UNKLIT)
     2774                } else if (sectors.get(0)[5] != Lit.UNKLIT) {
    26952775                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":category", LitSTR.get(sectors.get(0)[5])));
    2696                 if (!((String) sectors.get(i)[6]).isEmpty())
     2776                }
     2777                if (!((String) sectors.get(i)[6]).isEmpty()) {
    26972778                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_start", (String) sectors.get(i)[6]));
    2698                 if (!((String) sectors.get(i)[7]).isEmpty())
     2779                }
     2780                if (!((String) sectors.get(i)[7]).isEmpty()) {
    26992781                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_end", (String) sectors.get(i)[7]));
    2700                 if (!((String) sectors.get(i)[8]).isEmpty())
     2782                }
     2783                if (!((String) sectors.get(i)[8]).isEmpty()) {
    27012784                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":radius", (String) sectors.get(i)[8]));
    2702                 else if (!((String) sectors.get(0)[8]).isEmpty())
     2785                } else if (!((String) sectors.get(0)[8]).isEmpty()) {
    27032786                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":radius", (String) sectors.get(0)[8]));
    2704                 if (!((String) sectors.get(i)[9]).isEmpty())
     2787                }
     2788                if (!((String) sectors.get(i)[9]).isEmpty()) {
    27052789                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":height", (String) sectors.get(i)[9]));
    2706                 else if (!((String) sectors.get(0)[9]).isEmpty())
     2790                } else if (!((String) sectors.get(0)[9]).isEmpty()) {
    27072791                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":height", (String) sectors.get(0)[9]));
    2708                 if (!((String) sectors.get(i)[10]).isEmpty())
     2792                }
     2793                if (!((String) sectors.get(i)[10]).isEmpty()) {
    27092794                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":range", (String) sectors.get(i)[10]));
    2710                 else if (!((String) sectors.get(0)[10]).isEmpty())
     2795                } else if (!((String) sectors.get(0)[10]).isEmpty()) {
    27112796                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":range", (String) sectors.get(0)[10]));
    2712                 if (sectors.get(i)[11] != Vis.UNKVIS)
     2797                }
     2798                if (sectors.get(i)[11] != Vis.UNKVIS) {
    27132799                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":visibility", VisSTR.get(sectors.get(i)[11])));
    2714                 else if (sectors.get(0)[11] != Vis.UNKVIS)
     2800                } else if (sectors.get(0)[11] != Vis.UNKVIS) {
    27152801                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":visibility", VisSTR.get(sectors.get(0)[11])));
    2716                 if (sectors.get(i)[12] != Exh.UNKEXH)
     2802                }
     2803                if (sectors.get(i)[12] != Exh.UNKEXH) {
    27172804                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":exhibition", ExhSTR.get(sectors.get(i)[12])));
    2718                 else if (sectors.get(0)[12] != Exh.UNKEXH)
     2805                } else if (sectors.get(0)[12] != Exh.UNKEXH) {
    27192806                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":exhibition", ExhSTR.get(sectors.get(0)[12])));
    2720                 if (!((String) sectors.get(i)[13]).isEmpty())
     2807                }
     2808                if (!((String) sectors.get(i)[13]).isEmpty()) {
    27212809                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":orientation", (String) sectors.get(i)[13]));
    2722                 if (!((String) sectors.get(i)[14]).isEmpty())
     2810                }
     2811                if (!((String) sectors.get(i)[14]).isEmpty()) {
    27232812                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":multiple", (String) sectors.get(i)[14]));
    2724                 else if (!((String) sectors.get(0)[14]).isEmpty())
     2813                } else if (!((String) sectors.get(0)[14]).isEmpty()) {
    27252814                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":multiple", (String) sectors.get(0)[14]));
     2815                }
    27262816            }
    27272817
    27282818            if (getFogSound() != Fog.NOFOG) {
    2729                 if (getFogSound() == Fog.FOGSIG)
     2819                if (getFogSound() == Fog.FOGSIG) {
    27302820                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal", "yes"));
    2731                 else
     2821                } else {
    27322822                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:category", FogSTR.get(getFogSound())));
     2823                }
    27332824                if (!getFogGroup().isEmpty()) {
    27342825                    Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:fog_signal:group", getFogGroup()));
  • applications/editors/josm/plugins/smed/src/smed/Smed.java

    r32767 r32911  
    1010
    1111    SmedAction dialog = new SmedAction();
    12    
     12
    1313    public Smed(PluginInformation info) {
    1414        super(info);
    1515        MainMenu.add(Main.main.menu.toolsMenu, dialog);
    1616    }
    17    
     17
     18    @Override
    1819    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
    1920        if (newFrame == null) {
  • applications/editors/josm/plugins/smed/src/smed/SmedAction.java

    r32767 r32911  
    4646    public void actionPerformed(ActionEvent arg0) {
    4747        SwingUtilities.invokeLater(new Runnable() {
     48            @Override
    4849            public void run() {
    49                 if (!isOpen)
     50                if (!isOpen) {
    5051                    createFrame();
    51                 else
     52                } else {
    5253                    editFrame.toFront();
     54                }
    5355                isOpen = true;
    5456            }
     
    6062        editFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    6163        editFrame.addWindowListener(new java.awt.event.WindowAdapter() {
     64            @Override
    6265            public void windowClosing(java.awt.event.WindowEvent e) {
    6366                closeDialog();
     
    9497
    9598        for (OsmPrimitive osm : selection) {
    96             nextNode = (OsmPrimitive) osm;
     99            nextNode = osm;
    97100            if (selection.size() == 1) {
    98101                if (nextNode.compareTo(node) != 0) {
Note: See TracChangeset for help on using the changeset viewer.