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/PanelSectors.java

    r30737 r30738  
    123123
    124124                public int getRowCount() {
    125                         if (dlg.panelMain == null)
     125                        if (SmedAction.panelMain == null)
    126126                                return 1;
    127127                        else
    128                                 return dlg.panelMain.mark.getSectorCount();
     128                                return SmedAction.panelMain.mark.getSectorCount();
    129129                }
    130130
     
    152152                                        return row;
    153153                        case 1:
    154                                 if (((String)dlg.panelMain.mark.getLightAtt(Att.CHR, row)).contains("Al")) {
    155                                         if (dlg.panelMain.mark.getLightAtt(Att.COL, row) == Col.UNKCOL) {
     154                                if (((String)SmedAction.panelMain.mark.getLightAtt(Att.CHR, row)).contains("Al")) {
     155                                        if (SmedAction.panelMain.mark.getLightAtt(Att.COL, row) == Col.UNKCOL) {
    156156                                                return Col.UNKCOL;
    157157                                        } else {
    158                                                 return dlg.panelMain.mark.getLightAtt(Att.ALT, row);
     158                                                return SmedAction.panelMain.mark.getLightAtt(Att.ALT, row);
    159159                                        }
    160160                                } else {
    161                                         return dlg.panelMain.mark.getLightAtt(Att.COL, row);
     161                                        return SmedAction.panelMain.mark.getLightAtt(Att.COL, row);
    162162                                }
    163163                        case 6:
    164                                 return (dlg.panelMain.mark.getLightAtt(Att.LIT, row) == Lit.DIR);
     164                                return (SmedAction.panelMain.mark.getLightAtt(Att.LIT, row) == Lit.DIR);
    165165                        case 7:
    166166                        case 8:
    167                                 if (dlg.panelMain.mark.getLightAtt(Att.LIT, row) == Lit.DIR)
    168                                         return dlg.panelMain.mark.getLightAtt(Att.ORT, row);
     167                                if (SmedAction.panelMain.mark.getLightAtt(Att.LIT, row) == Lit.DIR)
     168                                        return SmedAction.panelMain.mark.getLightAtt(Att.ORT, row);
    169169                                else
    170                                         return dlg.panelMain.mark.getLightAtt(col - 1, row);
     170                                        return SmedAction.panelMain.mark.getLightAtt(col - 1, row);
    171171                        case 12:
    172                                 return visibilities.get(dlg.panelMain.mark.getLightAtt(Att.VIS, row));
     172                                return visibilities.get(SmedAction.panelMain.mark.getLightAtt(Att.VIS, row));
    173173                        case 13:
    174                                 return exhibitions.get(dlg.panelMain.mark.getLightAtt(Att.EXH, row));
     174                                return exhibitions.get(SmedAction.panelMain.mark.getLightAtt(Att.EXH, row));
    175175                        default:
    176                                 return dlg.panelMain.mark.getLightAtt(col - 1, row);
     176                                return SmedAction.panelMain.mark.getLightAtt(col - 1, row);
    177177                        }
    178178                }
     
    184184                                        ImageIcon img = colours.get(colour);
    185185                                        if (img == value)
    186                                                 if (((String)dlg.panelMain.mark.getLightAtt(Att.CHR, row)).contains("Al")) {
    187                                                         if (((colour == Col.UNKCOL) && (dlg.panelMain.mark.getLightAtt(Att.ALT, row) == Col.UNKCOL))
    188                                                                         || (dlg.panelMain.mark.getLightAtt(Att.COL, row) == Col.UNKCOL)) {
    189                                                                 dlg.panelMain.mark.setLightAtt(Att.COL, row, colour);
     186                                                if (((String)SmedAction.panelMain.mark.getLightAtt(Att.CHR, row)).contains("Al")) {
     187                                                        if (((colour == Col.UNKCOL) && (SmedAction.panelMain.mark.getLightAtt(Att.ALT, row) == Col.UNKCOL))
     188                                                                        || (SmedAction.panelMain.mark.getLightAtt(Att.COL, row) == Col.UNKCOL)) {
     189                                                                SmedAction.panelMain.mark.setLightAtt(Att.COL, row, colour);
    190190                                                        } else {
    191                                                                 dlg.panelMain.mark.setLightAtt(Att.ALT, row, colour);
     191                                                                SmedAction.panelMain.mark.setLightAtt(Att.ALT, row, colour);
    192192                                                        }
    193193                                                } else {
    194                                                         dlg.panelMain.mark.setLightAtt(Att.COL, row, colour);
     194                                                        SmedAction.panelMain.mark.setLightAtt(Att.COL, row, colour);
    195195                                                }
    196196                                }
     
    200200                        case 10:
    201201                        case 11:
    202                                 dlg.panelMain.mark.setLightAtt(col - 1, row, value);
     202                                SmedAction.panelMain.mark.setLightAtt(col - 1, row, value);
    203203                                break;
    204204                        case 6:
    205205                                if ((Boolean) value == true) {
    206                                         dlg.panelMain.mark.setLightAtt(Att.LIT, row, Lit.DIR);
    207                                         dlg.panelMain.mark.setLightAtt(Att.BEG, row, "");
    208                                         dlg.panelMain.mark.setLightAtt(Att.END, row, "");
     206                                        SmedAction.panelMain.mark.setLightAtt(Att.LIT, row, Lit.DIR);
     207                                        SmedAction.panelMain.mark.setLightAtt(Att.BEG, row, "");
     208                                        SmedAction.panelMain.mark.setLightAtt(Att.END, row, "");
    209209                                } else {
    210                                         dlg.panelMain.mark.setLightAtt(Att.LIT, row, Lit.UNKLIT);
    211                                         dlg.panelMain.mark.setLightAtt(Att.ORT, row, "");
     210                                        SmedAction.panelMain.mark.setLightAtt(Att.LIT, row, Lit.UNKLIT);
     211                                        SmedAction.panelMain.mark.setLightAtt(Att.ORT, row, "");
    212212                                }
    213213                                break;
    214214                        case 7:
    215215                        case 8:
    216                                 if (dlg.panelMain.mark.getLightAtt(Att.LIT, row) == Lit.DIR) {
    217                                         dlg.panelMain.mark.setLightAtt(Att.ORT, row, value);
     216                                if (SmedAction.panelMain.mark.getLightAtt(Att.LIT, row) == Lit.DIR) {
     217                                        SmedAction.panelMain.mark.setLightAtt(Att.ORT, row, value);
    218218                                } else {
    219                                         dlg.panelMain.mark.setLightAtt(col - 1, row, value);
     219                                        SmedAction.panelMain.mark.setLightAtt(col - 1, row, value);
    220220                                }
    221221                                break;
     
    224224                                        String str = visibilities.get(vis);
    225225                                        if (str.equals(value))
    226                                                 dlg.panelMain.mark.setLightAtt(Att.VIS, row, vis);
     226                                                SmedAction.panelMain.mark.setLightAtt(Att.VIS, row, vis);
    227227                                }
    228228                                break;
     
    231231                                        String str = exhibitions.get(exh);
    232232                                        if (str.equals(value))
    233                                                 dlg.panelMain.mark.setLightAtt(Att.EXH, row, exh);
     233                                                SmedAction.panelMain.mark.setLightAtt(Att.EXH, row, exh);
    234234                                }
    235235                                break;
    236236                        default:
    237                                 dlg.panelMain.mark.setLightAtt(col - 1, row, value);
     237                                SmedAction.panelMain.mark.setLightAtt(col - 1, row, value);
    238238                        }
    239239                }
     
    261261                }
    262262                public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) {
    263                         if (!((String)dlg.panelMain.mark.getLightAtt(Att.CHR, rowIndex)).contains("Al")) {
    264                                 col2Label.setBackground(SeaMark.ColMAP.get(dlg.panelMain.mark.getLightAtt(Att.COL, rowIndex)));
     263                        if (!((String)SmedAction.panelMain.mark.getLightAtt(Att.CHR, rowIndex)).contains("Al")) {
     264                                col2Label.setBackground(SeaMark.ColMAP.get(SmedAction.panelMain.mark.getLightAtt(Att.COL, rowIndex)));
    265265                        } else {
    266                                 col2Label.setBackground(SeaMark.ColMAP.get(dlg.panelMain.mark.getLightAtt(Att.ALT, rowIndex)));
    267                         }
    268                         col1Label.setBackground(SeaMark.ColMAP.get(dlg.panelMain.mark.getLightAtt(Att.COL, rowIndex)));
     266                                col2Label.setBackground(SeaMark.ColMAP.get(SmedAction.panelMain.mark.getLightAtt(Att.ALT, rowIndex)));
     267                        }
     268                        col1Label.setBackground(SeaMark.ColMAP.get(SmedAction.panelMain.mark.getLightAtt(Att.COL, rowIndex)));
    269269                        return this;
    270270                }
     
    276276
    277277        public void addSector(int idx) {
    278                 dlg.panelMain.mark.addLight(idx);
     278                SmedAction.panelMain.mark.addLight(idx);
    279279                table.setSize(860, ((table.getRowCount() * 16) + 28));
    280280                if (table.getRowCount() > 3) {
     
    287287        public void deleteSector(int idx) {
    288288                if (idx > 0) {
    289                         dlg.panelMain.mark.delLight(idx);
     289                        SmedAction.panelMain.mark.delLight(idx);
    290290                        table.setSize(860, ((table.getRowCount() * 16) + 28));
    291291                        if (table.getRowCount() > 3) {
Note: See TracChangeset for help on using the changeset viewer.