28,6 → 28,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 ; |
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)); |
55,6 → 63,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; |
103,6 → 134,10 |
public void setContientMots(String mots) { |
contientMots.setText(mots); |
} |
|
public String getPays() { |
return pays.getValue(pays.getSelectedIndex()); |
} |
|
public String getDepartement() { |
return departement.getText(); |
179,6 → 214,18 |
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); |
} |
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() + " "); |
} |
232,7 → 285,7 |
if (informationRecherche.getReferentiel() != null && !informationRecherche.getReferentiel().equals("")) { |
texteRecherchePrecedente.append(I18n.getVocabulary().referentiel() + ":" + informationRecherche.getReferentiel() + " "); |
} |
|
|
recherchePrecedente.setText(texteRecherchePrecedente.toString()); |
} |
|