Subversion Repositories eFlore/Applications.del

Rev

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

Rev 500 Rev 533
Line 31... Line 31...
31
		public abstract HasClickHandlers getBoutonVider();
31
		public abstract HasClickHandlers getBoutonVider();
32
		public abstract HasClickHandlers getBoutonRechercheAvancee();
32
		public abstract HasClickHandlers getBoutonRechercheAvancee();
33
		public abstract HasKeyPressHandlers getChampSaisie();
33
		public abstract HasKeyPressHandlers getChampSaisie();
34
		public abstract HasClickHandlers getChampSaisieCliquable();
34
		public abstract HasClickHandlers getChampSaisieCliquable();
35
		public abstract String getValeurRechercheSimple();
35
		public abstract String getValeurRechercheSimple();
36
		public void setValeurRechercheSimple(String valeurRecherche);
-
 
37
		public void setValeurDepartement(String dpt);
-
 
38
		public String getLabelRecherche();
36
		public String getLabelRecherche();
39
		public String getRecherchePrincipale();
37
		public String getContientMots();
40
		public String getDepartement();
38
		public String getDepartement();
41
		public HasWidgets getCommune();
39
		public HasWidgets getCommune();
42
		public HasWidgets getTaxon();
40
		public HasWidgets getTaxon();
43
		public String getFamille();
41
		public String getFamille();
44
		public String getGenre();
42
		public String getGenre();
45
		public String getTag();
43
		public String getTag();
46
		public String getMotCle();
44
		public String getMotCle();
47
		public String getAuteur();
45
		public String getAuteur();
48
		public String getDate();
46
		public String getDate();
-
 
47
		public void setValeurRechercheSimple(String valeurRecherche);
-
 
48
		public void setContientMots(String mots);
-
 
49
		public void setValeurDepartement(String dpt);
49
		public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche);
50
		public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche);
50
		public void focusSaisie();
51
		public void focusSaisie();
51
		public void nettoyer();
52
		public void nettoyer();
52
	}
53
	}
Line 53... Line 54...
53
 
54
 
54
	private final Vue vue;
55
	private final Vue vue;
-
 
56
	private ModeRecherche modeRecherche;
-
 
57
	public enum TypeMoteur {SIMPLE, AVANCEE};
Line 55... Line 58...
55
	private ModeRecherche modeRecherche;
58
	private TypeMoteur typeMoteur = TypeMoteur.SIMPLE;
56
 
59
 
Line 57... Line 60...
57
	private AutoCompletionComboBoxPresenteur autoCompletionNomTaxonsPresenteur;
60
	private AutoCompletionComboBoxPresenteur autoCompletionNomTaxonsPresenteur;
Line 96... Line 99...
96
			protected String[] parserResultatRequete(Response response) {
99
			protected String[] parserResultatRequete(Response response) {
97
				return UtilitairesAutoCompletionService.parserRetourSimple(response);
100
				return UtilitairesAutoCompletionService.parserRetourSimple(response);
98
			}
101
			}
99
		};
102
		};
100
		this.vue = vue;
103
		this.vue = vue;
101
		
-
 
102
		setMode(mode);
104
		setMode(mode);
Line 103... Line 105...
103
 
105
 
104
		autoCompletionCommunesPresenteur = completionCommunesPresenteur;
106
		autoCompletionCommunesPresenteur = completionCommunesPresenteur;
105
		autoCompletionNomTaxonsPresenteur = completionNomTaxonsPresenteur;
107
		autoCompletionNomTaxonsPresenteur = completionNomTaxonsPresenteur;
106
		gererEvenements();
108
		gererEvenements();
Line 107... Line -...
107
	}
-
 
108
	
-
 
109
	private void setMode(ModeRecherche mode) {
-
 
110
		modeRecherche = mode;
-
 
111
	}
109
	}
112
	
110
	
113
	public MoteurRecherchePresenteur(AutoCompletionComboBoxPresenteur presenteurAutoCompletionTaxon, 
111
	public MoteurRecherchePresenteur(AutoCompletionComboBoxPresenteur presenteurAutoCompletionTaxon, 
114
									AutoCompletionComboBoxPresenteur presenteurAutoCompletionCommunes,
112
									AutoCompletionComboBoxPresenteur presenteurAutoCompletionCommunes,
115
									Vue vue, ModeRecherche mode) {
113
									Vue vue, ModeRecherche mode) {
116
		this.vue = vue;
114
		this.vue = vue;
117
		setMode(mode);
115
		setMode(mode);
118
		autoCompletionNomTaxonsPresenteur = presenteurAutoCompletionTaxon;
116
		autoCompletionNomTaxonsPresenteur = presenteurAutoCompletionTaxon;
119
		autoCompletionCommunesPresenteur = presenteurAutoCompletionCommunes;
117
		autoCompletionCommunesPresenteur = presenteurAutoCompletionCommunes;
-
 
118
		gererEvenements();
-
 
119
	}
-
 
120
	
-
 
121
	private Vue getVue() {
-
 
122
		return vue;
-
 
123
	}
-
 
124
	
-
 
125
	public ModeRecherche getMode() {
-
 
126
		return modeRecherche;
-
 
127
	}
-
 
128
	
-
 
129
	private void setMode(ModeRecherche mode) {
-
 
130
		modeRecherche = mode;
-
 
131
	}
-
 
132
	
-
 
133
	public void setTypeMoteur(TypeMoteur typeMoteur) {
-
 
134
		this.typeMoteur = typeMoteur;
-
 
135
	}
-
 
136
 
-
 
137
	public boolean estPourRechercheImages() {
-
 
138
		return (modeRecherche == ModeRecherche.MODE_IMAGE);
-
 
139
	}
-
 
140
 
-
 
141
	public boolean estPourRechercheObservations() {
Line 120... Line 142...
120
		gererEvenements();
142
		return (modeRecherche == ModeRecherche.MODE_OBSERVATION);
121
	}
143
	}	
122
 
144
 
123
	@Override
145
	@Override
Line 131... Line 153...
131
 
153
 
132
	@Override
154
	@Override
133
	protected void gererEvenements() {
155
	protected void gererEvenements() {
134
		vue.getLienRechercheAvancee().addClickHandler(new ClickHandler() {
156
		vue.getLienRechercheAvancee().addClickHandler(new ClickHandler() {
-
 
157
			public void onClick(ClickEvent event) {
135
			public void onClick(ClickEvent event) {
158
				vue.setContientMots(vue.getValeurRechercheSimple());
136
				vue.basculerAffichageZoneCache();
159
				vue.basculerAffichageZoneCache();
137
			}
160
			}
Line 138... Line 161...
138
		});
161
		});
139
 
162
 
-
 
163
		vue.getBoutonRechercheSimple().addClickHandler(new ClickHandler() {
140
		vue.getBoutonRechercheSimple().addClickHandler(new ClickHandler() {
164
			public void onClick(ClickEvent event) {
141
			public void onClick(ClickEvent event) {
165
				setTypeMoteur(TypeMoteur.SIMPLE);
142
				collecterInfosRecherche();
166
				collecterInfosRecherche();
143
				afficherRequeteEtLancerRecherche();
167
				afficherRequeteEtLancerRecherche();
Line 144... Line 168...
144
			}
168
			}
145
		});
-
 
146
 
-
 
147
		vue.getBoutonFermer().addClickHandler(new ClickHandler() {
169
		});
-
 
170
 
148
 
171
		vue.getBoutonFermer().addClickHandler(new ClickHandler() {
149
			@Override
172
			public void onClick(ClickEvent event) {
150
			public void onClick(ClickEvent event) {
173
				vue.setValeurRechercheSimple(vue.getContientMots());
Line 151... Line 174...
151
				vue.basculerAffichageZoneCache();
174
				vue.basculerAffichageZoneCache();
152
			}
-
 
153
		});
-
 
154
 
175
			}
155
		vue.getBoutonVider().addClickHandler(new ClickHandler() {
-
 
156
 
176
		});
157
			@Override
-
 
158
			public void onClick(ClickEvent event) {
177
 
159
 
178
		vue.getBoutonVider().addClickHandler(new ClickHandler() {
160
				nettoyerChamps();
179
			public void onClick(ClickEvent event) {
161
 
180
				nettoyerChamps();
162
				InformationsRecherche infosRecherche = new InformationsRecherche();
181
				InformationsRecherche infosRecherche = new InformationsRecherche();
Line 168... Line 187...
168
			}
187
			}
169
		});
188
		});
Line 170... Line 189...
170
 
189
 
171
		vue.getBoutonRechercheAvancee().addClickHandler(new ClickHandler() {
190
		vue.getBoutonRechercheAvancee().addClickHandler(new ClickHandler() {
-
 
191
			public void onClick(ClickEvent event) {
172
			public void onClick(ClickEvent event) {
192
				setTypeMoteur(TypeMoteur.AVANCEE);
173
				collecterInfosRecherche();
193
				collecterInfosRecherche();
174
				vue.basculerAffichageZoneCache();
194
				vue.basculerAffichageZoneCache();
175
				afficherRequeteEtLancerRecherche();
195
				afficherRequeteEtLancerRecherche();
176
			}
196
			}
Line 177... Line 197...
177
		});
197
		});
178
 
-
 
179
		vue.getChampSaisie().addKeyPressHandler(new KeyPressHandler() {
198
 
180
 
199
		vue.getChampSaisie().addKeyPressHandler(new KeyPressHandler() {
-
 
200
			public void onKeyPress(KeyPressEvent event) {
181
			public void onKeyPress(KeyPressEvent event) {
201
				if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
182
				if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
202
					setTypeMoteur(TypeMoteur.SIMPLE);
183
					collecterInfosRecherche();
203
					collecterInfosRecherche();
184
					afficherRequeteEtLancerRecherche();
204
					afficherRequeteEtLancerRecherche();
185
				}
205
				}
Line 186... Line 206...
186
			}
206
			}
187
		});
-
 
188
 
-
 
189
		vue.getChampSaisieCliquable().addClickHandler(new ClickHandler() {
207
		});
190
 
208
 
191
			@Override
209
		vue.getChampSaisieCliquable().addClickHandler(new ClickHandler() {
192
			public void onClick(ClickEvent event) {
210
			public void onClick(ClickEvent event) {
193
				if (vue.getValeurRechercheSimple().equals(vue.getLabelRecherche())) {
211
				if (vue.getValeurRechercheSimple().equals(vue.getLabelRecherche())) {
Line 212... Line 230...
212
		informationRecherche.setGenre(vue.getGenre());
230
		informationRecherche.setGenre(vue.getGenre());
213
		informationRecherche.setTag(vue.getTag());
231
		informationRecherche.setTag(vue.getTag());
214
		informationRecherche.setMotClef(vue.getMotCle());
232
		informationRecherche.setMotClef(vue.getMotCle());
215
		informationRecherche.setAuteur(vue.getAuteur());
233
		informationRecherche.setAuteur(vue.getAuteur());
216
		informationRecherche.setDate(vue.getDate());
234
		informationRecherche.setDate(vue.getDate());
217
		informationRecherche.setRechercheLibre(vue.getRecherchePrincipale());
235
		informationRecherche.setRechercheLibre(this.getRechercheLibre());
Line 218... Line 236...
218
 
236
 
219
		if (estPourRechercheImages()) {
237
		if (estPourRechercheImages()) {
220
			CacheClient.getInstance().setPageCouranteRechercheImages(1);
238
			CacheClient.getInstance().setPageCouranteRechercheImages(1);
221
			CacheClient.getInstance().setInformationsRechercheImage(informationRecherche);
239
			CacheClient.getInstance().setInformationsRechercheImage(informationRecherche);
222
		} else if (estPourRechercheObservations()) {
240
		} else if (estPourRechercheObservations()) {
223
			CacheClient.getInstance().setPageCouranteRechercheObservations(1);
241
			CacheClient.getInstance().setPageCouranteRechercheObservations(1);
224
			CacheClient.getInstance().setInformationsRechercheObservation(informationRecherche);
242
			CacheClient.getInstance().setInformationsRechercheObservation(informationRecherche);
225
		}
243
		}
-
 
244
	}
-
 
245
	
-
 
246
	private String getRechercheLibre() {
-
 
247
		String rechercheLibre = "";
-
 
248
		switch (this.typeMoteur) {
-
 
249
			case SIMPLE : 
-
 
250
				rechercheLibre = vue.getValeurRechercheSimple();
-
 
251
				break;
-
 
252
			case AVANCEE : 
-
 
253
				rechercheLibre = vue.getContientMots();
-
 
254
				break;
-
 
255
			default:
-
 
256
				// TODO : voir comment gérer les exceptions proprement
-
 
257
				//throw new Exception("Le type de moteur de recherche indiqué n'est pas disponilbe");
-
 
258
		}
-
 
259
		return rechercheLibre;
Line 226... Line 260...
226
	}
260
	}
227
 
261
 
228
	private InformationsRecherche getInformationsRechercheEnCache() {
262
	private InformationsRecherche getInformationsRechercheEnCache() {
229
		if (estPourRechercheImages()) {
263
		if (estPourRechercheImages()) {
Line 242... Line 276...
242
		}
276
		}
243
		lancerRecherche();
277
		lancerRecherche();
244
	}
278
	}
Line 245... Line 279...
245
 
279
 
246
	public abstract void lancerRecherche();
-
 
247
 
-
 
248
	public boolean estPourRechercheImages() {
-
 
249
		return (modeRecherche == ModeRecherche.MODE_IMAGE);
-
 
250
	}
-
 
251
 
-
 
252
	public boolean estPourRechercheObservations() {
-
 
253
		return (modeRecherche == ModeRecherche.MODE_OBSERVATION);
-
 
254
	}
-
 
255
	
-
 
256
	private Vue getVue() {
-
 
257
		return vue;
-
 
258
	}
-
 
259
	
-
 
260
	public ModeRecherche getMode() {
-
 
261
		return modeRecherche;
-
 
262
	}
280
	public abstract void lancerRecherche();