1196 |
gduche |
1 |
package org.tela_botanica.del.client.vues.pictoflora.resultats;
|
|
|
2 |
|
|
|
3 |
import java.util.ArrayList;
|
|
|
4 |
import java.util.List;
|
|
|
5 |
|
|
|
6 |
import org.tela_botanica.del.client.modeles.Protocole;
|
|
|
7 |
|
|
|
8 |
import com.google.gwt.core.client.GWT;
|
|
|
9 |
import com.google.gwt.dom.client.NodeList;
|
|
|
10 |
import com.google.gwt.dom.client.OptionElement;
|
|
|
11 |
import com.google.gwt.dom.client.SelectElement;
|
|
|
12 |
import com.google.gwt.event.dom.client.HasChangeHandlers;
|
|
|
13 |
import com.google.gwt.event.dom.client.HasClickHandlers;
|
|
|
14 |
import com.google.gwt.uibinder.client.UiBinder;
|
|
|
15 |
import com.google.gwt.uibinder.client.UiField;
|
|
|
16 |
import com.google.gwt.user.client.Window;
|
|
|
17 |
import com.google.gwt.user.client.ui.Button;
|
|
|
18 |
import com.google.gwt.user.client.ui.Composite;
|
|
|
19 |
import com.google.gwt.user.client.ui.HTMLPanel;
|
|
|
20 |
import com.google.gwt.user.client.ui.HasWidgets;
|
|
|
21 |
import com.google.gwt.user.client.ui.Label;
|
|
|
22 |
import com.google.gwt.user.client.ui.ListBox;
|
|
|
23 |
import com.google.gwt.user.client.ui.Panel;
|
|
|
24 |
import com.google.gwt.user.client.ui.Widget;
|
|
|
25 |
|
|
|
26 |
public class ResultatPictofloraVue extends Composite implements ResultatPictofloraPresenteur.Vue {
|
|
|
27 |
|
|
|
28 |
@UiField
|
|
|
29 |
Panel panneauChargement;
|
|
|
30 |
private final List<HasWidgets> panneauxImages = new ArrayList<HasWidgets>();
|
|
|
31 |
private final int nbImagesPerPage = 10;
|
|
|
32 |
private int numImage = 0;
|
|
|
33 |
|
|
|
34 |
// Annotation can be used to change the name of the associated xml file
|
|
|
35 |
// @UiTemplate("ObservationRechercheVue.ui.xml")
|
|
|
36 |
interface MyUiBinder extends UiBinder<Widget, ResultatPictofloraVue> {
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
|
|
|
40 |
|
|
|
41 |
@UiField
|
|
|
42 |
Panel panneauPagination, panneauPaginationHaut, zoneTri;
|
|
|
43 |
|
|
|
44 |
@UiField
|
|
|
45 |
HTMLPanel imageTable;
|
|
|
46 |
|
|
|
47 |
@UiField
|
|
|
48 |
Button triParNbVotesAscendant, triParNbVotesDescendant, triParDateAscendant, triParDateDescendant, triParNbTagsAscendant, triParNbTagsDescendant;
|
|
|
49 |
|
|
|
50 |
@UiField
|
|
|
51 |
Label aucunResultat;
|
|
|
52 |
|
|
|
53 |
@UiField
|
|
|
54 |
Label labelVote, labelDate, labelTag;
|
|
|
55 |
|
|
|
56 |
@UiField
|
|
|
57 |
ListBox listeProtocoles;
|
|
|
58 |
// Constructeur
|
|
|
59 |
public ResultatPictofloraVue() {
|
|
|
60 |
initWidget(uiBinder.createAndBindUi(this));
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
/**
|
|
|
64 |
* Nettoie et remet à zéro les composants du panneau qui doivent l'être
|
|
|
65 |
* */
|
|
|
66 |
public void nettoyer() {
|
|
|
67 |
setNumImage(0);
|
|
|
68 |
imageTable.clear();
|
|
|
69 |
panneauxImages.clear();
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
public void creerPanneauxObservations(int taille) {
|
|
|
73 |
|
|
|
74 |
panneauxImages.clear();
|
|
|
75 |
for (int i = 0; i < taille; i++) {
|
|
|
76 |
Panel imagePanel = new HTMLPanel("");
|
|
|
77 |
panneauxImages.add(imagePanel);
|
|
|
78 |
}
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
public void afficherElementsAucunResultatTrouve() {
|
|
|
82 |
imageTable.clear();
|
|
|
83 |
aucunResultat.setVisible(true);
|
|
|
84 |
panneauPaginationHaut.setVisible(false);
|
|
|
85 |
panneauPagination.setVisible(false);
|
|
|
86 |
zoneTri.setVisible(false);
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
public void afficherElementsResultatsTrouve() {
|
|
|
90 |
aucunResultat.setVisible(false);
|
|
|
91 |
panneauPaginationHaut.setVisible(true);
|
|
|
92 |
panneauPagination.setVisible(true);
|
|
|
93 |
zoneTri.setVisible(true);
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
public void setNumImage(int numImage) {
|
|
|
97 |
this.numImage = numImage;
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
public void startChargement() {
|
|
|
101 |
panneauChargement.setHeight((this.getOffsetHeight() - (panneauPagination.getOffsetHeight() * 2)) + "px");
|
|
|
102 |
panneauChargement.setVisible(true);
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
public void stopChargement() {
|
|
|
106 |
panneauChargement.setVisible(false);
|
|
|
107 |
}
|
|
|
108 |
|
|
|
109 |
public HTMLPanel getImageTable() {
|
|
|
110 |
return imageTable;
|
|
|
111 |
}
|
|
|
112 |
|
|
|
113 |
public int getNumImage() {
|
|
|
114 |
return numImage;
|
|
|
115 |
}
|
|
|
116 |
|
|
|
117 |
public Panel getPanneauChargement() {
|
|
|
118 |
return panneauChargement;
|
|
|
119 |
}
|
|
|
120 |
|
|
|
121 |
public Panel getPanneauPagination() {
|
|
|
122 |
return panneauPagination;
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
public Panel getPanneauPaginationHaut() {
|
|
|
126 |
return panneauPaginationHaut;
|
|
|
127 |
}
|
|
|
128 |
|
|
|
129 |
public int getNbImagesPerPage() {
|
|
|
130 |
return nbImagesPerPage;
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
public List<HasWidgets> getPanneauxImages() {
|
|
|
134 |
return panneauxImages;
|
|
|
135 |
}
|
|
|
136 |
|
|
|
137 |
public Button getTriParNbVotesAscendant() {
|
|
|
138 |
return triParNbVotesAscendant;
|
|
|
139 |
}
|
|
|
140 |
|
|
|
141 |
public Button getTriParNbVotesDescendant() {
|
|
|
142 |
return triParNbVotesDescendant;
|
|
|
143 |
}
|
|
|
144 |
|
|
|
145 |
public Button getTriParDateAscendant() {
|
|
|
146 |
return triParDateAscendant;
|
|
|
147 |
}
|
|
|
148 |
|
|
|
149 |
public Button getTriParDateDescendant() {
|
|
|
150 |
return triParDateDescendant;
|
|
|
151 |
}
|
|
|
152 |
|
|
|
153 |
public void setListeProtocoles(ListBox listeProtocoles) {
|
|
|
154 |
this.listeProtocoles = listeProtocoles;
|
|
|
155 |
}
|
|
|
156 |
|
|
|
157 |
public HasChangeHandlers getListeProtocoles() {
|
|
|
158 |
return listeProtocoles;
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
public void ajouterProtocole(String NomProtocole, String idProtocole) {
|
|
|
162 |
listeProtocoles.addItem(NomProtocole, idProtocole);
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
public void selectionnerProtocole(int index) {
|
|
|
166 |
listeProtocoles.setSelectedIndex(index);
|
|
|
167 |
}
|
|
|
168 |
|
|
|
169 |
@Override
|
|
|
170 |
public String getNomProtocoleSelectionne() {
|
|
|
171 |
return listeProtocoles.getItemText((listeProtocoles.getSelectedIndex()));
|
|
|
172 |
}
|
|
|
173 |
|
|
|
174 |
@Override
|
|
|
175 |
public int getIdProtocoleSelectionne() {
|
|
|
176 |
return Integer.parseInt(listeProtocoles.getValue((listeProtocoles.getSelectedIndex())));
|
|
|
177 |
}
|
|
|
178 |
|
|
|
179 |
@Override
|
|
|
180 |
public Label getLabelVote() {
|
|
|
181 |
return labelVote;
|
|
|
182 |
}
|
|
|
183 |
|
|
|
184 |
@Override
|
|
|
185 |
public void masquerVoteAscendant() {
|
|
|
186 |
triParNbVotesAscendant.setVisible(false);
|
|
|
187 |
}
|
|
|
188 |
|
|
|
189 |
@Override
|
|
|
190 |
public void masquerVoteDescendant() {
|
|
|
191 |
triParNbVotesDescendant.setVisible(false);
|
|
|
192 |
}
|
|
|
193 |
|
|
|
194 |
@Override
|
|
|
195 |
public void afficherVoteAscendant() {
|
|
|
196 |
triParNbVotesAscendant.setVisible(true);
|
|
|
197 |
}
|
|
|
198 |
|
|
|
199 |
@Override
|
|
|
200 |
public void afficherVoteDescendant() {
|
|
|
201 |
triParNbVotesDescendant.setVisible(true);
|
|
|
202 |
}
|
|
|
203 |
|
|
|
204 |
@Override
|
|
|
205 |
public Label getLabelDate() {
|
|
|
206 |
return labelDate;
|
|
|
207 |
}
|
|
|
208 |
|
|
|
209 |
@Override
|
|
|
210 |
public Label getLabelTag() {
|
|
|
211 |
return labelTag;
|
|
|
212 |
}
|
|
|
213 |
|
|
|
214 |
@Override
|
|
|
215 |
public void masquerDateAscendant() {
|
|
|
216 |
triParDateAscendant.setVisible(false);
|
|
|
217 |
}
|
|
|
218 |
|
|
|
219 |
@Override
|
|
|
220 |
public void masquerDateDescendant() {
|
|
|
221 |
triParDateDescendant.setVisible(false);
|
|
|
222 |
}
|
|
|
223 |
|
|
|
224 |
@Override
|
|
|
225 |
public void afficherDateAscendant() {
|
|
|
226 |
triParDateAscendant.setVisible(true);
|
|
|
227 |
}
|
|
|
228 |
|
|
|
229 |
@Override
|
|
|
230 |
public void afficherDateDescendant() {
|
|
|
231 |
triParDateDescendant.setVisible(true);
|
|
|
232 |
}
|
|
|
233 |
|
|
|
234 |
@Override
|
|
|
235 |
public HasClickHandlers getTriParNbTagsAscendant() {
|
|
|
236 |
return triParNbTagsAscendant;
|
|
|
237 |
}
|
|
|
238 |
|
|
|
239 |
@Override
|
|
|
240 |
public HasClickHandlers getTriParNbTagsDescendant() {
|
|
|
241 |
return triParNbTagsDescendant;
|
|
|
242 |
}
|
|
|
243 |
|
|
|
244 |
|
|
|
245 |
@Override
|
|
|
246 |
public void afficherTagAscendant() {
|
|
|
247 |
triParNbTagsAscendant.setVisible(true);
|
|
|
248 |
}
|
|
|
249 |
|
|
|
250 |
@Override
|
|
|
251 |
public void masquerTagAscendant() {
|
|
|
252 |
triParNbTagsAscendant.setVisible(false);
|
|
|
253 |
}
|
|
|
254 |
|
|
|
255 |
@Override
|
|
|
256 |
public void afficherTagDescendant() {
|
|
|
257 |
triParNbTagsDescendant.setVisible(true);
|
|
|
258 |
}
|
|
|
259 |
|
|
|
260 |
@Override
|
|
|
261 |
public void masquerTagDescendant() {
|
|
|
262 |
triParNbTagsDescendant.setVisible(false);
|
|
|
263 |
}
|
|
|
264 |
|
|
|
265 |
@Override
|
|
|
266 |
public void ajouterProtocoles(List<Protocole> protocoles) {
|
|
|
267 |
SelectElement selectElement = SelectElement.as(listeProtocoles.getElement());
|
|
|
268 |
NodeList<OptionElement> options = selectElement.getOptions();
|
|
|
269 |
for (int i = 0; i < protocoles.size(); i++) {
|
|
|
270 |
listeProtocoles.addItem(protocoles.get(i).getNom(), protocoles.get(i).getId()+"");
|
|
|
271 |
options.getItem(i).setTitle(protocoles.get(i).getDescription());
|
|
|
272 |
}
|
|
|
273 |
}
|
|
|
274 |
|
|
|
275 |
@Override
|
|
|
276 |
public void mettreAJourDescriptionProtocoleCourant(
|
|
|
277 |
Protocole protocoleCourant) {
|
|
|
278 |
listeProtocoles.setTitle(protocoleCourant.getDescription());
|
|
|
279 |
}
|
|
|
280 |
}
|