Subversion Repositories eFlore/Applications.del

Rev

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

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