Subversion Repositories eFlore/Applications.del

Rev

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

Rev 386 Rev 407
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;
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
 
62
 
63
	@Override
63
	@Override
64
	public HasClickHandlers getBoutonRechercheAvancee() {
64
	public HasClickHandlers getBoutonRechercheAvancee() {
65
		return boutonRechercheAvancee;
65
		return boutonRechercheAvancee;
66
	}
66
	}
67
 
67
 
68
	@Override
68
	@Override
69
	public HasKeyPressHandlers getChampSaisie() {
69
	public HasKeyPressHandlers getChampSaisie() {
70
		return recherchePrincipale;
70
		return recherchePrincipale;
71
	}
71
	}
72
 
72
 
73
	@Override
73
	@Override
74
	public String getValeurRechercheSimple() {
74
	public String getValeurRechercheSimple() {
75
		return recherchePrincipale.getText();
75
		return recherchePrincipale.getText();
76
	}
76
	}
77
 
77
 
78
	@Override
78
	@Override
79
	public HasClickHandlers getChampSaisieCliquable() {
79
	public HasClickHandlers getChampSaisieCliquable() {
80
		return recherchePrincipale;
80
		return recherchePrincipale;
81
	}
81
	}
82
 
82
 
83
	@Override
83
	@Override
84
	public void setValeurRechercheSimple(String valeurRecherche) {
84
	public void setValeurRechercheSimple(String valeurRecherche) {
85
		recherchePrincipale.setText(valeurRecherche);
85
		recherchePrincipale.setText(valeurRecherche);
86
	}
86
	}
87
 
87
 
88
	public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche) {
88
	public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche) {
89
		getAuteur().setText(informationsRecherche.getAuteur());
89
		getAuteur().setText(informationsRecherche.getAuteur());
90
		getCommune().setText(informationsRecherche.getCommune());
90
		getCommune().setText(informationsRecherche.getCommune());
91
		getDate().setText(informationsRecherche.getDate());
91
		getDate().setText(informationsRecherche.getDate());
92
		getDepartement().setText(informationsRecherche.getDepartement());
92
		getDepartement().setText(informationsRecherche.getDepartement());
93
		getFamille().setText(informationsRecherche.getFamille());
93
		getFamille().setText(informationsRecherche.getFamille());
94
		getMotCle().setText(informationsRecherche.getMotClef());
94
		getMotCle().setText(informationsRecherche.getMotClef());
95
 
95
 
96
		
96
		
97
		if (informationsRecherche.getRechercheLibre() != null && !informationsRecherche.getRechercheLibre().equals("")) {
97
		if (informationsRecherche.getRechercheLibre() != null && !informationsRecherche.getRechercheLibre().equals("")) {
98
			getRecherchePrincipale().setText(informationsRecherche.getRechercheLibre());
98
			getRecherchePrincipale().setText(informationsRecherche.getRechercheLibre());
99
		}
99
		}
100
 
100
 
101
		afficherLigneInfoRecherche(informationsRecherche);
101
		afficherLigneInfoRecherche(informationsRecherche);
102
	}
102
	}
103
 
103
 
104
	/**
104
	/**
105
	 * Affiche la ligne d'en tête montrant les elements de la requête à
105
	 * Affiche la ligne d'en tête montrant les elements de la requête à
106
	 * l'utilisateur
106
	 * l'utilisateur
107
	 * 
107
	 * 
108
	 * @param informationRecherche
108
	 * @param informationRecherche
109
	 */
109
	 */
110
	private void afficherLigneInfoRecherche(InformationsRecherche informationRecherche) {
110
	private void afficherLigneInfoRecherche(InformationsRecherche informationRecherche) {
111
 
111
 
112
		StringBuffer texteRecherchePrecedente = new StringBuffer();
112
		StringBuffer texteRecherchePrecedente = new StringBuffer();
113
		if (informationRecherche.getRechercheLibre()!=null&&!informationRecherche.getRechercheLibre().equals("")) {
113
		if (informationRecherche.getRechercheLibre()!=null&&!informationRecherche.getRechercheLibre().equals("")) {
114
			texteRecherchePrecedente.append(I18n.getVocabulary().rechercheLibre() + ":" + informationRecherche.getRechercheLibre() + " ");
114
			texteRecherchePrecedente.append(I18n.getVocabulary().rechercheLibre() + ":" + informationRecherche.getRechercheLibre() + " ");
115
		}
115
		}
116
		if (!informationRecherche.getAuteur().equals("")) {
116
		if (!informationRecherche.getAuteur().equals("")) {
117
			texteRecherchePrecedente.append(I18n.getVocabulary().auteur() + ":" + informationRecherche.getAuteur() + " ");
117
			texteRecherchePrecedente.append(I18n.getVocabulary().auteur() + ":" + informationRecherche.getAuteur() + " ");
118
		}
118
		}
119
		if (!informationRecherche.getCommune().equals("")) {
119
		if (!informationRecherche.getCommune().equals("")) {
120
			texteRecherchePrecedente.append(I18n.getVocabulary().commune() + ":" + informationRecherche.getCommune() + " ");
120
			texteRecherchePrecedente.append(I18n.getVocabulary().commune() + ":" + informationRecherche.getCommune() + " ");
121
		}
121
		}
122
		if (!informationRecherche.getDate().equals("")) {
122
		if (!informationRecherche.getDate().equals("")) {
123
			texteRecherchePrecedente.append(I18n.getVocabulary().date() + ":" + informationRecherche.getDate() + " ");
123
			texteRecherchePrecedente.append(I18n.getVocabulary().date() + ":" + informationRecherche.getDate() + " ");
124
		}
124
		}
125
		if (!informationRecherche.getDepartement().equals("")) {
125
		if (!informationRecherche.getDepartement().equals("")) {
126
			texteRecherchePrecedente.append(I18n.getVocabulary().departement() + ":" + informationRecherche.getDepartement() + " ");
126
			texteRecherchePrecedente.append(I18n.getVocabulary().departement() + ":" + informationRecherche.getDepartement() + " ");
127
		}
127
		}
128
		if (!informationRecherche.getFamille().equals("")) {
128
		if (!informationRecherche.getFamille().equals("")) {
129
			texteRecherchePrecedente.append(I18n.getVocabulary().famille() + ":" + informationRecherche.getFamille() + " ");
129
			texteRecherchePrecedente.append(I18n.getVocabulary().famille() + ":" + informationRecherche.getFamille() + " ");
130
		}
130
		}
131
		if (!informationRecherche.getGenre().equals("")) {
131
		if (!informationRecherche.getGenre().equals("")) {
132
			texteRecherchePrecedente.append(I18n.getVocabulary().genre() + ":" + informationRecherche.getGenre() + " ");
132
			texteRecherchePrecedente.append(I18n.getVocabulary().genre() + ":" + informationRecherche.getGenre() + " ");
133
		}
133
		}
134
		if (!informationRecherche.getMotClef().equals("")) {
134
		if (!informationRecherche.getMotClef().equals("")) {
135
			texteRecherchePrecedente.append(I18n.getVocabulary().mot_clef() + ":" + informationRecherche.getMotClef() + " ");
135
			texteRecherchePrecedente.append(I18n.getVocabulary().mot_clef() + ":" + informationRecherche.getMotClef() + " ");
136
		}
136
		}
137
		recherchePrecedente.setText(texteRecherchePrecedente.toString());
137
		recherchePrecedente.setText(texteRecherchePrecedente.toString());
138
	}
138
	}
139
 
139
 
140
	public HasText getRecherchePrincipale() {
140
	public HasText getRecherchePrincipale() {
141
		return recherchePrincipale;
141
		return recherchePrincipale;
142
	}
142
	}
143
 
143
 
144
	public HasText getDepartement() {
144
	public HasText getDepartement() {
145
		return departement;
145
		return departement;
146
	}
146
	}
147
 
147
 
148
	public HasText getCommune() {
148
	public HasText getCommune() {
149
		return commune;
149
		return commune;
150
	}
150
	}
151
 
151
 
152
	public HasWidgets getTaxon() {
152
	public HasWidgets getTaxon() {
153
		return taxon;
153
		return taxon;
154
	}
154
	}
155
 
155
 
156
	public HasText getFamille() {
156
	public HasText getFamille() {
157
		return famille;
157
		return famille;
158
	}
158
	}
159
 
159
 
160
	public HasText getGenre() {
160
	public HasText getGenre() {
161
		return genre;
161
		return genre;
162
	}
162
	}
163
 
163
 
164
	public HasText getTag() {
164
	public HasText getTag() {
165
		return tag;
165
		return tag;
166
	}
166
	}
167
 
167
 
168
	public HasText getMotCle() {
168
	public HasText getMotCle() {
169
		return motCle;
169
		return motCle;
170
	}
170
	}
171
 
171
 
172
	public HasText getAuteur() {
172
	public HasText getAuteur() {
173
		return auteur;
173
		return auteur;
174
	}
174
	}
175
 
175
 
176
	public HasText getDate() {
176
	public HasText getDate() {
177
		return date;
177
		return date;
178
	}
178
	}
-
 
179
 
-
 
180
	public void focusSaisie() {
-
 
181
		this.recherchePrincipale.setFocus(true);
179
 
182
	}
180
}
183
}