Subversion Repositories eFlore/Applications.del

Rev

Rev 671 | Rev 1367 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 671 Rev 1120
1
package org.tela_botanica.del.client.composants.moteurrecherche;
1
package org.tela_botanica.del.client.composants.moteurrecherche;
2
 
2
 
3
import org.tela_botanica.del.client.i18n.I18n;
3
import org.tela_botanica.del.client.i18n.I18n;
4
import org.tela_botanica.del.client.modeles.InformationsRecherche;
4
import org.tela_botanica.del.client.modeles.InformationsRecherche;
5
 
5
 
6
import com.google.gwt.core.client.GWT;
6
import com.google.gwt.core.client.GWT;
7
import com.google.gwt.event.dom.client.HasClickHandlers;
7
import com.google.gwt.event.dom.client.HasClickHandlers;
8
import com.google.gwt.event.dom.client.HasKeyPressHandlers;
8
import com.google.gwt.event.dom.client.HasKeyPressHandlers;
9
import com.google.gwt.uibinder.client.UiBinder;
9
import com.google.gwt.uibinder.client.UiBinder;
10
import com.google.gwt.uibinder.client.UiField;
10
import com.google.gwt.uibinder.client.UiField;
11
import com.google.gwt.user.client.ui.Button;
11
import com.google.gwt.user.client.ui.Button;
12
import com.google.gwt.user.client.ui.Composite;
12
import com.google.gwt.user.client.ui.Composite;
13
import com.google.gwt.user.client.ui.HasWidgets;
13
import com.google.gwt.user.client.ui.HasWidgets;
14
import com.google.gwt.user.client.ui.Label;
14
import com.google.gwt.user.client.ui.Label;
15
import com.google.gwt.user.client.ui.Panel;
15
import com.google.gwt.user.client.ui.Panel;
16
import com.google.gwt.user.client.ui.TextBox;
16
import com.google.gwt.user.client.ui.TextBox;
17
import com.google.gwt.user.client.ui.Widget;
17
import com.google.gwt.user.client.ui.Widget;
18
 
18
 
19
public class MoteurRechercheVue extends Composite implements MoteurRecherchePresenteur.Vue {
19
public class MoteurRechercheVue extends Composite implements MoteurRecherchePresenteur.Vue {
20
 
20
 
21
	interface Binder extends UiBinder<Widget, MoteurRechercheVue> {
21
	interface Binder extends UiBinder<Widget, MoteurRechercheVue> {
22
	}
22
	}
23
 
23
 
24
	private static Binder uiBinder = GWT.create(Binder.class);
24
	private static Binder uiBinder = GWT.create(Binder.class);
25
	private String labelRecherche = "";
25
	private String labelRecherche = "";
26
 
26
 
27
	@UiField
27
	@UiField
28
	Panel rechercheAvancee, taxon, commune;
28
	Panel rechercheAvancee, taxon, commune, zoneRss;
29
	@UiField
29
	@UiField
30
	Label lienRechercheAvancee, recherchePrecedente;
30
	Label lienRechercheAvancee, recherchePrecedente;
31
	@UiField
31
	@UiField
32
	Button boutonRecherche, boutonRechercheAvancee, boutonFermer, boutonVider;
32
	Button boutonRecherche, boutonRechercheAvancee, boutonFermer, boutonVider;
33
	@UiField
33
	@UiField
34
	TextBox recherchePrincipale, contientMots, departement, famille, genre, motCle, auteur, date;
34
	TextBox recherchePrincipale, contientMots, departement, famille, genre, motCle, auteur, date;
35
 
35
 
36
	public MoteurRechercheVue(String labelRecherche) {
36
	public MoteurRechercheVue(String labelRecherche) {
37
		initWidget(uiBinder.createAndBindUi(this));
37
		initWidget(uiBinder.createAndBindUi(this));
38
		this.labelRecherche = labelRecherche;
38
		this.labelRecherche = labelRecherche;
39
		recherchePrincipale.setText(labelRecherche);
39
		recherchePrincipale.setText(labelRecherche);
40
		rechercheAvancee.setVisible(false);
40
		rechercheAvancee.setVisible(false);
41
	}
41
	}
42
 
42
 
43
	public String getLabelRecherche() {
43
	public String getLabelRecherche() {
44
		return labelRecherche;
44
		return labelRecherche;
45
	}
45
	}
46
 
46
 
47
	public HasClickHandlers getLienRechercheAvancee() {
47
	public HasClickHandlers getLienRechercheAvancee() {
48
		return lienRechercheAvancee;
48
		return lienRechercheAvancee;
49
	}
49
	}
50
 
50
 
51
	public HasClickHandlers getBoutonRechercheSimple() {
51
	public HasClickHandlers getBoutonRechercheSimple() {
52
		return boutonRecherche;
52
		return boutonRecherche;
53
	}
53
	}
54
 
54
 
55
	public HasClickHandlers getBoutonFermer() {
55
	public HasClickHandlers getBoutonFermer() {
56
		return boutonFermer;
56
		return boutonFermer;
57
	}
57
	}
58
 
58
 
59
	public HasClickHandlers getBoutonVider() {
59
	public HasClickHandlers getBoutonVider() {
60
		return boutonVider;
60
		return boutonVider;
61
	}
61
	}
62
 
62
 
63
	public HasClickHandlers getBoutonRechercheAvancee() {
63
	public HasClickHandlers getBoutonRechercheAvancee() {
64
		return boutonRechercheAvancee;
64
		return boutonRechercheAvancee;
65
	}
65
	}
66
 
66
 
67
	public HasKeyPressHandlers getChampSaisie() {
67
	public HasKeyPressHandlers getChampSaisie() {
68
		return recherchePrincipale;
68
		return recherchePrincipale;
69
	}
69
	}
70
 
70
 
71
	public String getValeurRechercheSimple() {
71
	public String getValeurRechercheSimple() {
72
		return recherchePrincipale.getText();
72
		return recherchePrincipale.getText();
73
	}
73
	}
74
 
74
 
75
	public void setValeurRechercheSimple(String valeurRecherche) {
75
	public void setValeurRechercheSimple(String valeurRecherche) {
76
		recherchePrincipale.setText(valeurRecherche);
76
		recherchePrincipale.setText(valeurRecherche);
77
	}
77
	}
78
 
78
 
79
	public HasClickHandlers getChampSaisieCliquable() {
79
	public HasClickHandlers getChampSaisieCliquable() {
80
		return recherchePrincipale;
80
		return recherchePrincipale;
81
	}
81
	}
82
 
82
 
83
	public String getContientMots() {
83
	public String getContientMots() {
84
		return contientMots.getText();
84
		return contientMots.getText();
85
	}
85
	}
86
 
86
 
87
	public void setContientMots(String mots) {
87
	public void setContientMots(String mots) {
88
		contientMots.setText(mots);
88
		contientMots.setText(mots);
89
	}
89
	}
90
 
90
 
91
	public String getDepartement() {
91
	public String getDepartement() {
92
		return departement.getText();
92
		return departement.getText();
93
	}
93
	}
94
 
94
 
95
	public void setValeurDepartement(String dpt) {
95
	public void setValeurDepartement(String dpt) {
96
		departement.setValue(dpt);
96
		departement.setValue(dpt);
97
	}
97
	}
98
 
98
 
99
	public HasWidgets getCommune() {
99
	public HasWidgets getCommune() {
100
		return commune;
100
		return commune;
101
	}
101
	}
102
 
102
 
103
	public HasWidgets getTaxon() {
103
	public HasWidgets getTaxon() {
104
		return taxon;
104
		return taxon;
105
	}
105
	}
106
 
106
 
107
	public String getFamille() {
107
	public String getFamille() {
108
		return famille.getText();
108
		return famille.getText();
109
	}
109
	}
110
 
110
 
111
	public String getGenre() {
111
	public String getGenre() {
112
		return genre.getText();
112
		return genre.getText();
113
	}
113
	}
114
 
114
 
115
	public String getMotCle() {
115
	public String getMotCle() {
116
		return motCle.getText();
116
		return motCle.getText();
117
	}
117
	}
118
 
118
 
119
	public String getAuteur() {
119
	public String getAuteur() {
120
		return auteur.getText();
120
		return auteur.getText();
121
	}
121
	}
122
 
122
 
123
	public String getDate() {
123
	public String getDate() {
124
		return date.getText();
124
		return date.getText();
125
	}
125
	}
126
 
126
 
127
	public void focusSaisie() {
127
	public void focusSaisie() {
128
		this.recherchePrincipale.setFocus(true);
128
		this.recherchePrincipale.setFocus(true);
129
	}
129
	}
130
 
130
 
131
	public void ajouterVue(HasWidgets composite) {
131
	public void ajouterVue(HasWidgets composite) {
132
		composite.add(this.asWidget());
132
		composite.add(this.asWidget());
133
	}
133
	}
134
 
134
 
135
	public void basculerAffichageZoneCache() {
135
	public void basculerAffichageZoneCache() {
136
		rechercheAvancee.setVisible(!rechercheAvancee.isVisible());
136
		rechercheAvancee.setVisible(!rechercheAvancee.isVisible());
137
		recherchePrincipale.setVisible(!recherchePrincipale.isVisible());
137
		recherchePrincipale.setVisible(!recherchePrincipale.isVisible());
138
		boutonRecherche.setVisible(!boutonRecherche.isVisible());
138
		boutonRecherche.setVisible(!boutonRecherche.isVisible());
139
	}
139
	}
140
 
140
 
141
	public void nettoyer() {
141
	public void nettoyer() {
142
		chargerValeursRecherchePrecedente(new InformationsRecherche());
142
		chargerValeursRecherchePrecedente(new InformationsRecherche());
143
	}
143
	}
144
 
144
 
145
	public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche) {
145
	public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche) {
146
		recherchePrincipale.setText(informationsRecherche.getRechercheLibre());
146
		recherchePrincipale.setText(informationsRecherche.getRechercheLibre());
147
		contientMots.setText(informationsRecherche.getRechercheLibre());
147
		contientMots.setText(informationsRecherche.getRechercheLibre());
148
		departement.setText(informationsRecherche.getDepartement());
148
		departement.setText(informationsRecherche.getDepartement());
149
		famille.setText(informationsRecherche.getFamille());
149
		famille.setText(informationsRecherche.getFamille());
150
		genre.setText(informationsRecherche.getGenre());
150
		genre.setText(informationsRecherche.getGenre());
151
		motCle.setText(informationsRecherche.getMotClef());
151
		motCle.setText(informationsRecherche.getMotClef());
152
		auteur.setText(informationsRecherche.getAuteur());
152
		auteur.setText(informationsRecherche.getAuteur());
153
		date.setText(informationsRecherche.getDate());
153
		date.setText(informationsRecherche.getDate());
154
 
154
 
155
		afficherLigneInfoRecherche(informationsRecherche);
155
		afficherLigneInfoRecherche(informationsRecherche);
156
	}
156
	}
157
 
157
 
158
	/**
158
	/**
159
	 * Affiche la ligne d'en tête montrant les elements de la requête à
159
	 * Affiche la ligne d'en tête montrant les elements de la requête à
160
	 * l'utilisateur
160
	 * l'utilisateur
161
	 * 
161
	 * 
162
	 * @param informationRecherche
162
	 * @param informationRecherche
163
	 */
163
	 */
164
	private void afficherLigneInfoRecherche(InformationsRecherche informationRecherche) {
164
	private void afficherLigneInfoRecherche(InformationsRecherche informationRecherche) {
165
		// tax dep com fam gen ta mo au date
165
		// tax dep com fam gen ta mo au date
166
		StringBuffer texteRecherchePrecedente = new StringBuffer();
166
		StringBuffer texteRecherchePrecedente = new StringBuffer();
167
 
167
 
168
		if (informationRecherche.getRechercheLibre() != null && !informationRecherche.getRechercheLibre().equals("")) {
168
		if (informationRecherche.getRechercheLibre() != null && !informationRecherche.getRechercheLibre().equals("")) {
169
			texteRecherchePrecedente.append(I18n.getVocabulary().rechercheLibre() + ":" + informationRecherche.getRechercheLibre() + " ");
169
			texteRecherchePrecedente.append(I18n.getVocabulary().rechercheLibre() + ":" + informationRecherche.getRechercheLibre() + " ");
170
		}
170
		}
171
		if (informationRecherche.getTaxon() != null && !informationRecherche.getTaxon().equals("")) {
171
		if (informationRecherche.getTaxon() != null && !informationRecherche.getTaxon().equals("")) {
172
			texteRecherchePrecedente.append(I18n.getVocabulary().taxon() + ":" + informationRecherche.getTaxon() + " ");
172
			texteRecherchePrecedente.append(I18n.getVocabulary().taxon() + ":" + informationRecherche.getTaxon() + " ");
173
		}
173
		}
174
		if (informationRecherche.getDepartement() != null && !informationRecherche.getDepartement().equals("")) {
174
		if (informationRecherche.getDepartement() != null && !informationRecherche.getDepartement().equals("")) {
175
			texteRecherchePrecedente.append(I18n.getVocabulary().departement() + ":" + informationRecherche.getDepartement() + " ");
175
			texteRecherchePrecedente.append(I18n.getVocabulary().departement() + ":" + informationRecherche.getDepartement() + " ");
176
		}
176
		}
177
		if (informationRecherche.getCommune() != null && !informationRecherche.getCommune().equals("")) {
177
		if (informationRecherche.getCommune() != null && !informationRecherche.getCommune().equals("")) {
178
			texteRecherchePrecedente.append(I18n.getVocabulary().commune() + ":" + informationRecherche.getCommune() + " ");
178
			texteRecherchePrecedente.append(I18n.getVocabulary().commune() + ":" + informationRecherche.getCommune() + " ");
179
		}
179
		}
180
		if (informationRecherche.getFamille() != null && !informationRecherche.getFamille().equals("")) {
180
		if (informationRecherche.getFamille() != null && !informationRecherche.getFamille().equals("")) {
181
			texteRecherchePrecedente.append(I18n.getVocabulary().famille() + ":" + informationRecherche.getFamille() + " ");
181
			texteRecherchePrecedente.append(I18n.getVocabulary().famille() + ":" + informationRecherche.getFamille() + " ");
182
		}
182
		}
183
		if (informationRecherche.getGenre() != null && !informationRecherche.getGenre().equals("")) {
183
		if (informationRecherche.getGenre() != null && !informationRecherche.getGenre().equals("")) {
184
			texteRecherchePrecedente.append(I18n.getVocabulary().genre() + ":" + informationRecherche.getGenre() + " ");
184
			texteRecherchePrecedente.append(I18n.getVocabulary().genre() + ":" + informationRecherche.getGenre() + " ");
185
		}
185
		}
186
		if (informationRecherche.getTag() != null && !informationRecherche.getTag().equals("")) {
186
		if (informationRecherche.getTag() != null && !informationRecherche.getTag().equals("")) {
187
			texteRecherchePrecedente.append(I18n.getVocabulary().tag() + ":" + informationRecherche.getTag() + " ");
187
			texteRecherchePrecedente.append(I18n.getVocabulary().tag() + ":" + informationRecherche.getTag() + " ");
188
		}
188
		}
189
		if (informationRecherche.getMotClef() != null && !informationRecherche.getMotClef().equals("")) {
189
		if (informationRecherche.getMotClef() != null && !informationRecherche.getMotClef().equals("")) {
190
			texteRecherchePrecedente.append(I18n.getVocabulary().mot_clef() + ":" + informationRecherche.getMotClef() + " ");
190
			texteRecherchePrecedente.append(I18n.getVocabulary().mot_clef() + ":" + informationRecherche.getMotClef() + " ");
191
		}
191
		}
192
		if (informationRecherche.getAuteur() != null && !informationRecherche.getAuteur().equals("")) {
192
		if (informationRecherche.getAuteur() != null && !informationRecherche.getAuteur().equals("")) {
193
			texteRecherchePrecedente.append(I18n.getVocabulary().auteur() + ":" + informationRecherche.getAuteur() + " ");
193
			texteRecherchePrecedente.append(I18n.getVocabulary().auteur() + ":" + informationRecherche.getAuteur() + " ");
194
		}
194
		}
195
		if (informationRecherche.getDate() != null && !informationRecherche.getDate().equals("")) {
195
		if (informationRecherche.getDate() != null && !informationRecherche.getDate().equals("")) {
196
			texteRecherchePrecedente.append(I18n.getVocabulary().date() + ":" + informationRecherche.getDate() + " ");
196
			texteRecherchePrecedente.append(I18n.getVocabulary().date() + ":" + informationRecherche.getDate() + " ");
197
		}
197
		}
198
 
198
 
199
		recherchePrecedente.setText(texteRecherchePrecedente.toString());
199
		recherchePrecedente.setText(texteRecherchePrecedente.toString());
200
	}
200
	}
201
 
201
 
202
	@Override
202
	@Override
203
	public HasKeyPressHandlers getChampsFamille() {
203
	public HasKeyPressHandlers getChampsFamille() {
204
		return famille;
204
		return famille;
205
	}
205
	}
206
 
206
 
207
	@Override
207
	@Override
208
	public HasKeyPressHandlers getChampsGenre() {
208
	public HasKeyPressHandlers getChampsGenre() {
209
		return genre;
209
		return genre;
210
	}
210
	}
211
 
211
 
212
	@Override
212
	@Override
213
	public HasKeyPressHandlers getChampsMotCle() {
213
	public HasKeyPressHandlers getChampsMotCle() {
214
		return motCle;
214
		return motCle;
215
	}
215
	}
216
 
216
 
217
	@Override
217
	@Override
218
	public HasKeyPressHandlers getChampsAuteur() {
218
	public HasKeyPressHandlers getChampsAuteur() {
219
		return auteur;
219
		return auteur;
220
	}
220
	}
221
 
221
 
222
	@Override
222
	@Override
223
	public HasKeyPressHandlers getChampsDate() {
223
	public HasKeyPressHandlers getChampsDate() {
224
		return date;
224
		return date;
225
	}
225
	}
226
 
226
 
227
	@Override
227
	@Override
228
	public HasKeyPressHandlers getChampsDepartement() {
228
	public HasKeyPressHandlers getChampsDepartement() {
229
		return departement;
229
		return departement;
230
	}
230
	}
231
 
231
 
232
	@Override
232
	@Override
233
	public HasKeyPressHandlers getChampsContientMots() {
233
	public HasKeyPressHandlers getChampsContientMots() {
234
		return contientMots;
234
		return contientMots;
235
	}
235
	}
-
 
236
	
-
 
237
	public HasWidgets getZoneRss() {
-
 
238
		return zoneRss;
-
 
239
	}
236
}
240
}
237
241