Subversion Repositories eFlore/Applications.del

Rev

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

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