Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 1986 → Rev 1985

/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRechercheVue.java
28,14 → 28,6
 
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 ;
46,7 → 38,7
@UiField
TextBox recherchePrincipale, contientMots, departement, famille, genre, motCle, motCleCel, motCleDel, auteur, date;
@UiField
ListBox referentiel, pays;
ListBox referentiel;
 
public MoteurRechercheVue(String labelRecherche) {
initWidget(uiBinder.createAndBindUi(this));
63,29 → 55,6
}
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;
134,10 → 103,6
public void setContientMots(String mots) {
contientMots.setText(mots);
}
public String getPays() {
return pays.getValue(pays.getSelectedIndex());
}
 
public String getDepartement() {
return departement.getText();
214,18 → 179,6
referentiel.setSelectedIndex(i);
}
}
// 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);
}
237,9 → 190,6
* @param informationRecherche
*/
private void afficherLigneInfoRecherche(InformationsRecherche informationRecherche) {
this.informationRecherche = informationRecherche;
// tax dep com fam gen ta mo au date
StringBuffer texteRecherchePrecedente = new StringBuffer();
 
252,9 → 202,6
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() + " ");
}
285,7 → 232,7
if (informationRecherche.getReferentiel() != null && !informationRecherche.getReferentiel().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().referentiel() + ":" + informationRecherche.getReferentiel() + " ");
}
 
recherchePrecedente.setText(texteRecherchePrecedente.toString());
}