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 |
|
545 |
jpm |
21 |
interface Binder extends UiBinder<Widget, MoteurRechercheVue> {}
|
335 |
benjamin |
22 |
|
322 |
gduche |
23 |
private static Binder uiBinder = GWT.create(Binder.class);
|
|
|
24 |
private String labelRecherche = "";
|
335 |
benjamin |
25 |
|
|
|
26 |
@UiField
|
457 |
aurelien |
27 |
Panel rechercheAvancee, taxon, commune;
|
335 |
benjamin |
28 |
@UiField
|
|
|
29 |
Label lienRechercheAvancee, recherchePrecedente;
|
|
|
30 |
@UiField
|
419 |
gduche |
31 |
Button boutonRecherche, boutonRechercheAvancee, boutonFermer, boutonVider;
|
335 |
benjamin |
32 |
@UiField
|
533 |
jpm |
33 |
TextBox recherchePrincipale, contientMots, departement, famille, genre, tag, motCle, auteur, date;
|
335 |
benjamin |
34 |
|
322 |
gduche |
35 |
public MoteurRechercheVue(String labelRecherche) {
|
|
|
36 |
initWidget(uiBinder.createAndBindUi(this));
|
|
|
37 |
this.labelRecherche = labelRecherche;
|
|
|
38 |
recherchePrincipale.setText(labelRecherche);
|
|
|
39 |
rechercheAvancee.setVisible(false);
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
public String getLabelRecherche() {
|
|
|
43 |
return labelRecherche;
|
|
|
44 |
}
|
335 |
benjamin |
45 |
|
322 |
gduche |
46 |
public HasClickHandlers getLienRechercheAvancee() {
|
|
|
47 |
return lienRechercheAvancee;
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
public HasClickHandlers getBoutonRechercheSimple() {
|
|
|
51 |
return boutonRecherche;
|
|
|
52 |
}
|
445 |
benjamin |
53 |
|
408 |
gduche |
54 |
public HasClickHandlers getBoutonFermer() {
|
|
|
55 |
return boutonFermer;
|
|
|
56 |
}
|
445 |
benjamin |
57 |
|
419 |
gduche |
58 |
public HasClickHandlers getBoutonVider() {
|
|
|
59 |
return boutonVider;
|
|
|
60 |
}
|
335 |
benjamin |
61 |
|
322 |
gduche |
62 |
public HasClickHandlers getBoutonRechercheAvancee() {
|
|
|
63 |
return boutonRechercheAvancee;
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
public HasKeyPressHandlers getChampSaisie() {
|
|
|
67 |
return recherchePrincipale;
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
public String getValeurRechercheSimple() {
|
|
|
71 |
return recherchePrincipale.getText();
|
|
|
72 |
}
|
533 |
jpm |
73 |
|
545 |
jpm |
74 |
public void setValeurRechercheSimple(String valeurRecherche) {
|
|
|
75 |
recherchePrincipale.setText(valeurRecherche);
|
533 |
jpm |
76 |
}
|
545 |
jpm |
77 |
|
322 |
gduche |
78 |
public HasClickHandlers getChampSaisieCliquable() {
|
|
|
79 |
return recherchePrincipale;
|
|
|
80 |
}
|
545 |
jpm |
81 |
|
|
|
82 |
public String getContientMots() {
|
|
|
83 |
return contientMots.getText();
|
|
|
84 |
}
|
335 |
benjamin |
85 |
|
533 |
jpm |
86 |
public void setContientMots(String mots) {
|
|
|
87 |
contientMots.setText(mots);
|
|
|
88 |
}
|
|
|
89 |
|
545 |
jpm |
90 |
public String getDepartement() {
|
|
|
91 |
return departement.getText();
|
|
|
92 |
}
|
|
|
93 |
|
457 |
aurelien |
94 |
public void setValeurDepartement(String dpt) {
|
|
|
95 |
departement.setValue(dpt);
|
|
|
96 |
}
|
545 |
jpm |
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 |
}
|
533 |
jpm |
129 |
|
545 |
jpm |
130 |
public void focusSaisie() {
|
|
|
131 |
this.recherchePrincipale.setFocus(true);
|
|
|
132 |
}
|
322 |
gduche |
133 |
|
545 |
jpm |
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());
|
|
|
146 |
}
|
|
|
147 |
|
335 |
benjamin |
148 |
public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche) {
|
451 |
aurelien |
149 |
recherchePrincipale.setText(informationsRecherche.getRechercheLibre());
|
533 |
jpm |
150 |
contientMots.setText(informationsRecherche.getRechercheLibre());
|
451 |
aurelien |
151 |
departement.setText(informationsRecherche.getDepartement());
|
|
|
152 |
famille.setText(informationsRecherche.getFamille());
|
|
|
153 |
genre.setText(informationsRecherche.getGenre());
|
|
|
154 |
tag.setText(informationsRecherche.getTag());
|
|
|
155 |
motCle.setText(informationsRecherche.getMotClef());
|
|
|
156 |
auteur.setText(informationsRecherche.getAuteur());
|
|
|
157 |
date.setText(informationsRecherche.getDate());
|
445 |
benjamin |
158 |
|
335 |
benjamin |
159 |
afficherLigneInfoRecherche(informationsRecherche);
|
|
|
160 |
}
|
|
|
161 |
|
|
|
162 |
/**
|
|
|
163 |
* Affiche la ligne d'en tête montrant les elements de la requête à
|
|
|
164 |
* l'utilisateur
|
|
|
165 |
*
|
|
|
166 |
* @param informationRecherche
|
|
|
167 |
*/
|
|
|
168 |
private void afficherLigneInfoRecherche(InformationsRecherche informationRecherche) {
|
445 |
benjamin |
169 |
// tax dep com fam gen ta mo au date
|
335 |
benjamin |
170 |
StringBuffer texteRecherchePrecedente = new StringBuffer();
|
445 |
benjamin |
171 |
|
|
|
172 |
if (informationRecherche.getRechercheLibre() != null && !informationRecherche.getRechercheLibre().equals("")) {
|
335 |
benjamin |
173 |
texteRecherchePrecedente.append(I18n.getVocabulary().rechercheLibre() + ":" + informationRecherche.getRechercheLibre() + " ");
|
322 |
gduche |
174 |
}
|
445 |
benjamin |
175 |
if (informationRecherche.getTaxon() != null && !informationRecherche.getTaxon().equals("")) {
|
419 |
gduche |
176 |
texteRecherchePrecedente.append(I18n.getVocabulary().taxon() + ":" + informationRecherche.getTaxon() + " ");
|
322 |
gduche |
177 |
}
|
445 |
benjamin |
178 |
if (informationRecherche.getDepartement() != null && !informationRecherche.getDepartement().equals("")) {
|
419 |
gduche |
179 |
texteRecherchePrecedente.append(I18n.getVocabulary().departement() + ":" + informationRecherche.getDepartement() + " ");
|
|
|
180 |
}
|
445 |
benjamin |
181 |
if (informationRecherche.getCommune() != null && !informationRecherche.getCommune().equals("")) {
|
335 |
benjamin |
182 |
texteRecherchePrecedente.append(I18n.getVocabulary().commune() + ":" + informationRecherche.getCommune() + " ");
|
322 |
gduche |
183 |
}
|
445 |
benjamin |
184 |
if (informationRecherche.getFamille() != null && !informationRecherche.getFamille().equals("")) {
|
335 |
benjamin |
185 |
texteRecherchePrecedente.append(I18n.getVocabulary().famille() + ":" + informationRecherche.getFamille() + " ");
|
322 |
gduche |
186 |
}
|
445 |
benjamin |
187 |
if (informationRecherche.getGenre() != null && !informationRecherche.getGenre().equals("")) {
|
335 |
benjamin |
188 |
texteRecherchePrecedente.append(I18n.getVocabulary().genre() + ":" + informationRecherche.getGenre() + " ");
|
322 |
gduche |
189 |
}
|
445 |
benjamin |
190 |
if (informationRecherche.getTag() != null && !informationRecherche.getTag().equals("")) {
|
419 |
gduche |
191 |
texteRecherchePrecedente.append(I18n.getVocabulary().tag() + ":" + informationRecherche.getTag() + " ");
|
|
|
192 |
}
|
445 |
benjamin |
193 |
if (informationRecherche.getMotClef() != null && !informationRecherche.getMotClef().equals("")) {
|
335 |
benjamin |
194 |
texteRecherchePrecedente.append(I18n.getVocabulary().mot_clef() + ":" + informationRecherche.getMotClef() + " ");
|
322 |
gduche |
195 |
}
|
445 |
benjamin |
196 |
if (informationRecherche.getAuteur() != null && !informationRecherche.getAuteur().equals("")) {
|
419 |
gduche |
197 |
texteRecherchePrecedente.append(I18n.getVocabulary().auteur() + ":" + informationRecherche.getAuteur() + " ");
|
|
|
198 |
}
|
445 |
benjamin |
199 |
if (informationRecherche.getDate() != null && !informationRecherche.getDate().equals("")) {
|
419 |
gduche |
200 |
texteRecherchePrecedente.append(I18n.getVocabulary().date() + ":" + informationRecherche.getDate() + " ");
|
|
|
201 |
}
|
445 |
benjamin |
202 |
|
335 |
benjamin |
203 |
recherchePrecedente.setText(texteRecherchePrecedente.toString());
|
322 |
gduche |
204 |
}
|
545 |
jpm |
205 |
}
|