90,7 → 90,6 |
private ComboBox espece = null; |
private String numeroNom = null; |
private String numeroOrdre = null; |
|
private String codeInseeCommune = null; |
|
private String referentielGeo = null; |
250,10 → 249,7 |
panneauFormulaire = new FormPanel(Position.RIGHT); |
panneauFormulaire.setBorder(false); |
|
|
|
// Panneau intermediaire qui contient deux colonnes de formulaire |
|
panneauIntermediaire = new Panel(); |
|
if (Window.getClientWidth()> Window.getClientHeight()) { |
283,12 → 279,10 |
final String resultTplCommune = "<div class=\"search-item-commune\">{commune}</div>"; |
commune.setTpl(resultTplCommune); |
commune.setMode(ComboBox.REMOTE); |
// commune.setPageSize(10); // Ne fonctionne pas |
commune.setItemSelector("div.search-item-commune"); |
commune.setTypeAhead(true); |
commune.setLoadingText("Recherche..."); |
commune.setHideTrigger(true); |
//commune.setTabIndex(1); |
|
//création du lien "Accès carto" dans le formulaire |
basculerverscarto = new HTML(" <a id=\"lien_carto\" href=\"#\" tabindex=\"2\">Localiser la commune</a>"); |
369,8 → 363,7 |
"<a title=\"Cliquez pour obtenir les coordonnées de votre observation à partir de la carte\" class=\"lien_actif\" id=\"lien_carto_coord\" href=\"#\" tabindex=\"7\">Localiser sur la carte</a>"+ |
"</span>"); |
|
//ajout d'un listener sur le lien "saisie X/Y" |
|
//ajout d'un listener sur le lien "saisie X/Y" |
coordPanel.addListener(new PanelListenerAdapter() { |
|
@Override |
596,6 → 589,7 |
public void onSelect(ComboBox comboBox, Record record, int index) { |
commune.setValue(record.getAsString("commune")); |
departement=record.getAsString("departement"); |
codeInseeCommune=record.getAsString("codeInsee"); |
selectionCommune=true; |
commune.collapse(); |
} |
650,7 → 644,6 |
break; |
|
default: |
|
departement=""; |
commune.collapse(); |
obtenirListeReferentielCommune(); |
982,29 → 975,27 |
if(nouvelleDonnees instanceof ListeReferentielCommune) |
{ |
ListeReferentielCommune data = (ListeReferentielCommune) nouvelleDonnees ; |
Object[][] communeData = new Object[data.size()][2]; |
Object[][] communeData = new Object[data.size()][3]; |
int i = 0 ; |
|
// on la parse et on récupère les informations quiç nous interessent |
for (Iterator it = data.keySet().iterator(); it.hasNext();) |
{ |
|
{ |
ReferentielCommune ref=data.get(it.next()); |
|
|
communeData[i][0]= ref.getCommune(); |
communeData[i][1]= ref.getDepartement(); |
|
communeData[i][2]= ref.getCodeInsee(); |
i++ ; |
} |
|
// creation du store |
// creation du store |
FieldDef defCommune = new StringFieldDef("commune"); |
FieldDef defDepartement = new StringFieldDef("departement"); |
FieldDef defCodeInsee = new StringFieldDef("codeInsee"); |
|
FieldDef[] defTab = { defCommune, defDepartement, defCodeInsee}; |
|
|
FieldDef[] defTab = { defCommune, defDepartement}; |
|
RecordDef rd = new RecordDef(defTab); |
|
final MemoryProxy dataProxy = new MemoryProxy(communeData); |
1038,9 → 1029,7 |
} |
else { |
nomData[i][2]=""; |
} |
|
|
} |
i++ ; |
} |
|
1109,7 → 1098,7 |
if(infosCom != null && !infosCom.getZoneGeo().trim().equals("")){ |
nCommune += infosCom.getZoneGeo(); |
if(!infosCom.getIdZoneGeo().trim().equals("")) |
nCommune += " ("+Util.convertirChaineZoneGeoVersCodeInsee(infosCom.getIdZoneGeo())+")"; |
nCommune += " ("+Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo())+")"; |
|
lienSelectionCommune.setHtml("<a id=\"lien_selection_commune\" tabindex=\"9\">"+nCommune+"</a>"); |
lienSelectionCommune.setStyleName("img-curseur-depl"); |
1158,16 → 1147,15 |
|
private void rafraichirCommune(EntiteGeographiqueObservation infosCom) { |
String nCommune = ""; |
|
|
|
if(infosCom.getZoneGeo() != null && !infosCom.getZoneGeo().equals("")) { |
nCommune += infosCom.getZoneGeo(); |
} |
|
if(infosCom.getIdZoneGeo() != null && !infosCom.getIdZoneGeo().equals("")) { |
String codeGeoFormate = Util.convertirChaineZoneGeoVersCodeInsee(infosCom.getIdZoneGeo()); |
String codeGeoFormate = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo()); |
nCommune += " ("+codeGeoFormate+")"; |
departement = Util.convertirChaineZoneGeoVersCodeInsee(infosCom.getIdZoneGeo());; |
departement = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo()); |
} |
commune.setValue(nCommune); |
communeModifiee = true; |
1204,23 → 1192,18 |
} |
|
|
public void obtenirListeReferentielNom() { |
|
public void obtenirListeReferentielNom() { |
// FIXME : trouver un autre moyen que le hack "/*" pour rechercher les taxons lors de la saisie d'un espace apres le genre |
|
String esp=espece.getText().replaceAll(" ","/*"); |
esp=esp.replaceAll("%",""); |
|
observationMediateur.obtenirListeReferentielNom(this,esp); |
|
observationMediateur.obtenirListeReferentielNom(this,esp); |
} |
|
|
|
protected void obtenirReferentielStation() { |
observationMediateur.obtenirListeReferentielPerso(this,TypesReferentiels.REFERENTIEL_STATION,station.getText()); |
} |
|
|
protected void obtenirListeReferentielMilieu() { |
observationMediateur.obtenirListeReferentielPerso(this,TypesReferentiels.REFERENTIEL_MILIEU,milieu.getText()); |
} |
1229,7 → 1212,6 |
observationMediateur.obtenirListeReferentielPerso(this,TypesReferentiels.REFERENTIEL_LIEU_DIT,lieudit.getText()); |
} |
|
|
public void ajouterObservation() { |
|
if(!Util.verifierDateFormatCel(date.getRawValue()) && !date.getRawValue().equals("")) { |
1452,13 → 1434,19 |
raz() ; |
String idLoc ; |
if(obs.getIdentifiantLocalite() != VALEURS_MULTIPLES) { |
idLoc =obs.getIdentifiantLocalite().replaceAll(" ","/"); |
idLoc = obs.getIdentifiantLocalite().replaceAll(" ","/"); |
idLoc = idLoc.replaceAll("%",""); |
idLoc = idLoc.replaceAll("\"",""); |
idLoc = idLoc.replace('\\',' '); |
idLoc = idLoc.trim(); |
if(idLoc.length() == 5) { |
idLoc = idLoc.substring(0,2); |
} |
} else { |
idLoc = obs.getIdentifiantLocalite(); |
if(idLoc.length() == 5) { |
idLoc = idLoc.substring(0,2); |
} |
} |
|
if(!obs.getDate().equals("null") && !obs.getDate().equals("000null") && !obs.getDate().equals(VALEURS_MULTIPLES)) { |
1510,7 → 1498,7 |
if(!obs.getNumeroNomenclaturalSaisi().equals("null") && !obs.getNumeroNomenclaturalSaisi().equals("000null")) { |
numeroNom = obs.getNumeroNomenclaturalSaisi() ; |
} |
if(!obs.getNumeroOrdre().equals("null") && !obs.getNumeroOrdre().equals("000nu2ll")) { |
if(!obs.getNumeroOrdre().equals("null") && !obs.getNumeroOrdre().equals("000null")) { |
numeroOrdre = obs.getNumeroOrdre() ; |
} |
|
1865,24 → 1853,11 |
} |
|
public void redimensionnerFormulaire() { |
//htmlCommunePanel.setWidth(panneauPremierColonne.getWidth() - 10); |
afficherFormulaireLatLon.setWidth(panneauIntermediaire.getWidth()+"px"); |
panneauPremierColonne.doLayout(); |
panneauSecondeColonne.doLayout(); |
panneauIntermediaire.doLayout(); |
|
/*if(panneauPremierColonne.getWidth() < 450 ) { |
basculerverscarto.setHTML("<a id=\"lien_carto\" href=\"#\" tabindex=\"2\">Localiser</a>"); |
commune.setWidth(180); |
basculerverscarto.setWidth("60px"); |
htmlCommunePanel.doLayout(); |
} else { |
basculerverscarto.setHTML("<a id=\"lien_carto\" href=\"#\" tabindex=\"2\">Localiser la commune</a>"); |
commune.setWidth(290); |
basculerverscarto.setWidth("160px"); |
htmlCommunePanel.doLayout(); |
}*/ |
|
doLayout(); |
} |
} |