private static String getVilleCP(String name) { Ville ville = Ville.getVilleFromVilleEtCode(name); if (ville == null) { return null; } return ville.getCodepostal(); }
@Override public void show(SQLRowAccessor r) { final String fieldName0 = getFields().get(0).getName(); final String fieldName1 = getFields().get(1).getName(); if (r.getFields().contains(fieldName0) && r.getFields().contains(fieldName1)) { String cp = r.getString(fieldName0); String name = r.getString(fieldName1); final Ville villeFromVilleEtCode = Ville.getVilleFromVilleEtCode(name + " (" + cp + ")"); // get a matching Ville if (villeFromVilleEtCode != null) { this.getWrapper().setValue(villeFromVilleEtCode); } else { this.getWrapper().setValue(new Ville(name, 0, 0, 0, cp)); } } }
private static String getVille(final String name) { Ville ville = Ville.getVilleFromVilleEtCode(name); if (ville == null) { SwingUtilities.invokeLater( new Runnable() { public void run() { JOptionPane.showMessageDialog( null, "La ville " + "\"" + name + "\"" + " est introuvable! Veuillez corriger l'erreur!"); } }); return null; } return ville.getName(); }