Subversion Repositories eFlore/Applications.del

Rev

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

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