Subversion Repositories eFlore/Archives.cel-v1

Rev

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