Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 14 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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