Subversion Repositories eFlore/Applications.del

Compare Revisions

Regard whitespace Rev 1985 → Rev 1986

/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRechercheVue.java
29,6 → 29,14
private static Binder uiBinder = GWT.create(Binder.class);
private String labelRecherche = "";
 
private Map<String,String> listePays;
private InformationsRecherche informationRecherche;
// Si l'on charge une recherche précédente et que la liste des pays n'est
// pas encore arrivée, on stocke le pays pour l'afficher quand la liste arrive
private String paysEnAttente;
 
@UiField
Panel rechercheAvancee, taxon, commune, zoneRss, conteneurMotCle, conteneurMotCleCel, conteneurMotCleDel ;
@UiField
38,7 → 46,7
@UiField
TextBox recherchePrincipale, contientMots, departement, famille, genre, motCle, motCleCel, motCleDel, auteur, date;
@UiField
ListBox referentiel;
ListBox referentiel, pays;
 
public MoteurRechercheVue(String labelRecherche) {
initWidget(uiBinder.createAndBindUi(this));
56,6 → 64,29
referentiel.setItemSelected(1, true);
}
 
@Override
public void remplirListePays(Map<String, String> listePays) {
this.listePays = listePays;
pays.clear();
// Pour pouvoir annuler la selection de pays, on ajoute un item vide
pays.addItem("", "");
int index = 1;
for (Iterator<String> iterator = listePays.keySet().iterator(); iterator.hasNext();) {
String codePays = iterator.next();
pays.addItem(listePays.get(codePays), codePays);
if(paysEnAttente != null && codePays.equals(paysEnAttente)) {
pays.setItemSelected(index, true);
}
index++;
}
if(paysEnAttente != null) {
afficherLigneInfoRecherche(informationRecherche);
}
paysEnAttente = null;
}
 
public String getLabelRecherche() {
return labelRecherche;
}
104,6 → 135,10
contientMots.setText(mots);
}
 
public String getPays() {
return pays.getValue(pays.getSelectedIndex());
}
 
public String getDepartement() {
return departement.getText();
}
180,6 → 215,18
}
}
 
// la liste des pays du champs de recherche est asynchrone
// donc elle peut ne pas avoir encore été chargée
if(listePays != null) {
for(int i = 0; i < pays.getItemCount(); i++) {
if(pays.getValue(i).equals(paysEnAttente)) {
pays.setSelectedIndex(i);
}
}
} else {
paysEnAttente = informationsRecherche.getPays();
}
 
afficherLigneInfoRecherche(informationsRecherche);
}
 
190,6 → 237,9
* @param informationRecherche
*/
private void afficherLigneInfoRecherche(InformationsRecherche informationRecherche) {
this.informationRecherche = informationRecherche;
// tax dep com fam gen ta mo au date
StringBuffer texteRecherchePrecedente = new StringBuffer();
 
202,6 → 252,9
if (informationRecherche.getDepartement() != null && !informationRecherche.getDepartement().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().departement() + ":" + informationRecherche.getDepartement() + " ");
}
if (listePays != null && informationRecherche.getPays() != null && !informationRecherche.getPays().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().pays() + ":" + listePays.get(informationRecherche.getPays()) + " ");
}
if (informationRecherche.getCommune() != null && !informationRecherche.getCommune().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().commune() + ":" + informationRecherche.getCommune() + " ");
}