Subversion Repositories eFlore/Applications.del

Rev

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

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