Subversion Repositories eFlore/Archives.cel-v1

Rev

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

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