Subversion Repositories eFlore/Applications.del

Rev

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

Rev 408 Rev 420
Line 31... Line 31...
31
 
31
 
Line 32... Line 32...
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();
Line 71... Line 77...
71
	}
77
	}
Line 72... Line 78...
72
 
78
 
-
 
79
	private final Vue vue;
73
	private final Vue vue;
80
	private final boolean pourRechercheImages, pourRechercheObservations;
74
	private final boolean pourRechercheImages, pourRechercheObservations;
81
 
75
	
82
	private AutoCompletionComboBoxPresenteur autoCompletionNomTaxonsPresenteur;
Line 76... Line 83...
76
	private AutoCompletionComboBoxPresenteur autoCompletionNomTaxonsPresenteur;
83
 
-
 
84
	public MoteurRecherchePresenteur(Vue vue, boolean pourRechercheImages,
Line 77... Line 85...
77
 
85
			boolean pourRechercheObservations) {
-
 
86
		this.vue = vue;
78
	public MoteurRecherchePresenteur(Vue vue, boolean pourRechercheImages, boolean pourRechercheObservations) {
87
		this.pourRechercheImages = pourRechercheImages;
79
		this.vue = vue;
88
		this.pourRechercheObservations = pourRechercheObservations;
-
 
89
 
80
		this.pourRechercheImages = pourRechercheImages;
90
		autoCompletionNomTaxonsPresenteur = new AutoCompletionComboBoxPresenteur(
81
		this.pourRechercheObservations = pourRechercheObservations;
91
				UtilitairesAutoCompletionService.urlServiceCompletionNomLocale) {
Line 82... Line 92...
82
		
92
 
83
		autoCompletionNomTaxonsPresenteur = new AutoCompletionComboBoxPresenteur(UtilitairesAutoCompletionService.urlServiceCompletionNomLocale) {	
93
			protected String effectuerPreTraitementChaineRequete(String requete) {
84
			
94
				return UtilitairesAutoCompletionService
-
 
95
						.effectuerPreTraitementChaineRequeteGenreEspeceSlash(requete);
85
			protected String effectuerPreTraitementChaineRequete(String requete) {
96
				// A décommenter lors de l'utilisation des web services eflore
86
				return UtilitairesAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceSlash(requete);
97
				// return
87
				// A décommenter lors de l'utilisation des web services eflore
98
				// RetourAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceEflore(requete);
88
				//return RetourAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceEflore(requete);
99
			}
89
			}
100
 
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
		});
Line 123... Line 134...
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) {
-
 
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
				}
128
				vue.basculerAffichageZoneCache();
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) {
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());
Line 165... Line 197...
165
		informationRecherche.setDepartement(vue.getDepartement().getText());
197
		informationRecherche.setTag(vue.getTag().getText());
-
 
198
		informationRecherche.setMotClef(vue.getMotCle().getText());
166
		informationRecherche.setFamille(vue.getFamille().getText());
199
		informationRecherche.setAuteur(vue.getAuteur().getText());
-
 
200
		informationRecherche.setDate(vue.getDate().getText());
167
		informationRecherche.setGenre(vue.getGenre().getText());
201
		
168
		informationRecherche.setMotClef(vue.getMotCle().getText());
202
		if (!vue.getRecherchePrincipale().getText()
169
 
203
				.equals(vue.getLabelRecherche())) {
-
 
204
			informationRecherche.setRechercheLibre(vue.getRecherchePrincipale()
170
		if (!vue.getRecherchePrincipale().getText().equals(vue.getLabelRecherche())) {
205
					.getText());
171
			informationRecherche.setRechercheLibre(vue.getRecherchePrincipale().getText());
206
		}
-
 
207
		if (isPourRechercheImages()) {
172
		}
208
			CacheClient.getInstance().setInformationsRechercheImage(
173
		if (isPourRechercheImages()) {
209
					informationRecherche);
Line 174... Line 210...
174
			CacheClient.getInstance().setInformationsRechercheImage(informationRecherche);
210
		} else if (isPourRechercheObservations()) {
175
		} else if (isPourRechercheObservations()) {
211
			CacheClient.getInstance().setInformationsRechercheObservation(
176
			CacheClient.getInstance().setInformationsRechercheObservation(informationRecherche);
212
					informationRecherche);
177
		}
213
		}
-
 
214
	}
178
	}
215
 
179
 
216
	private InformationsRecherche getInformationsRechercheEnCache() {
180
	private InformationsRecherche getInformationsRechercheEnCache() {
217
		if (isPourRechercheImages()) {
181
		if (isPourRechercheImages()) {
218
			return CacheClient.getInstance().getInformationsRechercheImage();
Line -... Line 219...
-
 
219
		} else if (isPourRechercheObservations()) {
-
 
220
			return CacheClient.getInstance()
-
 
221
					.getInformationsRechercheObservation();
-
 
222
		}
-
 
223
		return null;
-
 
224
	}
-
 
225
 
-
 
226
	public void afficherRequeteEtLancerRechercheSimple() {
182
			return CacheClient.getInstance().getInformationsRechercheImage();
227
		InformationsRecherche informationsRecherche = getInformationsRechercheEnCache();
183
		} else if (isPourRechercheObservations()) {
228
		if (informationsRecherche != null) {
184
			return CacheClient.getInstance().getInformationsRechercheObservation();
229
			vue.chargerValeursRechercheSimplePrecedente(informationsRecherche);
-
 
230
		}
185
		}
231
		lancerRecherche();
186
		return null;
232
	}
187
	}
233
	
188
 
234
	public void afficherRequeteEtLancerRecherche() {