Ignore:
Timestamp:
2010-05-28T21:22:49+02:00 (15 years ago)
Author:
pieren
Message:

Improve renaming after municipality selection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java

    r21191 r21493  
    175175                    // commune unknown, prompt the list of communes from
    176176                    // server and try with codeCommune
    177                     wmsLayer.setCodeCommune(selectCommuneDialog());
     177                    String selected = selectMunicipalityDialog(wmsLayer);
     178                    if (selected != null) {
     179                        String newCodeCommune = selected.substring(1, selected.indexOf(">")-2);
     180                        String newLocation = selected.substring(selected.indexOf(">")+1, selected.lastIndexOf(" - "));
     181                        wmsLayer.setCodeCommune(newCodeCommune);
     182                        wmsLayer.setLocation(newLocation);
     183                        Main.pref.put("cadastrewms.codeCommune", newCodeCommune);
     184                        Main.pref.put("cadastrewms.location", newLocation);
     185                    }
    178186                    checkLayerDuplicates(wmsLayer);
    179187                    interfaceRef = postForm(wmsLayer, wmsLayer.getCodeCommune());
     
    381389    }
    382390   
    383     private String selectCommuneDialog() {
     391    private String selectMunicipalityDialog(WMSLayer wmsLayer) {
    384392        JPanel p = new JPanel(new GridBagLayout());
    385393        String[] communeList = new String[listOfCommunes.size() + 1];
     
    401409        if (!Integer.valueOf(JOptionPane.OK_OPTION).equals(pane.getValue()))
    402410            return null;
    403         String result = listOfCommunes.elementAt(inputCommuneList.getSelectedIndex()-1);
    404         return result.substring(1, result.indexOf(">")-2);
     411        return listOfCommunes.elementAt(inputCommuneList.getSelectedIndex()-1);
    405412    }
    406413
Note: See TracChangeset for help on using the changeset viewer.