Ignore:
Timestamp:
2014-10-19T01:27:04+02:00 (11 years ago)
Author:
donvip
Message:

[josm_plugins] fix java 7 warnings / global usage of try-with-resource

File:
1 edited

Legend:

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

    r30737 r30738  
    2424        private ActionListener alCat = new ActionListener() {
    2525                public void actionPerformed(java.awt.event.ActionEvent e) {
    26                         dlg.panelMain.mark.setObjPattern(Pat.HSTRP);
     26                        SmedAction.panelMain.mark.setObjPattern(Pat.HSTRP);
    2727                        if (northButton.isSelected()) {
    28                                 dlg.panelMain.mark.setCategory(Cat.CAM_NORTH);
    29                                 dlg.panelMain.mark.setObjColour(Col.BLACK);
    30                                 dlg.panelMain.mark.addObjColour(Col.YELLOW);
     28                                SmedAction.panelMain.mark.setCategory(Cat.CAM_NORTH);
     29                                SmedAction.panelMain.mark.setObjColour(Col.BLACK);
     30                                SmedAction.panelMain.mark.addObjColour(Col.YELLOW);
    3131                                northButton.setBorderPainted(true);
    3232                        } else {
     
    3434                        }
    3535                        if (southButton.isSelected()) {
    36                                 dlg.panelMain.mark.setCategory(Cat.CAM_SOUTH);
    37                                 dlg.panelMain.mark.setObjColour(Col.YELLOW);
    38                                 dlg.panelMain.mark.addObjColour(Col.BLACK);
     36                                SmedAction.panelMain.mark.setCategory(Cat.CAM_SOUTH);
     37                                SmedAction.panelMain.mark.setObjColour(Col.YELLOW);
     38                                SmedAction.panelMain.mark.addObjColour(Col.BLACK);
    3939                                southButton.setBorderPainted(true);
    4040                        } else {
     
    4242                        }
    4343                        if (eastButton.isSelected()) {
    44                                 dlg.panelMain.mark.setCategory(Cat.CAM_EAST);
    45                                 dlg.panelMain.mark.setObjColour(Col.BLACK);
    46                                 dlg.panelMain.mark.addObjColour(Col.YELLOW);
    47                                 dlg.panelMain.mark.addObjColour(Col.BLACK);
     44                                SmedAction.panelMain.mark.setCategory(Cat.CAM_EAST);
     45                                SmedAction.panelMain.mark.setObjColour(Col.BLACK);
     46                                SmedAction.panelMain.mark.addObjColour(Col.YELLOW);
     47                                SmedAction.panelMain.mark.addObjColour(Col.BLACK);
    4848                                eastButton.setBorderPainted(true);
    4949                        } else {
     
    5151                        }
    5252                        if (westButton.isSelected()) {
    53                                 dlg.panelMain.mark.setCategory(Cat.CAM_WEST);
    54                                 dlg.panelMain.mark.setObjColour(Col.YELLOW);
    55                                 dlg.panelMain.mark.addObjColour(Col.BLACK);
    56                                 dlg.panelMain.mark.addObjColour(Col.YELLOW);
     53                                SmedAction.panelMain.mark.setCategory(Cat.CAM_WEST);
     54                                SmedAction.panelMain.mark.setObjColour(Col.YELLOW);
     55                                SmedAction.panelMain.mark.addObjColour(Col.BLACK);
     56                                SmedAction.panelMain.mark.addObjColour(Col.YELLOW);
    5757                                westButton.setBorderPainted(true);
    5858                        } else {
     
    6060                        }
    6161                        if (isolButton.isSelected()) {
    62                                 dlg.panelMain.mark.setCategory(Cat.NOCAT);
    63                                 dlg.panelMain.mark.setObjColour(Col.BLACK);
    64                                 dlg.panelMain.mark.addObjColour(Col.RED);
    65                                 dlg.panelMain.mark.addObjColour(Col.BLACK);
     62                                SmedAction.panelMain.mark.setCategory(Cat.NOCAT);
     63                                SmedAction.panelMain.mark.setObjColour(Col.BLACK);
     64                                SmedAction.panelMain.mark.addObjColour(Col.RED);
     65                                SmedAction.panelMain.mark.addObjColour(Col.BLACK);
    6666                                isolButton.setBorderPainted(true);
    6767                        } else {
    6868                                isolButton.setBorderPainted(false);
    6969                        }
    70                         topmarkButton.setVisible(dlg.panelMain.mark.testValid());
    71                         lightButton.setVisible(dlg.panelMain.mark.testValid());
    72                         dlg.panelMain.panelMore.syncPanel();
     70                        topmarkButton.setVisible(SmedAction.panelMain.mark.testValid());
     71                        lightButton.setVisible(SmedAction.panelMain.mark.testValid());
     72                        SmedAction.panelMain.panelMore.syncPanel();
    7373                }
    7474        };
     
    9090                                JRadioButton button = shapes.get(shp);
    9191                                if (button.isSelected()) {
    92                                         dlg.panelMain.mark.setShape(shp);
     92                                        SmedAction.panelMain.mark.setShape(shp);
    9393                                        if (isolButton.isSelected())
    94                                                 dlg.panelMain.mark.setObject(isdObjects.get(shp));
     94                                                SmedAction.panelMain.mark.setObject(isdObjects.get(shp));
    9595                                        else
    96                                                 dlg.panelMain.mark.setObject(carObjects.get(shp));
     96                                                SmedAction.panelMain.mark.setObject(carObjects.get(shp));
    9797                                        button.setBorderPainted(true);
    9898                                } else
    9999                                        button.setBorderPainted(false);
    100100                        }
    101                         topmarkButton.setVisible(dlg.panelMain.mark.testValid());
    102                         lightButton.setVisible(dlg.panelMain.mark.testValid());
     101                        topmarkButton.setVisible(SmedAction.panelMain.mark.testValid());
     102                        lightButton.setVisible(SmedAction.panelMain.mark.testValid());
    103103                }
    104104        };
     
    107107                public void actionPerformed(java.awt.event.ActionEvent e) {
    108108                        if (topmarkButton.isSelected()) {
    109                                 dlg.panelMain.mark.setTopPattern(Pat.NOPAT);
    110                                 dlg.panelMain.mark.setTopColour(Col.BLACK);
    111                                 switch (dlg.panelMain.mark.getCategory()) {
     109                                SmedAction.panelMain.mark.setTopPattern(Pat.NOPAT);
     110                                SmedAction.panelMain.mark.setTopColour(Col.BLACK);
     111                                switch (SmedAction.panelMain.mark.getCategory()) {
    112112                                case CAM_NORTH:
    113                                         dlg.panelMain.mark.setTopmark(Top.NORTH);
     113                                        SmedAction.panelMain.mark.setTopmark(Top.NORTH);
    114114                                        break;
    115115                                case CAM_SOUTH:
    116                                         dlg.panelMain.mark.setTopmark(Top.SOUTH);
     116                                        SmedAction.panelMain.mark.setTopmark(Top.SOUTH);
    117117                                        break;
    118118                                case CAM_EAST:
    119                                         dlg.panelMain.mark.setTopmark(Top.EAST);
     119                                        SmedAction.panelMain.mark.setTopmark(Top.EAST);
    120120                                        break;
    121121                                case CAM_WEST:
    122                                         dlg.panelMain.mark.setTopmark(Top.WEST);
     122                                        SmedAction.panelMain.mark.setTopmark(Top.WEST);
    123123                                        break;
    124124                                default:
    125                                         dlg.panelMain.mark.setTopmark(Top.SPHERES2);
     125                                        SmedAction.panelMain.mark.setTopmark(Top.SPHERES2);
    126126                                        break;
    127127                                }
    128128                                topmarkButton.setBorderPainted(true);
    129129                        } else {
    130                                 dlg.panelMain.mark.setTopmark(Top.NOTOP);
    131                                 dlg.panelMain.mark.setTopPattern(Pat.NOPAT);
    132                                 dlg.panelMain.mark.setTopColour(Col.UNKCOL);
     130                                SmedAction.panelMain.mark.setTopmark(Top.NOTOP);
     131                                SmedAction.panelMain.mark.setTopPattern(Pat.NOPAT);
     132                                SmedAction.panelMain.mark.setTopColour(Col.UNKCOL);
    133133                                topmarkButton.setBorderPainted(false);
    134134                        }
    135                         dlg.panelMain.panelTop.syncPanel();
     135                        SmedAction.panelMain.panelTop.syncPanel();
    136136                }
    137137        };
     
    140140                public void actionPerformed(java.awt.event.ActionEvent e) {
    141141                        if (lightButton.isSelected()) {
    142                                 dlg.panelMain.mark.setLightAtt(Att.COL, 0, Col.WHITE);
    143                                 switch (dlg.panelMain.mark.getCategory()) {
     142                                SmedAction.panelMain.mark.setLightAtt(Att.COL, 0, Col.WHITE);
     143                                switch (SmedAction.panelMain.mark.getCategory()) {
    144144                                case CAM_NORTH:
    145                                         dlg.panelMain.mark.setLightAtt(Att.CHR, 0, "Q");
    146                                         dlg.panelMain.mark.setLightAtt(Att.GRP, 0, "");
     145                                        SmedAction.panelMain.mark.setLightAtt(Att.CHR, 0, "Q");
     146                                        SmedAction.panelMain.mark.setLightAtt(Att.GRP, 0, "");
    147147                                        break;
    148148                                case CAM_SOUTH:
    149                                         dlg.panelMain.mark.setLightAtt(Att.CHR, 0, "Q+LFl");
    150                                         dlg.panelMain.mark.setLightAtt(Att.GRP, 0, "6");
     149                                        SmedAction.panelMain.mark.setLightAtt(Att.CHR, 0, "Q+LFl");
     150                                        SmedAction.panelMain.mark.setLightAtt(Att.GRP, 0, "6");
    151151                                        break;
    152152                                case CAM_EAST:
    153                                         dlg.panelMain.mark.setLightAtt(Att.CHR, 0, "Q");
    154                                         dlg.panelMain.mark.setLightAtt(Att.GRP, 0, "3");
     153                                        SmedAction.panelMain.mark.setLightAtt(Att.CHR, 0, "Q");
     154                                        SmedAction.panelMain.mark.setLightAtt(Att.GRP, 0, "3");
    155155                                        break;
    156156                                case CAM_WEST:
    157                                         dlg.panelMain.mark.setLightAtt(Att.CHR, 0, "Q");
    158                                         dlg.panelMain.mark.setLightAtt(Att.GRP, 0, "9");
     157                                        SmedAction.panelMain.mark.setLightAtt(Att.CHR, 0, "Q");
     158                                        SmedAction.panelMain.mark.setLightAtt(Att.GRP, 0, "9");
    159159                                        break;
    160160                                default:
    161                                         dlg.panelMain.mark.setLightAtt(Att.CHR, 0, "Fl");
    162                                         dlg.panelMain.mark.setLightAtt(Att.GRP, 0, "2");
     161                                        SmedAction.panelMain.mark.setLightAtt(Att.CHR, 0, "Fl");
     162                                        SmedAction.panelMain.mark.setLightAtt(Att.GRP, 0, "2");
    163163                                        break;
    164164                                }
    165165                                lightButton.setBorderPainted(true);
    166166                        } else {
    167                                 dlg.panelMain.mark.clrLight();
     167                                SmedAction.panelMain.mark.clrLight();
    168168                                lightButton.setBorderPainted(false);
    169169                        }
    170                         dlg.panelMain.panelLit.syncPanel();
     170                        SmedAction.panelMain.panelLit.syncPanel();
    171171                }
    172172        };
     
    205205
    206206        public void syncPanel() {
    207                 northButton.setBorderPainted(dlg.panelMain.mark.getCategory() == Cat.CAM_NORTH);
    208                 southButton.setBorderPainted(dlg.panelMain.mark.getCategory() == Cat.CAM_SOUTH);
    209                 eastButton.setBorderPainted(dlg.panelMain.mark.getCategory() == Cat.CAM_EAST);
    210                 westButton.setBorderPainted(dlg.panelMain.mark.getCategory() == Cat.CAM_WEST);
    211                 isolButton.setBorderPainted(SeaMark.GrpMAP.get(dlg.panelMain.mark.getObject()) == Grp.ISD);
     207                northButton.setBorderPainted(SmedAction.panelMain.mark.getCategory() == Cat.CAM_NORTH);
     208                southButton.setBorderPainted(SmedAction.panelMain.mark.getCategory() == Cat.CAM_SOUTH);
     209                eastButton.setBorderPainted(SmedAction.panelMain.mark.getCategory() == Cat.CAM_EAST);
     210                westButton.setBorderPainted(SmedAction.panelMain.mark.getCategory() == Cat.CAM_WEST);
     211                isolButton.setBorderPainted(SeaMark.GrpMAP.get(SmedAction.panelMain.mark.getObject()) == Grp.ISD);
    212212                for (Shp shp : shapes.keySet()) {
    213213                        JRadioButton button = shapes.get(shp);
    214                         button.setBorderPainted(dlg.panelMain.mark.getShape() == shp);
    215                 }
    216                 topmarkButton.setBorderPainted(dlg.panelMain.mark.getTopmark() != Top.NOTOP);
    217                 topmarkButton.setSelected(dlg.panelMain.mark.getTopmark() != Top.NOTOP);
    218                 topmarkButton.setVisible(dlg.panelMain.mark.testValid());
    219                 Boolean lit = (dlg.panelMain.mark.getLightAtt(Att.COL, 0) != Col.UNKCOL) && !((String)dlg.panelMain.mark.getLightAtt(Att.CHR, 0)).isEmpty();
     214                        button.setBorderPainted(SmedAction.panelMain.mark.getShape() == shp);
     215                }
     216                topmarkButton.setBorderPainted(SmedAction.panelMain.mark.getTopmark() != Top.NOTOP);
     217                topmarkButton.setSelected(SmedAction.panelMain.mark.getTopmark() != Top.NOTOP);
     218                topmarkButton.setVisible(SmedAction.panelMain.mark.testValid());
     219                Boolean lit = (SmedAction.panelMain.mark.getLightAtt(Att.COL, 0) != Col.UNKCOL) && !((String)SmedAction.panelMain.mark.getLightAtt(Att.CHR, 0)).isEmpty();
    220220                lightButton.setBorderPainted(lit);
    221221                lightButton.setSelected(lit);
    222                 lightButton.setVisible(dlg.panelMain.mark.testValid());
     222                lightButton.setVisible(SmedAction.panelMain.mark.testValid());
    223223        }
    224224
Note: See TracChangeset for help on using the changeset viewer.