Subversion Repositories eFlore/Applications.del

Rev

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

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