Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 26 | Rev 28 | 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
package org.tela_botanica.client;
1
package org.tela_botanica.client;
2
 
2
 
3
 
3
 
4
// TODO : sortie User vers une classe ...
4
// TODO : sortie User vers une classe ...
5
// TODO : sortie les boutons supprimer et exporter et inclure ici
5
// TODO : sortie les boutons supprimer et exporter et inclure ici
6
 
6
 
7
import com.google.gwt.i18n.client.Dictionary;
7
import com.google.gwt.i18n.client.Dictionary;
8
import com.google.gwt.json.client.JSONArray;
8
import com.google.gwt.json.client.JSONArray;
9
import com.google.gwt.json.client.JSONBoolean;
9
import com.google.gwt.json.client.JSONBoolean;
10
import com.google.gwt.json.client.JSONParser;
10
import com.google.gwt.json.client.JSONParser;
11
import com.google.gwt.json.client.JSONString;
11
import com.google.gwt.json.client.JSONString;
12
import com.google.gwt.json.client.JSONValue;
12
import com.google.gwt.json.client.JSONValue;
13
import com.google.gwt.user.client.HTTPRequest;
13
import com.google.gwt.user.client.HTTPRequest;
14
import com.google.gwt.user.client.ResponseTextHandler;
14
import com.google.gwt.user.client.ResponseTextHandler;
15
import com.google.gwt.user.client.Window;
-
 
16
import com.google.gwt.user.client.ui.TextBox;
15
import com.google.gwt.user.client.ui.TextBox;
17
 
16
 
18
public class Mediator implements AutoCompleteAsyncTextBoxListener {
17
public class Mediator implements AutoCompleteAsyncTextBoxListener {
19
		
18
		
20
		
19
		
-
 
20
		private String serviceBaseUrl = getServiceBaseUrlFromDictionnary(); // Recherche url de base des services distants
21
		private String serviceBaseUrl = getServiceBaseUrlFromDictionnary();
21
		
22
		private String user = null;
22
		// Utilisateur
23
		private InventoryItemList inventoryItemList = null;
23
		private TopPanel topPanel=null; // Information de connexion
24
		private LocationList locationList = null;
24
		private String user = null; // Utilisateur connecte ou bien identifiant de session
-
 
25
		private boolean connected=false;
25
		private DateList dateList = null;
26
 
26
		private StationList stationList = null;
27
		// Filtres 
27
		private NameAssistant nameAssistant=null;
28
		private LeftPanel leftPanel=null; // Containeur filtre date, lieu, lieu-dit ...
28
		private LocationAssistant locationAssistant=null;
29
		private LocationList locationList = null; // Filtre sur lieu de releve
29
		private InventoryItem inventoryItem=null;
30
		private DateList dateList = null; // Filtre sur date d'observation
-
 
31
		private StationList stationList = null; // Filtre sur station d'observation
30
		private EntryPanel entryPanel=null;
32
		
-
 
33
		// Saisie d'une observation
31
		private ActionPanel actionPanel=null;
34
		
-
 
35
		private EntryPanel entryPanel=null;  // Formulaire de saisie observation
32
		private TopPanel topPanel=null;
36
	
33
		private LeftPanel leftPanel=null;
37
		private NameAssistant nameAssistant=null; //  Assistant de saisie nom scientifique
34
		private InfoPopup infoPopup=null;
38
		private LocationAssistant locationAssistant=null; // Assistant de saisie nom de commune
35
		
39
		
36
		private TextBox date = null; 
40
		private TextBox date = null; // date observation 
-
 
41
		private TextBox milieu = null;  // milieu observation
37
		private TextBox complementLocation = null; 
42
		private TextBox lieudit = null;  // lieu dit observation
-
 
43
		private TextBox comment = null; // commentaire observation
38
		private TextBox comment = null;
-
 
-
 
44
		private InventoryItem inventoryItem=null;  // Une observation saisie
-
 
45
 
-
 
46
 
-
 
47
		// Liste des observations
-
 
48
		private InventoryItemList inventoryItemList = null; // Liste de releves saisis
-
 
49
		private ActionPanel actionPanel=null; // Action sur les observations
-
 
50
		
-
 
51
		
-
 
52
		// Informations 
-
 
53
		
-
 
54
		private InfoPopup infoPopup=null; // Information complementaire sur un taxon (photo, repartition)
39
 
55
		
40
		boolean connected=false;
56
 
41
 
57
		// Point d'entree (pour fin d'initialisation)
42
 
58
 
43
		private Cel cel = null;
59
		private Cel cel = null;
44
 
60
 
45
		
61
		
46
		Mediator() {
62
		Mediator() {
47
			
63
			
48
		}
64
		}
-
 
65
		
-
 
66
		
-
 
67
		// Methodes Private 
-
 
68
	
-
 
69
		
-
 
70
		
-
 
71
		/**
-
 
72
		 * Recuperation du prefixe d'appel des services
-
 
73
		 * @return prefix appel des service
-
 
74
		 */
-
 
75
 
-
 
76
		private String getServiceBaseUrlFromDictionnary() {
-
 
77
 
-
 
78
			Dictionary theme = Dictionary.getDictionary("Parameters");
-
 
79
			return theme.get("serviceBaseUrl");
-
 
80
 
-
 
81
		}
-
 
82
 
-
 
83
 
-
 
84
		// Appel aux services :
-
 
85
		
-
 
86
 
-
 
87
		/**
-
 
88
		 * Recherche distante et asynchrone de l'utilisateur connecte, en retour lancement methode initialisation
-
 
89
		 * de l'appellant Cel. (initAsync)
-
 
90
		 * 
-
 
91
		 */
-
 
92
		
-
 
93
		private void getUserFromService() {
-
 
94
 
-
 
95
 
-
 
96
			HTTPRequest.asyncGet(serviceBaseUrl + "/User/",
-
 
97
					new ResponseTextHandler() {
-
 
98
 
-
 
99
						public void onCompletion(String str) {
-
 
100
							JSONValue jsonValue = JSONParser.parse(str);
-
 
101
							JSONArray jsonArray;
-
 
102
							if ((jsonArray = jsonValue.isArray()) != null) {
-
 
103
									user = ((JSONString) jsonArray.get(0)).stringValue(); // Identifiant utilisateur ou identifiant de session si non connecte
-
 
104
									connected = ((JSONBoolean) jsonArray.get(1)).booleanValue();  // Drapeau leve si utilisateur identifie
-
 
105
							}
-
 
106
							cel.initAsync();
-
 
107
						}
-
 
108
					});
-
 
109
 
-
 
110
		}
-
 
111
 
-
 
112
		
-
 
113
 
-
 
114
		
-
 
115
		// Methodes Public
-
 
116
		
-
 
117
		
-
 
118
		
-
 
119
		// Information sur Etat du systeme
49
	
120
		
50
		/**
121
		/**
51
		 * Recuperation information utilisateur
122
		 * Recuperation information utilisateur
52
		 *
123
		 *
53
		 */
124
		 */
54
		
125
		
55
		public void initUser() {
126
		public void initUser() {
56
			getUserFromService(); // Appel distant recherche de l'utilisateur
127
			getUserFromService(); // Appel distant recherche de l'utilisateur
57
		}
128
		}
58
		
129
		
-
 
130
		
-
 
131
		// Actions declanchee par le systeme
59
		
132
		
60
		/**
133
		/**
61
		 * Action initialisation
134
		 * Action initialisation premier affichage 
62
		 */
-
 
63
		
135
		 */
64
	
136
		
65
		public void onInit() {
137
		public void onInit() {
66
 
138
 
67
			
139
			
68
			locationList.setLocation("all");
140
			locationList.setLocation("all");
69
			locationList.updateCount();
141
			locationList.updateCount();
70
 
142
 
71
			this.onLocationSelected("all");
143
			this.onLocationSelected("all");
72
			
144
			
73
		}
145
		}
74
		
146
		
-
 
147
		
-
 
148
		// Actions sur formulaire de saisie 
75
		
149
		
76
 
150
 
77
		/**
151
		/**
78
		 * Action lancee par la completion d'un nom dans l'assistant de saisie
152
		 * Action lancee par la completion d'un nom dans un assistant de saisie
79
		 * Recherche d'information compl�mentaires ....
153
		 * Recherche d'information complementaires ....
80
		 * 
154
		 * 
81
		 * @return void
155
		 * @return void
82
		 */
156
		 */
83
		  
157
		  
84
		public void onComplete(ResponseTextHandler sender, String str, String value) {
158
		public void onComplete(ResponseTextHandler sender, String str, String value) {
85
			
159
			
86
			if (sender instanceof NameAssistant) {
160
			if (sender instanceof NameAssistant) {
87
				onNameCompleted(value);
161
				onNameCompleted(value);
88
			}
162
			}
89
 
163
 
90
		}	
164
		}	
91
		 
165
		 
-
 
166
		
-
 
167
		/**
-
 
168
		 * Action suivant la completion d'un nom
-
 
169
		 * 
-
 
170
		 */
-
 
171
 
-
 
172
		public void  onNameCompleted(String value) {
-
 
173
			if (infoPopup==null) {
-
 
174
				infoPopup = new InfoPopup(this);
-
 
175
			}
-
 
176
			infoPopup.setImageUrl(value);
-
 
177
		}
-
 
178
		
-
 
179
 
-
 
180
		
-
 
181
		/**
-
 
182
		 * Action prealable a l'ajout d'une observation : controle presence champs requis et lancement mise a jour 
-
 
183
		 * 
-
 
184
		 */
-
 
185
		
-
 
186
		public void onAddInventoryItem() {
-
 
187
		
-
 
188
			// Lazy instantiation
-
 
189
			if (inventoryItem==null) {
-
 
190
				registerInventoryItem(new InventoryItem());
-
 
191
			}
-
 
192
			
-
 
193
			inventoryItem.setContent(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),milieu.getText(),comment.getText(),"null");
-
 
194
			inventoryItemList.addelement();
-
 
195
			
-
 
196
		}
-
 
197
		
-
 
198
 
-
 
199
		
-
 
200
		/**
-
 
201
		 * Action prealable a la modification d'une observation : controle presence champs requis et lancement mise a jour 
-
 
202
		 * 
-
 
203
		 */
-
 
204
 
-
 
205
		public void onModifyInventoryItem(String ordre) {
-
 
206
 
-
 
207
		// Lazy instantiation
-
 
208
		if (inventoryItem==null) {
-
 
209
			registerInventoryItem(new InventoryItem());
-
 
210
		}
-
 
211
 
-
 
212
		inventoryItem.setContent(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),milieu.getText(),comment.getText(),ordre);
-
 
213
		inventoryItemList.updateElement();
-
 
214
 
-
 
215
		}
-
 
216
 
-
 
217
		
-
 
218
		public boolean inventoryItemIsValid() {
-
 
219
			// TODO : controle date
-
 
220
			
-
 
221
		    if (inventoryItem.getName().compareTo("")==0) {
-
 
222
		    	return false;
-
 
223
		    }
-
 
224
		    else {
-
 
225
		    	return true;
-
 
226
		    }
-
 
227
			
-
 
228
		}
-
 
229
 
92
		
230
 
93
 
231
 
94
		/**
232
		/**
95
		 * Action lancee par la selection d'un nom dans l'assistant de saisie. Lance
233
		 * Action lancee par la selection d'un nom dans un assistant de saisie. Lance
96
		 * la recherche d'informations compl�mentaires (famille, numero
234
		 * la recherche d'informations complementaires (famille, numero
97
		 * nomenclaturaux etc) et met a jour l'inventaire (addelement())
235
		 * nomenclaturaux etc) et met a jour l'inventaire (addelement())
98
		 * 
236
		 * 
99
		 * @return void
237
		 * @return void
100
		 */
238
		 */
-
 
239
		
-
 
240
		
101
		public void onValidate(SourcesAutoCompleteAsyncTextBoxEvents sender,
241
		public void onValidate(SourcesAutoCompleteAsyncTextBoxEvents sender,
102
				  String str, String value) {
242
				  String str, String value) {
103
		
243
		
104
		  	if (getEntryPanel().getOrdre()==null) {
244
		  	if (getEntryPanel().getOrdre()==null) { // Nouvelle observation 
105
				     onAddInventoryItem(); 
245
				     onAddInventoryItem(); 
106
			  	}
246
			  	}
107
			else {
247
			else {
108
			     onModifyInventoryItem(getEntryPanel().getOrdre()); 
248
			     onModifyInventoryItem(getEntryPanel().getOrdre());   // Modification d'une observation
109
			     getEntryPanel().setOrdre(null);
249
			     getEntryPanel().setOrdre(null);
110
			 }
250
			 }
111
 
251
 
112
		}
252
		}
113
		
-
 
-
 
253
		
114
 
254
	
115
	
255
		// Action portant sur la liste des observations
116
		
256
		
117
		/**
257
		/**
118
		 * Action suite ajout, modification, suppression element inventaire
258
		 * Action suite ajout, modification, suppression d'un element inventaire 
119
		 */
259
		 */
120
		
260
		
121
	
261
	
122
		public void onInventoryUpdated(String location) {
262
		public void onInventoryUpdated(String location) {
123
 
-
 
124
			
263
 
125
			locationList.setLocation(location);
264
			locationList.setLocation(location); // Mise a jour filtre localite
126
			locationList.updateCount();
265
			locationList.updateCount(); 
127
 
266
 
128
			this.onLocationSelected(location);
267
			this.onLocationSelected(location); // Selection localite
129
			
268
			
130
		}
269
		}
131
		
270
		
132
		
271
		
133
		/**
272
		/**
134
		 * Action sur selection d'une observation : affichage du detail
273
		 * Action sur selection d'une observation : affichage du detail
135
		 */
274
		 */
136
		
275
		
137
		public void onInventoryItemSelected(String ordre) {
276
		public void onInventoryItemSelected(String ordre) {
138
		
277
		
139
			entryPanel.setOrdre(ordre);
278
			entryPanel.setOrdre(ordre); // Mise a jour du formulaire de saisie avec l'element selectionne
140
			entryPanel.update();
-
 
141
			
279
			entryPanel.update();
142
			
280
			
143
		}
281
		}
144
 
282
 
145
		
283
		
146
		/**
284
		/**
147
		 * Action sur deselection d'une observation : affichage du detail
285
		 * Action sur deselection d'une observation : remise a zero
148
		 */
286
		 */
149
		
287
		
150
		public void onInventoryItemUnselected(String ordre) {
288
		public void onInventoryItemUnselected(String ordre) {
151
		
289
		
152
			entryPanel.setOrdre(null);
290
			entryPanel.setOrdre(null); //  Mise a jour du formulaire de saisie avec l'element selectionne
153
			
291
			
154
		}
292
		}
155
 
293
 
156
 
-
 
157
 
-
 
158
		
-
 
159
		/**
-
 
160
		 * Action sur recherche  : affichage de la liste des taxons correspondants
-
 
161
		 */
294
 
162
		
-
 
163
		public void onSearch(String search) {
-
 
164
	
-
 
165
			if (search.trim().compareTo("")==0) {
-
 
166
				search="all";
-
 
167
			}
-
 
168
			inventoryItemList.setSearch(search);
-
 
169
			inventoryItemList.updateCount();
-
 
170
			
-
 
171
		}
-
 
172
 
-
 
173
		
-
 
174
		
-
 
175
		/**
-
 
176
		 * Action sur selection d'un lieu : affichage de la liste des taxons correspondants
-
 
177
		 * TODO : gerer asynchronicite ?
-
 
178
		 */
-
 
179
		
-
 
180
		public void onLocationSelected(String loc) {
-
 
181
		
-
 
182
			inventoryItemList.setLocation(loc);
-
 
183
			inventoryItemList.updateCount();
-
 
184
			
-
 
185
			inventoryItemList.displayFilter();
-
 
186
 
295
		
187
			dateList.setLocation(loc);
-
 
188
			dateList.updateCount();
-
 
189
			
-
 
190
			stationList.setLocation(loc);
296
		// Action sur Filtrage 
191
			stationList.updateCount();
-
 
192
			
297
 
193
		}
298
 
194
			
299
		// Filtre identification 
195
			
300
		
196
		
301
		
197
		/**
302
		/**
198
		 * Action sur login
303
		 * Action sur login : initialisation filtres pour cette utilisateur
199
		 * @param user
304
		 * @param user
200
		 */
305
		 */
201
		
306
		
202
		
307
		
203
		public void onLogin(String user) {
308
		public void onLogin(String user) {
204
			
309
			
205
			
310
			
206
			this.user=user;
311
			this.user=user;
207
			topPanel.getSignLabel().setText(user+ " (deconnexion)");
312
			topPanel.getSignLabel().setText(user+ " (deconnexion)");
208
			inventoryItemList.setUser(user);
313
			inventoryItemList.setUser(user);
209
			dateList.setUser(user);
314
			dateList.setUser(user);
210
			stationList.setUser(user);
315
			stationList.setUser(user);
211
			entryPanel.setUser(user);
316
			entryPanel.setUser(user);
212
			locationList.setUser(user);
317
			locationList.setUser(user);
213
			this.onInit();
318
			this.onInit();
214
			
319
			
215
		}
320
		}
216
		
321
		
217
		
322
		
218
		/**
323
		/**
219
		 * Action sur logoff
324
		 * Action sur logoff
220
		 * @param user
325
		 * @param user
221
		 */
326
		 */
222
		
327
		
223
		
328
		
224
		public void onLogoff(String user) {
329
		public void onLogoff(String user) {
225
			
330
			
226
			this.user=user;
331
			this.user=user;
227
			topPanel.getSignLabel().setText("Connexion");
332
			topPanel.getSignLabel().setText("Connexion");
228
			inventoryItemList.setUser(user);
333
			inventoryItemList.setUser(user);
229
			dateList.setUser(user);
334
			dateList.setUser(user);
230
			stationList.setUser(user);
335
			stationList.setUser(user);
231
			entryPanel.setUser(user);
336
			entryPanel.setUser(user);
232
			locationList.setUser(user);
337
			locationList.setUser(user);
233
			this.onInit();
338
			this.onInit();
-
 
339
		}
-
 
340
		
-
 
341
		
-
 
342
		
-
 
343
		// Filtre recherche contenu
-
 
344
		
-
 
345
		/**
-
 
346
		 * Action sur recherche  : affichage de la liste des taxons correspondants
-
 
347
		 */
-
 
348
		
-
 
349
		public void onSearch(String search) {
-
 
350
	
-
 
351
			if (search.trim().compareTo("")==0) {
-
 
352
				search="all";
-
 
353
			}
-
 
354
			inventoryItemList.setSearch(search);
-
 
355
			inventoryItemList.updateCount();
234
			
356
			
235
		}
357
		}
-
 
358
 
-
 
359
		
-
 
360
		
-
 
361
		// Filtre  selection lieu
236
 
362
		
237
		/**
363
		/**
-
 
364
		 * Action sur selection d'un lieu : affichage de la liste des taxons correspondants
238
		 * Action sur selection d'une station : affichage de la liste des taxons correspondants
365
		 * TODO : gerer asynchronicite ?
239
		 */
366
		 */
240
		
367
		
241
		public void onStationSelected(String station) {
368
		public void onLocationSelected(String loc) {
242
 
369
		
243
			inventoryItemList.setStation(station);
370
			inventoryItemList.setLocation(loc);
244
			inventoryItemList.updateCount();
371
			inventoryItemList.updateCount();
245
			
372
			
246
			inventoryItemList.displayFilter();
373
			inventoryItemList.displayFilter();
247
 
374
 
-
 
375
			dateList.setLocation(loc);
248
//			nameAssistant.setValue(null);
376
			dateList.updateCount();
-
 
377
			
-
 
378
			stationList.setLocation(loc);
249
 
379
			stationList.updateCount();
250
 
380
			
-
 
381
		}
251
		}
-
 
252
 
-
 
-
 
382
		
253
 
383
 
254
 
384
		// Filtre station
255
		
385
		
256
		/**
386
		/**
257
		 * Action sur selection d'une date : affichage de la liste des taxons correspondants
387
		 * Action sur selection d'une station : affichage de la liste des taxons correspondants
258
		 */
388
		 */
259
		
389
		
260
		public void onDateSelected(String date) {
390
		public void onStationSelected(String station) {
261
 
391
 
262
			inventoryItemList.setDate(date);
392
			inventoryItemList.setStation(station);
263
			inventoryItemList.updateCount();
393
			inventoryItemList.updateCount();
264
			
394
			
265
			inventoryItemList.displayFilter();
395
			inventoryItemList.displayFilter();
266
 
-
 
267
	//		nameAssistant.setValue(null);
396
 
268
 
397
 
269
 
398
 
270
		}
399
		}
271
 
-
 
272
		/**
400
 
273
		 * Action suivant la completion d'un nom
-
 
274
		 * 
-
 
275
		 */
-
 
276
 
-
 
277
		public void  onNameCompleted(String value) {
-
 
278
			if (infoPopup==null) {
-
 
279
				infoPopup = new InfoPopup(this);
-
 
280
			}
-
 
281
			infoPopup.setImageUrl(value);
-
 
282
		}
401
		// Filtre date d'observation
283
		
402
 
284
		
-
 
285
		/**
403
		
286
		 * Action prealable a l'ajout d'une observation : controle presence champs requis et lancement mise a jour 
404
		/**
287
		 * 
-
 
288
		 */
-
 
289
		
-
 
290
		public void onAddInventoryItem() {
-
 
291
		
-
 
292
			// TODO : singleton ?
-
 
-
 
405
		 * Action sur selection d'une date : affichage de la liste des taxons correspondants
-
 
406
		 */
293
			registerInventoryItem(new InventoryItem(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),complementLocation.getText(),comment.getText(),"null"));
407
		
294
			inventoryItemList.addelement();
-
 
295
			
408
		public void onDateSelected(String date) {
296
		}
-
 
297
 
-
 
298
		
-
 
299
		/**
-
 
300
		 * Action prealable a la modification d'une observation : controle presence champs requis et lancement mise a jour 
-
 
301
		 * 
-
 
302
		 */
409
 
303
 
410
			inventoryItemList.setDate(date);
304
		public void onModifyInventoryItem(String ordre) {
411
			inventoryItemList.updateCount();
305
 
412
			
306
		// TODO : singleton ?
413
			inventoryItemList.displayFilter();
307
		registerInventoryItem(new InventoryItem(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),complementLocation.getText(),comment.getText(),ordre));
414
 
308
		inventoryItemList.updateElement();
415
 
309
 
416
 
310
		}
417
		}
311
 
-
 
312
		
-
 
313
		public boolean inventoryItemIsValid() {
418
 
314
			// TODO : controle date
-
 
315
			
-
 
316
		    if (inventoryItem.getName().compareTo("")==0) {
-
 
317
		    	return false;
-
 
318
		    }
-
 
319
		    else {
-
 
320
		    	return true;
-
 
321
		    }
-
 
322
			
-
 
323
		}
419
		// Declaration, enregistrement 
324
 
420
 
325
		/**
421
		/**
326
		 * Declaration InventoryItem
422
		 * Declaration InventoryItem  : une observation
327
		 * @param cel
423
		 * @param cel
328
		 */
424
		 */
329
 
425
 
330
		public void registerInventoryItem(InventoryItem inventoryItem) {
426
		public void registerInventoryItem(InventoryItem inventoryItem) {
331
			
427
			
332
			this.inventoryItem=inventoryItem;
428
			this.inventoryItem=inventoryItem;
333
		}
429
		}
334
 
430
 
335
 
431
 
336
		
-
 
337
		
432
		
338
		/**
433
		/**
339
		 * Declaration InventoryItemList 
434
		 * Declaration InventoryItemList  : liste d'observation
340
		 * @param inventoryItemList
435
		 * @param inventoryItemList
341
		 */
436
		 */
342
		
437
		
343
		public void registerInventoryItemList(InventoryItemList inventoryItemList) {
438
		public void registerInventoryItemList(InventoryItemList inventoryItemList) {
344
			
439
			
345
			this.inventoryItemList=inventoryItemList;
440
			this.inventoryItemList=inventoryItemList;
346
		
441
		
347
		}
442
		}
348
	
443
	
349
		/**
444
		/**
350
		 * Declaration LocationList
445
		 * Declaration LocationList : filtre lieu observation
351
		 * @param locationList
446
		 * @param locationList
352
		 */
447
		 */
353
		
448
		
354
		public void registerLocationList(LocationList locationList) {
449
		public void registerLocationList(LocationList locationList) {
355
			
450
			
356
			this.locationList=locationList;
451
			this.locationList=locationList;
357
		}
452
		}
358
	
453
	
359
		
454
		
360
		
455
		
361
		/**
456
		/**
362
		 * Declaration DateList
457
		 * Declaration DateList : filtre date observation
363
		 * @param locationList
458
		 * @param locationList
364
		 */
459
		 */
365
		
460
		
366
		public void registerDateList(DateList dateList) {
461
		public void registerDateList(DateList dateList) {
367
			
462
			
368
			this.dateList=dateList;
463
			this.dateList=dateList;
369
		}
464
		}
370
 
465
 
371
		
466
		
372
		/**
467
		/**
373
		 * Declaration InfoPopup
468
		 * Declaration InfoPopup : information complementaire taxon en cours
374
		 * @param infoPopup
469
		 * @param infoPopup
375
		 */
470
		 */
376
		
471
		
377
		public void registerInfoPopup(InfoPopup infoPopup) {
472
		public void registerInfoPopup(InfoPopup infoPopup) {
378
			
473
			
379
			this.infoPopup=infoPopup;
474
			this.infoPopup=infoPopup;
380
		}
475
		}
381
 
476
 
382
 
477
 
383
		
478
		
384
		/**
479
		/**
385
		 * Declaration StationList
480
		 * Declaration StationList : filtre par station
386
		 * @param locationList
481
		 * @param locationList
387
		 */
482
		 */
388
		
483
		
389
		public void registerStationList(StationList stationList) {
484
		public void registerStationList(StationList stationList) {
390
			
485
			
391
			this.stationList=stationList;
486
			this.stationList=stationList;
392
		}
487
		}
393
 
488
 
394
		
489
		
395
		
490
		
396
		/**
491
		/**
397
		 * Declaration Cel
492
		 * Declaration Cel : point d'entree
398
		 * @param cel
493
		 * @param cel
399
		 */
494
		 */
400
 
495
 
401
		public void registerCel(Cel cel) {
496
		public void registerCel(Cel cel) {
402
			
497
			
403
			this.cel=cel;
498
			this.cel=cel;
404
		}
499
		}
405
 
500
 
406
		
501
		
407
		/**
502
		/**
408
		 * Declaration NameAssistant 
503
		 * Declaration NameAssistant  : completion nom scientifique
409
		 * @param nameassistant
504
		 * @param nameassistant
410
		 */
505
		 */
411
		
506
		
412
		public void registerNameAssistant(NameAssistant nameAssistant) {
507
		public void registerNameAssistant(NameAssistant nameAssistant) {
413
			this.nameAssistant=nameAssistant;
508
			this.nameAssistant=nameAssistant;
414
			
509
			
415
		}
510
		}
416
		
511
		
417
		/**
512
		/**
418
		 * Declaration LocationAssistant 
513
		 * Declaration LocationAssistant : completion commune
419
		 * @param locationassistant
514
		 * @param locationassistant
420
		 */
515
		 */
421
		
516
		
422
		public void registerLocationAssistant(LocationAssistant locationAssistant) {
517
		public void registerLocationAssistant(LocationAssistant locationAssistant) {
423
			this.locationAssistant=locationAssistant;
518
			this.locationAssistant=locationAssistant;
424
			
519
			
425
		}
520
		}
426
 
521
 
427
		
522
	
428
		
523
		
429
		/**
524
		/**
430
		 * Declaration date
525
		 * Declaration date : date observation
431
		 * @param date
526
		 * @param date
432
		 */
527
		 */
433
		
528
		
434
		public void registerDate(TextBox date) {
529
		public void registerDate(TextBox date) {
435
			this.date=date;
530
			this.date=date;
436
			
531
			
437
		}
532
		}
438
	
533
	
439
		
534
	
440
		
535
		
-
 
536
		/**
441
		/**
537
		 * Declaration lieu dit : lieu dit d'observation
442
		 * Declaration complementLocation
538
		 * 
443
		 * @param complementLocation
539
		 * @param milieu
444
		 */
540
		 */
445
		
541
		
-
 
542
		public void registerLieudit(TextBox lieudit) {
-
 
543
			this.lieudit=lieudit;
-
 
544
			
-
 
545
		}
-
 
546
 
-
 
547
 
-
 
548
		
-
 
549
		/**
-
 
550
		 * Declaration milieu : milieu d'observation
-
 
551
		 * 
-
 
552
		 * @param milieu
-
 
553
		 */
-
 
554
		
-
 
555
		public void registerMilieu(TextBox milieu) {
-
 
556
			this.milieu=milieu;
-
 
557
			
-
 
558
		}
446
		public void registerComplementLocation(TextBox complementLocation) {
559
 
447
			this.complementLocation=complementLocation;
560
		/**
448
			
561
		 * Declaration Entry Panel : formulaire de saisie observation
449
		}
562
		 */
450
		
563
 
451
		
564
		
452
	    public void  registerEntryPanel(EntryPanel entryPanel) {
565
	    public void  registerEntryPanel(EntryPanel entryPanel) {
453
	    	this.entryPanel=entryPanel;
566
	    	this.entryPanel=entryPanel;
454
		}
567
		}
-
 
568
 
-
 
569
 
-
 
570
		/**
-
 
571
		 * Declaration Action Panel : actions sur liste des observations
-
 
572
		 */
455
 
573
 
456
	    
574
	    
457
	    public void  registerActionPanel(ActionPanel actionPanel) {
575
	    public void  registerActionPanel(ActionPanel actionPanel) {
458
	    	this.actionPanel=actionPanel;
576
	    	this.actionPanel=actionPanel;
459
		}
577
		}
-
 
578
 
-
 
579
 
-
 
580
		/**
-
 
581
		 * Declaration TopPanel : panneau de connexion
460
 
582
		 */
461
	    
583
	    
462
 
584
 
463
	    public void  registerTopPanel(TopPanel topPanel) {
585
	    public void  registerTopPanel(TopPanel topPanel) {
464
	    	this.topPanel=topPanel;
586
	    	this.topPanel=topPanel;
465
		}
587
		}
466
 
588
 
467
	    
589
	    
468
	    
590
	    
469
		/**
591
		/**
470
		 * Declaration commentaire 
592
		 * Declaration commentaire 
471
		 * @param commentaire
593
		 * @param commentaire
472
		 */
594
		 */
473
		
595
		
474
		public void registerComment(TextBox comment) {
596
		public void registerComment(TextBox comment) {
475
			this.comment=comment;
597
			this.comment=comment;
476
			
598
			
477
		}
599
		}
478
		
600
		
479
 
601
 
-
 
602
		/* 
480
		/* Panneau gauche 
603
		 * Declaration LeftPanel Panneau gauche filtre sur liste d'observation
481
		 * 
604
		 * 
482
		 */
605
		 */
483
		
606
		
484
		public void registerLeftPanel(LeftPanel leftPanel) {
607
		public void registerLeftPanel(LeftPanel leftPanel) {
485
			this.leftPanel=leftPanel;
608
			this.leftPanel=leftPanel;
486
			
609
			
487
		}
610
		}
488
		
611
		
-
 
612
		
489
		
-
 
490
		
-
 
491
 
-
 
492
		/**
-
 
493
		 * Recherche distante et asynchrone de l'utilisateur connecte, en retour lancement methode initialisation
-
 
494
		 * de l'appellant Cel. (initAsync)
-
 
495
		 * 
-
 
496
		 */
-
 
497
		
-
 
498
		private void getUserFromService() {
-
 
499
 
-
 
500
 
-
 
501
			HTTPRequest.asyncGet(serviceBaseUrl + "/User/",
-
 
502
					new ResponseTextHandler() {
-
 
503
 
-
 
504
						public void onCompletion(String str) {
-
 
505
							JSONValue jsonValue = JSONParser.parse(str);
-
 
506
							JSONArray jsonArray;
-
 
507
							if ((jsonArray = jsonValue.isArray()) != null) {
-
 
508
									user = ((JSONString) jsonArray.get(0)).stringValue(); // Identifiant utilisateur ou identifiant de session si non connecte
-
 
509
									connected = ((JSONBoolean) jsonArray.get(1)).booleanValue();  // Drapeau leve si utilisateur identifie
-
 
510
							}
-
 
511
							cel.initAsync();
-
 
512
						}
-
 
513
					});
-
 
514
 
613
		// Accesseurs et setteurs
515
		}
614
		
516
	
615
		
517
		/**
616
		/**
518
		 * Accesseur Url de base
617
		 * Accesseur Url de base
519
		 * @return Url de base
618
		 * @return Url de base
520
		 */
619
		 */
521
		
620
		
522
		public String getServiceBaseUrl() {
621
		public String getServiceBaseUrl() {
523
			
622
			
524
			return serviceBaseUrl;
623
			return serviceBaseUrl;
525
 
624
 
526
		}
625
		}
527
 
626
 
528
		
-
 
529
		/**
-
 
530
		 * Recuperation du prefixe d'appel des services
-
 
531
		 * @return prefix appel des service
-
 
532
		 */
-
 
533
 
-
 
534
		private String getServiceBaseUrlFromDictionnary() {
-
 
535
 
-
 
536
			Dictionary theme = Dictionary.getDictionary("Parameters");
-
 
537
			return theme.get("serviceBaseUrl");
-
 
538
 
-
 
539
		}
-
 
540
 
-
 
541
 
627
	
542
		/**
628
		/**
543
		 *  Accesseur Utilisateur
629
		 *  Accesseur Utilisateur
544
		 * @return utilisateur connecte ou identifiant de session
630
		 * @return utilisateur connecte ou identifiant de session
545
		 */
631
		 */
546
		
632
		
547
		public String getUser() {
633
		public String getUser() {
548
			return user;
634
			return user;
549
		}
635
		}
550
 
-
 
551
		
-
 
552
 
636
 
553
		public void setUser(String user) {
637
		public void setUser(String user) {
554
			this.user=user;
638
			this.user=user;
555
		}
639
		}
556
 
-
 
557
 
640
 
558
		
641
		
559
		public InventoryItemList getInventoryItemList() {
642
		public InventoryItemList getInventoryItemList() {
560
			return inventoryItemList;
643
			return inventoryItemList;
561
		}
644
		}
562
 
645
 
563
		public LocationList getLocationList() {
646
		public LocationList getLocationList() {
564
			return locationList;
647
			return locationList;
565
		}
648
		}
566
 
649
 
567
		public DateList getDateList() {
650
		public DateList getDateList() {
568
			return dateList;
651
			return dateList;
569
		}
652
		}
570
 
653
 
571
		
654
		
572
		public NameAssistant getNameAssistant() {
655
		public NameAssistant getNameAssistant() {
573
			return nameAssistant;
656
			return nameAssistant;
574
		}
657
		}
575
 
658
 
576
		public LocationAssistant getLocationAssistant() {
659
		public LocationAssistant getLocationAssistant() {
577
			return locationAssistant;
660
			return locationAssistant;
578
		}
661
		}
579
 
662
 
580
		public InventoryItem getInventoryItem() {
663
		public InventoryItem getInventoryItem() {
581
			return inventoryItem;
664
			return inventoryItem;
582
		}
665
		}
583
 
666
 
584
		public EntryPanel getEntryPanel() {
667
		public EntryPanel getEntryPanel() {
585
			return entryPanel;
668
			return entryPanel;
586
		}
669
		}
587
 
670
 
588
 
671
 
589
		public LeftPanel getLeftPanel() {
672
		public LeftPanel getLeftPanel() {
590
			return leftPanel;
673
			return leftPanel;
591
		}
674
		}
592
 
675
 
593
		public InfoPopup getInfoPopup() {
676
		public InfoPopup getInfoPopup() {
594
			if (infoPopup==null) {
677
			if (infoPopup==null) {
595
				infoPopup = new InfoPopup(this);
678
				infoPopup = new InfoPopup(this);
596
			}
679
			}
597
			return infoPopup;
680
			return infoPopup;
598
		}
681
		}
599
 
682
 
600
		public void setConnected(boolean connected) {
683
		public void setConnected(boolean connected) {
601
		
684
		
602
			this.connected=connected;
685
			this.connected=connected;
603
		}
686
		}
604
		
687
		
605
		public boolean getConnected() {
688
		public boolean getConnected() {
606
			
689
			
607
			return this.connected;
690
			return this.connected;
608
		}
691
		}
609
 
692
 
610
		
693
		
611
		public ActionPanel getActionPanel() {
694
		public ActionPanel getActionPanel() {
612
			
695
			
613
			return this.actionPanel;
696
			return this.actionPanel;
614
		}
697
		}
615
 
698
 
616
	}
699
	}