Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 8 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 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
 
9 ddelon 18
import java.util.Iterator;
19
import java.util.Vector;
20
 
4 ddelon 21
import com.google.gwt.i18n.client.Dictionary;
2 ddelon 22
import com.google.gwt.json.client.JSONArray;
3 ddelon 23
import com.google.gwt.json.client.JSONNumber;
2 ddelon 24
import com.google.gwt.json.client.JSONParser;
25
import com.google.gwt.json.client.JSONString;
26
import com.google.gwt.json.client.JSONValue;
27
import com.google.gwt.user.client.HTTPRequest;
28
import com.google.gwt.user.client.ResponseTextHandler;
29
import com.google.gwt.user.client.ui.Composite;
30
import com.google.gwt.user.client.ui.FlexTable;
31
import com.google.gwt.user.client.ui.Grid;
3 ddelon 32
import com.google.gwt.user.client.ui.HTML;
33
import com.google.gwt.user.client.ui.HorizontalPanel;
2 ddelon 34
import com.google.gwt.user.client.ui.VerticalPanel;
3 ddelon 35
import com.google.gwt.user.client.ui.DockPanel;
36
import com.google.gwt.user.client.ui.Button;
2 ddelon 37
import com.google.gwt.user.client.ui.CheckBox;
3 ddelon 38
import com.google.gwt.user.client.ui.Widget;
4 ddelon 39
import com.google.gwt.user.client.ui.ClickListener;
40
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
41
import com.google.gwt.user.client.ui.HasVerticalAlignment;
8 ddelon 42
import com.google.gwt.user.client.ui.Label;
2 ddelon 43
 
6 ddelon 44
/*
45
 * Le retour de getUser appelle getCount qui appelle update pour veiller à une
46
 * initialisation correcte
47
 *
48
 */
2 ddelon 49
 
6 ddelon 50
public class TaxonList extends Composite implements
51
		AutoCompleteAsyncTextBoxListener {
4 ddelon 52
 
6 ddelon 53
	// Barre de navigation
5 ddelon 54
 
6 ddelon 55
	private class NavBar extends Composite implements ClickListener {
2 ddelon 56
 
6 ddelon 57
		public final DockPanel bar = new DockPanel();
2 ddelon 58
 
6 ddelon 59
		public final Button gotoFirst = new Button("<<", this);
3 ddelon 60
 
6 ddelon 61
		public final Button gotoNext = new Button(">", this);
3 ddelon 62
 
6 ddelon 63
		public final Button gotoPrev = new Button("<", this);
3 ddelon 64
 
6 ddelon 65
		public final Button gotoEnd = new Button(">>", this);
3 ddelon 66
 
6 ddelon 67
		public final HTML status = new HTML();
8 ddelon 68
 
3 ddelon 69
 
6 ddelon 70
		public NavBar() {
71
			initWidget(bar);
72
			bar.setStyleName("navbar");
73
			status.setStyleName("status");
8 ddelon 74
 
75
			HorizontalPanel buttons = new HorizontalPanel();
76
 
77
			buttons.add(status);
78
			buttons.setCellHorizontalAlignment(status,
79
					HasHorizontalAlignment.ALIGN_RIGHT);
80
			buttons.setCellVerticalAlignment(status,
81
					HasVerticalAlignment.ALIGN_MIDDLE);
82
			buttons.setCellWidth(status, "100%");
3 ddelon 83
 
8 ddelon 84
 
6 ddelon 85
			buttons.add(gotoFirst);
86
			buttons.add(gotoPrev);
87
			buttons.add(gotoNext);
88
			buttons.add(gotoEnd);
89
			bar.add(buttons, DockPanel.EAST);
90
			bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_RIGHT);
8 ddelon 91
 
92
 
93
 
94
			VerticalPanel actions = new VerticalPanel();
95
 
96
			HorizontalPanel actionButton = new HorizontalPanel();
97
 
98
		/*
99
			actionButton.add(new Button("Ajout",
100
			    	new ClickListener() {
101
			    		public void onClick(Widget sender) {
102
			    			deleteElement();
103
			    		}
104
			     	}
105
			));
106
 
107
			*/
9 ddelon 108
 
109
 
110
			HTML delButton=new HTML("Suppression");
111
			delButton.setStyleName("html_button");
112
			delButton.addClickListener(
8 ddelon 113
			    	new ClickListener() {
114
			    		public void onClick(Widget sender) {
115
			    			deleteElement();
116
			    		}
117
			     	}
9 ddelon 118
			);
119
			actionButton.add(delButton);
8 ddelon 120
 
9 ddelon 121
			HTML exportButton=new HTML("<a href=\""+serviceBaseUrl+"/InventoryExport/" +user+"\">"+"Tout exporter</a>");
122
			actionButton.add(exportButton);
123
			exportButton.setStyleName("html_button");
8 ddelon 124
 
9 ddelon 125
			actionButton.setSpacing(5);
8 ddelon 126
 
127
			actions.add(actionButton);
128
 
129
			HorizontalPanel selections = new HorizontalPanel();
130
 
131
			selections.setSpacing(3);
132
 
133
			actions.add(selections);
134
 
135
			selections.add(new HTML("S&eacute;lection : "));
136
 
9 ddelon 137
			Label allLabel = new Label("Tous");
138
			Label separatorLabel = new Label(",");
139
			Label noneLabel = new Label("Aucun");
8 ddelon 140
 
9 ddelon 141
			allLabel.setStyleName("selection_label");
142
			noneLabel.setStyleName("selection_label");
143
 
144
			selections.add(allLabel);
145
			allLabel.addClickListener(
8 ddelon 146
				    	new ClickListener() {
147
				    		public void onClick(Widget sender) {
148
				    			selectAll();
149
				    		}
150
				     	}
151
			);
152
 
9 ddelon 153
			selections.add(separatorLabel);
154
 
155
			selections.add(noneLabel);
156
			noneLabel.addClickListener(
8 ddelon 157
				    	new ClickListener() {
158
				    		public void onClick(Widget sender) {
159
				    			deselectAll();
160
				    		}
161
				     	}
162
			);
9 ddelon 163
 
164
 
8 ddelon 165
			bar.add(actions, DockPanel.WEST);
166
			bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_LEFT);
167
 
168
 
6 ddelon 169
			bar.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
8 ddelon 170
 
171
 
6 ddelon 172
		}
3 ddelon 173
 
6 ddelon 174
		public void onClick(Widget sender) {
175
			if (sender == gotoNext) {
176
				// Move forward a page.
177
				startIndex += VISIBLE_TAXON_COUNT;
178
				if (startIndex >= count)
179
					startIndex -= VISIBLE_TAXON_COUNT;
180
			} else {
181
				if (sender == gotoPrev) {
182
					// Move back a page.
183
					startIndex -= VISIBLE_TAXON_COUNT;
184
					if (startIndex < 0)
185
						startIndex = 0;
186
				} else {
187
					if (sender == gotoEnd) {
188
						gotoEnd();
189
					} else {
190
						if (sender == gotoFirst) {
191
							startIndex = 0;
192
						}
193
					}
194
				}
195
			}
9 ddelon 196
			update(true);
6 ddelon 197
		}
3 ddelon 198
 
6 ddelon 199
	}
2 ddelon 200
 
6 ddelon 201
	private void setStatusText(String text) {
202
		navBar.status.setText(text);
203
	}
4 ddelon 204
 
6 ddelon 205
	private static final int VISIBLE_TAXON_COUNT = 15;
2 ddelon 206
 
6 ddelon 207
	private Grid header = new Grid(1, 6);
3 ddelon 208
 
6 ddelon 209
	private FlexTable table = new FlexTable();
2 ddelon 210
 
6 ddelon 211
	private VerticalPanel panel = new VerticalPanel();
5 ddelon 212
 
6 ddelon 213
	private int startIndex = 0;
3 ddelon 214
 
6 ddelon 215
	private String serviceBaseUrl = getServiceBaseUrl();
2 ddelon 216
 
6 ddelon 217
	private int count = 65000;
4 ddelon 218
 
6 ddelon 219
	private String user;
4 ddelon 220
 
9 ddelon 221
	private NavBar navBar=null;
2 ddelon 222
 
9 ddelon 223
	int sizeChecked=0;
224
	int itemDeleted=0;
225
 
6 ddelon 226
	public TaxonList() {
5 ddelon 227
 
9 ddelon 228
		getUser(); // Appelle le reste des initialisations
229
 
230
		initWidget(panel);
2 ddelon 231
 
5 ddelon 232
 
6 ddelon 233
	}
5 ddelon 234
 
6 ddelon 235
	/**
236
	 * Action lancee par la selection d'un nom dans l'assistant de saisie. Lance
237
	 * la recherche d'informations complémentaires (famille, numero
238
	 * nomenclaturaux etc) et met a jour l'inventaire (addelement())
239
	 *
240
	 * @return void
241
	 */
242
	public void onValidate(SourcesAutoCompleteAsyncTextBoxEvents sender,
243
			 final String str,final String value) {
3 ddelon 244
 
6 ddelon 245
		setStatusDisabled();
2 ddelon 246
 
9 ddelon 247
		// On met a jour rapidement l'affichage puis on lance la requete  ....
248
 
249
		int row = table.insertRow(table.getRowCount());
250
		// Case a cocher
251
		table.setWidget(row, 0, new CheckBox());
252
		// Nom saisi
253
		table.setText(row, 1, str);
254
 
255
		table.getFlexCellFormatter().setWidth(row, 0, "2%");
256
		table.getFlexCellFormatter()
257
				.setWidth(row, 1, "31%");
258
 
259
		// Recherche complement d'information
2 ddelon 260
 
6 ddelon 261
		if (value !=null) {
2 ddelon 262
 
263
 
6 ddelon 264
			HTTPRequest.asyncGet(serviceBaseUrl + "/NameValid/" + value,
265
					new ResponseTextHandler() {
2 ddelon 266
 
6 ddelon 267
						public void onCompletion(String strcomplete) {
2 ddelon 268
 
6 ddelon 269
							JSONValue jsonValue = JSONParser.parse(strcomplete);
270
							JSONArray jsonArray;
271
 
272
							if ((jsonArray = jsonValue.isArray()) != null) {
273
								// Nom retenu, Num Nomen nom retenu, Num Taxon,
274
								// Famille
275
								addElement(str, value,
276
										((JSONString) jsonArray.get(0))
277
												.stringValue(),
278
										((JSONString) jsonArray.get(1))
279
												.stringValue(),
280
										((JSONString) jsonArray.get(2))
281
												.stringValue(),
282
										((JSONString) jsonArray.get(3))
283
												.stringValue());
284
							}
285
						}
286
 
287
					});
288
		}
289
		// Saisie libre
290
		else {
291
			addElement(str, " ", " ", " ", " ", " ");
292
		}
9 ddelon 293
 
294
 
295
 
6 ddelon 296
	}
297
 
298
	/**
299
	 * Ajoute un element à l'inventaire
300
	 *
301
	 * @param nom_sel :
302
	 *            nom selectionne
303
	 * @param num_nom_sel :
304
	 *            numero nomenclatural nom selectionne
305
	 * @param nom_ret :
306
	 *            nom retenu
307
	 * @param num_nom_ret :
308
	 *            numero nomenclaturel nom retenu
309
	 * @param num_taxon :
310
	 *            numero taxonomique
311
	 * @param famille :
312
	 *            famille
313
	 */
314
 
315
	public void addElement(String nom_sel, String num_nom_sel, String nom_ret,
316
			String num_nom_ret, String num_taxon, String famille) {
317
 
318
		// Calcul du nouveau numéro d'ordre
319
 
320
		/*
321
		 * int order=1; if (table.getRowCount()>0) { order=new
322
		 * Integer(table.getText(table.getRowCount()-1,6)).intValue()+1; }
323
		 */
324
 
325
		count++;
326
		HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/", "identifiant="
327
				+ user + "&nom_sel=" + nom_sel + "&num_nom_sel=" + num_nom_sel
328
				+ "&nom_ret=" + nom_ret + "&num_nom_ret=" + num_nom_ret
329
				+ "&num_taxon=" + num_taxon + "&famille=" + famille,
330
 
331
		new ResponseTextHandler() {
332
 
333
			public void onCompletion(String str) {
9 ddelon 334
				// (Optimisation) Si on reste sur la meme page  : ajout à la fin
335
				if (((count-2)/VISIBLE_TAXON_COUNT)==(count-1/VISIBLE_TAXON_COUNT)) {
336
					update(false);
337
				}
338
				else {
339
					gotoEnd();
340
					update(true);
341
				}
6 ddelon 342
			}
343
		});
344
	}
345
 
346
	/**
347
	 * Suppression d'un element lde l'inventaire, a partir de son numero d'ordre
348
	 *
349
	 */
350
 
351
	public void deleteElement() {
352
 
353
		setStatusDisabled();
354
		boolean checked = false;
9 ddelon 355
		Vector parseChecked = new Vector();
6 ddelon 356
 
357
		// Lifo ...
358
		for (int i = table.getRowCount() - 1; i >= 0; i--) {
359
			if (((CheckBox) table.getWidget(i, 0)).isChecked()) {
360
				checked = true;
9 ddelon 361
				parseChecked.add(table.getText(i, 6));
6 ddelon 362
				count--;
9 ddelon 363
 
364
			}
365
		}
366
		sizeChecked=parseChecked.size();
367
		itemDeleted=0;
368
		for (Iterator it = parseChecked.iterator(); it.hasNext();) {
369
			itemDeleted++;
370
			HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + user
371
						+ "/" + (String) it.next(), "action=DELETE",
372
 
6 ddelon 373
						new ResponseTextHandler() {
374
							public void onCompletion(String str) {
9 ddelon 375
								// On ne lance la suppression qu'a la fin
376
								    if (itemDeleted==sizeChecked) {
377
										gotoEnd();
378
										update(true);
379
								    }
6 ddelon 380
							}
381
						});
382
 
383
		}
384
		if (!checked) {
385
			setStatusEnabled();
386
		}
387
	}
8 ddelon 388
 
389
	/**
390
	 * Selection de l'ensemble des elements affichés
391
	 *
392
	 */
6 ddelon 393
 
8 ddelon 394
	public void selectAll() {
395
 
396
		for (int i = table.getRowCount() - 1; i >= 0; i--) {
397
			 ((CheckBox) table.getWidget(i, 0)).setChecked(true);
398
		}
399
	}
400
 
401
	public void deselectAll() {
402
 
403
		for (int i = table.getRowCount() - 1; i >= 0; i--) {
404
			((CheckBox) table.getWidget(i, 0)).setChecked(false);
405
		}
406
	}
407
 
408
 
6 ddelon 409
	/**
410
	 *
411
	 * Lancement des initialisations dependantes de réponses asynchrones : le
412
	 * retour d'une demande d'initialisation declanche la demande
413
	 * d'initialisation suivantes user : resultat recherche nom d'utilisateur
414
	 * count : resultat nombre d'enregistrements d'inventaires affichage
415
	 * enregistrements trouvés
416
	 *
417
	 */
418
	private void initAsync() {
419
 
9 ddelon 420
		navBar = new NavBar();
421
 
422
 
423
		// Information complementaire : un tableau associe au retour de
424
		// l'assistant de saisie
425
 
426
		// Mise en forme du header
427
 
428
		header.setCellSpacing(0);
429
		header.setCellPadding(2);
430
		header.setWidth("100%");
431
 
432
		header.setStyleName("taxon-ListHeader");
433
 
434
		header.setText(0, 0, "");
435
		header.setText(0, 1, "Nom saisi");
436
		header.setText(0, 2, "Nom retenu");
437
		header.setHTML(0, 3, "Code<br>Nomenclatural");
438
		header.setHTML(0, 4, "Code<br>Taxonomique");
439
		header.setText(0, 5, "Famille");
440
 
441
		header.getCellFormatter().setWidth(0, 0, "2%");
442
		header.getCellFormatter().setWidth(0, 1, "31%");
443
		header.getCellFormatter().setWidth(0, 2, "31%");
444
		header.getCellFormatter().setWidth(0, 3, "9%");
445
		header.getCellFormatter().setWidth(0, 4, "9%");
446
		header.getCellFormatter().setWidth(0, 5, "18%");
447
 
448
		// Mise en forme de la table.
449
 
450
		table.setCellSpacing(0);
451
		table.setBorderWidth(0);
452
		table.setCellPadding(2);
453
		table.setWidth("100%");
454
 
455
		// Mise en forme barre navigation
456
 
457
		navBar.setWidth("100%");
458
 
459
		table.setStyleName("taxon-List");
460
 
461
		panel.add(navBar);
462
		panel.add(header);
463
		panel.add(table);
464
 
465
		getCount();
6 ddelon 466
		// update()
467
 
468
	}
469
 
470
	/**
471
	 * Recherche utilisateur en cours
472
	 *
473
	 */
474
	private void getUser() {
475
 
476
 
477
		HTTPRequest.asyncGet(serviceBaseUrl + "/User/",
478
				new ResponseTextHandler() {
479
 
480
					public void onCompletion(String str) {
481
						JSONValue jsonValue = JSONParser.parse(str);
482
						JSONString jsonString;
483
						if ((jsonString = jsonValue.isString()) != null) {
484
							user = jsonString.stringValue();
485
						}
9 ddelon 486
						initAsync();
6 ddelon 487
					}
488
				});
489
 
490
	}
491
 
492
	/**
493
	 * Recherche nombre d'enregistrement pour l'utilisateur en cours
494
	 *
495
	 */
496
	private void getCount() {
9 ddelon 497
 
498
		setStatusDisabled();
6 ddelon 499
 
500
		HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryList/" + user + "/",
501
				new ResponseTextHandler() {
502
 
503
					public void onCompletion(String str) {
504
 
505
						JSONValue jsonValue = JSONParser.parse(str);
506
						JSONNumber jsonNumber;
507
						if ((jsonNumber = jsonValue.isNumber()) != null) {
508
							count = (int) jsonNumber.getValue();
509
							gotoEnd(); // Derniere page
9 ddelon 510
							update(true);
6 ddelon 511
						}
512
					}
513
				});
514
 
515
	}
516
 
517
	/**
518
	 * Mise a jour de l'affichage, à partir des données d'inventaire deja
519
	 * saisies. La valeur de this.startIndex permet de determiner quelles
520
	 * données seront affichées
521
	 *
522
	 */
523
 
9 ddelon 524
	private void update(final boolean deep) {
6 ddelon 525
 
526
		setStatusDisabled();
527
 
528
		// TODO : optimisation : ne supprimer que les lignes qui ne seront pas
529
		// alimentes .
9 ddelon 530
 
531
		// TODO : ne pas recreer la table a chaque fois ... : parcouris le retour, le comparer au present
532
		// et inserer ou supprimer s'il le faut.
6 ddelon 533
 
9 ddelon 534
		// TODO : ou alors prevoir un update pour les ajouts (forcemment à la fin) et un update pour les suppressions ...
535
		// Sauf qu'il y a les chgts de pages ... : oui, la un fait un update normal ...
536
 
6 ddelon 537
		HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryList/" + user + "/"
538
				+ startIndex + "/" + VISIBLE_TAXON_COUNT,
539
 
540
		new ResponseTextHandler() {
541
 
542
			public void onCompletion(String str) {
543
 
544
				JSONValue jsonValue = JSONParser.parse(str);
545
				JSONArray jsonArray;
546
				JSONArray jsonArrayNested;
547
 
548
				// Lifo ...
9 ddelon 549
				if (deep) {
550
					for (int i = table.getRowCount() - 1; i >= 0; i--) {
551
						table.removeRow(i);
552
					}
6 ddelon 553
				}
9 ddelon 554
				else {
555
					table.removeRow(table.getRowCount());
556
				}
557
 
6 ddelon 558
				if ((jsonArray = jsonValue.isArray()) != null) {
9 ddelon 559
					int arraySize = jsonArray.size();
560
					for (int i = 0; i < arraySize; ++i) {
561
						if (!deep && i != arraySize -1) {
562
							continue;
563
						}
6 ddelon 564
						if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
565
							int row = table.insertRow(table.getRowCount());
566
							// Case a cocher
567
							table.setWidget(row, 0, new CheckBox());
568
							// Nom saisi
569
							table.setText(row, 1, ((JSONString) jsonArrayNested
570
									.get(0)).stringValue());
571
							// Nom retenu
572
							table.setText(row, 2, ((JSONString) jsonArrayNested
573
									.get(2)).stringValue());
574
							// Num nomenclatural
575
							table.setText(row, 3, ((JSONString) jsonArrayNested
576
									.get(1)).stringValue());
577
							// Num Taxonomique
578
							table.setText(row, 4, ((JSONString) jsonArrayNested
579
									.get(4)).stringValue());
580
							// Famille
581
							table.setText(row, 5, ((JSONString) jsonArrayNested
582
									.get(5)).stringValue());
583
							// Numero d'ordre
584
							table.setText(row, 6, ((JSONString) jsonArrayNested
585
									.get(6)).stringValue());
586
 
587
							table.getCellFormatter().setVisible(row, 6, false);
588
 
589
							table.getFlexCellFormatter().setWidth(row, 0, "2%");
590
							table.getFlexCellFormatter()
591
									.setWidth(row, 1, "31%");
592
							table.getFlexCellFormatter()
593
									.setWidth(row, 2, "31%");
594
							table.getFlexCellFormatter().setWidth(row, 3, "9%");
595
							table.getFlexCellFormatter().setWidth(row, 4, "9%");
596
							table.getFlexCellFormatter()
597
									.setWidth(row, 5, "18%");
598
						}
599
 
600
					}
601
				}
602
				setStatusEnabled();
603
 
604
			}
605
		});
606
 
607
	}
608
 
609
	/**
610
	 * Recuperation du prefixe d'appel des services
611
	 */
612
 
5 ddelon 613
	private String getServiceBaseUrl() {
6 ddelon 614
 
615
		Dictionary theme = Dictionary.getDictionary("Parameters");
616
		return theme.get("serviceBaseUrl");
617
 
618
	}
619
 
5 ddelon 620
	/**
621
	 * Affichage message d'attente et désactivation navigation
6 ddelon 622
	 *
623
	 * @param
624
	 * @return void
5 ddelon 625
	 */
6 ddelon 626
 
5 ddelon 627
	private void setStatusDisabled() {
6 ddelon 628
 
5 ddelon 629
		navBar.gotoFirst.setEnabled(false);
630
		navBar.gotoPrev.setEnabled(false);
631
		navBar.gotoNext.setEnabled(false);
632
		navBar.gotoEnd.setEnabled(false);
6 ddelon 633
 
5 ddelon 634
		setStatusText("Patientez ...");
635
	}
4 ddelon 636
 
5 ddelon 637
	/**
638
	 * Affichage numero de page et gestion de la navigation
6 ddelon 639
	 *
5 ddelon 640
	 */
6 ddelon 641
 
5 ddelon 642
	private void setStatusEnabled() {
6 ddelon 643
 
5 ddelon 644
		// Il y a forcemment un disabled avant d'arriver ici
6 ddelon 645
 
646
		if (count > 0) {
647
 
648
			if (startIndex >= VISIBLE_TAXON_COUNT) { // Au dela de la
649
														// premiere page
5 ddelon 650
				navBar.gotoPrev.setEnabled(true);
651
				navBar.gotoFirst.setEnabled(true);
6 ddelon 652
				if (startIndex < (count - VISIBLE_TAXON_COUNT)) { // Pas la
653
																	// derniere
654
																	// page
5 ddelon 655
					navBar.gotoNext.setEnabled(true);
656
					navBar.gotoEnd.setEnabled(true);
6 ddelon 657
					setStatusText((startIndex + 1) + " - "
8 ddelon 658
							+ (startIndex + VISIBLE_TAXON_COUNT) + " sur " + count );
6 ddelon 659
				} else { // Derniere page
8 ddelon 660
					setStatusText((startIndex + 1) + " - " + count + " sur " + count );
5 ddelon 661
				}
6 ddelon 662
			} else { // Premiere page
5 ddelon 663
				if (count > VISIBLE_TAXON_COUNT) { // Des pages derrieres
664
					navBar.gotoNext.setEnabled(true);
665
					navBar.gotoEnd.setEnabled(true);
6 ddelon 666
					setStatusText((startIndex + 1) + " - "
8 ddelon 667
							+ (startIndex + VISIBLE_TAXON_COUNT) + " sur " + count);
6 ddelon 668
				} else {
8 ddelon 669
					setStatusText((startIndex + 1) + " - " + count + " sur " + count);
5 ddelon 670
				}
671
			}
672
		}
6 ddelon 673
 
5 ddelon 674
		else { // Pas d'inventaire, pas de navigation
8 ddelon 675
			setStatusText("0 - 0 sur 0");
5 ddelon 676
		}
677
	}
6 ddelon 678
 
8 ddelon 679
	/*
6 ddelon 680
	 * Positionnement index de parcours (this.startIndex) pour affichage de la
681
	 * dernière page
682
	 *
683
	 * @param
684
	 * @return void
5 ddelon 685
	 */
6 ddelon 686
 
5 ddelon 687
	private void gotoEnd() {
6 ddelon 688
 
689
		if ((count == 0) || (count % VISIBLE_TAXON_COUNT) > 0) {
690
			startIndex = count - (count % VISIBLE_TAXON_COUNT);
691
		} else {
692
			startIndex = count - VISIBLE_TAXON_COUNT;
693
		}
694
 
5 ddelon 695
	}
6 ddelon 696
 
8 ddelon 697
 
2 ddelon 698
}