Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 14 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14 Rev 26
-
 
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;
17
 
15
 
-
 
16
 
-
 
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;
27
import com.google.gwt.user.client.ui.ClickListener;
28
import com.google.gwt.user.client.ui.Composite;
28
import com.google.gwt.user.client.ui.Composite;
29
import com.google.gwt.user.client.ui.DockPanel;
-
 
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;
33
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
32
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
34
import com.google.gwt.user.client.ui.HasVerticalAlignment;
33
import com.google.gwt.user.client.ui.HasVerticalAlignment;
35
import com.google.gwt.user.client.ui.HorizontalPanel;
34
import com.google.gwt.user.client.ui.HorizontalPanel;
36
import com.google.gwt.user.client.ui.SourcesTableEvents;
35
import com.google.gwt.user.client.ui.SourcesTableEvents;
37
import com.google.gwt.user.client.ui.TableListener;
36
import com.google.gwt.user.client.ui.TableListener;
38
import com.google.gwt.user.client.ui.VerticalPanel;
37
import com.google.gwt.user.client.ui.VerticalPanel;
39
import com.google.gwt.user.client.ui.Widget;
38
import com.google.gwt.user.client.ui.Widget;
40
 
39
 
41
/**
40
/**
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 {
45
	
44
	
46
	
-
 
47
	
45
	
48
	// Barre de navigation
46
	// Debut Barre de navigation
49
 
47
 
50
	private class NavBar extends Composite implements ClickListener {
48
	private class NavBar extends Composite implements ClickListener {
51
 
-
 
52
		public final DockPanel bar = new DockPanel();
-
 
53
 
49
 
54
		public final Button gotoFirst = new Button("<<", this);
-
 
55
 
50
		public final Button gotoFirst = new Button("<<", this);
56
		public final Button gotoNext = new Button(">", this);
-
 
57
 
51
		public final Button gotoNext = new Button(">", this);
58
		public final Button gotoPrev = new Button("<", this);
-
 
59
 
52
		public final Button gotoPrev = new Button("<", this);
60
		public final Button gotoEnd = new Button(">>", this);
-
 
61
 
53
		public final Button gotoEnd = new Button(">>", this);
62
		public final HTML status = new HTML();
54
		public final HTML status = new HTML();
63
		
55
		
64
 
56
 
65
		public NavBar() {
57
		public NavBar() {
66
			initWidget(bar);
-
 
67
			bar.setStyleName("navbar");
-
 
68
			status.setStyleName("status");
-
 
69
			status.setWordWrap(false);
-
 
70
			
-
 
71
			HorizontalPanel buttons = new HorizontalPanel();
-
 
72
			
58
			
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%");
-
 
79
 
-
 
80
 
-
 
81
			buttons.add(gotoFirst);
-
 
82
			buttons.add(gotoPrev);
-
 
83
			buttons.add(gotoNext);
-
 
84
			buttons.add(gotoEnd);
-
 
-
 
59
			
-
 
60
			HorizontalPanel bar = new HorizontalPanel();
85
			bar.add(buttons, DockPanel.EAST);
-
 
86
			bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_RIGHT);
-
 
87
			
-
 
-
 
61
			
-
 
62
			bar.setStyleName("navbar");
-
 
63
			status.setStyleName("status");
-
 
64
			
88
			
65
			
-
 
66
			bar.add(status);
-
 
67
			bar.setCellHorizontalAlignment(status, HasHorizontalAlignment.ALIGN_RIGHT);
-
 
68
			bar.setCellVerticalAlignment(status, HasVerticalAlignment.ALIGN_MIDDLE);
-
 
69
			bar.setCellWidth(status, "100%");
89
			bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_LEFT);
70
 
-
 
71
			bar.add(gotoFirst);
90
 
72
			bar.add(gotoPrev);
-
 
73
			bar.add(gotoNext);
91
			bar.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
74
			bar.add(gotoEnd);
92
			
75
			
93
					
76
			
94
			
77
			initWidget(bar);
95
	
78
			
96
			
79
		}
97
		}
80
		
98
 
81
 
99
		public void onClick(Widget sender) {
82
		public void onClick(Widget sender) {
100
			if (sender == gotoNext) {
83
			if (sender == gotoNext) {
101
				// Move forward a page.
84
				// Move forward a page.
102
				startIndex += VISIBLE_DATE_COUNT;
85
				startIndex += VISIBLE_DATE_COUNT;
103
				if (startIndex >= count)
86
				if (startIndex >= count)
104
					startIndex -= VISIBLE_DATE_COUNT;
87
					startIndex -= VISIBLE_DATE_COUNT;
105
			} else {
88
			} else {
106
				if (sender == gotoPrev) {
89
				if (sender == gotoPrev) {
107
					// Move back a page.
90
					// Move back a page.
108
					startIndex -= VISIBLE_DATE_COUNT;
91
					startIndex -= VISIBLE_DATE_COUNT;
109
					if (startIndex < 0)
92
					if (startIndex < 0)
110
						startIndex = 0;
93
						startIndex = 0;
111
				} else {
94
				} else {
112
					if (sender == gotoEnd) {
95
					if (sender == gotoEnd) {
113
						gotoEnd();
96
						gotoEnd();
114
					} else {
97
					} else {
115
						if (sender == gotoFirst) {
98
						if (sender == gotoFirst) {
116
							startIndex = 0;
99
							startIndex = 0;
117
						}
100
						}
118
					}
101
					}
119
				}
102
				}
120
			}
103
			}
121
			update();
104
			update();
122
		}
105
		}
123
 
106
 
124
	}
107
	}
-
 
108
 
125
 
109
	// Fin Barre de navigation
126
 
110
 
127
 
111
 
128
		private static final int VISIBLE_DATE_COUNT = 10;
112
		private static final int VISIBLE_DATE_COUNT = 10;
129
		private static final String VALUE_UNKNOWN = "Inconnues";
113
		private static final String VALUE_UNKNOWN = "Inconnues";
130
 
114
 
131
		private Grid header = new Grid(1, 2);
115
		private Grid header = new Grid(1, 2);
132
		
116
		
133
		private Grid selector = new Grid(1, 2);
117
		private Grid selector = new Grid(1, 2);
134
 
118
 
135
		private FlexTable table = new FlexTable();
119
		private FlexTable table = new FlexTable();
136
 
120
 
137
		private VerticalPanel outer = new VerticalPanel();
121
		private VerticalPanel outer = new VerticalPanel();
138
		private VerticalPanel inner = new VerticalPanel();
122
		private VerticalPanel inner = new VerticalPanel();
139
 
123
 
140
		private int startIndex = 0;
124
		private int startIndex = 0;
141
 
125
 
142
		private String user;
126
		private String user;
143
 
127
 
144
		private String serviceBaseUrl = null;
128
		private String serviceBaseUrl = null;
145
 
129
 
146
		private String location = "all";
130
		private String location = "all";
147
		private String date = "all";
131
		private String date = "all";
148
		
132
		
149
 
133
 
150
		private NavBar navBar=null;
134
		private NavBar navBar=null;
151
 
135
 
152
		
136
		
153
		private int count = 65000;
137
		private int count = 0;
154
		
138
		
155
		// Tous selectionné 
139
		// Tous selectionne 
156
		private int  selectedRow = -1;
140
		private int  selectedRow = -1;
157
		
141
		
158
		private Mediator mediator = null;
142
		private Mediator mediator = null;
159
 
143
 
160
		
144
		
161
		public DateList(Mediator med) {
145
		public DateList(Mediator med) {
162
			
146
			
163
			mediator=med;
147
			mediator=med;
164
 
148
 
165
			mediator.registerDateList(this);
149
			mediator.registerDateList(this);
166
 
150
 
167
			user=mediator.getUser();
151
			user=mediator.getUser();
168
			serviceBaseUrl = mediator.getServiceBaseUrl();
152
			serviceBaseUrl = mediator.getServiceBaseUrl();
169
			
153
			
170
			navBar = new NavBar();
154
			navBar = new NavBar();
171
			
155
			
172
			// Mise en forme du header
156
			// Mise en forme du header
173
 
157
 
174
			
158
			
175
 
159
 
176
			header.setCellSpacing(0);
160
			header.setCellSpacing(0);
177
			header.setCellPadding(2);
161
			header.setCellPadding(2);
178
			header.setWidth("100%");
162
			header.setWidth("100%");
179
 
163
 
180
			header.setStyleName("date-ListHeader");
164
			header.setStyleName("date-ListHeader");
181
 
165
 
182
			
166
			
183
			
167
			
184
			header.setWidget(0, 1,navBar);
168
			header.setWidget(0, 1,navBar);
185
			
169
			
186
 
170
 
187
//			header.getCellFormatter().setWidth(0, 0, "100%");
171
//			header.getCellFormatter().setWidth(0, 0, "100%");
188
 
172
 
189
 
173
 
190
			// Mise en forme de l'entree "Toutes localités"
174
			// Mise en forme de l'entree "Toutes localites"
191
 
175
 
192
			selector.setCellSpacing(0);
176
			selector.setCellSpacing(0);
193
			selector.setCellPadding(0);
177
			selector.setCellPadding(0);
194
			selector.setWidth("100%");
178
			selector.setWidth("100%");
195
 
179
 
196
			selector.setHTML(0, 0, "Toutes");
180
			selector.setHTML(0, 0, "Toutes");
197
 
181
 
198
			selector.getCellFormatter().setWidth(0, 0, "100%");
182
			selector.getCellFormatter().setWidth(0, 0, "100%");
199
 
183
 
200
 
184
 
201
			 // Hook up events.
185
			 // Hook up events.
202
			selector.addTableListener(new TableListener () {
186
			selector.addTableListener(new TableListener () {
203
		    	
187
		    	
204
				  public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
188
				  public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
205
					  	styleRow(selectedRow, false);
189
					  	styleRow(selectedRow, false);
206
				        selector.getRowFormatter().addStyleName(0, "date-SelectedRow");
190
				        selector.getRowFormatter().addStyleName(0, "date-SelectedRow");
207
					    mediator.onDateSelected("all");
191
					    mediator.onDateSelected("all");
208
					    date="all";
192
					    date="all";
209
					  }
193
					  }
210
 
194
 
211
		    });
195
		    });
212
			
196
			
213
			selector.setStyleName("date-ListElement");
197
			selector.setStyleName("date-ListElement");
214
 
198
 
215
			
199
			
216
			// Mise en forme du contenu 
200
			// Mise en forme du contenu 
217
 
201
 
218
			table.setCellSpacing(0);
202
			table.setCellSpacing(0);
219
			table.setBorderWidth(0);
203
			table.setBorderWidth(0);
220
			table.setCellPadding(2);
204
			table.setCellPadding(2);
221
			table.setWidth("100%");
205
			table.setWidth("100%");
222
 
206
 
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");
230
			inner.setWidth("100%");
214
			inner.setWidth("100%");
231
			outer.setWidth("100%");
215
			outer.setWidth("100%");
232
			outer.add(inner);
216
			outer.add(inner);
233
			
217
			
234
			 // Hook up events.
218
			 // Hook up events.
235
		    table.addTableListener(new TableListener () {
219
		    table.addTableListener(new TableListener () {
236
		    	
220
		    	
237
				  public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
221
				  public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
238
					  
222
					  
239
					      selectRow(row);
223
					      selectRow(row);
240
					      String adate=table.getText(row,cell);
224
					      String adate=table.getText(row,cell);
241
					      if (adate.compareTo(VALUE_UNKNOWN)!=0) {
225
					      if (adate.compareTo(VALUE_UNKNOWN)!=0) {
242
					    	  date=adate;
226
					    	  date=adate;
243
					    	  mediator.onDateSelected(adate);
227
					    	  mediator.onDateSelected(adate);
244
					      }
228
					      }
245
					      else {
229
					      else {
246
					    	  date="00/00/0000";
230
					    	  date="00/00/0000";
247
					    	  mediator.onDateSelected("00/00/0000");
231
					    	  mediator.onDateSelected("00/00/0000");
248
					      }
232
					      }
249
					    
233
					    
250
					  }
234
					  }
251
 
235
 
252
		    });
236
		    });
253
		    
237
		    
254
		  	styleRow(selectedRow, false);
238
		  	styleRow(selectedRow, false);
255
	        selector.getRowFormatter().addStyleName(0, "date-SelectedRow");
239
	        selector.getRowFormatter().addStyleName(0, "date-SelectedRow");
256
		    		
240
		    		
257
		    
-
 
258
			//updateCount();
-
 
259
			// update()
-
 
260
			
241
		    
261
			initWidget(outer);
242
			initWidget(outer);
262
 
243
 
263
 
244
 
264
  }
245
  }
265
 
246
 
266
		/**
247
		/**
267
		 * Recherche nombre d'enregistrement pour l'utilisateur en cours
248
		 * Recherche nombre d'enregistrement pour l'utilisateur en cours
268
		 * 
249
		 * 
269
		 * 
250
		 * 
270
		 */
251
		 */
271
		
252
		
272
		public void updateCount() {
253
		public void updateCount() {
273
			
254
			
274
			setStatusDisabled();
255
			setStatusDisabled();
275
 
256
 
276
//			HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + location + "/"+  station,
257
//			HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + location + "/"+  station,
277
			HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + location ,
258
			HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + URL.encodeComponent(location) ,
278
					new ResponseTextHandler() {
259
					new ResponseTextHandler() {
279
 
260
 
280
						public void onCompletion(String str) {
261
						public void onCompletion(String str) {
281
							JSONValue jsonValue = JSONParser.parse(str);
262
							JSONValue jsonValue = JSONParser.parse(str);
282
							JSONNumber jsonNumber;
263
							JSONNumber jsonNumber;
283
							if ((jsonNumber = jsonValue.isNumber()) != null) {
264
							if ((jsonNumber = jsonValue.isNumber()) != null) {
284
								count = (int) jsonNumber.getValue();
265
								count = (int) jsonNumber.getValue();
285
								update();
266
								update();
286
							}
267
							}
287
						}
268
						}
288
					});
269
					});
289
 
270
 
290
		}
271
		}
291
 
272
 
292
	
273
	
293
		  private void selectRow(int row) {
274
		  private void selectRow(int row) {
294
			  
275
			  
295
		    styleRow(selectedRow, false);
276
		    styleRow(selectedRow, false);
296
		    styleRow(row, true);
277
		    styleRow(row, true);
297
 
278
 
298
		    selectedRow = row;
279
		    selectedRow = row;
299
		    
280
		    
300
		  }
281
		  }
301
		  
282
		  
302
		  
283
		  
303
		  private void styleRow(int row, boolean selected) {
284
		  private void styleRow(int row, boolean selected) {
304
			    if (row != -1) {
285
			    if (row != -1) {
305
				   selector.getRowFormatter().removeStyleName(0, "date-SelectedRow");
286
				   selector.getRowFormatter().removeStyleName(0, "date-SelectedRow");
306
			      if (selected)
287
			      if (selected)
307
			        table.getRowFormatter().addStyleName(row, "date-SelectedRow");
288
			        table.getRowFormatter().addStyleName(row, "date-SelectedRow");
308
			      else
289
			      else
309
			    	if (row < table.getRowCount()) { 
290
			    	if (row < table.getRowCount()) { 
310
			    		table.getRowFormatter().removeStyleName(row, "date-SelectedRow");
291
			    		table.getRowFormatter().removeStyleName(row, "date-SelectedRow");
311
			    	}
292
			    	}
312
			    }
293
			    }
313
			  }
294
			  }
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
321
	 * 
302
	 * 
322
	 */	
303
	 */	
323
 
304
 
324
		public void update() {
305
		public void update() {
325
 
306
 
326
			
307
			
327
			setStatusDisabled();
308
			setStatusDisabled();
328
 
309
 
329
//			HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + location + "/" + station + "/"
310
//			HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + location + "/" + station + "/"
330
			HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + location + "/" 
311
			HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + URL.encodeComponent(location) + "/" 
331
					+ startIndex + "/" + VISIBLE_DATE_COUNT,
312
					+ startIndex + "/" + VISIBLE_DATE_COUNT,
332
 
313
 
333
			new ResponseTextHandler() {
314
			new ResponseTextHandler() {
334
 
315
 
335
				public void onCompletion(String str) {
316
				public void onCompletion(String str) {
336
					
317
					
337
					
318
					
338
 
319
 
339
					JSONValue jsonValue = JSONParser.parse(str);
320
					JSONValue jsonValue = JSONParser.parse(str);
340
					JSONArray jsonArray;
321
					JSONArray jsonArray;
341
					JSONArray jsonArrayNested;
322
					JSONArray jsonArrayNested;
342
			
323
			
343
					int row=0;
324
					int row=0;
344
					int i=0;
325
					int i=0;
345
					
326
					
346
					if ((jsonArray = jsonValue.isArray()) != null) {
327
					if ((jsonArray = jsonValue.isArray()) != null) {
347
						int arraySize = jsonArray.size();
328
						int arraySize = jsonArray.size();
348
						for (i = 0; i < arraySize; ++i) {
329
						for (i = 0; i < arraySize; ++i) {
349
							if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
330
							if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
350
								if (i>=table.getRowCount()) {
331
								if (i>=table.getRowCount()) {
351
									 row = table.insertRow(table.getRowCount());
332
									 row = table.insertRow(table.getRowCount());
352
								}
333
								}
353
								else {
334
								else {
354
									row = i;
335
									row = i;
355
								}
336
								}
356
								// Lieu
337
								// Lieu
357
							    	
338
							    	
358
								String adate=((JSONString)jsonArrayNested.get(0)).stringValue();
339
								String adate=((JSONString)jsonArrayNested.get(0)).stringValue();
359
								
340
								
360
								if (adate.compareTo("0000-00-00 00:00:00")!=0) {
341
								if (adate.compareTo("0000-00-00 00:00:00")!=0) {
361
									table.setText(row, 0,adate); 
342
									table.setText(row, 0,adate); 
362
								}
343
								}
363
								else {
344
								else {
364
									table.setText(row, 0,VALUE_UNKNOWN);
345
									table.setText(row, 0,VALUE_UNKNOWN);
365
								}
346
								}
366
								
347
								
367
								if ((adate.compareTo(date)==0) || ( date.compareTo("00/00/0000")==0) && adate.compareTo("0000-00-00 00:00:00")==0 ) {
348
								if ((adate.compareTo(date)==0) || ( date.compareTo("00/00/0000")==0) && adate.compareTo("0000-00-00 00:00:00")==0 ) {
368
								  styleRow(row, true);
349
								  styleRow(row, true);
369
								}
350
								}
370
								else {
351
								else {
371
								  styleRow(row, false);
352
								  styleRow(row, false);
372
								}
353
								}
373
 
354
 
374
								table.getFlexCellFormatter().setWidth(row, 0, "100%");
355
								table.getFlexCellFormatter().setWidth(row, 0, "100%");
375
							}
356
							}
376
 
357
 
377
						}
358
						}
378
					}
359
					}
379
					
360
					
380
					if (date.compareTo("all")==0) {
361
					if (date.compareTo("all")==0) {
381
							selector.getRowFormatter().addStyleName(0, "date-SelectedRow");
362
							selector.getRowFormatter().addStyleName(0, "date-SelectedRow");
382
					}
363
					}
383
 
364
 
384
					
365
					
385
					// Suppression fin ancien affichage
366
					// Suppression fin ancien affichage
386
					if (i<table.getRowCount()) {
367
					if (i<table.getRowCount()) {
387
						 for (int j = table.getRowCount() -1 ; j >= i; j--) {
368
						 for (int j = table.getRowCount() -1 ; j >= i; j--) {
388
							 table.removeRow(j);
369
							 table.removeRow(j);
389
						 }
370
						 }
390
					}
371
					}
391
 
372
 
392
					setStatusEnabled();
373
					setStatusEnabled();
393
 
374
 
394
 
375
 
395
				}
376
				}
396
			});
377
			});
397
 
378
 
398
		}
379
		}
399
 
380
 
400
		public void setLocation(String location) {
381
		public void setLocation(String location) {
401
			this.location = location;
382
			this.location = location;
402
		}
383
		}
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
		 * 
410
		 * @param
391
		 * @param
411
		 * @return void
392
		 * @return void
412
		 */
393
		 */
413
 
394
 
414
		private void gotoEnd() {
395
		private void gotoEnd() {
415
 
396
 
416
			if ((count == 0) || (count % VISIBLE_DATE_COUNT) > 0) {
397
			if ((count == 0) || (count % VISIBLE_DATE_COUNT) > 0) {
417
				startIndex = count - (count % VISIBLE_DATE_COUNT);
398
				startIndex = count - (count % VISIBLE_DATE_COUNT);
418
			} else {
399
			} else {
419
				startIndex = count - VISIBLE_DATE_COUNT;
400
				startIndex = count - VISIBLE_DATE_COUNT;
420
			}
401
			}
421
 
402
 
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
		 * 
428
		 * @param
409
		 * @param
429
		 * @return void
410
		 * @return void
430
		 */
411
		 */
431
 
412
 
432
		private void setStatusDisabled() {
413
		private void setStatusDisabled() {
433
 
414
 
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);
438
 
419
 
439
			setStatusText("Patientez ...");
420
			navBar.status.setText("Patientez ...");
440
		}
421
		}
441
 
422
 
442
		/**
423
		/**
443
		 * Affichage numero de page et gestion de la navigation
424
		 * Affichage numero de page et gestion de la navigation
444
		 * 
425
		 * 
445
		 */
426
		 */
446
 
427
 
447
		private void setStatusEnabled() {
428
		private void setStatusEnabled() {
448
 
429
 
449
			// Il y a forcemment un disabled avant d'arriver ici
430
			// Il y a forcemment un disabled avant d'arriver ici
450
 
431
 
451
			if (count > 0) {
432
			if (count > 0) {
452
 
433
 
453
				if (startIndex >= VISIBLE_DATE_COUNT) { // Au dela de la
434
				if (startIndex >= VISIBLE_DATE_COUNT) { // Au dela de la
454
															// premiere page
435
															// premiere page
455
					navBar.gotoPrev.setEnabled(true);
436
					navBar.gotoPrev.setEnabled(true);
456
					navBar.gotoFirst.setEnabled(true);
437
					navBar.gotoFirst.setEnabled(true);
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
			}
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
			}
482
		}
463
		}
483
 
464
 
484
 
465
 
485
 
-
 
486
		private void setStatusText(String text) {
-
 
487
			navBar.status.setText(text);
-
 
488
		}
-
 
489
		
466
 
490
		
467
		
491
		public void setUser(String user) {
468
		public void setUser(String user) {
492
			this.user = user;
469
			this.user = user;
493
		}
470
		}
494
		
471
		
495
 
472
 
496
		
473
		
497
		public void setDate(String date) {
474
		public void setDate(String date) {
498
			this.date = date;
475
			this.date = date;
499
		}
476
		}
500
	
477
	
501
 
478
 
502
}
479
}
-
 
480
 
-
 
481
/* +--Fin du code ---------------------------------------------------------------------------------------+
-
 
482
* $Log$
-
 
483
* 
-
 
484
*/