Subversion Repositories eFlore/Applications.del

Rev

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

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