Subversion Repositories eFlore/Applications.del

Rev

Rev 408 | Rev 436 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 408 Rev 420
Line 28... Line 28...
28
		public abstract HasClickHandlers getLienRechercheAvancee();
28
		public abstract HasClickHandlers getLienRechercheAvancee();
Line 29... Line 29...
29
 
29
 
Line 30... Line 30...
30
		public abstract void basculerAffichageZoneCache();
30
		public abstract void basculerAffichageZoneCache();
31
 
31
 
32
		public abstract HasClickHandlers getBoutonRechercheSimple();
32
		public abstract HasClickHandlers getBoutonRechercheSimple();
Line -... Line 33...
-
 
33
 
-
 
34
		public abstract HasClickHandlers getBoutonFermer();
33
		
35
 
Line 34... Line 36...
34
		public abstract HasClickHandlers getBoutonFermer();
36
		public abstract HasClickHandlers getBoutonVider();
Line 35... Line 37...
35
 
37
 
Line 65... Line 67...
65
 
67
 
Line 66... Line 68...
66
		public HasText getDate();
68
		public HasText getDate();
Line -... Line 69...
-
 
69
 
-
 
70
		public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche);
67
 
71
		
-
 
72
		public void chargerValeursRechercheSimplePrecedente(InformationsRecherche informationsRecherche);
-
 
73
 
68
		public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche);
74
		public void focusSaisie();
Line 69... Line 75...
69
		
75
		
70
		public void focusSaisie();
76
		public void nettoyer();
71
	}
77
	}
72
 
78
 
Line 73... Line 79...
73
	private final Vue vue;
79
	private final Vue vue;
-
 
80
	private final boolean pourRechercheImages, pourRechercheObservations;
74
	private final boolean pourRechercheImages, pourRechercheObservations;
81
 
75
	
82
	private AutoCompletionComboBoxPresenteur autoCompletionNomTaxonsPresenteur;
76
	private AutoCompletionComboBoxPresenteur autoCompletionNomTaxonsPresenteur;
83
 
77
 
84
	public MoteurRecherchePresenteur(Vue vue, boolean pourRechercheImages,
78
	public MoteurRecherchePresenteur(Vue vue, boolean pourRechercheImages, boolean pourRechercheObservations) {
85
			boolean pourRechercheObservations) {
-
 
86
		this.vue = vue;
79
		this.vue = vue;
87
		this.pourRechercheImages = pourRechercheImages;
80
		this.pourRechercheImages = pourRechercheImages;
88
		this.pourRechercheObservations = pourRechercheObservations;
-
 
89
 
81
		this.pourRechercheObservations = pourRechercheObservations;
90
		autoCompletionNomTaxonsPresenteur = new AutoCompletionComboBoxPresenteur(
82
		
91
				UtilitairesAutoCompletionService.urlServiceCompletionNomLocale) {
-
 
92
 
83
		autoCompletionNomTaxonsPresenteur = new AutoCompletionComboBoxPresenteur(UtilitairesAutoCompletionService.urlServiceCompletionNomLocale) {	
93
			protected String effectuerPreTraitementChaineRequete(String requete) {
84
			
94
				return UtilitairesAutoCompletionService
85
			protected String effectuerPreTraitementChaineRequete(String requete) {
95
						.effectuerPreTraitementChaineRequeteGenreEspeceSlash(requete);
86
				return UtilitairesAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceSlash(requete);
96
				// A décommenter lors de l'utilisation des web services eflore
87
				// A décommenter lors de l'utilisation des web services eflore
97
				// return
88
				//return RetourAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceEflore(requete);
98
				// RetourAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceEflore(requete);
-
 
99
			}
89
			}
100
 
90
			
101
			@Override
91
			@Override
102
			protected String[] parserResultatRequete(Response response) {
92
			protected String[] parserResultatRequete(Response response) {
103
				return UtilitairesAutoCompletionService
93
				return UtilitairesAutoCompletionService.parserRetourSimple(response);
104
						.parserRetourSimple(response);
94
				// A décommenter lors de l'utilisation des web services eflore
105
				// A décommenter lors de l'utilisation des web services eflore
Line 95... Line 106...
95
				//return RetourAutoCompletionService.parserRetourOss(response);
106
				// return RetourAutoCompletionService.parserRetourOss(response);
96
			}
107
			}
Line 115... Line 126...
115
		});
126
		});
Line 116... Line 127...
116
 
127
 
117
		vue.getBoutonRechercheSimple().addClickHandler(new ClickHandler() {
128
		vue.getBoutonRechercheSimple().addClickHandler(new ClickHandler() {
118
			public void onClick(ClickEvent event) {
129
			public void onClick(ClickEvent event) {
119
				collecterInfosRecherche();
130
				collecterInfosRecherche();
120
				afficherRequeteEtLancerRecherche();
131
				afficherRequeteEtLancerRechercheSimple();
121
			}
132
			}
Line 122... Line 133...
122
		});
133
		});
123
 
134
 
124
		vue.getBoutonFermer().addClickHandler(new ClickHandler() {
135
		vue.getBoutonFermer().addClickHandler(new ClickHandler() {
125
			
136
 
126
			@Override
137
			@Override
127
			public void onClick(ClickEvent event) {
138
			public void onClick(ClickEvent event) {
128
				vue.basculerAffichageZoneCache();
139
				vue.basculerAffichageZoneCache();
-
 
140
			}
-
 
141
		});
-
 
142
 
-
 
143
		vue.getBoutonVider().addClickHandler(new ClickHandler() {
-
 
144
 
-
 
145
			@Override
-
 
146
			public void onClick(ClickEvent event) {
-
 
147
				
-
 
148
				autoCompletionNomTaxonsPresenteur.nettoyer();
-
 
149
				vue.nettoyer();
-
 
150
				
-
 
151
				InformationsRecherche infosRecherche = new InformationsRecherche();
-
 
152
				if (isPourRechercheImages()) {
-
 
153
					CacheClient.getInstance().setInformationsRechercheImage(infosRecherche);
-
 
154
				} else if (isPourRechercheObservations()) {
-
 
155
					CacheClient.getInstance().setInformationsRechercheObservation(infosRecherche);
-
 
156
				}
-
 
157
			}
129
			}
158
		});
130
		});
159
 
131
		vue.getBoutonRechercheAvancee().addClickHandler(new ClickHandler() {
160
		vue.getBoutonRechercheAvancee().addClickHandler(new ClickHandler() {
132
			public void onClick(ClickEvent event) {
161
			public void onClick(ClickEvent event) {
133
				collecterInfosRecherche();
162
				collecterInfosRecherche();
Line 139... Line 168...
139
		vue.getChampSaisie().addKeyPressHandler(new KeyPressHandler() {
168
		vue.getChampSaisie().addKeyPressHandler(new KeyPressHandler() {
Line 140... Line 169...
140
 
169
 
141
			public void onKeyPress(KeyPressEvent event) {
170
			public void onKeyPress(KeyPressEvent event) {
142
				if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
171
				if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
143
					collecterInfosRecherche();
172
					collecterInfosRecherche();
144
					afficherRequeteEtLancerRecherche();
173
					afficherRequeteEtLancerRechercheSimple();
145
				}
174
				}
146
			}
175
			}
Line 147... Line 176...
147
		});
176
		});
Line 148... Line 177...
148
 
177
 
149
		vue.getChampSaisieCliquable().addClickHandler(new ClickHandler() {
178
		vue.getChampSaisieCliquable().addClickHandler(new ClickHandler() {
150
 
179
 
-
 
180
			@Override
151
			@Override
181
			public void onClick(ClickEvent event) {
152
			public void onClick(ClickEvent event) {
182
				if (vue.getValeurRechercheSimple().equals(
153
				if (vue.getValeurRechercheSimple().equals(vue.getLabelRecherche())) {
183
						vue.getLabelRecherche())) {
154
					vue.setValeurRechercheSimple("");
184
					vue.setValeurRechercheSimple("");
155
				}
185
				}
Line 156... Line 186...
156
			}
186
			}
157
		});
187
		});
158
	}
-
 
159
 
188
	}
160
	private void collecterInfosRecherche() {
-
 
161
		InformationsRecherche informationRecherche = new InformationsRecherche();
189
 
-
 
190
	private void collecterInfosRecherche() {
162
		informationRecherche.setAuteur(vue.getAuteur().getText());
191
		InformationsRecherche informationRecherche = new InformationsRecherche();
163
		informationRecherche.setCommune(vue.getCommune().getText());
192
		informationRecherche.setTaxon(autoCompletionNomTaxonsPresenteur.getValeur());
-
 
193
		informationRecherche.setDepartement(vue.getDepartement().getText());
164
		informationRecherche.setDate(vue.getDate().getText());
194
		informationRecherche.setCommune(vue.getCommune().getText());
-
 
195
		informationRecherche.setFamille(vue.getFamille().getText());
-
 
196
		informationRecherche.setGenre(vue.getGenre().getText());
165
		informationRecherche.setDepartement(vue.getDepartement().getText());
197
		informationRecherche.setTag(vue.getTag().getText());
166
		informationRecherche.setFamille(vue.getFamille().getText());
198
		informationRecherche.setMotClef(vue.getMotCle().getText());
-
 
199
		informationRecherche.setAuteur(vue.getAuteur().getText());
167
		informationRecherche.setGenre(vue.getGenre().getText());
200
		informationRecherche.setDate(vue.getDate().getText());
-
 
201
		
168
		informationRecherche.setMotClef(vue.getMotCle().getText());
202
		if (!vue.getRecherchePrincipale().getText()
169
 
203
				.equals(vue.getLabelRecherche())) {
170
		if (!vue.getRecherchePrincipale().getText().equals(vue.getLabelRecherche())) {
204
			informationRecherche.setRechercheLibre(vue.getRecherchePrincipale()
-
 
205
					.getText());
171
			informationRecherche.setRechercheLibre(vue.getRecherchePrincipale().getText());
206
		}
172
		}
207
		if (isPourRechercheImages()) {
-
 
208
			CacheClient.getInstance().setInformationsRechercheImage(
173
		if (isPourRechercheImages()) {
209
					informationRecherche);
174
			CacheClient.getInstance().setInformationsRechercheImage(informationRecherche);
210
		} else if (isPourRechercheObservations()) {
Line 175... Line 211...
175
		} else if (isPourRechercheObservations()) {
211
			CacheClient.getInstance().setInformationsRechercheObservation(
176
			CacheClient.getInstance().setInformationsRechercheObservation(informationRecherche);
212
					informationRecherche);
177
		}
213
		}
178
	}
214
	}
-
 
215
 
179
 
216
	private InformationsRecherche getInformationsRechercheEnCache() {
180
	private InformationsRecherche getInformationsRechercheEnCache() {
217
		if (isPourRechercheImages()) {
181
		if (isPourRechercheImages()) {
218
			return CacheClient.getInstance().getInformationsRechercheImage();
182
			return CacheClient.getInstance().getInformationsRechercheImage();
219
		} else if (isPourRechercheObservations()) {
Line -... Line 220...
-
 
220
			return CacheClient.getInstance()
-
 
221
					.getInformationsRechercheObservation();
-
 
222
		}
-
 
223
		return null;
-
 
224
	}
-
 
225
 
-
 
226
	public void afficherRequeteEtLancerRechercheSimple() {
-
 
227
		InformationsRecherche informationsRecherche = getInformationsRechercheEnCache();
183
		} else if (isPourRechercheObservations()) {
228
		if (informationsRecherche != null) {
184
			return CacheClient.getInstance().getInformationsRechercheObservation();
229
			vue.chargerValeursRechercheSimplePrecedente(informationsRecherche);
185
		}
230
		}
-
 
231
		lancerRecherche();
186
		return null;
232
	}
187
	}
233
	
188
 
234
	public void afficherRequeteEtLancerRecherche() {
189
	public void afficherRequeteEtLancerRecherche() {
235
		InformationsRecherche informationsRecherche = getInformationsRechercheEnCache();
Line 190... Line 236...
190
		InformationsRecherche informationsRecherche = getInformationsRechercheEnCache();
236
		if (informationsRecherche != null) {
Line 191... Line 237...
191
		if (informationsRecherche != null) {
237
			autoCompletionNomTaxonsPresenteur.setValeur(informationsRecherche.getTaxon());
192
			vue.chargerValeursRecherchePrecedente(informationsRecherche);
238
			vue.chargerValeursRecherchePrecedente(informationsRecherche);
193
		}
239
		}