Subversion Repositories eFlore/Applications.del

Rev

Rev 602 | Rev 938 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 602 Rev 671
1
package org.tela_botanica.del.client.composants.moteurrecherche;
1
package org.tela_botanica.del.client.composants.moteurrecherche;
2
 
2
 
3
import org.tela_botanica.del.client.cache.CacheClient;
3
import org.tela_botanica.del.client.cache.CacheClient;
4
import org.tela_botanica.del.client.composants.formulaires.autocompletion.AutoCompletionComboBoxPresenteur;
4
import org.tela_botanica.del.client.composants.formulaires.autocompletion.AutoCompletionComboBoxPresenteur;
5
import org.tela_botanica.del.client.composants.formulaires.autocompletion.AutoCompletionComboBoxVue;
5
import org.tela_botanica.del.client.composants.formulaires.autocompletion.AutoCompletionComboBoxVue;
6
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
6
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
7
import org.tela_botanica.del.client.config.Config;
7
import org.tela_botanica.del.client.config.Config;
8
import org.tela_botanica.del.client.modeles.InformationsRecherche;
8
import org.tela_botanica.del.client.modeles.InformationsRecherche;
9
import org.tela_botanica.del.client.modeles.ModeRecherche;
9
import org.tela_botanica.del.client.modeles.ModeRecherche;
10
import org.tela_botanica.del.client.utils.UtilitairesAutoCompletionService;
10
import org.tela_botanica.del.client.utils.UtilitairesAutoCompletionService;
11
 
11
 
12
import com.google.gwt.event.dom.client.ClickEvent;
12
import com.google.gwt.event.dom.client.ClickEvent;
13
import com.google.gwt.event.dom.client.ClickHandler;
13
import com.google.gwt.event.dom.client.ClickHandler;
14
import com.google.gwt.event.dom.client.HasClickHandlers;
14
import com.google.gwt.event.dom.client.HasClickHandlers;
15
import com.google.gwt.event.dom.client.HasKeyPressHandlers;
15
import com.google.gwt.event.dom.client.HasKeyPressHandlers;
16
import com.google.gwt.event.dom.client.KeyCodes;
16
import com.google.gwt.event.dom.client.KeyCodes;
17
import com.google.gwt.event.dom.client.KeyPressEvent;
17
import com.google.gwt.event.dom.client.KeyPressEvent;
18
import com.google.gwt.event.dom.client.KeyPressHandler;
18
import com.google.gwt.event.dom.client.KeyPressHandler;
19
import com.google.gwt.http.client.Response;
19
import com.google.gwt.http.client.Response;
20
import com.google.gwt.user.client.ui.HasWidgets;
20
import com.google.gwt.user.client.ui.HasWidgets;
21
import com.google.gwt.user.client.ui.IsWidget;
21
import com.google.gwt.user.client.ui.IsWidget;
22
 
22
 
23
public abstract class MoteurRecherchePresenteur extends Presenteur {
23
public abstract class MoteurRecherchePresenteur extends Presenteur {
24
 
24
 
25
	public abstract interface Vue extends IsWidget {
25
	public abstract interface Vue extends IsWidget {
26
		public void ajouterVue(HasWidgets composite);
26
		public void ajouterVue(HasWidgets composite);
27
 
27
 
28
		public HasClickHandlers getLienRechercheAvancee();
28
		public HasClickHandlers getLienRechercheAvancee();
29
 
29
 
30
		public void basculerAffichageZoneCache();
30
		public void basculerAffichageZoneCache();
31
 
31
 
32
		public HasClickHandlers getBoutonRechercheSimple();
32
		public HasClickHandlers getBoutonRechercheSimple();
33
 
33
 
34
		public HasClickHandlers getBoutonFermer();
34
		public HasClickHandlers getBoutonFermer();
35
 
35
 
36
		public HasClickHandlers getBoutonVider();
36
		public HasClickHandlers getBoutonVider();
37
 
37
 
38
		public HasClickHandlers getBoutonRechercheAvancee();
38
		public HasClickHandlers getBoutonRechercheAvancee();
39
 
39
 
40
		public HasKeyPressHandlers getChampSaisie();
40
		public HasKeyPressHandlers getChampSaisie();
41
 
41
 
42
		public HasClickHandlers getChampSaisieCliquable();
42
		public HasClickHandlers getChampSaisieCliquable();
43
 
43
 
44
		public String getValeurRechercheSimple();
44
		public String getValeurRechercheSimple();
45
 
45
 
46
		public String getLabelRecherche();
46
		public String getLabelRecherche();
47
 
47
 
48
		public String getContientMots();
48
		public String getContientMots();
49
 
49
 
50
		public String getDepartement();
50
		public String getDepartement();
51
 
51
 
52
		public HasWidgets getCommune();
52
		public HasWidgets getCommune();
53
 
53
 
54
		public HasWidgets getTaxon();
54
		public HasWidgets getTaxon();
55
 
55
 
56
		public String getFamille();
56
		public String getFamille();
57
 
57
 
58
		public String getGenre();
58
		public String getGenre();
59
 
59
 
60
		public String getMotCle();
60
		public String getMotCle();
61
 
61
 
62
		public String getAuteur();
62
		public String getAuteur();
63
 
63
 
64
		public String getDate();
64
		public String getDate();
65
 
65
 
66
		public void setValeurRechercheSimple(String valeurRecherche);
66
		public void setValeurRechercheSimple(String valeurRecherche);
67
 
67
 
68
		public void setContientMots(String mots);
68
		public void setContientMots(String mots);
69
 
69
 
70
		public void setValeurDepartement(String dpt);
70
		public void setValeurDepartement(String dpt);
71
 
71
 
72
		public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche);
72
		public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche);
73
 
73
 
74
		public void focusSaisie();
74
		public void focusSaisie();
75
 
75
 
76
		public void nettoyer();
76
		public void nettoyer();
77
 
77
 
78
		public HasKeyPressHandlers getChampsFamille();
78
		public HasKeyPressHandlers getChampsFamille();
79
 
79
 
80
		public HasKeyPressHandlers getChampsGenre();
80
		public HasKeyPressHandlers getChampsGenre();
81
 
81
 
82
		public HasKeyPressHandlers getChampsMotCle();
82
		public HasKeyPressHandlers getChampsMotCle();
83
 
83
 
84
		public HasKeyPressHandlers getChampsAuteur();
84
		public HasKeyPressHandlers getChampsAuteur();
85
 
85
 
86
		public HasKeyPressHandlers getChampsDate();
86
		public HasKeyPressHandlers getChampsDate();
-
 
87
		
-
 
88
		public HasKeyPressHandlers getChampsDepartement();
-
 
89
		
-
 
90
		public HasKeyPressHandlers getChampsContientMots();
87
 
91
 
88
	}
92
	}
89
 
93
 
90
	private Vue vue;
94
	private Vue vue;
91
	private Config config;
95
	private Config config;
92
	private ModeRecherche modeRecherche;
96
	private ModeRecherche modeRecherche;
93
 
97
 
94
	public enum TypeMoteur {
98
	public enum TypeMoteur {
95
		SIMPLE, AVANCEE
99
		SIMPLE, AVANCEE
96
	};
100
	};
97
 
101
 
98
	private TypeMoteur typeMoteur = TypeMoteur.SIMPLE;
102
	private TypeMoteur typeMoteur = TypeMoteur.SIMPLE;
99
 
103
 
100
	private AutoCompletionComboBoxPresenteur completionTaxonsPresenteur = null;
104
	private AutoCompletionComboBoxPresenteur completionTaxonsPresenteur = null;
101
	private AutoCompletionComboBoxPresenteur completionCommunesPresenteur = null;
105
	private AutoCompletionComboBoxPresenteur completionCommunesPresenteur = null;
102
 
106
 
103
	public MoteurRecherchePresenteur(Vue vue, ModeRecherche mode) {
107
	public MoteurRecherchePresenteur(Vue vue, ModeRecherche mode) {
104
		initialiser(vue, mode, new Config());
108
		initialiser(vue, mode, new Config());
105
	}
109
	}
106
 
110
 
107
	public MoteurRecherchePresenteur(AutoCompletionComboBoxPresenteur presenteurAutoCompletionTaxon, AutoCompletionComboBoxPresenteur presenteurAutoCompletionCommunes, Vue vue, ModeRecherche mode, Config configuration) {
111
	public MoteurRecherchePresenteur(AutoCompletionComboBoxPresenteur presenteurAutoCompletionTaxon, AutoCompletionComboBoxPresenteur presenteurAutoCompletionCommunes, Vue vue, ModeRecherche mode, Config configuration) {
108
		completionTaxonsPresenteur = presenteurAutoCompletionTaxon;
112
		completionTaxonsPresenteur = presenteurAutoCompletionTaxon;
109
		completionCommunesPresenteur = presenteurAutoCompletionCommunes;
113
		completionCommunesPresenteur = presenteurAutoCompletionCommunes;
110
		initialiser(vue, mode, configuration);
114
		initialiser(vue, mode, configuration);
111
	}
115
	}
112
 
116
 
113
	private void initialiser(Vue vue, ModeRecherche mode, Config configuration) {
117
	private void initialiser(Vue vue, ModeRecherche mode, Config configuration) {
114
		this.vue = vue;
118
		this.vue = vue;
115
		setMode(mode);
119
		setMode(mode);
116
		this.config = configuration;
120
		this.config = configuration;
117
		if (completionTaxonsPresenteur == null)
121
		if (completionTaxonsPresenteur == null)
118
			this.creerCompletionTaxons();
122
			this.creerCompletionTaxons();
119
		if (completionCommunesPresenteur == null)
123
		if (completionCommunesPresenteur == null)
120
			this.creerCompletionCommunes();
124
			this.creerCompletionCommunes();
121
		gererEvenements();
125
		gererEvenements();
122
	}
126
	}
123
 
127
 
124
	public ModeRecherche getMode() {
128
	public ModeRecherche getMode() {
125
		return modeRecherche;
129
		return modeRecherche;
126
	}
130
	}
127
 
131
 
128
	private void setMode(ModeRecherche mode) {
132
	private void setMode(ModeRecherche mode) {
129
		modeRecherche = mode;
133
		modeRecherche = mode;
130
	}
134
	}
131
	
135
	
132
	public TypeMoteur getTypeMoteur() {
136
	public TypeMoteur getTypeMoteur() {
133
		return this.typeMoteur;
137
		return this.typeMoteur;
134
	}
138
	}
135
	
139
	
136
	public void setTypeMoteur(TypeMoteur typeMoteur) {
140
	public void setTypeMoteur(TypeMoteur typeMoteur) {
137
		this.typeMoteur = typeMoteur;
141
		this.typeMoteur = typeMoteur;
138
	}
142
	}
139
 
143
 
140
	public boolean estPourRechercheImages() {
144
	public boolean estPourRechercheImages() {
141
		return (modeRecherche == ModeRecherche.MODE_IMAGE);
145
		return (modeRecherche == ModeRecherche.MODE_IMAGE);
142
	}
146
	}
143
 
147
 
144
	public boolean estPourRechercheObservations() {
148
	public boolean estPourRechercheObservations() {
145
		return (modeRecherche == ModeRecherche.MODE_OBSERVATION);
149
		return (modeRecherche == ModeRecherche.MODE_OBSERVATION);
146
	}
150
	}
147
 
151
 
148
	private void creerCompletionTaxons() {
152
	private void creerCompletionTaxons() {
149
		String url = this.config.getUrl("nomSciCompletionService");
153
		String url = this.config.getUrl("nomSciCompletionService");
150
		completionTaxonsPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), url) {
154
		completionTaxonsPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), url) {
151
			protected String effectuerPreTraitementChaineRequete(String requete) {
155
			protected String effectuerPreTraitementChaineRequete(String requete) {
152
				return UtilitairesAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceSlash(requete);
156
				return UtilitairesAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceSlash(requete);
153
				// A décommenter lors de l'utilisation des web services eflore
157
				// A décommenter lors de l'utilisation des web services eflore
154
				// return
158
				// return
155
				// RetourAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceEflore(requete);
159
				// RetourAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceEflore(requete);
156
			}
160
			}
157
 
161
 
158
			@Override
162
			@Override
159
			protected String[] parserResultatRequete(Response response) {
163
			protected String[] parserResultatRequete(Response response) {
160
				return UtilitairesAutoCompletionService.parserRetourSimple(response);
164
				return UtilitairesAutoCompletionService.parserRetourSimple(response);
161
				// A décommenter lors de l'utilisation des web services eflore
165
				// A décommenter lors de l'utilisation des web services eflore
162
				// return RetourAutoCompletionService.parserRetourOss(response);
166
				// return RetourAutoCompletionService.parserRetourOss(response);
163
			}
167
			}
164
		};
168
		};
165
	}
169
	}
166
 
170
 
167
	private void creerCompletionCommunes() {
171
	private void creerCompletionCommunes() {
168
		String url = this.config.getUrl("communeCompletionService");
172
		String url = this.config.getUrl("communeCompletionService");
169
		completionCommunesPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), url) {
173
		completionCommunesPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), url) {
170
			protected String effectuerPreTraitementChaineRequete(String requete) {
174
			protected String effectuerPreTraitementChaineRequete(String requete) {
171
				return requete;
175
				return requete;
172
			}
176
			}
173
 
177
 
174
			@Override
178
			@Override
175
			protected void surSelectionSuggestion(String suggestion) {
179
			protected void surSelectionSuggestion(String suggestion) {
176
				setValeur(suggestion);
180
				setValeur(suggestion);
177
				collecterInfosRecherche();
181
				collecterInfosRecherche();
178
				setValeur(getInformationsRechercheEnCache().getCommune());
182
				setValeur(getInformationsRechercheEnCache().getCommune());
179
				vue.setValeurDepartement(getInformationsRechercheEnCache().getDepartement());
183
				vue.setValeurDepartement(getInformationsRechercheEnCache().getDepartement());
180
			}
184
			}
181
 
185
 
182
			@Override
186
			@Override
183
			protected String[] parserResultatRequete(Response response) {
187
			protected String[] parserResultatRequete(Response response) {
184
				return UtilitairesAutoCompletionService.parserRetourSimple(response);
188
				return UtilitairesAutoCompletionService.parserRetourSimple(response);
185
			}
189
			}
186
		};
190
		};
187
	}
191
	}
188
 
192
 
189
	@Override
193
	@Override
190
	public void go(HasWidgets composite) {
194
	public void go(HasWidgets composite) {
191
		afficherRequeteEtLancerRecherche();
195
		afficherRequeteEtLancerRecherche();
192
		completionTaxonsPresenteur.go(vue.getTaxon());
196
		completionTaxonsPresenteur.go(vue.getTaxon());
193
		completionCommunesPresenteur.go(vue.getCommune());
197
		completionCommunesPresenteur.go(vue.getCommune());
194
		vue.ajouterVue(composite);
198
		vue.ajouterVue(composite);
195
		vue.focusSaisie();
199
		vue.focusSaisie();
196
	}
200
	}
197
 
201
 
198
	@Override
202
	@Override
199
	protected void gererEvenements() {
203
	protected void gererEvenements() {
200
		vue.getLienRechercheAvancee().addClickHandler(new ClickHandler() {
204
		vue.getLienRechercheAvancee().addClickHandler(new ClickHandler() {
201
			public void onClick(ClickEvent event) {
205
			public void onClick(ClickEvent event) {
202
				setTypeMoteur(TypeMoteur.AVANCEE);
206
				setTypeMoteur(TypeMoteur.AVANCEE);
203
				vue.setContientMots(vue.getValeurRechercheSimple());
207
				vue.setContientMots(vue.getValeurRechercheSimple());
204
				vue.basculerAffichageZoneCache();
208
				vue.basculerAffichageZoneCache();
205
			}
209
			}
206
		});
210
		});
207
 
211
 
208
		vue.getBoutonRechercheSimple().addClickHandler(new ClickHandler() {
212
		vue.getBoutonRechercheSimple().addClickHandler(new ClickHandler() {
209
			public void onClick(ClickEvent event) {
213
			public void onClick(ClickEvent event) {
210
				setTypeMoteur(TypeMoteur.SIMPLE);
214
				setTypeMoteur(TypeMoteur.SIMPLE);
211
				collecterInfosRecherche();
215
				collecterInfosRecherche();
212
				afficherRequeteEtLancerRecherche();
216
				afficherRequeteEtLancerRecherche();
213
			}
217
			}
214
		});
218
		});
215
 
219
 
216
		vue.getBoutonFermer().addClickHandler(new ClickHandler() {
220
		vue.getBoutonFermer().addClickHandler(new ClickHandler() {
217
			public void onClick(ClickEvent event) {
221
			public void onClick(ClickEvent event) {
218
				vue.setValeurRechercheSimple(vue.getContientMots());
222
				vue.setValeurRechercheSimple(vue.getContientMots());
219
				vue.basculerAffichageZoneCache();
223
				vue.basculerAffichageZoneCache();
220
			}
224
			}
221
		});
225
		});
222
 
226
 
223
		vue.getBoutonVider().addClickHandler(new ClickHandler() {
227
		vue.getBoutonVider().addClickHandler(new ClickHandler() {
224
			public void onClick(ClickEvent event) {
228
			public void onClick(ClickEvent event) {
225
				nettoyerChamps();
229
				nettoyerChamps();
226
				InformationsRecherche infosRecherche = new InformationsRecherche();
230
				InformationsRecherche infosRecherche = new InformationsRecherche();
227
				if (estPourRechercheImages()) {
231
				if (estPourRechercheImages()) {
228
					CacheClient.getInstance().setInformationsRechercheImage(infosRecherche);
232
					CacheClient.getInstance().setInformationsRechercheImage(infosRecherche);
229
				} else if (estPourRechercheObservations()) {
233
				} else if (estPourRechercheObservations()) {
230
					CacheClient.getInstance().setInformationsRechercheObservation(infosRecherche);
234
					CacheClient.getInstance().setInformationsRechercheObservation(infosRecherche);
231
				}
235
				}
232
			}
236
			}
233
		});
237
		});
234
 
238
 
235
		vue.getBoutonRechercheAvancee().addClickHandler(new ClickHandler() {
239
		vue.getBoutonRechercheAvancee().addClickHandler(new ClickHandler() {
236
			public void onClick(ClickEvent event) {
240
			public void onClick(ClickEvent event) {
237
				setTypeMoteur(TypeMoteur.AVANCEE);
241
				setTypeMoteur(TypeMoteur.AVANCEE);
238
				collecterInfosRecherche();
242
				collecterInfosRecherche();
239
				vue.basculerAffichageZoneCache();
243
				vue.basculerAffichageZoneCache();
240
				afficherRequeteEtLancerRecherche();
244
				afficherRequeteEtLancerRecherche();
241
			}
245
			}
242
		});
246
		});
243
 
247
 
244
		vue.getChampSaisie().addKeyPressHandler(new KeyPressHandler() {
248
		vue.getChampSaisie().addKeyPressHandler(new KeyPressHandler() {
245
			public void onKeyPress(KeyPressEvent event) {
249
			public void onKeyPress(KeyPressEvent event) {
246
				if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
250
				if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
247
					setTypeMoteur(TypeMoteur.SIMPLE);
251
					setTypeMoteur(TypeMoteur.SIMPLE);
248
					collecterInfosRecherche();
252
					collecterInfosRecherche();
249
					afficherRequeteEtLancerRecherche();
253
					afficherRequeteEtLancerRecherche();
250
				}
254
				}
251
			}
255
			}
252
		});
256
		});
253
 
257
 
254
		vue.getChampSaisieCliquable().addClickHandler(new ClickHandler() {
258
		vue.getChampSaisieCliquable().addClickHandler(new ClickHandler() {
255
			public void onClick(ClickEvent event) {
259
			public void onClick(ClickEvent event) {
256
				if (vue.getValeurRechercheSimple().equals(vue.getLabelRecherche())) {
260
				if (vue.getValeurRechercheSimple().equals(vue.getLabelRecherche())) {
257
					vue.setValeurRechercheSimple("");
261
					vue.setValeurRechercheSimple("");
258
				}
262
				}
259
			}
263
			}
260
		});
264
		});
261
 
265
 
262
		vue.getChampsAuteur().addKeyPressHandler(creerGestionnaireEvenementToucheEntree());
266
		vue.getChampsAuteur().addKeyPressHandler(creerGestionnaireEvenementToucheEntree());
263
 
-
 
264
		vue.getChampsDate().addKeyPressHandler(creerGestionnaireEvenementToucheEntree());
267
		vue.getChampsDate().addKeyPressHandler(creerGestionnaireEvenementToucheEntree());
265
 
-
 
266
		vue.getChampsFamille().addKeyPressHandler(creerGestionnaireEvenementToucheEntree());
268
		vue.getChampsFamille().addKeyPressHandler(creerGestionnaireEvenementToucheEntree());
267
 
-
 
268
		vue.getChampsGenre().addKeyPressHandler(creerGestionnaireEvenementToucheEntree());
269
		vue.getChampsGenre().addKeyPressHandler(creerGestionnaireEvenementToucheEntree());
269
 
-
 
270
		vue.getChampsMotCle().addKeyPressHandler(creerGestionnaireEvenementToucheEntree());
270
		vue.getChampsMotCle().addKeyPressHandler(creerGestionnaireEvenementToucheEntree());
-
 
271
		vue.getChampsDepartement().addKeyPressHandler(creerGestionnaireEvenementToucheEntree());
-
 
272
		vue.getChampsContientMots().addKeyPressHandler(creerGestionnaireEvenementToucheEntree());
271
 
273
 
272
	}
274
	}
273
 
275
 
274
	public KeyPressHandler creerGestionnaireEvenementToucheEntree() {
276
	public KeyPressHandler creerGestionnaireEvenementToucheEntree() {
275
		return new KeyPressHandler() {
277
		return new KeyPressHandler() {
276
			public void onKeyPress(KeyPressEvent event) {
278
			public void onKeyPress(KeyPressEvent event) {
277
				if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
279
				if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
278
					vue.basculerAffichageZoneCache();
280
					vue.basculerAffichageZoneCache();
279
					collecterInfosRecherche();
281
					collecterInfosRecherche();
280
					afficherRequeteEtLancerRecherche();
282
					afficherRequeteEtLancerRecherche();
281
				}
283
				}
282
			}
284
			}
283
		};
285
		};
284
	}
286
	}
285
 
287
 
286
	private void nettoyerChamps() {
288
	private void nettoyerChamps() {
287
		completionCommunesPresenteur.nettoyer();
289
		completionCommunesPresenteur.nettoyer();
288
		completionTaxonsPresenteur.nettoyer();
290
		completionTaxonsPresenteur.nettoyer();
289
		vue.nettoyer();
291
		vue.nettoyer();
290
	}
292
	}
291
 
293
 
292
	public void collecterInfosRecherche() {
294
	public void collecterInfosRecherche() {
293
		InformationsRecherche informationRecherche = new InformationsRecherche();
295
		InformationsRecherche informationRecherche = new InformationsRecherche();
294
		informationRecherche.setRechercheLibre(this.getRechercheLibre());
296
		informationRecherche.setRechercheLibre(this.getRechercheLibre());
295
		if (this.typeMoteur == TypeMoteur.AVANCEE) {
297
		if (this.typeMoteur == TypeMoteur.AVANCEE) {
296
			informationRecherche.setTaxon(completionTaxonsPresenteur.getValeur());
298
			informationRecherche.setTaxon(completionTaxonsPresenteur.getValeur());
297
			informationRecherche.setDepartement(vue.getDepartement());
299
			informationRecherche.setDepartement(vue.getDepartement());
298
			informationRecherche.setCommune(completionCommunesPresenteur.getValeur());
300
			informationRecherche.setCommune(completionCommunesPresenteur.getValeur());
299
			informationRecherche.setFamille(vue.getFamille());
301
			informationRecherche.setFamille(vue.getFamille());
300
			informationRecherche.setGenre(vue.getGenre());
302
			informationRecherche.setGenre(vue.getGenre());
301
			informationRecherche.setMotClef(vue.getMotCle());
303
			informationRecherche.setMotClef(vue.getMotCle());
302
			informationRecherche.setTag(vue.getMotCle());
304
			informationRecherche.setTag(vue.getMotCle());
303
			informationRecherche.setAuteur(vue.getAuteur());
305
			informationRecherche.setAuteur(vue.getAuteur());
304
			informationRecherche.setDate(vue.getDate());
306
			informationRecherche.setDate(vue.getDate());
305
		}
307
		}
306
 
308
 
307
		if (estPourRechercheImages()) {
309
		if (estPourRechercheImages()) {
308
			CacheClient.getInstance().setPageCouranteRechercheImages(1);
310
			CacheClient.getInstance().setPageCouranteRechercheImages(1);
309
			CacheClient.getInstance().setInformationsRechercheImage(informationRecherche);
311
			CacheClient.getInstance().setInformationsRechercheImage(informationRecherche);
310
		} else if (estPourRechercheObservations()) {
312
		} else if (estPourRechercheObservations()) {
311
			CacheClient.getInstance().setPageCouranteRechercheObservations(1);
313
			CacheClient.getInstance().setPageCouranteRechercheObservations(1);
312
			CacheClient.getInstance().setInformationsRechercheObservation(informationRecherche);
314
			CacheClient.getInstance().setInformationsRechercheObservation(informationRecherche);
313
		}
315
		}
314
	}
316
	}
315
 
317
 
316
	private String getRechercheLibre() {
318
	private String getRechercheLibre() {
317
		String rechercheLibre = "";
319
		String rechercheLibre = "";
318
		switch (this.typeMoteur) {
320
		switch (this.typeMoteur) {
319
		case SIMPLE:
321
		case SIMPLE:
320
			rechercheLibre = vue.getValeurRechercheSimple();
322
			rechercheLibre = vue.getValeurRechercheSimple();
321
			break;
323
			break;
322
		case AVANCEE:
324
		case AVANCEE:
323
			rechercheLibre = vue.getContientMots();
325
			rechercheLibre = vue.getContientMots();
324
			break;
326
			break;
325
		default:
327
		default:
326
			// TODO : voir comment gérer les exceptions proprement
328
			// TODO : voir comment gérer les exceptions proprement
327
			// throw new
329
			// throw new
328
			// Exception("Le type de moteur de recherche indiqué n'est pas disponilbe");
330
			// Exception("Le type de moteur de recherche indiqué n'est pas disponilbe");
329
		}
331
		}
330
		return rechercheLibre;
332
		return rechercheLibre;
331
	}
333
	}
332
 
334
 
333
	private InformationsRecherche getInformationsRechercheEnCache() {
335
	private InformationsRecherche getInformationsRechercheEnCache() {
334
		if (estPourRechercheImages()) {
336
		if (estPourRechercheImages()) {
335
			return CacheClient.getInstance().getInformationsRechercheImage();
337
			return CacheClient.getInstance().getInformationsRechercheImage();
336
		} else if (estPourRechercheObservations()) {
338
		} else if (estPourRechercheObservations()) {
337
			return CacheClient.getInstance().getInformationsRechercheObservation();
339
			return CacheClient.getInstance().getInformationsRechercheObservation();
338
		}
340
		}
339
		return null;
341
		return null;
340
	}
342
	}
341
 
343
 
342
	public void afficherRequeteEtLancerRecherche() {
344
	public void afficherRequeteEtLancerRecherche() {
343
		InformationsRecherche informationsRecherche = getInformationsRechercheEnCache();
345
		InformationsRecherche informationsRecherche = getInformationsRechercheEnCache();
344
		if (informationsRecherche != null) {
346
		if (informationsRecherche != null) {
345
			completionTaxonsPresenteur.setValeur(informationsRecherche.getTaxon());
347
			completionTaxonsPresenteur.setValeur(informationsRecherche.getTaxon());
346
			completionCommunesPresenteur.setValeur(informationsRecherche.getCommune());
348
			completionCommunesPresenteur.setValeur(informationsRecherche.getCommune());
347
			vue.chargerValeursRecherchePrecedente(informationsRecherche);
349
			vue.chargerValeursRecherchePrecedente(informationsRecherche);
348
		}
350
		}
349
		lancerRecherche();
351
		lancerRecherche();
350
	}
352
	}
351
 
353
 
352
	public abstract void lancerRecherche();
354
	public abstract void lancerRecherche();
353
}
355
}