| 11 |
ddelon |
1 |
/*
|
|
|
2 |
* Copyright 2006 Google Inc.
|
|
|
3 |
*
|
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
|
5 |
* use this file except in compliance with the License. You may obtain a copy of
|
|
|
6 |
* the License at
|
|
|
7 |
*
|
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
9 |
*
|
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
12 |
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
13 |
* License for the specific language governing permissions and limitations under
|
|
|
14 |
* the License.
|
|
|
15 |
*/
|
|
|
16 |
package org.tela_botanica.client;
|
|
|
17 |
|
|
|
18 |
import java.util.Iterator;
|
|
|
19 |
import java.util.Vector;
|
|
|
20 |
|
|
|
21 |
import com.google.gwt.json.client.JSONArray;
|
|
|
22 |
import com.google.gwt.json.client.JSONNumber;
|
|
|
23 |
import com.google.gwt.json.client.JSONParser;
|
|
|
24 |
import com.google.gwt.json.client.JSONString;
|
|
|
25 |
import com.google.gwt.json.client.JSONValue;
|
|
|
26 |
import com.google.gwt.user.client.HTTPRequest;
|
|
|
27 |
import com.google.gwt.user.client.ResponseTextHandler;
|
|
|
28 |
import com.google.gwt.user.client.ui.Composite;
|
|
|
29 |
import com.google.gwt.user.client.ui.FlexTable;
|
|
|
30 |
import com.google.gwt.user.client.ui.Grid;
|
|
|
31 |
import com.google.gwt.user.client.ui.HTML;
|
|
|
32 |
import com.google.gwt.user.client.ui.HorizontalPanel;
|
| 14 |
ddelon |
33 |
import com.google.gwt.user.client.ui.Image;
|
| 13 |
ddelon |
34 |
import com.google.gwt.user.client.ui.SourcesTableEvents;
|
|
|
35 |
import com.google.gwt.user.client.ui.TableListener;
|
| 11 |
ddelon |
36 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
|
|
37 |
import com.google.gwt.user.client.ui.DockPanel;
|
|
|
38 |
import com.google.gwt.user.client.ui.Button;
|
|
|
39 |
import com.google.gwt.user.client.ui.CheckBox;
|
|
|
40 |
import com.google.gwt.user.client.ui.Widget;
|
|
|
41 |
import com.google.gwt.user.client.ui.ClickListener;
|
|
|
42 |
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
|
|
43 |
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
|
|
44 |
|
|
|
45 |
/*
|
|
|
46 |
* Le retour de getUser appelle updateCount qui appelle update pour veiller à une
|
|
|
47 |
* initialisation correcte
|
|
|
48 |
*
|
|
|
49 |
*/
|
|
|
50 |
|
|
|
51 |
public class InventoryItemList extends Composite implements
|
|
|
52 |
AutoCompleteAsyncTextBoxListener {
|
|
|
53 |
|
|
|
54 |
// Barre de navigation
|
|
|
55 |
|
|
|
56 |
private class NavBar extends Composite implements ClickListener {
|
|
|
57 |
|
|
|
58 |
public final DockPanel bar = new DockPanel();
|
|
|
59 |
|
|
|
60 |
public final Button gotoFirst = new Button("<<", this);
|
|
|
61 |
|
|
|
62 |
public final Button gotoNext = new Button(">", this);
|
|
|
63 |
|
|
|
64 |
public final Button gotoPrev = new Button("<", this);
|
|
|
65 |
|
|
|
66 |
public final Button gotoEnd = new Button(">>", this);
|
| 12 |
ddelon |
67 |
|
|
|
68 |
|
| 11 |
ddelon |
69 |
public final HTML status = new HTML();
|
|
|
70 |
|
|
|
71 |
|
|
|
72 |
public NavBar() {
|
| 12 |
ddelon |
73 |
|
|
|
74 |
|
| 11 |
ddelon |
75 |
initWidget(bar);
|
|
|
76 |
bar.setStyleName("navbar");
|
|
|
77 |
status.setStyleName("status");
|
|
|
78 |
|
|
|
79 |
HorizontalPanel buttons = new HorizontalPanel();
|
|
|
80 |
|
|
|
81 |
buttons.add(status);
|
|
|
82 |
buttons.setCellHorizontalAlignment(status,
|
|
|
83 |
HasHorizontalAlignment.ALIGN_RIGHT);
|
|
|
84 |
buttons.setCellVerticalAlignment(status,
|
|
|
85 |
HasVerticalAlignment.ALIGN_MIDDLE);
|
|
|
86 |
buttons.setCellWidth(status, "100%");
|
|
|
87 |
|
|
|
88 |
|
|
|
89 |
buttons.add(gotoFirst);
|
|
|
90 |
buttons.add(gotoPrev);
|
|
|
91 |
buttons.add(gotoNext);
|
|
|
92 |
buttons.add(gotoEnd);
|
|
|
93 |
bar.add(buttons, DockPanel.EAST);
|
|
|
94 |
bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_RIGHT);
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_LEFT);
|
|
|
98 |
|
|
|
99 |
bar.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
}
|
| 12 |
ddelon |
103 |
|
|
|
104 |
|
| 11 |
ddelon |
105 |
|
|
|
106 |
public void onClick(Widget sender) {
|
|
|
107 |
if (sender == gotoNext) {
|
|
|
108 |
// Move forward a page.
|
|
|
109 |
startIndex += VISIBLE_TAXON_COUNT;
|
|
|
110 |
if (startIndex >= count)
|
|
|
111 |
startIndex -= VISIBLE_TAXON_COUNT;
|
|
|
112 |
} else {
|
|
|
113 |
if (sender == gotoPrev) {
|
|
|
114 |
// Move back a page.
|
|
|
115 |
startIndex -= VISIBLE_TAXON_COUNT;
|
|
|
116 |
if (startIndex < 0)
|
|
|
117 |
startIndex = 0;
|
|
|
118 |
} else {
|
|
|
119 |
if (sender == gotoEnd) {
|
|
|
120 |
gotoEnd();
|
|
|
121 |
} else {
|
|
|
122 |
if (sender == gotoFirst) {
|
|
|
123 |
startIndex = 0;
|
|
|
124 |
}
|
|
|
125 |
}
|
|
|
126 |
}
|
|
|
127 |
}
|
|
|
128 |
update();
|
|
|
129 |
}
|
|
|
130 |
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
private void setStatusText(String text) {
|
|
|
134 |
navBar.status.setText(text);
|
|
|
135 |
}
|
|
|
136 |
|
|
|
137 |
private static final int VISIBLE_TAXON_COUNT = 15;
|
|
|
138 |
|
| 13 |
ddelon |
139 |
private Grid header = new Grid(1, 3);
|
| 11 |
ddelon |
140 |
|
|
|
141 |
private FlexTable table = new FlexTable();
|
|
|
142 |
|
|
|
143 |
private VerticalPanel panel = new VerticalPanel();
|
|
|
144 |
|
|
|
145 |
private int startIndex = 0;
|
|
|
146 |
|
|
|
147 |
private String serviceBaseUrl = null;
|
|
|
148 |
|
|
|
149 |
private int count = 65000;
|
|
|
150 |
|
|
|
151 |
private String user;
|
|
|
152 |
|
|
|
153 |
private NavBar navBar=null;
|
|
|
154 |
|
|
|
155 |
private Mediator mediator = null;
|
|
|
156 |
|
| 13 |
ddelon |
157 |
private int selectedRow = -1;
|
|
|
158 |
|
| 11 |
ddelon |
159 |
private String location = "all";
|
| 12 |
ddelon |
160 |
private String date = "all";
|
| 13 |
ddelon |
161 |
private String search = "all";
|
| 14 |
ddelon |
162 |
private String station = "all";
|
| 13 |
ddelon |
163 |
|
|
|
164 |
private boolean add=false;
|
| 11 |
ddelon |
165 |
|
|
|
166 |
public InventoryItemList(Mediator med) {
|
|
|
167 |
|
|
|
168 |
mediator=med;
|
|
|
169 |
|
|
|
170 |
mediator.registerInventoryItemList(this);
|
|
|
171 |
|
|
|
172 |
user=mediator.getUser();
|
|
|
173 |
serviceBaseUrl = mediator.getServiceBaseUrl();
|
|
|
174 |
|
|
|
175 |
navBar = new NavBar();
|
|
|
176 |
|
|
|
177 |
|
|
|
178 |
// Information complementaire : un tableau associe au retour de
|
|
|
179 |
// l'assistant de saisie
|
|
|
180 |
|
|
|
181 |
// Mise en forme du header
|
|
|
182 |
|
|
|
183 |
header.setCellSpacing(0);
|
|
|
184 |
header.setCellPadding(2);
|
|
|
185 |
header.setWidth("100%");
|
|
|
186 |
|
| 12 |
ddelon |
187 |
header.setStyleName("inventoryItem-ListHeader");
|
| 11 |
ddelon |
188 |
|
| 13 |
ddelon |
189 |
header.setWidget(0, 2, navBar);
|
| 11 |
ddelon |
190 |
|
|
|
191 |
// Mise en forme de la table.
|
|
|
192 |
|
|
|
193 |
table.setCellSpacing(0);
|
|
|
194 |
table.setBorderWidth(0);
|
|
|
195 |
table.setCellPadding(2);
|
|
|
196 |
table.setWidth("100%");
|
| 13 |
ddelon |
197 |
|
| 11 |
ddelon |
198 |
|
|
|
199 |
// Mise en forme barre navigation
|
|
|
200 |
|
|
|
201 |
navBar.setWidth("100%");
|
|
|
202 |
|
| 12 |
ddelon |
203 |
table.setStyleName("inventoryItem-List");
|
| 11 |
ddelon |
204 |
|
| 13 |
ddelon |
205 |
//panel.add(navBar);
|
| 11 |
ddelon |
206 |
panel.add(header);
|
|
|
207 |
panel.add(table);
|
|
|
208 |
|
| 13 |
ddelon |
209 |
|
|
|
210 |
// Hook up events.
|
|
|
211 |
table.addTableListener(new TableListener () {
|
|
|
212 |
|
|
|
213 |
public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
|
|
|
214 |
|
|
|
215 |
if (table.getWidget(row, 0)!=null) {
|
|
|
216 |
selectRow(row);
|
|
|
217 |
// Numero d'ordre
|
| 14 |
ddelon |
218 |
mediator.onInventoryItemSelected(table.getText(row, 5));
|
| 13 |
ddelon |
219 |
}
|
|
|
220 |
}
|
|
|
221 |
|
|
|
222 |
});
|
|
|
223 |
|
|
|
224 |
|
| 12 |
ddelon |
225 |
//updateCount();
|
| 11 |
ddelon |
226 |
// update()
|
|
|
227 |
|
|
|
228 |
|
|
|
229 |
initWidget(panel);
|
|
|
230 |
|
|
|
231 |
|
|
|
232 |
}
|
| 12 |
ddelon |
233 |
|
|
|
234 |
|
| 13 |
ddelon |
235 |
|
|
|
236 |
private void selectRow(int row) {
|
|
|
237 |
|
|
|
238 |
styleRow(selectedRow, false);
|
|
|
239 |
styleRow(row, true);
|
| 11 |
ddelon |
240 |
|
| 13 |
ddelon |
241 |
selectedRow = row;
|
|
|
242 |
|
|
|
243 |
}
|
|
|
244 |
|
|
|
245 |
|
|
|
246 |
private void styleRow(int row, boolean selected) {
|
|
|
247 |
if (row != -1) {
|
|
|
248 |
if (selected)
|
|
|
249 |
table.getRowFormatter().addStyleName(row, "inventoryItem-SelectedRow");
|
|
|
250 |
else
|
|
|
251 |
if (row < table.getRowCount()) {
|
|
|
252 |
table.getRowFormatter().removeStyleName(row, "inventoryItem-SelectedRow");
|
|
|
253 |
}
|
|
|
254 |
}
|
|
|
255 |
}
|
|
|
256 |
|
|
|
257 |
|
| 12 |
ddelon |
258 |
|
|
|
259 |
|
| 11 |
ddelon |
260 |
/**
|
|
|
261 |
* Action lancee par la selection d'un nom dans l'assistant de saisie. Lance
|
|
|
262 |
* la recherche d'informations complémentaires (famille, numero
|
|
|
263 |
* nomenclaturaux etc) et met a jour l'inventaire (addelement())
|
|
|
264 |
*
|
|
|
265 |
* @return void
|
|
|
266 |
*/
|
|
|
267 |
public void onValidate(SourcesAutoCompleteAsyncTextBoxEvents sender,
|
|
|
268 |
String str, String value) {
|
|
|
269 |
|
| 12 |
ddelon |
270 |
|
|
|
271 |
mediator.onAddInventoryItem();
|
| 11 |
ddelon |
272 |
|
| 12 |
ddelon |
273 |
}
|
| 11 |
ddelon |
274 |
|
| 13 |
ddelon |
275 |
|
|
|
276 |
// Action sur modification d'un element
|
| 12 |
ddelon |
277 |
|
| 13 |
ddelon |
278 |
|
|
|
279 |
public void updateElement() {
|
|
|
280 |
|
|
|
281 |
|
|
|
282 |
if (mediator.inventoryItemIsValid()) {
|
|
|
283 |
|
|
|
284 |
final InventoryItem inventoryItem=mediator.getInventoryItem();
|
|
|
285 |
|
|
|
286 |
setStatusDisabled();
|
|
|
287 |
|
|
|
288 |
if (inventoryItem.getNomenclaturalNumber() !=null) {
|
|
|
289 |
|
|
|
290 |
HTTPRequest.asyncGet(serviceBaseUrl + "/NameValid/" + inventoryItem.getNomenclaturalNumber(),
|
|
|
291 |
new ResponseTextHandler() {
|
|
|
292 |
|
|
|
293 |
public void onCompletion(String strcomplete) {
|
|
|
294 |
|
|
|
295 |
JSONValue jsonValue = JSONParser.parse(strcomplete);
|
|
|
296 |
JSONArray jsonArray;
|
|
|
297 |
|
|
|
298 |
if ((jsonArray = jsonValue.isArray()) != null) {
|
|
|
299 |
// Nom retenu, Num Nomen nom retenu, Num Taxon,
|
|
|
300 |
// Famille
|
|
|
301 |
updateElement(inventoryItem.getOrdre(),inventoryItem.getName(), inventoryItem.getNomenclaturalNumber(),
|
|
|
302 |
((JSONString) jsonArray.get(0))
|
|
|
303 |
.stringValue(),
|
|
|
304 |
((JSONString) jsonArray.get(1))
|
|
|
305 |
.stringValue(),
|
|
|
306 |
((JSONString) jsonArray.get(2))
|
|
|
307 |
.stringValue(),
|
|
|
308 |
((JSONString) jsonArray.get(3))
|
|
|
309 |
.stringValue(),
|
|
|
310 |
inventoryItem.getLocation(),inventoryItem.getLocation_id(),inventoryItem.getDate(),inventoryItem.getComplementlocation(),inventoryItem.getComment());
|
|
|
311 |
}
|
|
|
312 |
}
|
|
|
313 |
|
|
|
314 |
});
|
|
|
315 |
}
|
|
|
316 |
// Saisie libre
|
|
|
317 |
else {
|
|
|
318 |
updateElement(inventoryItem.getOrdre(),inventoryItem.getName(), " ", " ", " ", " ", " ",inventoryItem.getLocation(),inventoryItem.getLocation_id(),inventoryItem.getDate(),inventoryItem.getComplementlocation(),inventoryItem.getComment());
|
|
|
319 |
}
|
|
|
320 |
|
|
|
321 |
}
|
|
|
322 |
else {
|
|
|
323 |
return;
|
|
|
324 |
}
|
|
|
325 |
}
|
|
|
326 |
|
|
|
327 |
|
|
|
328 |
|
|
|
329 |
// Action sur ajout d'un element
|
|
|
330 |
|
|
|
331 |
|
| 12 |
ddelon |
332 |
public void addelement() {
|
|
|
333 |
|
|
|
334 |
|
|
|
335 |
if (mediator.inventoryItemIsValid()) {
|
|
|
336 |
|
|
|
337 |
final InventoryItem inventoryItem=mediator.getInventoryItem();
|
|
|
338 |
|
|
|
339 |
setStatusDisabled();
|
| 11 |
ddelon |
340 |
|
|
|
341 |
// On met a jour rapidement l'affichage puis on lance la requete ....
|
|
|
342 |
|
|
|
343 |
/* int row = table.insertRow(table.getRowCount());
|
|
|
344 |
// Case a cocher
|
|
|
345 |
table.setWidget(row, 0, new CheckBox());
|
|
|
346 |
// Nom saisi
|
|
|
347 |
table.setText(row, 1, nameText);
|
|
|
348 |
|
|
|
349 |
table.getFlexCellFormatter().setWidth(row, 0, "2%");
|
|
|
350 |
table.getFlexCellFormatter()
|
|
|
351 |
.setWidth(row, 1, "31%");*/
|
|
|
352 |
|
|
|
353 |
// Recherche complement d'information
|
|
|
354 |
|
| 12 |
ddelon |
355 |
if (inventoryItem.getNomenclaturalNumber() !=null) {
|
| 11 |
ddelon |
356 |
|
| 12 |
ddelon |
357 |
HTTPRequest.asyncGet(serviceBaseUrl + "/NameValid/" + inventoryItem.getNomenclaturalNumber(),
|
| 11 |
ddelon |
358 |
new ResponseTextHandler() {
|
|
|
359 |
|
|
|
360 |
public void onCompletion(String strcomplete) {
|
|
|
361 |
|
|
|
362 |
JSONValue jsonValue = JSONParser.parse(strcomplete);
|
|
|
363 |
JSONArray jsonArray;
|
|
|
364 |
|
|
|
365 |
if ((jsonArray = jsonValue.isArray()) != null) {
|
|
|
366 |
// Nom retenu, Num Nomen nom retenu, Num Taxon,
|
|
|
367 |
// Famille
|
| 12 |
ddelon |
368 |
addElement(inventoryItem.getName(), inventoryItem.getNomenclaturalNumber(),
|
| 11 |
ddelon |
369 |
((JSONString) jsonArray.get(0))
|
|
|
370 |
.stringValue(),
|
|
|
371 |
((JSONString) jsonArray.get(1))
|
|
|
372 |
.stringValue(),
|
|
|
373 |
((JSONString) jsonArray.get(2))
|
|
|
374 |
.stringValue(),
|
|
|
375 |
((JSONString) jsonArray.get(3))
|
|
|
376 |
.stringValue(),
|
| 12 |
ddelon |
377 |
inventoryItem.getLocation(),inventoryItem.getLocation_id(),inventoryItem.getDate(),inventoryItem.getComplementlocation(),inventoryItem.getComment());
|
| 11 |
ddelon |
378 |
}
|
|
|
379 |
}
|
|
|
380 |
|
|
|
381 |
});
|
|
|
382 |
}
|
|
|
383 |
// Saisie libre
|
|
|
384 |
else {
|
| 12 |
ddelon |
385 |
addElement(inventoryItem.getName(), " ", " ", " ", " ", " ",inventoryItem.getLocation(),inventoryItem.getLocation_id(),inventoryItem.getDate(),inventoryItem.getComplementlocation(),inventoryItem.getComment());
|
| 11 |
ddelon |
386 |
}
|
|
|
387 |
|
| 12 |
ddelon |
388 |
}
|
|
|
389 |
else {
|
|
|
390 |
return;
|
| 11 |
ddelon |
391 |
}
|
| 12 |
ddelon |
392 |
}
|
| 11 |
ddelon |
393 |
|
|
|
394 |
/**
|
|
|
395 |
* Ajoute un element à l'inventaire
|
|
|
396 |
*
|
|
|
397 |
* @param nom_sel :
|
|
|
398 |
* nom selectionne
|
|
|
399 |
* @param num_nom_sel :
|
|
|
400 |
* numero nomenclatural nom selectionne
|
|
|
401 |
* @param nom_ret :
|
|
|
402 |
* nom retenu
|
|
|
403 |
* @param num_nom_ret :
|
|
|
404 |
* numero nomenclaturel nom retenu
|
|
|
405 |
* @param num_taxon :
|
|
|
406 |
* numero taxonomique
|
|
|
407 |
* @param famille :
|
|
|
408 |
* famille
|
|
|
409 |
*/
|
|
|
410 |
|
| 12 |
ddelon |
411 |
private void addElement(String nom_sel, String num_nom_sel, String nom_ret,
|
|
|
412 |
String num_nom_ret, String num_taxon, String famille,final String loc, String id_location,String dat, String complementLocation, String comment) {
|
| 11 |
ddelon |
413 |
|
|
|
414 |
|
|
|
415 |
count++;
|
|
|
416 |
HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/", "identifiant="
|
|
|
417 |
+ user + "&nom_sel=" + nom_sel + "&num_nom_sel=" + num_nom_sel
|
|
|
418 |
+ "&nom_ret=" + nom_ret + "&num_nom_ret=" + num_nom_ret
|
| 12 |
ddelon |
419 |
+ "&num_taxon=" + num_taxon + "&famille=" + famille + "&location=" + loc + "&id_location=" + id_location + "&date_observation=" + dat
|
|
|
420 |
+ "&station="+ complementLocation + "&commentaire="+ comment,
|
| 11 |
ddelon |
421 |
|
|
|
422 |
new ResponseTextHandler() {
|
|
|
423 |
|
|
|
424 |
public void onCompletion(String str) {
|
|
|
425 |
location=loc;
|
| 12 |
ddelon |
426 |
if (location.compareTo("")==0) {
|
|
|
427 |
location="000null";
|
|
|
428 |
}
|
| 13 |
ddelon |
429 |
add=true;
|
| 14 |
ddelon |
430 |
mediator.onInventoryUpdated(location);
|
| 11 |
ddelon |
431 |
updateCount();
|
|
|
432 |
}
|
|
|
433 |
});
|
|
|
434 |
}
|
|
|
435 |
|
| 13 |
ddelon |
436 |
|
|
|
437 |
|
| 11 |
ddelon |
438 |
/**
|
| 13 |
ddelon |
439 |
* Modifie un element de l'inventaire
|
|
|
440 |
*
|
|
|
441 |
* @param ordre : numero d'ordre
|
|
|
442 |
* @param nom_sel :
|
|
|
443 |
* nom selectionne
|
|
|
444 |
* @param num_nom_sel :
|
|
|
445 |
* numero nomenclatural nom selectionne
|
|
|
446 |
* @param nom_ret :
|
|
|
447 |
* nom retenu
|
|
|
448 |
* @param num_nom_ret :
|
|
|
449 |
* numero nomenclaturel nom retenu
|
|
|
450 |
* @param num_taxon :
|
|
|
451 |
* numero taxonomique
|
|
|
452 |
* @param famille :
|
|
|
453 |
* famille
|
|
|
454 |
*/
|
|
|
455 |
|
|
|
456 |
private void updateElement(String ordre, String nom_sel, String num_nom_sel, String nom_ret,
|
|
|
457 |
String num_nom_ret, String num_taxon, String famille,final String loc, String id_location,String dat, String complementLocation, String comment) {
|
|
|
458 |
|
|
|
459 |
|
| 14 |
ddelon |
460 |
HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + user + "/" +ordre + "/",
|
|
|
461 |
"&nom_sel=" + nom_sel + "&num_nom_sel=" + num_nom_sel
|
| 13 |
ddelon |
462 |
+ "&nom_ret=" + nom_ret + "&num_nom_ret=" + num_nom_ret
|
|
|
463 |
+ "&num_taxon=" + num_taxon + "&famille=" + famille + "&location=" + loc + "&id_location=" + id_location + "&date_observation=" + dat
|
|
|
464 |
+ "&station="+ complementLocation + "&commentaire="+ comment,
|
|
|
465 |
|
|
|
466 |
new ResponseTextHandler() {
|
|
|
467 |
|
|
|
468 |
public void onCompletion(String str) {
|
|
|
469 |
add=false;
|
| 14 |
ddelon |
470 |
mediator.onInventoryUpdated(location);
|
| 13 |
ddelon |
471 |
update();
|
|
|
472 |
}
|
|
|
473 |
});
|
|
|
474 |
}
|
|
|
475 |
|
| 14 |
ddelon |
476 |
/**
|
|
|
477 |
* Transmission de releve à Tela
|
|
|
478 |
*
|
|
|
479 |
*/
|
|
|
480 |
|
| 13 |
ddelon |
481 |
|
| 14 |
ddelon |
482 |
|
|
|
483 |
public void transmitElement() {
|
|
|
484 |
|
|
|
485 |
setStatusDisabled();
|
|
|
486 |
Vector parseChecked = new Vector();
|
|
|
487 |
|
|
|
488 |
// TODO : optimiser
|
|
|
489 |
// Lifo ...
|
|
|
490 |
for (int i = table.getRowCount() - 1; i >= 0; i--) {
|
|
|
491 |
if (table.getWidget(i, 0)!=null) {
|
|
|
492 |
if (((CheckBox) table.getWidget(i, 0)).isChecked()) {
|
|
|
493 |
// Numero ordre
|
|
|
494 |
parseChecked.add(table.getText(i, 5));
|
|
|
495 |
}
|
|
|
496 |
}
|
|
|
497 |
}
|
|
|
498 |
StringBuffer ids=new StringBuffer();
|
|
|
499 |
for (Iterator it = parseChecked.iterator(); it.hasNext();) {
|
|
|
500 |
ids.append((String)it.next());
|
|
|
501 |
if (it.hasNext()) ids.append(",");
|
|
|
502 |
}
|
|
|
503 |
|
|
|
504 |
if (ids.length()>0) {
|
|
|
505 |
|
|
|
506 |
HTTPRequest.asyncPost(serviceBaseUrl + "/InventoryTransmit/" + user
|
|
|
507 |
+ "/" + ids.toString(), "transmission=1",
|
|
|
508 |
|
|
|
509 |
new ResponseTextHandler() {
|
|
|
510 |
public void onCompletion(String str) {
|
|
|
511 |
update();
|
|
|
512 |
}
|
|
|
513 |
});
|
|
|
514 |
}
|
|
|
515 |
|
|
|
516 |
setStatusEnabled();
|
|
|
517 |
|
|
|
518 |
|
|
|
519 |
}
|
|
|
520 |
|
|
|
521 |
|
| 13 |
ddelon |
522 |
/**
|
| 11 |
ddelon |
523 |
* Suppression d'un element lde l'inventaire, a partir de son numero d'ordre
|
|
|
524 |
*
|
|
|
525 |
*/
|
|
|
526 |
|
|
|
527 |
public void deleteElement() {
|
|
|
528 |
|
|
|
529 |
setStatusDisabled();
|
|
|
530 |
Vector parseChecked = new Vector();
|
|
|
531 |
|
| 12 |
ddelon |
532 |
// TODO : optimiser
|
| 11 |
ddelon |
533 |
// Lifo ...
|
|
|
534 |
for (int i = table.getRowCount() - 1; i >= 0; i--) {
|
| 12 |
ddelon |
535 |
if (table.getWidget(i, 0)!=null) {
|
|
|
536 |
if (((CheckBox) table.getWidget(i, 0)).isChecked()) {
|
|
|
537 |
// Numero ordre
|
| 14 |
ddelon |
538 |
parseChecked.add(table.getText(i, 5));
|
| 12 |
ddelon |
539 |
count--;
|
|
|
540 |
}
|
|
|
541 |
}
|
| 11 |
ddelon |
542 |
}
|
| 12 |
ddelon |
543 |
StringBuffer ids=new StringBuffer();
|
| 11 |
ddelon |
544 |
for (Iterator it = parseChecked.iterator(); it.hasNext();) {
|
| 12 |
ddelon |
545 |
ids.append((String)it.next());
|
|
|
546 |
if (it.hasNext()) ids.append(",");
|
|
|
547 |
}
|
| 14 |
ddelon |
548 |
if (ids.length()>0) {
|
|
|
549 |
|
|
|
550 |
HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + user
|
|
|
551 |
+ "/" + ids.toString(), "action=DELETE",
|
|
|
552 |
|
|
|
553 |
new ResponseTextHandler() {
|
|
|
554 |
public void onCompletion(String str) {
|
|
|
555 |
mediator.onInventoryUpdated("all");
|
|
|
556 |
updateCount();
|
|
|
557 |
}
|
|
|
558 |
});
|
| 11 |
ddelon |
559 |
}
|
| 14 |
ddelon |
560 |
|
|
|
561 |
setStatusEnabled();
|
| 11 |
ddelon |
562 |
}
|
|
|
563 |
|
|
|
564 |
/**
|
|
|
565 |
* Selection de l'ensemble des elements affichés
|
|
|
566 |
*
|
|
|
567 |
*/
|
|
|
568 |
|
|
|
569 |
public void selectAll() {
|
|
|
570 |
|
| 12 |
ddelon |
571 |
// TODO : optimiser ...
|
| 11 |
ddelon |
572 |
for (int i = table.getRowCount() - 1; i >= 0; i--) {
|
| 12 |
ddelon |
573 |
if (table.getWidget(i, 0)!=null)
|
| 11 |
ddelon |
574 |
((CheckBox) table.getWidget(i, 0)).setChecked(true);
|
|
|
575 |
}
|
|
|
576 |
}
|
|
|
577 |
|
|
|
578 |
public void deselectAll() {
|
|
|
579 |
|
| 12 |
ddelon |
580 |
// TODO : optimiser ...
|
| 11 |
ddelon |
581 |
for (int i = table.getRowCount() - 1; i >= 0; i--) {
|
| 12 |
ddelon |
582 |
if (table.getWidget(i, 0)!=null)
|
| 11 |
ddelon |
583 |
((CheckBox) table.getWidget(i, 0)).setChecked(false);
|
|
|
584 |
}
|
|
|
585 |
}
|
|
|
586 |
|
|
|
587 |
|
|
|
588 |
|
|
|
589 |
/**
|
|
|
590 |
* Recherche nombre d'enregistrement pour l'utilisateur et la localite en cours
|
|
|
591 |
*
|
|
|
592 |
*/
|
| 13 |
ddelon |
593 |
public void updateCount () {
|
| 11 |
ddelon |
594 |
|
|
|
595 |
setStatusDisabled();
|
| 12 |
ddelon |
596 |
|
|
|
597 |
String adate="all";
|
|
|
598 |
if (date.compareTo("all")!=0) {
|
|
|
599 |
adate=date.substring(6,10)+"-"+date.substring(3,5)+"-"+date.substring(0,2)+" 00:00:00";
|
|
|
600 |
}
|
| 11 |
ddelon |
601 |
|
| 14 |
ddelon |
602 |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + location + "/" + adate + "/" + search + "/" + station,
|
| 11 |
ddelon |
603 |
new ResponseTextHandler() {
|
|
|
604 |
|
|
|
605 |
public void onCompletion(String str) {
|
|
|
606 |
|
|
|
607 |
JSONValue jsonValue = JSONParser.parse(str);
|
|
|
608 |
JSONNumber jsonNumber;
|
|
|
609 |
if ((jsonNumber = jsonValue.isNumber()) != null) {
|
|
|
610 |
count = (int) jsonNumber.getValue();
|
|
|
611 |
/*
|
|
|
612 |
if (count==0) {
|
|
|
613 |
location="all";
|
|
|
614 |
}
|
|
|
615 |
*/
|
|
|
616 |
if (location.compareTo("")==0)
|
|
|
617 |
location="000null";
|
| 14 |
ddelon |
618 |
// mediator.onInventoryItemUpdate(location);
|
| 11 |
ddelon |
619 |
gotoEnd(); // Derniere page
|
|
|
620 |
update();
|
|
|
621 |
}
|
|
|
622 |
}
|
|
|
623 |
});
|
|
|
624 |
|
|
|
625 |
}
|
| 13 |
ddelon |
626 |
|
|
|
627 |
|
|
|
628 |
private String subLeft(String text, int length) {
|
|
|
629 |
return (text.length() < length) ? text : text.substring(0, length)+ " ...";
|
|
|
630 |
}
|
| 11 |
ddelon |
631 |
|
|
|
632 |
/**
|
|
|
633 |
* Mise a jour de l'affichage, à partir des données d'inventaire deja
|
|
|
634 |
* saisies. La valeur de this.startIndex permet de determiner quelles
|
|
|
635 |
* données seront affichées
|
|
|
636 |
*
|
|
|
637 |
* @param deep : force une mise a jour totale
|
|
|
638 |
*/
|
|
|
639 |
|
|
|
640 |
public void update() {
|
|
|
641 |
|
| 13 |
ddelon |
642 |
|
|
|
643 |
// table.setBorderWidth(1);
|
| 11 |
ddelon |
644 |
setStatusDisabled();
|
|
|
645 |
|
| 12 |
ddelon |
646 |
String adate="all";
|
|
|
647 |
if (date.compareTo("all")!=0) {
|
|
|
648 |
adate=date.substring(6,10)+"-"+date.substring(3,5)+"-"+date.substring(0,2)+" 00:00:00";
|
|
|
649 |
}
|
| 13 |
ddelon |
650 |
|
|
|
651 |
|
|
|
652 |
String com;
|
|
|
653 |
if (location.compareTo("all")==0) {
|
|
|
654 |
com="Toutes communes";
|
|
|
655 |
}
|
|
|
656 |
else {
|
|
|
657 |
if (location.compareTo("000null")==0) {
|
| 14 |
ddelon |
658 |
com="Communes non renseignées";
|
| 13 |
ddelon |
659 |
}
|
|
|
660 |
else {
|
|
|
661 |
com="Commune de "+location;
|
|
|
662 |
}
|
|
|
663 |
}
|
|
|
664 |
|
|
|
665 |
|
|
|
666 |
String dat;
|
|
|
667 |
|
|
|
668 |
if (date.compareTo("all")==0) {
|
| 14 |
ddelon |
669 |
dat=", toutes périodes";
|
| 13 |
ddelon |
670 |
}
|
|
|
671 |
else {
|
|
|
672 |
if (date.compareTo("00/00/0000")==0) {
|
| 14 |
ddelon |
673 |
dat=", périodes non renseignées";
|
| 13 |
ddelon |
674 |
}
|
|
|
675 |
else {
|
|
|
676 |
dat=", le "+ date;
|
|
|
677 |
}
|
|
|
678 |
}
|
| 14 |
ddelon |
679 |
|
| 13 |
ddelon |
680 |
|
| 14 |
ddelon |
681 |
String stat;
|
| 13 |
ddelon |
682 |
|
| 14 |
ddelon |
683 |
if (station.compareTo("all")==0) {
|
|
|
684 |
stat=", toutes stations";
|
|
|
685 |
}
|
|
|
686 |
else {
|
|
|
687 |
if (station.compareTo("000null")==0) {
|
|
|
688 |
stat=", stations non renseignées";
|
|
|
689 |
}
|
|
|
690 |
else {
|
|
|
691 |
stat=", station "+ station;
|
|
|
692 |
}
|
|
|
693 |
}
|
|
|
694 |
|
|
|
695 |
|
|
|
696 |
header.setHTML(0, 0, com + dat + stat );
|
|
|
697 |
|
|
|
698 |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + location +"/" + adate + "/" + search + "/" + station + "/"
|
| 11 |
ddelon |
699 |
+ startIndex + "/" + VISIBLE_TAXON_COUNT,
|
|
|
700 |
|
|
|
701 |
new ResponseTextHandler() {
|
|
|
702 |
|
|
|
703 |
public void onCompletion(String str) {
|
|
|
704 |
|
|
|
705 |
JSONValue jsonValue = JSONParser.parse(str);
|
|
|
706 |
JSONArray jsonArray;
|
|
|
707 |
JSONArray jsonArrayNested;
|
| 13 |
ddelon |
708 |
|
|
|
709 |
StringBuffer left=new StringBuffer();
|
|
|
710 |
StringBuffer center=new StringBuffer();
|
|
|
711 |
StringBuffer right=new StringBuffer();
|
| 14 |
ddelon |
712 |
|
|
|
713 |
|
| 11 |
ddelon |
714 |
|
| 12 |
ddelon |
715 |
|
| 11 |
ddelon |
716 |
int row=0;
|
|
|
717 |
int i=0;
|
|
|
718 |
if ((jsonArray = jsonValue.isArray()) != null) {
|
|
|
719 |
int arraySize = jsonArray.size();
|
|
|
720 |
for (i = 0; i < arraySize; ++i) {
|
|
|
721 |
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
|
|
|
722 |
if (i>=table.getRowCount()) {
|
|
|
723 |
row = table.insertRow(table.getRowCount());
|
|
|
724 |
}
|
|
|
725 |
else {
|
|
|
726 |
row = i;
|
|
|
727 |
}
|
| 12 |
ddelon |
728 |
|
| 13 |
ddelon |
729 |
left=new StringBuffer();
|
|
|
730 |
center=new StringBuffer();
|
|
|
731 |
right=new StringBuffer();
|
|
|
732 |
|
| 11 |
ddelon |
733 |
// Case a cocher
|
|
|
734 |
table.setWidget(row, 0, new CheckBox());
|
| 14 |
ddelon |
735 |
|
|
|
736 |
|
|
|
737 |
// Observation transmise
|
|
|
738 |
|
|
|
739 |
|
|
|
740 |
String atransmit=((JSONString) jsonArrayNested .get(11)).stringValue();
|
|
|
741 |
|
|
|
742 |
if (atransmit.compareTo("1")==0) {
|
|
|
743 |
table.setWidget(row,1,new Image("tela.gif"));
|
|
|
744 |
}
|
|
|
745 |
else {
|
|
|
746 |
table.setWidget(row,1,new HTML(" "));
|
|
|
747 |
}
|
|
|
748 |
|
| 13 |
ddelon |
749 |
left.append("<b>"+((JSONString) jsonArrayNested .get(0)).stringValue()+"</b>");
|
| 12 |
ddelon |
750 |
|
| 11 |
ddelon |
751 |
// Nom retenu
|
| 12 |
ddelon |
752 |
String aname=((JSONString) jsonArrayNested .get(2)).stringValue();
|
|
|
753 |
|
|
|
754 |
if (aname.compareTo("null")==0) {
|
|
|
755 |
}
|
|
|
756 |
else {
|
| 13 |
ddelon |
757 |
center.append(aname+", ");
|
| 12 |
ddelon |
758 |
}
|
|
|
759 |
|
| 11 |
ddelon |
760 |
// Num nomenclatural
|
| 12 |
ddelon |
761 |
String ann=((JSONString) jsonArrayNested .get(3)).stringValue();
|
|
|
762 |
|
| 13 |
ddelon |
763 |
if (ann.compareTo("0")!=0) {
|
|
|
764 |
center.append(""+ann+"-");
|
| 12 |
ddelon |
765 |
}
|
|
|
766 |
else {
|
| 13 |
ddelon |
767 |
center.append("0-");
|
| 12 |
ddelon |
768 |
}
|
|
|
769 |
|
|
|
770 |
|
| 11 |
ddelon |
771 |
// Num Taxonomique
|
| 12 |
ddelon |
772 |
|
|
|
773 |
String ant=((JSONString) jsonArrayNested .get(4)).stringValue();
|
|
|
774 |
|
| 13 |
ddelon |
775 |
if (ant.compareTo("0")!=0) {
|
|
|
776 |
center.append(ant+", ");
|
| 12 |
ddelon |
777 |
}
|
|
|
778 |
else {
|
| 13 |
ddelon |
779 |
center.append("0, ");
|
| 12 |
ddelon |
780 |
}
|
|
|
781 |
|
| 11 |
ddelon |
782 |
// Famille
|
| 12 |
ddelon |
783 |
String afamily=((JSONString) jsonArrayNested .get(5)).stringValue();
|
|
|
784 |
|
|
|
785 |
if (afamily.compareTo("null")==0) {
|
| 13 |
ddelon |
786 |
//
|
| 12 |
ddelon |
787 |
}
|
|
|
788 |
else {
|
| 13 |
ddelon |
789 |
center.append(afamily+", ");
|
| 12 |
ddelon |
790 |
}
|
| 11 |
ddelon |
791 |
|
|
|
792 |
|
| 13 |
ddelon |
793 |
String aloc=((JSONString) jsonArrayNested .get(6)).stringValue();
|
|
|
794 |
// Localisation - Lieu
|
|
|
795 |
|
|
|
796 |
if (aloc.compareTo("000null")==0) {
|
|
|
797 |
if (center.length()==0) {
|
|
|
798 |
center.append("Commune absente");
|
|
|
799 |
}
|
|
|
800 |
else {
|
|
|
801 |
center.append("commune absente");
|
|
|
802 |
}
|
|
|
803 |
}
|
|
|
804 |
else {
|
|
|
805 |
if (center.length()==0) {
|
|
|
806 |
center.append("Commune de "+aloc);
|
|
|
807 |
}
|
|
|
808 |
else {
|
|
|
809 |
center.append("commune de "+aloc);
|
|
|
810 |
}
|
|
|
811 |
|
|
|
812 |
}
|
| 12 |
ddelon |
813 |
|
| 13 |
ddelon |
814 |
|
|
|
815 |
String alieudit=((JSONString) jsonArrayNested .get(9)).stringValue();
|
| 12 |
ddelon |
816 |
|
| 13 |
ddelon |
817 |
// Localisation - Lieu dit
|
|
|
818 |
|
| 14 |
ddelon |
819 |
if (alieudit.compareTo("000null")!=0) {
|
| 13 |
ddelon |
820 |
center.append(", "+alieudit);
|
|
|
821 |
}
|
| 12 |
ddelon |
822 |
|
| 13 |
ddelon |
823 |
String acomment=((JSONString) jsonArrayNested .get(10)).stringValue();
|
|
|
824 |
// Commentaire
|
|
|
825 |
|
|
|
826 |
if (acomment.compareTo("null")!=0) {
|
|
|
827 |
center.append(", "+acomment);
|
|
|
828 |
}
|
|
|
829 |
|
| 11 |
ddelon |
830 |
|
| 13 |
ddelon |
831 |
String adate=((JSONString) jsonArrayNested .get(8)).stringValue();
|
|
|
832 |
|
|
|
833 |
// Date
|
|
|
834 |
if (adate.compareTo("0000-00-00 00:00:00")!=0) {
|
|
|
835 |
right.append("<b>"+adate+"</b>");
|
| 11 |
ddelon |
836 |
}
|
|
|
837 |
else {
|
| 13 |
ddelon |
838 |
// right.append("<b>00/00/0000</b>");
|
| 11 |
ddelon |
839 |
}
|
|
|
840 |
|
| 12 |
ddelon |
841 |
|
| 14 |
ddelon |
842 |
table.setHTML(row, 2, subLeft(" "+left,40));
|
|
|
843 |
table.setHTML(row, 3, subLeft(" "+center,120));
|
|
|
844 |
table.setHTML(row, 4, subLeft(" "+right,25));
|
| 12 |
ddelon |
845 |
|
| 13 |
ddelon |
846 |
table.getRowFormatter().removeStyleName(row, "inventoryItem-SelectedRow");
|
|
|
847 |
|
|
|
848 |
|
| 14 |
ddelon |
849 |
table.getCellFormatter().setWidth(row,0,"2%");
|
|
|
850 |
table.getCellFormatter().setWidth(row,1,"2%");
|
| 13 |
ddelon |
851 |
table.getCellFormatter().setWordWrap(row,2,false);
|
| 14 |
ddelon |
852 |
table.getCellFormatter().setWidth(row,2,"10%");
|
| 13 |
ddelon |
853 |
table.getCellFormatter().setWordWrap(row,3,false);
|
| 14 |
ddelon |
854 |
table.getCellFormatter().setWordWrap(row,4,false);
|
|
|
855 |
table.getCellFormatter().setWidth(row,4,"7%");
|
| 13 |
ddelon |
856 |
|
|
|
857 |
|
|
|
858 |
String aordre=((JSONString) jsonArrayNested.get(7)).stringValue();
|
|
|
859 |
|
| 11 |
ddelon |
860 |
// Numero d'ordre (caché)
|
| 14 |
ddelon |
861 |
|
|
|
862 |
|
|
|
863 |
table.setText(row, 5, aordre);
|
| 11 |
ddelon |
864 |
|
| 13 |
ddelon |
865 |
if (add){
|
|
|
866 |
if (i ==(arraySize -1)) {
|
|
|
867 |
selectRow(row);
|
|
|
868 |
mediator.getEntryPanel().setOrdre(aordre);
|
|
|
869 |
}
|
|
|
870 |
|
|
|
871 |
}
|
|
|
872 |
else {
|
|
|
873 |
if ((mediator.getEntryPanel().getOrdre()!=null) && (mediator.getEntryPanel().getOrdre().compareTo(aordre)==0)) {
|
|
|
874 |
selectRow(row);
|
|
|
875 |
}
|
|
|
876 |
}
|
| 11 |
ddelon |
877 |
|
| 14 |
ddelon |
878 |
table.getCellFormatter().setVisible(row, 5, false);
|
| 13 |
ddelon |
879 |
|
| 11 |
ddelon |
880 |
|
|
|
881 |
}
|
|
|
882 |
|
|
|
883 |
}
|
|
|
884 |
}
|
| 12 |
ddelon |
885 |
|
|
|
886 |
|
| 11 |
ddelon |
887 |
// Suppression fin ancien affichage
|
| 13 |
ddelon |
888 |
for (int j=i;j<VISIBLE_TAXON_COUNT;j++) {
|
|
|
889 |
table.setHTML(j,0," ");
|
|
|
890 |
table.setHTML(j,1," ");
|
|
|
891 |
table.setHTML(j,2," ");
|
|
|
892 |
table.setHTML(j,3," ");
|
|
|
893 |
table.setHTML(j,4," ");
|
| 14 |
ddelon |
894 |
table.setHTML(j,5," ");
|
|
|
895 |
table.getCellFormatter().setVisible(j, 5, false);
|
| 13 |
ddelon |
896 |
table.getRowFormatter().removeStyleName(j, "inventoryItem-SelectedRow");
|
| 11 |
ddelon |
897 |
}
|
| 13 |
ddelon |
898 |
|
|
|
899 |
add=false;
|
| 11 |
ddelon |
900 |
|
|
|
901 |
setStatusEnabled();
|
|
|
902 |
|
| 13 |
ddelon |
903 |
|
| 11 |
ddelon |
904 |
}
|
|
|
905 |
});
|
| 13 |
ddelon |
906 |
|
| 11 |
ddelon |
907 |
|
|
|
908 |
}
|
|
|
909 |
|
|
|
910 |
|
|
|
911 |
/**
|
|
|
912 |
* Affichage message d'attente et désactivation navigation
|
|
|
913 |
*
|
|
|
914 |
* @param
|
|
|
915 |
* @return void
|
|
|
916 |
*/
|
|
|
917 |
|
|
|
918 |
private void setStatusDisabled() {
|
|
|
919 |
|
|
|
920 |
navBar.gotoFirst.setEnabled(false);
|
|
|
921 |
navBar.gotoPrev.setEnabled(false);
|
|
|
922 |
navBar.gotoNext.setEnabled(false);
|
|
|
923 |
navBar.gotoEnd.setEnabled(false);
|
|
|
924 |
|
|
|
925 |
setStatusText("Patientez ...");
|
|
|
926 |
}
|
|
|
927 |
|
|
|
928 |
/**
|
|
|
929 |
* Affichage numero de page et gestion de la navigation
|
|
|
930 |
*
|
|
|
931 |
*/
|
|
|
932 |
|
|
|
933 |
private void setStatusEnabled() {
|
|
|
934 |
|
|
|
935 |
// Il y a forcemment un disabled avant d'arriver ici
|
|
|
936 |
|
|
|
937 |
if (count > 0) {
|
|
|
938 |
|
|
|
939 |
if (startIndex >= VISIBLE_TAXON_COUNT) { // Au dela de la
|
|
|
940 |
// premiere page
|
|
|
941 |
navBar.gotoPrev.setEnabled(true);
|
|
|
942 |
navBar.gotoFirst.setEnabled(true);
|
|
|
943 |
if (startIndex < (count - VISIBLE_TAXON_COUNT)) { // Pas la
|
|
|
944 |
// derniere
|
|
|
945 |
// page
|
|
|
946 |
navBar.gotoNext.setEnabled(true);
|
|
|
947 |
navBar.gotoEnd.setEnabled(true);
|
|
|
948 |
setStatusText((startIndex + 1) + " - "
|
|
|
949 |
+ (startIndex + VISIBLE_TAXON_COUNT) + " sur " + count );
|
|
|
950 |
} else { // Derniere page
|
|
|
951 |
setStatusText((startIndex + 1) + " - " + count + " sur " + count );
|
|
|
952 |
}
|
|
|
953 |
} else { // Premiere page
|
|
|
954 |
if (count > VISIBLE_TAXON_COUNT) { // Des pages derrieres
|
|
|
955 |
navBar.gotoNext.setEnabled(true);
|
|
|
956 |
navBar.gotoEnd.setEnabled(true);
|
|
|
957 |
setStatusText((startIndex + 1) + " - "
|
|
|
958 |
+ (startIndex + VISIBLE_TAXON_COUNT) + " sur " + count);
|
|
|
959 |
} else {
|
|
|
960 |
setStatusText((startIndex + 1) + " - " + count + " sur " + count);
|
|
|
961 |
}
|
|
|
962 |
}
|
|
|
963 |
}
|
|
|
964 |
|
|
|
965 |
else { // Pas d'inventaire, pas de navigation
|
|
|
966 |
setStatusText("0 - 0 sur 0");
|
|
|
967 |
}
|
|
|
968 |
}
|
|
|
969 |
|
|
|
970 |
/*
|
|
|
971 |
* Positionnement index de parcours (this.startIndex) pour affichage de la
|
|
|
972 |
* dernière page
|
|
|
973 |
*
|
|
|
974 |
* @param
|
|
|
975 |
* @return void
|
|
|
976 |
*/
|
|
|
977 |
|
|
|
978 |
private void gotoEnd() {
|
|
|
979 |
|
|
|
980 |
if ((count == 0) || (count % VISIBLE_TAXON_COUNT) > 0) {
|
|
|
981 |
startIndex = count - (count % VISIBLE_TAXON_COUNT);
|
|
|
982 |
} else {
|
|
|
983 |
startIndex = count - VISIBLE_TAXON_COUNT;
|
|
|
984 |
}
|
|
|
985 |
|
|
|
986 |
}
|
|
|
987 |
|
|
|
988 |
/*
|
| 13 |
ddelon |
989 |
* Recherche en cours
|
|
|
990 |
*
|
|
|
991 |
*/
|
|
|
992 |
|
|
|
993 |
public void setSearch(String search) {
|
|
|
994 |
this.search = search;
|
|
|
995 |
}
|
|
|
996 |
|
|
|
997 |
|
|
|
998 |
|
|
|
999 |
/*
|
| 11 |
ddelon |
1000 |
* Localite en cours
|
|
|
1001 |
*
|
|
|
1002 |
*/
|
|
|
1003 |
|
|
|
1004 |
public void setLocation(String location) {
|
|
|
1005 |
this.location = location;
|
|
|
1006 |
}
|
| 12 |
ddelon |
1007 |
|
|
|
1008 |
|
|
|
1009 |
|
|
|
1010 |
public void setDate(String date) {
|
|
|
1011 |
this.date = date;
|
|
|
1012 |
}
|
| 14 |
ddelon |
1013 |
|
|
|
1014 |
|
|
|
1015 |
public void setUser(String user) {
|
|
|
1016 |
this.user = user;
|
|
|
1017 |
}
|
| 11 |
ddelon |
1018 |
|
| 14 |
ddelon |
1019 |
|
|
|
1020 |
public void setStation(String station) {
|
|
|
1021 |
this.station = station;
|
|
|
1022 |
}
|
|
|
1023 |
|
|
|
1024 |
|
| 11 |
ddelon |
1025 |
|
|
|
1026 |
|
|
|
1027 |
|
|
|
1028 |
|
|
|
1029 |
|
|
|
1030 |
}
|