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