Subversion Repositories eFlore/Applications.del

Rev

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

Rev 445 Rev 451
Line 1... Line 1...
1
package org.tela_botanica.del.client.composants.moteurrecherche;
1
package org.tela_botanica.del.client.composants.moteurrecherche;
Line 2... Line 2...
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.AutoCompletionComboBoxPresenteur;
4
import org.tela_botanica.del.client.composants.formulaires.AutoCompletionComboBoxPresenteur;
5
import org.tela_botanica.del.client.composants.formulaires.AutoCompletionComboBoxVue;
5
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.modeles.InformationsRecherche;
6
import org.tela_botanica.del.client.modeles.InformationsRecherche;
8
import org.tela_botanica.del.client.modeles.ModeRecherche;
Line 7... Line 9...
7
import org.tela_botanica.del.client.services.UtilitairesAutoCompletionService;
9
import org.tela_botanica.del.client.services.UtilitairesAutoCompletionService;
8
 
10
 
9
import com.google.gwt.event.dom.client.ClickEvent;
11
import com.google.gwt.event.dom.client.ClickEvent;
Line 20... Line 22...
20
 
22
 
Line 21... Line 23...
21
public abstract class MoteurRecherchePresenteur extends Presenteur {
23
public abstract class MoteurRecherchePresenteur extends Presenteur {
Line -... Line 24...
-
 
24
 
22
 
25
	public abstract interface Vue extends IsWidget {
23
	public abstract interface Vue extends IsWidget {
-
 
24
 
26
 
25
		public abstract HasClickHandlers getLienRechercheAvancee();
-
 
26
 
27
		public abstract void ajouterVue(HasWidgets composite);
27
		public abstract void basculerAffichageZoneCache();
-
 
28
 
28
		public abstract HasClickHandlers getLienRechercheAvancee();
29
		public abstract HasClickHandlers getBoutonRechercheSimple();
-
 
30
 
29
		public abstract void basculerAffichageZoneCache();
31
		public abstract HasClickHandlers getBoutonFermer();
-
 
32
 
30
		public abstract HasClickHandlers getBoutonRechercheSimple();
33
		public abstract HasClickHandlers getBoutonVider();
-
 
34
 
31
		public abstract HasClickHandlers getBoutonFermer();
35
		public abstract HasClickHandlers getBoutonRechercheAvancee();
-
 
36
 
32
		public abstract HasClickHandlers getBoutonVider();
37
		public abstract HasKeyPressHandlers getChampSaisie();
-
 
38
 
33
		public abstract HasClickHandlers getBoutonRechercheAvancee();
39
		public abstract HasClickHandlers getChampSaisieCliquable();
-
 
40
 
34
		public abstract HasKeyPressHandlers getChampSaisie();
41
		public abstract String getValeurRechercheSimple();
-
 
42
 
35
		public abstract HasClickHandlers getChampSaisieCliquable();
43
		public void setValeurRechercheSimple(String valeurRecherche);
-
 
44
 
36
		public abstract String getValeurRechercheSimple();
45
		public String getLabelRecherche();
-
 
46
 
37
		public void setValeurRechercheSimple(String valeurRecherche);
47
		public HasText getRecherchePrincipale();
-
 
48
 
38
		public String getLabelRecherche();
49
		public HasText getDepartement();
-
 
50
 
39
		public String getRecherchePrincipale();
51
		public HasText getCommune();
-
 
52
 
40
		public String getDepartement();
53
		public HasWidgets getTaxon();
-
 
54
 
41
		public String getCommune();
55
		public HasText getFamille();
-
 
56
 
42
		public HasWidgets getTaxon();
57
		public HasText getGenre();
-
 
58
 
43
		public String getFamille();
59
		public HasText getTag();
-
 
60
 
44
		public String getGenre();
61
		public HasText getMotCle();
-
 
62
 
45
		public String getTag();
63
		public HasText getAuteur();
-
 
64
 
46
		public String getMotCle();
65
		public HasText getDate();
-
 
66
 
47
		public String getAuteur();
67
		public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche);
-
 
68
 
48
		public String getDate();
69
		public void focusSaisie();
49
		public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche);
Line 70... Line 50...
70
 
50
		public void focusSaisie();
71
		public void nettoyer();
51
		public void nettoyer();
Line 72... Line 52...
72
	}
52
	}
73
 
53
 
74
	private final Vue vue;
54
	private final Vue vue;
75
	private final boolean pourRechercheImages, pourRechercheObservations;
-
 
76
 
-
 
77
	private AutoCompletionComboBoxPresenteur autoCompletionNomTaxonsPresenteur;
-
 
78
 
55
	private boolean pourRechercheImages = false, pourRechercheObservations= false;
79
	public MoteurRecherchePresenteur(Vue vue, boolean pourRechercheImages, boolean pourRechercheObservations) {
56
 
Line 80... Line 57...
80
		this.vue = vue;
57
	private AutoCompletionComboBoxPresenteur autoCompletionNomTaxonsPresenteur;
81
		this.pourRechercheImages = pourRechercheImages;
58
	
82
		this.pourRechercheObservations = pourRechercheObservations;
59
	public MoteurRecherchePresenteur(Vue vue, ModeRecherche mode) {
83
 
60
		
Line 95... Line 72...
95
				return UtilitairesAutoCompletionService.parserRetourSimple(response);
72
				return UtilitairesAutoCompletionService.parserRetourSimple(response);
96
				// A décommenter lors de l'utilisation des web services eflore
73
				// A décommenter lors de l'utilisation des web services eflore
97
				// return RetourAutoCompletionService.parserRetourOss(response);
74
				// return RetourAutoCompletionService.parserRetourOss(response);
98
			}
75
			}
99
		};
76
		};
-
 
77
		this.vue = vue;
-
 
78
		
-
 
79
		setMode(mode);
-
 
80
 
-
 
81
		autoCompletionNomTaxonsPresenteur = completionNomTaxonsPresenteur;
-
 
82
		gererEvenements();
-
 
83
	}
-
 
84
	
-
 
85
	private void setMode(ModeRecherche mode) {
-
 
86
		switch(mode) {
-
 
87
		case MODE_IMAGE:
-
 
88
			this.pourRechercheImages = true;
-
 
89
		break;
-
 
90
		case MODE_OBSERVATION:
-
 
91
			this.pourRechercheObservations = true;
-
 
92
		}
-
 
93
	}
-
 
94
	
-
 
95
	public MoteurRecherchePresenteur(AutoCompletionComboBoxPresenteur presenteurAutoCompletion, Vue vue, ModeRecherche mode) {
-
 
96
		this.vue = vue;
-
 
97
		setMode(mode);
-
 
98
		autoCompletionNomTaxonsPresenteur = presenteurAutoCompletion;
100
		gererEvenements();
99
		gererEvenements();
101
	}
100
	}
Line 102... Line 101...
102
 
101
 
103
	@Override
102
	@Override
104
	public void go(HasWidgets composite) {
103
	public void go(HasWidgets composite) {
105
		afficherRequeteEtLancerRecherche();
104
		afficherRequeteEtLancerRecherche();
106
		autoCompletionNomTaxonsPresenteur.go(vue.getTaxon());
105
		autoCompletionNomTaxonsPresenteur.go(vue.getTaxon());
107
		composite.add(vue.asWidget());
106
		vue.ajouterVue(composite);
108
		vue.focusSaisie();
107
		vue.focusSaisie();
Line 109... Line 108...
109
	}
108
	}
110
 
109
 
Line 138... Line 137...
138
 
137
 
139
				autoCompletionNomTaxonsPresenteur.nettoyer();
138
				autoCompletionNomTaxonsPresenteur.nettoyer();
Line 140... Line 139...
140
				vue.nettoyer();
139
				vue.nettoyer();
141
 
140
 
142
				InformationsRecherche infosRecherche = new InformationsRecherche();
141
				InformationsRecherche infosRecherche = new InformationsRecherche();
143
				if (isPourRechercheImages()) {
142
				if (estPourRechercheImages()) {
144
					CacheClient.getInstance().setInformationsRechercheImage(infosRecherche);
143
					CacheClient.getInstance().setInformationsRechercheImage(infosRecherche);
145
				} else if (isPourRechercheObservations()) {
144
				} else if (estPourRechercheObservations()) {
146
					CacheClient.getInstance().setInformationsRechercheObservation(infosRecherche);
145
					CacheClient.getInstance().setInformationsRechercheObservation(infosRecherche);
147
				}
146
				}
Line 175... Line 174...
175
				}
174
				}
176
			}
175
			}
177
		});
176
		});
178
	}
177
	}
Line 179... Line 178...
179
 
178
 
180
	private void collecterInfosRecherche() {
179
	public void collecterInfosRecherche() {
181
		InformationsRecherche informationRecherche = new InformationsRecherche();
180
		InformationsRecherche informationRecherche = new InformationsRecherche();
182
		informationRecherche.setTaxon(autoCompletionNomTaxonsPresenteur.getValeur());
181
		informationRecherche.setTaxon(autoCompletionNomTaxonsPresenteur.getValeur());
183
		informationRecherche.setDepartement(vue.getDepartement().getText());
182
		informationRecherche.setDepartement(vue.getDepartement());
184
		informationRecherche.setCommune(vue.getCommune().getText());
183
		informationRecherche.setCommune(vue.getCommune());
185
		informationRecherche.setFamille(vue.getFamille().getText());
184
		informationRecherche.setFamille(vue.getFamille());
186
		informationRecherche.setGenre(vue.getGenre().getText());
185
		informationRecherche.setGenre(vue.getGenre());
187
		informationRecherche.setTag(vue.getTag().getText());
186
		informationRecherche.setTag(vue.getTag());
188
		informationRecherche.setMotClef(vue.getMotCle().getText());
187
		informationRecherche.setMotClef(vue.getMotCle());
189
		informationRecherche.setAuteur(vue.getAuteur().getText());
188
		informationRecherche.setAuteur(vue.getAuteur());
190
		informationRecherche.setDate(vue.getDate().getText());
189
		informationRecherche.setDate(vue.getDate());
Line 191... Line 190...
191
		informationRecherche.setRechercheLibre(vue.getRecherchePrincipale().getText());
190
		informationRecherche.setRechercheLibre(vue.getRecherchePrincipale());
192
 
191
 
193
		if (isPourRechercheImages()) {
192
		if (estPourRechercheImages()) {
194
			CacheClient.getInstance().setInformationsRechercheImage(informationRecherche);
193
			CacheClient.getInstance().setInformationsRechercheImage(informationRecherche);
195
		} else if (isPourRechercheObservations()) {
194
		} else if (estPourRechercheObservations()) {
196
			CacheClient.getInstance().setInformationsRechercheObservation(informationRecherche);
195
			CacheClient.getInstance().setInformationsRechercheObservation(informationRecherche);
Line 197... Line 196...
197
		}
196
		}
198
	}
197
	}
199
 
198
 
200
	private InformationsRecherche getInformationsRechercheEnCache() {
199
	private InformationsRecherche getInformationsRechercheEnCache() {
201
		if (isPourRechercheImages()) {
200
		if (estPourRechercheImages()) {
202
			return CacheClient.getInstance().getInformationsRechercheImage();
201
			return CacheClient.getInstance().getInformationsRechercheImage();
203
		} else if (isPourRechercheObservations()) {
202
		} else if (estPourRechercheObservations()) {
204
			return CacheClient.getInstance().getInformationsRechercheObservation();
203
			return CacheClient.getInstance().getInformationsRechercheObservation();
Line 215... Line 214...
215
		lancerRecherche();
214
		lancerRecherche();
216
	}
215
	}
Line 217... Line 216...
217
 
216
 
Line 218... Line 217...
218
	public abstract void lancerRecherche();
217
	public abstract void lancerRecherche();
219
 
218
 
220
	public boolean isPourRechercheImages() {
219
	public boolean estPourRechercheImages() {
Line 221... Line 220...
221
		return pourRechercheImages;
220
		return pourRechercheImages;
222
	}
221
	}
223
 
222
 
-
 
223
	public boolean estPourRechercheObservations() {
-
 
224
		return pourRechercheObservations;
-
 
225
	}
-
 
226
	
-
 
227
	public ModeRecherche getMode() {
-
 
228
		if(estPourRechercheImages()) {
-
 
229
			return ModeRecherche.MODE_IMAGE;
-
 
230
		} else {
224
	public boolean isPourRechercheObservations() {
231
			return ModeRecherche.MODE_OBSERVATION;