Subversion Repositories eFlore/Applications.del

Rev

Rev 1792 | Rev 1995 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1792 Rev 1986
Line 26... Line 26...
26
	interface Binder extends UiBinder<Widget, MoteurRechercheVue> {
26
	interface Binder extends UiBinder<Widget, MoteurRechercheVue> {
27
	}
27
	}
Line 28... Line 28...
28
 
28
 
29
	private static Binder uiBinder = GWT.create(Binder.class);
29
	private static Binder uiBinder = GWT.create(Binder.class);
-
 
30
	private String labelRecherche = "";
-
 
31
	
-
 
32
	private Map<String,String> listePays;
-
 
33
	
-
 
34
	private InformationsRecherche informationRecherche;
-
 
35
	
-
 
36
	// Si l'on charge une recherche précédente et que la liste des pays n'est 
-
 
37
	// pas encore arrivée, on stocke le pays pour l'afficher quand la liste arrive
Line 30... Line 38...
30
	private String labelRecherche = "";
38
	private String paysEnAttente;
31
 
39
 
32
	@UiField
40
	@UiField
33
	Panel rechercheAvancee, taxon, commune, zoneRss, conteneurMotCle, conteneurMotCleCel, conteneurMotCleDel  ;
41
	Panel rechercheAvancee, taxon, commune, zoneRss, conteneurMotCle, conteneurMotCleCel, conteneurMotCleDel  ;
34
	@UiField
42
	@UiField
35
	Label lienRechercheAvancee, recherchePrecedente;
43
	Label lienRechercheAvancee, recherchePrecedente;
36
	@UiField
44
	@UiField
37
	Button boutonRecherche, boutonRechercheAvancee, boutonFermer, boutonVider;
45
	Button boutonRecherche, boutonRechercheAvancee, boutonFermer, boutonVider;
38
	@UiField
46
	@UiField
39
	TextBox recherchePrincipale, contientMots, departement, famille, genre, motCle, motCleCel, motCleDel, auteur, date;
47
	TextBox recherchePrincipale, contientMots, departement, famille, genre, motCle, motCleCel, motCleDel, auteur, date;
Line 40... Line 48...
40
	@UiField
48
	@UiField
41
	ListBox referentiel;
49
	ListBox referentiel, pays;
42
 
50
 
43
	public MoteurRechercheVue(String labelRecherche) {
51
	public MoteurRechercheVue(String labelRecherche) {
Line 53... Line 61...
53
			String codeRef = iterator.next();
61
			String codeRef = iterator.next();
54
			referentiel.addItem(listeReferentiels.get(codeRef), codeRef);
62
			referentiel.addItem(listeReferentiels.get(codeRef), codeRef);
55
		}
63
		}
56
		referentiel.setItemSelected(1, true);
64
		referentiel.setItemSelected(1, true);
57
	}
65
	}
-
 
66
	
-
 
67
	@Override
-
 
68
	public void remplirListePays(Map<String, String> listePays) {
-
 
69
		this.listePays = listePays;
-
 
70
		pays.clear();
-
 
71
		// Pour pouvoir annuler la selection de pays, on ajoute un item vide
-
 
72
		pays.addItem("", "");
-
 
73
		int index = 1;
-
 
74
		for (Iterator<String> iterator = listePays.keySet().iterator(); iterator.hasNext();) {
-
 
75
			String codePays = iterator.next();
-
 
76
			pays.addItem(listePays.get(codePays), codePays);
-
 
77
			
-
 
78
			if(paysEnAttente != null && codePays.equals(paysEnAttente)) {
-
 
79
				pays.setItemSelected(index, true);
-
 
80
			}
-
 
81
			index++;
-
 
82
		}
-
 
83
		
-
 
84
		if(paysEnAttente != null) {
-
 
85
			afficherLigneInfoRecherche(informationRecherche);
-
 
86
		}
-
 
87
		paysEnAttente = null;
-
 
88
	}
Line 58... Line 89...
58
 
89
 
59
	public String getLabelRecherche() {
90
	public String getLabelRecherche() {
60
		return labelRecherche;
91
		return labelRecherche;
Line 101... Line 132...
101
	}
132
	}
Line 102... Line 133...
102
 
133
 
103
	public void setContientMots(String mots) {
134
	public void setContientMots(String mots) {
104
		contientMots.setText(mots);
135
		contientMots.setText(mots);
-
 
136
	}
-
 
137
	
-
 
138
	public String getPays() {
-
 
139
		return pays.getValue(pays.getSelectedIndex());
Line 105... Line 140...
105
	}
140
	}
106
 
141
 
107
	public String getDepartement() {
142
	public String getDepartement() {
Line 177... Line 212...
177
		for(int i = 0; i < referentiel.getItemCount(); i++) {
212
		for(int i = 0; i < referentiel.getItemCount(); i++) {
178
			if(referentiel.getValue(i).equals(informationsRecherche.getReferentiel())) {
213
			if(referentiel.getValue(i).equals(informationsRecherche.getReferentiel())) {
179
				referentiel.setSelectedIndex(i);
214
				referentiel.setSelectedIndex(i);
180
			}
215
			}
181
		}
216
		}
-
 
217
		
-
 
218
		// la liste des pays du champs de recherche est asynchrone 
-
 
219
		// donc elle peut ne pas avoir encore été chargée
-
 
220
		if(listePays != null) {
-
 
221
			for(int i = 0; i < pays.getItemCount(); i++) {
-
 
222
				if(pays.getValue(i).equals(paysEnAttente)) {
-
 
223
					pays.setSelectedIndex(i);
-
 
224
				}
-
 
225
			}
-
 
226
		} else {
-
 
227
			paysEnAttente = informationsRecherche.getPays();
-
 
228
		}
Line 182... Line 229...
182
 
229
 
183
		afficherLigneInfoRecherche(informationsRecherche);
230
		afficherLigneInfoRecherche(informationsRecherche);
Line 184... Line 231...
184
	}
231
	}
Line 188... Line 235...
188
	 * l'utilisateur
235
	 * l'utilisateur
189
	 * 
236
	 * 
190
	 * @param informationRecherche
237
	 * @param informationRecherche
191
	 */
238
	 */
192
	private void afficherLigneInfoRecherche(InformationsRecherche informationRecherche) {
239
	private void afficherLigneInfoRecherche(InformationsRecherche informationRecherche) {
-
 
240
		
-
 
241
		this.informationRecherche = informationRecherche; 
-
 
242
		
193
		// tax dep com fam gen ta mo au date
243
		// tax dep com fam gen ta mo au date
194
		StringBuffer texteRecherchePrecedente = new StringBuffer();
244
		StringBuffer texteRecherchePrecedente = new StringBuffer();
Line 195... Line 245...
195
 
245
 
196
		if (informationRecherche.getRechercheLibre() != null && !informationRecherche.getRechercheLibre().equals("")) {
246
		if (informationRecherche.getRechercheLibre() != null && !informationRecherche.getRechercheLibre().equals("")) {
Line 200... Line 250...
200
			texteRecherchePrecedente.append(I18n.getVocabulary().taxon() + ":" + informationRecherche.getTaxon() + " ");
250
			texteRecherchePrecedente.append(I18n.getVocabulary().taxon() + ":" + informationRecherche.getTaxon() + " ");
201
		}
251
		}
202
		if (informationRecherche.getDepartement() != null && !informationRecherche.getDepartement().equals("")) {
252
		if (informationRecherche.getDepartement() != null && !informationRecherche.getDepartement().equals("")) {
203
			texteRecherchePrecedente.append(I18n.getVocabulary().departement() + ":" + informationRecherche.getDepartement() + " ");
253
			texteRecherchePrecedente.append(I18n.getVocabulary().departement() + ":" + informationRecherche.getDepartement() + " ");
204
		}
254
		}
-
 
255
		if (listePays != null && informationRecherche.getPays() != null && !informationRecherche.getPays().equals("")) {
-
 
256
			texteRecherchePrecedente.append(I18n.getVocabulary().pays() + ":" + listePays.get(informationRecherche.getPays()) + " ");
-
 
257
		}
205
		if (informationRecherche.getCommune() != null && !informationRecherche.getCommune().equals("")) {
258
		if (informationRecherche.getCommune() != null && !informationRecherche.getCommune().equals("")) {
206
			texteRecherchePrecedente.append(I18n.getVocabulary().commune() + ":" + informationRecherche.getCommune() + " ");
259
			texteRecherchePrecedente.append(I18n.getVocabulary().commune() + ":" + informationRecherche.getCommune() + " ");
207
		}
260
		}
208
		if (informationRecherche.getFamille() != null && !informationRecherche.getFamille().equals("")) {
261
		if (informationRecherche.getFamille() != null && !informationRecherche.getFamille().equals("")) {
209
			texteRecherchePrecedente.append(I18n.getVocabulary().famille() + ":" + informationRecherche.getFamille() + " ");
262
			texteRecherchePrecedente.append(I18n.getVocabulary().famille() + ":" + informationRecherche.getFamille() + " ");
Line 230... Line 283...
230
			texteRecherchePrecedente.append(I18n.getVocabulary().date() + ":" + informationRecherche.getDate() + " ");
283
			texteRecherchePrecedente.append(I18n.getVocabulary().date() + ":" + informationRecherche.getDate() + " ");
231
		}
284
		}
232
		if (informationRecherche.getReferentiel() != null && !informationRecherche.getReferentiel().equals("")) {
285
		if (informationRecherche.getReferentiel() != null && !informationRecherche.getReferentiel().equals("")) {
233
			texteRecherchePrecedente.append(I18n.getVocabulary().referentiel() + ":" + informationRecherche.getReferentiel() + " ");
286
			texteRecherchePrecedente.append(I18n.getVocabulary().referentiel() + ":" + informationRecherche.getReferentiel() + " ");
234
		}
287
		}
235
 
288
		
236
		recherchePrecedente.setText(texteRecherchePrecedente.toString());
289
		recherchePrecedente.setText(texteRecherchePrecedente.toString());
237
	}
290
	}
Line 238... Line 291...
238
 
291
 
239
	@Override
292
	@Override