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