Subversion Repositories eFlore/Applications.del

Rev

Rev 533 | Rev 564 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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