Subversion Repositories eFlore/Applications.del

Rev

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

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