Subversion Repositories eFlore/Applications.del

Rev

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

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