Subversion Repositories eFlore/Applications.del

Rev

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

Rev 533 Rev 545
Line 20... Line 20...
20
import com.google.gwt.user.client.ui.IsWidget;
20
import com.google.gwt.user.client.ui.IsWidget;
Line 21... Line 21...
21
 
21
 
Line 22... Line 22...
22
public abstract class MoteurRecherchePresenteur extends Presenteur {
22
public abstract class MoteurRecherchePresenteur extends Presenteur {
23
 
-
 
24
	public abstract interface Vue extends IsWidget {
23
 
25
 
24
	public abstract interface Vue extends IsWidget {
26
		public abstract void ajouterVue(HasWidgets composite);
25
		public void ajouterVue(HasWidgets composite);
27
		public abstract HasClickHandlers getLienRechercheAvancee();
26
		public HasClickHandlers getLienRechercheAvancee();
28
		public abstract void basculerAffichageZoneCache();
27
		public void basculerAffichageZoneCache();
29
		public abstract HasClickHandlers getBoutonRechercheSimple();
28
		public HasClickHandlers getBoutonRechercheSimple();
30
		public abstract HasClickHandlers getBoutonFermer();
29
		public HasClickHandlers getBoutonFermer();
31
		public abstract HasClickHandlers getBoutonVider();
30
		public HasClickHandlers getBoutonVider();
32
		public abstract HasClickHandlers getBoutonRechercheAvancee();
31
		public HasClickHandlers getBoutonRechercheAvancee();
33
		public abstract HasKeyPressHandlers getChampSaisie();
32
		public HasKeyPressHandlers getChampSaisie();
34
		public abstract HasClickHandlers getChampSaisieCliquable();
33
		public HasClickHandlers getChampSaisieCliquable();
35
		public abstract String getValeurRechercheSimple();
34
		public String getValeurRechercheSimple();
36
		public String getLabelRecherche();
35
		public String getLabelRecherche();
37
		public String getContientMots();
36
		public String getContientMots();
38
		public String getDepartement();
37
		public String getDepartement();
Line 55... Line 54...
55
	private final Vue vue;
54
	private final Vue vue;
56
	private ModeRecherche modeRecherche;
55
	private ModeRecherche modeRecherche;
57
	public enum TypeMoteur {SIMPLE, AVANCEE};
56
	public enum TypeMoteur {SIMPLE, AVANCEE};
58
	private TypeMoteur typeMoteur = TypeMoteur.SIMPLE;
57
	private TypeMoteur typeMoteur = TypeMoteur.SIMPLE;
Line 59... Line 58...
59
 
58
 
60
	private AutoCompletionComboBoxPresenteur autoCompletionNomTaxonsPresenteur;
59
	private AutoCompletionComboBoxPresenteur completionTaxonsPresenteur;
Line 61... Line 60...
61
	private AutoCompletionComboBoxPresenteur autoCompletionCommunesPresenteur;
60
	private AutoCompletionComboBoxPresenteur completionCommunesPresenteur;
-
 
61
	
-
 
62
	public MoteurRecherchePresenteur(Vue vue, ModeRecherche mode) {
-
 
63
		this.vue = vue;
-
 
64
		setMode(mode);
-
 
65
		this.creerCompletionTaxons();
-
 
66
		this.creerCompletionCommunes();
-
 
67
		gererEvenements();
-
 
68
	}
-
 
69
	
-
 
70
	public MoteurRecherchePresenteur(AutoCompletionComboBoxPresenteur presenteurAutoCompletionTaxon, 
-
 
71
									AutoCompletionComboBoxPresenteur presenteurAutoCompletionCommunes,
-
 
72
									Vue vue, ModeRecherche mode) {
-
 
73
		this.vue = vue;
-
 
74
		setMode(mode);
-
 
75
		completionTaxonsPresenteur = presenteurAutoCompletionTaxon;
-
 
76
		completionCommunesPresenteur = presenteurAutoCompletionCommunes;
-
 
77
		gererEvenements();
-
 
78
	}
-
 
79
	
-
 
80
	private Vue getVue() {
Line 62... Line 81...
62
	
81
		return vue;
-
 
82
	}
-
 
83
	
Line -... Line 84...
-
 
84
	public ModeRecherche getMode() {
-
 
85
		return modeRecherche;
-
 
86
	}
-
 
87
	
-
 
88
	private void setMode(ModeRecherche mode) {
-
 
89
		modeRecherche = mode;
-
 
90
	}
-
 
91
	
-
 
92
	public void setTypeMoteur(TypeMoteur typeMoteur) {
-
 
93
		this.typeMoteur = typeMoteur;
-
 
94
	}
-
 
95
 
-
 
96
	public boolean estPourRechercheImages() {
-
 
97
		return (modeRecherche == ModeRecherche.MODE_IMAGE);
-
 
98
	}
-
 
99
 
-
 
100
	public boolean estPourRechercheObservations() {
-
 
101
		return (modeRecherche == ModeRecherche.MODE_OBSERVATION);
63
	public MoteurRecherchePresenteur(Vue vue, ModeRecherche mode) {
102
	}	
64
		
103
 
65
		AutoCompletionComboBoxPresenteur completionNomTaxonsPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), UtilitairesAutoCompletionService.urlServiceCompletionNomLocale) {
104
	private void creerCompletionTaxons() {
66
 
105
		completionTaxonsPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), UtilitairesAutoCompletionService.urlServiceCompletionNomLocale) {
67
			protected String effectuerPreTraitementChaineRequete(String requete) {
106
			protected String effectuerPreTraitementChaineRequete(String requete) {
Line 76... Line 115...
76
				return UtilitairesAutoCompletionService.parserRetourSimple(response);
115
				return UtilitairesAutoCompletionService.parserRetourSimple(response);
77
				// A décommenter lors de l'utilisation des web services eflore
116
				// A décommenter lors de l'utilisation des web services eflore
78
				// return RetourAutoCompletionService.parserRetourOss(response);
117
				// return RetourAutoCompletionService.parserRetourOss(response);
79
			}
118
			}
80
		};
119
		};
-
 
120
	}
Line -... Line 121...
-
 
121
	
81
		
122
	private void creerCompletionCommunes() {
82
		AutoCompletionComboBoxPresenteur completionCommunesPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), UtilitairesAutoCompletionService.urlServiceCompletionCommunes) {
-
 
83
 
123
		completionCommunesPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), UtilitairesAutoCompletionService.urlServiceCompletionCommunes) {
84
			protected String effectuerPreTraitementChaineRequete(String requete) {
124
			protected String effectuerPreTraitementChaineRequete(String requete) {
85
				return requete;
125
				return requete;
Line 86... Line 126...
86
			}
126
			}
Line 98... Line 138...
98
			@Override
138
			@Override
99
			protected String[] parserResultatRequete(Response response) {
139
			protected String[] parserResultatRequete(Response response) {
100
				return UtilitairesAutoCompletionService.parserRetourSimple(response);
140
				return UtilitairesAutoCompletionService.parserRetourSimple(response);
101
			}
141
			}
102
		};
142
		};
103
		this.vue = vue;
-
 
104
		setMode(mode);
-
 
105
 
-
 
106
		autoCompletionCommunesPresenteur = completionCommunesPresenteur;
-
 
107
		autoCompletionNomTaxonsPresenteur = completionNomTaxonsPresenteur;
-
 
108
		gererEvenements();
-
 
109
	}
-
 
110
	
-
 
111
	public MoteurRecherchePresenteur(AutoCompletionComboBoxPresenteur presenteurAutoCompletionTaxon, 
-
 
112
									AutoCompletionComboBoxPresenteur presenteurAutoCompletionCommunes,
-
 
113
									Vue vue, ModeRecherche mode) {
-
 
114
		this.vue = vue;
-
 
115
		setMode(mode);
-
 
116
		autoCompletionNomTaxonsPresenteur = presenteurAutoCompletionTaxon;
-
 
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() {
-
 
142
		return (modeRecherche == ModeRecherche.MODE_OBSERVATION);
-
 
143
	}	
143
	}
Line 144... Line 144...
144
 
144
	
145
	@Override
145
	@Override
146
	public void go(HasWidgets composite) {
146
	public void go(HasWidgets composite) {
147
		afficherRequeteEtLancerRecherche();
147
		afficherRequeteEtLancerRecherche();
148
		autoCompletionNomTaxonsPresenteur.go(vue.getTaxon());
148
		completionTaxonsPresenteur.go(vue.getTaxon());
149
		autoCompletionCommunesPresenteur.go(vue.getCommune());
149
		completionCommunesPresenteur.go(vue.getCommune());
150
		vue.ajouterVue(composite);
150
		vue.ajouterVue(composite);
151
		vue.focusSaisie();
151
		vue.focusSaisie();
Line 152... Line 152...
152
	}
152
	}
Line 214... Line 214...
214
			}
214
			}
215
		});
215
		});
216
	}
216
	}
Line 217... Line 217...
217
	
217
	
218
	private void nettoyerChamps() {
218
	private void nettoyerChamps() {
219
		autoCompletionCommunesPresenteur.nettoyer();
219
		completionCommunesPresenteur.nettoyer();
220
		autoCompletionNomTaxonsPresenteur.nettoyer();
220
		completionTaxonsPresenteur.nettoyer();
221
		vue.nettoyer();
221
		vue.nettoyer();
Line 222... Line 222...
222
	}
222
	}
223
 
223
 
-
 
224
	public void collecterInfosRecherche() {
-
 
225
		InformationsRecherche informationRecherche = new InformationsRecherche();
224
	public void collecterInfosRecherche() {
226
		informationRecherche.setRechercheLibre(this.getRechercheLibre());
225
		InformationsRecherche informationRecherche = new InformationsRecherche();
227
		if (this.typeMoteur == TypeMoteur.AVANCEE) {
226
		informationRecherche.setTaxon(autoCompletionNomTaxonsPresenteur.getValeur());
228
			informationRecherche.setTaxon(completionTaxonsPresenteur.getValeur());
227
		informationRecherche.setDepartement(vue.getDepartement());
229
			informationRecherche.setDepartement(vue.getDepartement());
228
		informationRecherche.setCommune(autoCompletionCommunesPresenteur.getValeur());
230
			informationRecherche.setCommune(completionCommunesPresenteur.getValeur());
229
		informationRecherche.setFamille(vue.getFamille());
231
			informationRecherche.setFamille(vue.getFamille());
230
		informationRecherche.setGenre(vue.getGenre());
232
			informationRecherche.setGenre(vue.getGenre());
231
		informationRecherche.setTag(vue.getTag());
233
			informationRecherche.setTag(vue.getTag());
232
		informationRecherche.setMotClef(vue.getMotCle());
234
			informationRecherche.setMotClef(vue.getMotCle());
233
		informationRecherche.setAuteur(vue.getAuteur());
-
 
-
 
235
			informationRecherche.setAuteur(vue.getAuteur());
Line 234... Line 236...
234
		informationRecherche.setDate(vue.getDate());
236
			informationRecherche.setDate(vue.getDate());
235
		informationRecherche.setRechercheLibre(this.getRechercheLibre());
237
		}
236
 
238
 
237
		if (estPourRechercheImages()) {
239
		if (estPourRechercheImages()) {
Line 269... Line 271...
269
	}
271
	}
Line 270... Line 272...
270
 
272
 
271
	public void afficherRequeteEtLancerRecherche() {
273
	public void afficherRequeteEtLancerRecherche() {
272
		InformationsRecherche informationsRecherche = getInformationsRechercheEnCache();
274
		InformationsRecherche informationsRecherche = getInformationsRechercheEnCache();
273
		if (informationsRecherche != null) {
275
		if (informationsRecherche != null) {
274
			autoCompletionNomTaxonsPresenteur.setValeur(informationsRecherche.getTaxon());
276
			completionTaxonsPresenteur.setValeur(informationsRecherche.getTaxon());
275
			vue.chargerValeursRecherchePrecedente(informationsRecherche);
277
			vue.chargerValeursRecherchePrecedente(informationsRecherche);
276
		}
278
		}
277
		lancerRecherche();
279
		lancerRecherche();