Subversion Repositories eFlore/Archives.cel-v1

Rev

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

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