Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 6 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6 Rev 8
Line 34... Line 34...
34
import com.google.gwt.user.client.ui.CheckBox;
34
import com.google.gwt.user.client.ui.CheckBox;
35
import com.google.gwt.user.client.ui.Widget;
35
import com.google.gwt.user.client.ui.Widget;
36
import com.google.gwt.user.client.ui.ClickListener;
36
import com.google.gwt.user.client.ui.ClickListener;
37
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
37
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
38
import com.google.gwt.user.client.ui.HasVerticalAlignment;
38
import com.google.gwt.user.client.ui.HasVerticalAlignment;
-
 
39
import com.google.gwt.user.client.ui.Label;
-
 
40
import com.google.gwt.user.client.Window;
Line 39... Line 41...
39
 
41
 
40
/*
42
/*
41
 * Le retour de getUser appelle getCount qui appelle update pour veiller à une
43
 * Le retour de getUser appelle getCount qui appelle update pour veiller à une
42
 * initialisation correcte
44
 * initialisation correcte
Line 59... Line 61...
59
		public final Button gotoPrev = new Button("<", this);
61
		public final Button gotoPrev = new Button("<", this);
Line 60... Line 62...
60
 
62
 
Line 61... Line 63...
61
		public final Button gotoEnd = new Button(">>", this);
63
		public final Button gotoEnd = new Button(">>", this);
-
 
64
 
Line 62... Line 65...
62
 
65
		public final HTML status = new HTML();
63
		public final HTML status = new HTML();
66
		
64
 
67
 
65
		public NavBar() {
68
		public NavBar() {
66
			initWidget(bar);
69
			initWidget(bar);
67
			bar.setStyleName("navbar");
70
			bar.setStyleName("navbar");
-
 
71
			status.setStyleName("status");
-
 
72
			
-
 
73
			HorizontalPanel buttons = new HorizontalPanel();
-
 
74
			
-
 
75
			buttons.add(status);
-
 
76
			buttons.setCellHorizontalAlignment(status,
-
 
77
					HasHorizontalAlignment.ALIGN_RIGHT);
-
 
78
			buttons.setCellVerticalAlignment(status,
-
 
79
					HasVerticalAlignment.ALIGN_MIDDLE);
68
			status.setStyleName("status");
80
			buttons.setCellWidth(status, "100%");
69
 
81
 
70
			HorizontalPanel buttons = new HorizontalPanel();
82
 
71
			buttons.add(gotoFirst);
83
			buttons.add(gotoFirst);
72
			buttons.add(gotoPrev);
84
			buttons.add(gotoPrev);
73
			buttons.add(gotoNext);
85
			buttons.add(gotoNext);
74
			buttons.add(gotoEnd);
-
 
75
			bar.add(buttons, DockPanel.EAST);
-
 
76
			bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_RIGHT);
-
 
77
			bar.add(status, DockPanel.CENTER);
-
 
78
			bar.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
-
 
79
			bar.setCellHorizontalAlignment(status,
-
 
80
					HasHorizontalAlignment.ALIGN_RIGHT);
-
 
-
 
86
			buttons.add(gotoEnd);
-
 
87
			bar.add(buttons, DockPanel.EAST);
-
 
88
			bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_RIGHT);
Line -... Line 89...
-
 
89
			
-
 
90
		
-
 
91
 
-
 
92
 
-
 
93
 
-
 
94
		
-
 
95
			VerticalPanel actions = new VerticalPanel();
-
 
96
			
-
 
97
			HorizontalPanel actionButton = new HorizontalPanel();
-
 
98
			
-
 
99
		/*	
-
 
100
			actionButton.add(new Button("Ajout",
-
 
101
			    	new ClickListener() {
-
 
102
			    		public void onClick(Widget sender) {
-
 
103
			    			deleteElement();
-
 
104
			    		}
-
 
105
			     	}
-
 
106
			));		
-
 
107
 
-
 
108
			*/
-
 
109
			actionButton.add(new Button("Suppression",
-
 
110
			    	new ClickListener() {
-
 
111
			    		public void onClick(Widget sender) {
-
 
112
			    			deleteElement();
-
 
113
			    		}
-
 
114
			     	}
-
 
115
			));		
-
 
116
		
-
 
117
 
-
 
118
			actionButton.add(new Button("Tout exporter",
-
 
119
			    	new ClickListener() {
-
 
120
			    		public void onClick(Widget sender) {
-
 
121
			    			exportAll();
-
 
122
			    		}
-
 
123
			     	}
-
 
124
			));		
-
 
125
 
-
 
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élection : "));
-
 
136
			
-
 
137
			Label all = new Label("Tous,");
-
 
138
			Label none = new Label("Aucun");
-
 
139
			
-
 
140
			selections.add(all);
-
 
141
			all.addClickListener(
-
 
142
				    	new ClickListener() {
-
 
143
				    		public void onClick(Widget sender) {
-
 
144
				    			selectAll();
-
 
145
				    		}
-
 
146
				     	}
-
 
147
			);		
-
 
148
			
-
 
149
			selections.add(none);
-
 
150
			none.addClickListener(
-
 
151
				    	new ClickListener() {
-
 
152
				    		public void onClick(Widget sender) {
-
 
153
				    			deselectAll();
-
 
154
				    		}
-
 
155
				     	}
-
 
156
			);		
-
 
157
		
-
 
158
			bar.add(actions, DockPanel.WEST);
-
 
159
			bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_LEFT);
-
 
160
 
81
			bar.setCellVerticalAlignment(status,
161
			
Line 82... Line 162...
82
					HasVerticalAlignment.ALIGN_MIDDLE);
162
			bar.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
83
			bar.setCellWidth(status, "100%");
163
			
84
 
164
			
Line 303... Line 383...
303
		}
383
		}
304
		if (!checked) {
384
		if (!checked) {
305
			setStatusEnabled();
385
			setStatusEnabled();
306
		}
386
		}
307
	}
387
	}
-
 
388
	
-
 
389
	/**
-
 
390
	 * Selection de l'ensemble des elements affichés
-
 
391
	 * 
-
 
392
	 */
-
 
393
 
-
 
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
 
Line 308... Line 408...
308
 
408
 
309
	/**
409
	/**
310
	 * 
410
	 * 
311
	 * Lancement des initialisations dependantes de réponses asynchrones : le
411
	 * Lancement des initialisations dependantes de réponses asynchrones : le
Line 495... Line 595...
495
																	// derniere
595
																	// derniere
496
																	// page
596
																	// page
497
					navBar.gotoNext.setEnabled(true);
597
					navBar.gotoNext.setEnabled(true);
498
					navBar.gotoEnd.setEnabled(true);
598
					navBar.gotoEnd.setEnabled(true);
499
					setStatusText((startIndex + 1) + " - "
599
					setStatusText((startIndex + 1) + " - "
500
							+ (startIndex + VISIBLE_TAXON_COUNT));
600
							+ (startIndex + VISIBLE_TAXON_COUNT) + " sur " + count );
501
				} else { // Derniere page
601
				} else { // Derniere page
502
					setStatusText((startIndex + 1) + " - " + count);
602
					setStatusText((startIndex + 1) + " - " + count + " sur " + count );
503
				}
603
				}
504
			} else { // Premiere page
604
			} else { // Premiere page
505
				if (count > VISIBLE_TAXON_COUNT) { // Des pages derrieres
605
				if (count > VISIBLE_TAXON_COUNT) { // Des pages derrieres
506
					navBar.gotoNext.setEnabled(true);
606
					navBar.gotoNext.setEnabled(true);
507
					navBar.gotoEnd.setEnabled(true);
607
					navBar.gotoEnd.setEnabled(true);
508
					setStatusText((startIndex + 1) + " - "
608
					setStatusText((startIndex + 1) + " - "
509
							+ (startIndex + VISIBLE_TAXON_COUNT));
609
							+ (startIndex + VISIBLE_TAXON_COUNT) + " sur " + count);
510
				} else {
610
				} else {
511
					setStatusText((startIndex + 1) + " - " + count);
611
					setStatusText((startIndex + 1) + " - " + count + " sur " + count);
512
				}
612
				}
513
			}
613
			}
514
		}
614
		}
Line 515... Line 615...
515
 
615
 
516
		else { // Pas d'inventaire, pas de navigation
616
		else { // Pas d'inventaire, pas de navigation
517
			setStatusText(0 + " - " + 0);
617
			setStatusText("0 - 0 sur 0");
518
		}
618
		}
Line 519... Line 619...
519
	}
619
	}
520
 
620
 
521
	/**
621
	/*
522
	 * Positionnement index de parcours (this.startIndex) pour affichage de la
622
	 * Positionnement index de parcours (this.startIndex) pour affichage de la
523
	 * dernière page
623
	 * dernière page
524
	 * 
624
	 * 
Line 534... Line 634...
534
			startIndex = count - VISIBLE_TAXON_COUNT;
634
			startIndex = count - VISIBLE_TAXON_COUNT;
535
		}
635
		}
Line 536... Line 636...
536
 
636
 
Line -... Line 637...
-
 
637
	}
-
 
638
 
-
 
639
	/*
-
 
640
	 * Export du releve affiche  dans un format tableur
-
 
641
	 * 
-
 
642
	 * @param
-
 
643
	 * @return void
-
 
644
	 */
-
 
645
 
-
 
646
	private void exportAll() {
-
 
647
		
-
 
648
		Window.open(serviceBaseUrl+"/InventoryExport/" +user + "/","_self","");
-
 
649
		
537
	}
650
	}