Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 29 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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