Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 26 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 26 Rev 27
Line 1... Line -...
1
/**
-
 
2
 David Delon david.delon@clapas.net 2007
-
 
3
 
-
 
4
 */
-
 
5
 
-
 
6
/*
1
/*
7
 * DateList.java  : filtrage des releves par date d'observation
2
 * Copyright 2006 Google Inc.
8
 * 
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
9
 * 
7
 * 
-
 
8
 * http://www.apache.org/licenses/LICENSE-2.0
-
 
9
 * 
10
 * 1: Le programme initialise les filtres communes, lieu-dit et dates)
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.
11
 */
15
 */
12
 
-
 
13
 
-
 
14
package org.tela_botanica.client;
16
package org.tela_botanica.client;
Line 15... Line -...
15
 
-
 
16
 
17
 
17
 
18
 
18
import com.google.gwt.http.client.URL;
19
import com.google.gwt.http.client.URL;
19
import com.google.gwt.json.client.JSONArray;
20
import com.google.gwt.json.client.JSONArray;
20
import com.google.gwt.json.client.JSONNumber;
21
import com.google.gwt.json.client.JSONNumber;
Line 24... Line 25...
24
import com.google.gwt.user.client.HTTPRequest;
25
import com.google.gwt.user.client.HTTPRequest;
25
import com.google.gwt.user.client.ResponseTextHandler;
26
import com.google.gwt.user.client.ResponseTextHandler;
26
import com.google.gwt.user.client.ui.Button;
27
import com.google.gwt.user.client.ui.Button;
27
import com.google.gwt.user.client.ui.ClickListener;
28
import com.google.gwt.user.client.ui.ClickListener;
28
import com.google.gwt.user.client.ui.Composite;
29
import com.google.gwt.user.client.ui.Composite;
-
 
30
import com.google.gwt.user.client.ui.DockPanel;
29
import com.google.gwt.user.client.ui.FlexTable;
31
import com.google.gwt.user.client.ui.FlexTable;
30
import com.google.gwt.user.client.ui.Grid;
32
import com.google.gwt.user.client.ui.Grid;
31
import com.google.gwt.user.client.ui.HTML;
33
import com.google.gwt.user.client.ui.HTML;
32
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
34
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
33
import com.google.gwt.user.client.ui.HasVerticalAlignment;
35
import com.google.gwt.user.client.ui.HasVerticalAlignment;
Line 41... Line 43...
41
 * A tree displaying a set of email folders.
43
 * A tree displaying a set of email folders.
42
 */
44
 */
43
public class DateList extends Composite {
45
public class DateList extends Composite {
Line -... Line 46...
-
 
46
	
44
	
47
	
Line 45... Line 48...
45
	
48
	
Line -... Line 49...
-
 
49
	// Barre de navigation
-
 
50
 
46
	// Debut Barre de navigation
51
	private class NavBar extends Composite implements ClickListener {
-
 
52
 
47
 
53
		public final DockPanel bar = new DockPanel();
-
 
54
 
48
	private class NavBar extends Composite implements ClickListener {
55
		public final Button gotoFirst = new Button("<<", this);
-
 
56
 
49
 
57
		public final Button gotoNext = new Button(">", this);
-
 
58
 
50
		public final Button gotoFirst = new Button("<<", this);
59
		public final Button gotoPrev = new Button("<", this);
Line 51... Line 60...
51
		public final Button gotoNext = new Button(">", this);
60
 
-
 
61
		public final Button gotoEnd = new Button(">>", this);
-
 
62
 
-
 
63
		public final HTML status = new HTML();
-
 
64
		
Line -... Line 65...
-
 
65
 
Line -... Line 66...
-
 
66
		public NavBar() {
52
		public final Button gotoPrev = new Button("<", this);
67
			initWidget(bar);
-
 
68
			bar.setStyleName("navbar");
-
 
69
			status.setStyleName("status");
-
 
70
			status.setWordWrap(false);
-
 
71
			
Line 53... Line -...
53
		public final Button gotoEnd = new Button(">>", this);
-
 
54
		public final HTML status = new HTML();
-
 
Line -... Line 72...
-
 
72
			HorizontalPanel buttons = new HorizontalPanel();
-
 
73
			
-
 
74
			buttons.add(status);
-
 
75
			buttons.setCellHorizontalAlignment(status,
-
 
76
					HasHorizontalAlignment.ALIGN_RIGHT);
-
 
77
			buttons.setCellVerticalAlignment(status,
Line 55... Line -...
55
		
-
 
56
 
-
 
57
		public NavBar() {
-
 
58
			
-
 
59
			
-
 
60
			HorizontalPanel bar = new HorizontalPanel();
-
 
61
			
-
 
62
			bar.setStyleName("navbar");
-
 
63
			status.setStyleName("status");
-
 
Line -... Line 78...
-
 
78
					HasVerticalAlignment.ALIGN_MIDDLE);
-
 
79
			buttons.setCellWidth(status, "100%");
-
 
80
 
Line 64... Line -...
64
			
-
 
Line 65... Line -...
65
			
-
 
Line -... Line 81...
-
 
81
 
-
 
82
			buttons.add(gotoFirst);
-
 
83
			buttons.add(gotoPrev);
66
			bar.add(status);
84
			buttons.add(gotoNext);
67
			bar.setCellHorizontalAlignment(status, HasHorizontalAlignment.ALIGN_RIGHT);
85
			buttons.add(gotoEnd);
68
			bar.setCellVerticalAlignment(status, HasVerticalAlignment.ALIGN_MIDDLE);
86
			bar.add(buttons, DockPanel.EAST);
69
			bar.setCellWidth(status, "100%");
87
			bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_RIGHT);
70
 
88
			
Line 104... Line 122...
104
			update();
122
			update();
105
		}
123
		}
Line 106... Line 124...
106
 
124
 
Line 107... Line -...
107
	}
-
 
Line 108... Line 125...
108
 
125
	}
109
	// Fin Barre de navigation
126
 
Line 132... Line 149...
132
		
149
		
Line 133... Line 150...
133
 
150
 
Line 134... Line 151...
134
		private NavBar navBar=null;
151
		private NavBar navBar=null;
135
 
152
 
Line 136... Line 153...
136
		
153
		
Line 169... Line 186...
169
			
186
			
Line 170... Line 187...
170
 
187
 
Line 171... Line 188...
171
//			header.getCellFormatter().setWidth(0, 0, "100%");
188
//			header.getCellFormatter().setWidth(0, 0, "100%");
172
 
189
 
173
 
190
 
Line 206... Line 223...
206
 
223
 
Line 207... Line 224...
207
			table.setStyleName("date-ListElement");
224
			table.setStyleName("date-ListElement");
208
 
225
 
209
			
226
			
210
			outer.add(header);
227
			outer.add(header);
211
			inner.add(selector); // Toutes localit�s
228
			inner.add(selector); // Toutes localités
212
			inner.add(table);
229
			inner.add(table);
213
			inner.setStyleName("date-List");
230
			inner.setStyleName("date-List");
Line 237... Line 254...
237
		    
254
		    
238
		  	styleRow(selectedRow, false);
255
		  	styleRow(selectedRow, false);
Line -... Line 256...
-
 
256
	        selector.getRowFormatter().addStyleName(0, "date-SelectedRow");
-
 
257
		    		
-
 
258
		    
239
	        selector.getRowFormatter().addStyleName(0, "date-SelectedRow");
259
			//updateCount();
Line 240... Line 260...
240
		    		
260
			// update()
Line 252... Line 272...
252
		
272
		
Line 253... Line 273...
253
		public void updateCount() {
273
		public void updateCount() {
Line 254... Line -...
254
			
-
 
255
			setStatusDisabled();
274
			
256
 
275
			setStatusDisabled();
Line 257... Line 276...
257
//			HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + location + "/"+  station,
276
 
258
			HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + URL.encodeComponent(location) ,
277
			HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + URL.encodeComponent(location) ,
Line 294... Line 313...
294
			  }
313
			  }
Line 295... Line 314...
295
 
314
 
296
		  
315
		  
297
	/**
316
	/**
298
	 * 
317
	 * 
299
	 * Mise a jour de l'affichage, a partir des donnees d'inventaire deja
318
	 * Mise a jour de l'affichage, à partir des données d'inventaire deja
300
	 * saisies. La valeur de this.startIndex permet de determiner quelles
319
	 * saisies. La valeur de this.startIndex permet de determiner quelles
301
	 * donnees seront affichees
320
	 * données seront affichées
Line 302... Line 321...
302
	 * 
321
	 * 
Line 303... Line 322...
303
	 */	
322
	 */	
Line 304... Line -...
304
 
-
 
305
		public void update() {
323
 
306
 
324
		public void update() {
Line 307... Line 325...
307
			
325
 
Line 384... Line 402...
384
		
402
		
385
		
403
		
386
			
404
			
387
		/*
405
		/*
388
		 * Positionnement index de parcours (this.startIndex) pour affichage de la
406
		 * Positionnement index de parcours (this.startIndex) pour affichage de la
389
		 * derni�re page
407
		 * dernière page
390
		 * 
408
		 * 
Line 402... Line 420...
402
 
420
 
Line 403... Line 421...
403
		}
421
		}
404
		
422
		
405
		
423
		
406
		/**
424
		/**
407
		 * Affichage message d'attente et d�sactivation navigation
425
		 * Affichage message d'attente et désactivation navigation
408
		 * 
426
		 * 
Line 415... Line 433...
415
			navBar.gotoFirst.setEnabled(false);
433
			navBar.gotoFirst.setEnabled(false);
416
			navBar.gotoPrev.setEnabled(false);
434
			navBar.gotoPrev.setEnabled(false);
417
			navBar.gotoNext.setEnabled(false);
435
			navBar.gotoNext.setEnabled(false);
418
			navBar.gotoEnd.setEnabled(false);
436
			navBar.gotoEnd.setEnabled(false);
Line 419... Line 437...
419
 
437
 
420
			navBar.status.setText("Patientez ...");
438
			setStatusText("Patientez ...");
Line 421... Line 439...
421
		}
439
		}
422
 
440
 
423
		/**
441
		/**
Line 438... Line 456...
438
					if (startIndex < (count - VISIBLE_DATE_COUNT)) { // Pas la
456
					if (startIndex < (count - VISIBLE_DATE_COUNT)) { // Pas la
439
																		// derniere
457
																		// derniere
440
																		// page
458
																		// page
441
						navBar.gotoNext.setEnabled(true);
459
						navBar.gotoNext.setEnabled(true);
442
						navBar.gotoEnd.setEnabled(true);
460
						navBar.gotoEnd.setEnabled(true);
443
						navBar.status.setText((startIndex + 1) + " - "
461
						setStatusText((startIndex + 1) + " - "
444
								+ (startIndex + VISIBLE_DATE_COUNT) + " sur " + count );
462
								+ (startIndex + VISIBLE_DATE_COUNT) + " sur " + count );
445
					} else { // Derniere page
463
					} else { // Derniere page
446
						navBar.status.setText((startIndex + 1) + " - " + count + " sur " + count );
464
						setStatusText((startIndex + 1) + " - " + count + " sur " + count );
447
					}
465
					}
448
				} else { // Premiere page
466
				} else { // Premiere page
449
					if (count > VISIBLE_DATE_COUNT) { // Des pages derrieres
467
					if (count > VISIBLE_DATE_COUNT) { // Des pages derrieres
450
						navBar.gotoNext.setEnabled(true);
468
						navBar.gotoNext.setEnabled(true);
451
						navBar.gotoEnd.setEnabled(true);
469
						navBar.gotoEnd.setEnabled(true);
452
						navBar.status.setText((startIndex + 1) + " - "
470
						setStatusText((startIndex + 1) + " - "
453
								+ (startIndex + VISIBLE_DATE_COUNT) + " sur " + count);
471
								+ (startIndex + VISIBLE_DATE_COUNT) + " sur " + count);
454
					} else {
472
					} else {
455
						navBar.status.setText((startIndex + 1) + " - " + count + " sur " + count);
473
						setStatusText((startIndex + 1) + " - " + count + " sur " + count);
456
					}
474
					}
457
				}
475
				}
458
			}
476
			}
Line 459... Line 477...
459
 
477
 
460
			else { // Pas d'inventaire, pas de navigation
478
			else { // Pas d'inventaire, pas de navigation
461
				navBar.status.setText("0 - 0 sur 0");
479
				setStatusText("0 - 0 sur 0");
462
			}
480
			}
Line -... Line 481...
-
 
481
		}
-
 
482
 
-
 
483
 
-
 
484
 
Line 463... Line 485...
463
		}
485
		private void setStatusText(String text) {
464
 
486
			navBar.status.setText(text);
465
 
487
		}
Line 475... Line 497...
475
			this.date = date;
497
			this.date = date;
476
		}
498
		}
Line 477... Line 499...
477
	
499
	
478
 
-
 
479
}
-
 
480
 
-
 
481
/* +--Fin du code ---------------------------------------------------------------------------------------+
-
 
482
* $Log$
-