Subversion Repositories eFlore/Applications.cel

Rev

Rev 218 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
195 david 1
package org.tela_botanica.client.vues.observation;
12 david 2
 
201 david 3
// TODO Detecter redim et supprimer ajuster
12 david 4
 
221 aurelien 5
import java.util.Date;
13 david 6
import java.util.Iterator;
7
 
8
import org.tela_botanica.client.interfaces.Rafraichissable;
216 aurelien 9
import org.tela_botanica.client.modeles.ListeObservation;
13 david 10
import org.tela_botanica.client.modeles.ListeReferentielCommune;
20 david 11
import org.tela_botanica.client.modeles.ListeReferentielNom;
39 david 12
import org.tela_botanica.client.modeles.Observation;
13 david 13
import org.tela_botanica.client.modeles.ReferentielCommune;
20 david 14
import org.tela_botanica.client.modeles.ReferentielNom;
12 david 15
import org.tela_botanica.client.observation.ObservationMediateur;
132 aurelien 16
 
221 aurelien 17
import com.google.gwt.core.client.JavaScriptObject;
216 aurelien 18
import com.google.gwt.user.client.Window;
13 david 19
import com.gwtext.client.core.EventCallback;
20
import com.gwtext.client.core.EventObject;
218 david 21
import com.gwtext.client.core.Ext;
13 david 22
import com.gwtext.client.core.ListenerConfig;
12 david 23
import com.gwtext.client.core.Position;
13 david 24
import com.gwtext.client.data.ArrayReader;
25
import com.gwtext.client.data.FieldDef;
26
import com.gwtext.client.data.MemoryProxy;
27
import com.gwtext.client.data.RecordDef;
71 jpm 28
import com.gwtext.client.data.SimpleStore;
13 david 29
import com.gwtext.client.data.Store;
30
import com.gwtext.client.data.StringFieldDef;
132 aurelien 31
import com.gwtext.client.widgets.BoxComponent;
12 david 32
import com.gwtext.client.widgets.Button;
221 aurelien 33
import com.gwtext.client.widgets.Component;
132 aurelien 34
import com.gwtext.client.widgets.Container;
221 aurelien 35
import com.gwtext.client.widgets.DatePicker;
12 david 36
import com.gwtext.client.widgets.Panel;
71 jpm 37
import com.gwtext.client.widgets.Toolbar;
132 aurelien 38
import com.gwtext.client.widgets.event.BoxComponentListenerAdapter;
20 david 39
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
132 aurelien 40
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
221 aurelien 41
import com.gwtext.client.widgets.event.DatePickerListener;
42
import com.gwtext.client.widgets.event.DatePickerListenerAdapter;
201 david 43
import com.gwtext.client.widgets.event.PanelListenerAdapter;
13 david 44
import com.gwtext.client.widgets.form.ComboBox;
12 david 45
import com.gwtext.client.widgets.form.DateField;
216 aurelien 46
import com.gwtext.client.widgets.form.Field;
12 david 47
import com.gwtext.client.widgets.form.FormPanel;
128 aurelien 48
import com.gwtext.client.widgets.form.TextArea;
12 david 49
import com.gwtext.client.widgets.form.TextField;
13 david 50
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
201 david 51
import com.gwtext.client.widgets.layout.AnchorLayoutData;
12 david 52
import com.gwtext.client.widgets.layout.ColumnLayout;
53
import com.gwtext.client.widgets.layout.ColumnLayoutData;
54
import com.gwtext.client.widgets.layout.FormLayout;
13 david 55
import com.gwtext.client.data.Record;
12 david 56
 
57
/**
58
 * Panneau contenant les infos, les métadonnées et l'arbre des mots clés, il implémente l'interface rafraichissable
59
 * @author aurelien
60
 *
61
 */
13 david 62
public class FormulaireSaisieObservationVue extends Panel implements Rafraichissable  {
12 david 63
 
64
 
65
	/**
66
	 * Le médiateur associé à la vue
67
	 */
68
	private ObservationMediateur	observationMediateur		= null;
69
 
205 aurelien 70
	FormPanel panneauFormulaire = null;
20 david 71
 
13 david 72
	private DateField date = null;
12 david 73
	private TextField lieudit = null;
74
	private TextField station = null;
75
	private TextField milieu = null;
76
	private TextField comment = null;
13 david 77
	private ComboBox  commune = null;
39 david 78
	private String departement = null;
20 david 79
	private ComboBox  espece = null;
39 david 80
	private String numeroNom = null;
74 david 81
	private String numeroOrdre = null;
20 david 82
 
118 david 83
	// Pour remise a zero partielle lors d'une validation
84
 
85
	private  enum Champs {
216 aurelien 86
	    DATE, LIEUDIT, STATION, MILIEU, COMMENT, COMMUNE, ESPECE, TOUT ;
87
 
88
	    public String toString() {
89
 
90
	    	switch(this) {
91
	    	case DATE:
92
	    		return "date";
93
 
94
	    	case COMMUNE:
95
	    		return "commune";
96
 
97
    		case LIEUDIT:
98
    			return "lieu dit";
99
 
100
    		case STATION:
101
    			return "station";
102
 
103
    		case MILIEU:
104
    			return "milieu";
105
 
106
    		case COMMENT:
107
    			return "commentaire";
108
 
109
	    	case ESPECE:
110
	    		return "espèce";
111
 
112
	    	case TOUT:
113
	    		return "date, commune, lieu dit, station, milieu, espèce, commentaire";
114
	    	}
115
			return TOUT.toString();
116
	    }
118 david 117
	};
118
 
119
 
120
 
110 aurelien 121
	private String formatDate = null ;
71 jpm 122
	private Button boutonOK = new Button("Créer");
77 jpm 123
	private Button boutonAnnuler = new Button("Réinitialiser");
20 david 124
 
13 david 125
	private boolean selectionCommune=false;
20 david 126
	private boolean selectionEspece=false;
12 david 127
 
71 jpm 128
	private boolean modification = false ;
129
	private Toolbar bt = null ;
13 david 130
 
216 aurelien 131
	private final String VALEURS_MULTIPLES = "(Valeurs multiples)";
221 aurelien 132
	private final String modeleMessageModif = "commune:lieu-dit:station:milieu:date:espece:commentaire";
216 aurelien 133
	private boolean communeModifiee = false;
221 aurelien 134
	private boolean lieuDitModifie = false;
135
	private boolean stationModifiee = false;
216 aurelien 136
	private boolean milieuModifie = false;
137
	private boolean dateModifiee = false;
138
	private boolean especeModifiee = false;
139
	private boolean commModifie = false;
140
 
141
 
20 david 142
	private final int KEY_ALT = 18;
143
	private final int KEY_BACKSPACE = 8;
144
	private final int KEY_CTRL = 17;
145
	private final int KEY_DELETE = 46;
146
	private final int KEY_DOWN = 40;
147
	private final int KEY_END = 35;
148
	private final int KEY_ENTER = 13;
149
	private final int KEY_ESCAPE = 27;
150
	private final int KEY_HOME = 36;
151
	private final int KEY_LEFT = 37;
152
	private final int KEY_PAGEDOWN = 34;
153
	private final int KEY_PAGEUP = 33;
154
	private final int KEY_RIGHT = 39;
155
	private final int KEY_SHIFT = 16;
156
	private final int KEY_TAB = 9;
157
	private final int KEY_UP = 38;
13 david 158
 
128 aurelien 159
 
71 jpm 160
	/**
161
	 * Combobox permettant de selectionner le mode
162
	 * modification ou bien création
163
	 */
164
	private ComboBox selecteurMode = new ComboBox();
13 david 165
 
71 jpm 166
	Store storeMode = null ;
13 david 167
 
12 david 168
	/**
169
	 * Booleen d'instanciation
170
	 */
171
	boolean estInstancie = false ;
205 aurelien 172
 
173
	private Panel panneauIntermediaire;
174
 
175
	private Panel panneauPremierColonne;
176
 
177
	private Panel panneauSecondeColonne;
216 aurelien 178
 
179
	private boolean masseModification =false ;
12 david 180
 
181
	/**
182
	 * Constructeur sans argument (privé car ne doit pas être utilisé)
183
	 */
71 jpm 184
	@SuppressWarnings("unused")
12 david 185
	private FormulaireSaisieObservationVue()
186
	{
187
		super() ;
188
	}
189
 
190
	/**
191
	 * Constructeur avec argument
192
	 * @param im
193
	 */
194
	public FormulaireSaisieObservationVue(ObservationMediateur obs)
195
	{
196
		// on associe le médiateur
197
		observationMediateur = obs ;
198
 
201 david 199
 
205 aurelien 200
		panneauFormulaire = new FormPanel(Position.RIGHT);
12 david 201
		panneauFormulaire.setBorder(false);
202
 
218 david 203
 
204
 
12 david 205
		// Panneau intermediaire qui contient deux colonnes de formulaire
206
 
205 aurelien 207
		panneauIntermediaire = new Panel();
12 david 208
		panneauIntermediaire.setLayout(new ColumnLayout());
209
		panneauIntermediaire.setBorder(false);
218 david 210
 
211
		if (Ext.isIE6()) {
212
			panneauIntermediaire.setWidth(800);
213
		}
214
 
12 david 215
		//create first panel and add fields to it
205 aurelien 216
		panneauPremierColonne = new Panel();
12 david 217
		panneauPremierColonne.setLayout(new FormLayout());
218
		panneauPremierColonne.setBorder(false);
219
 
220
		//create second panel and add fields to it
205 aurelien 221
	    panneauSecondeColonne = new Panel();
12 david 222
		panneauSecondeColonne.setLayout(new FormLayout());
223
		panneauSecondeColonne.setBorder(false);
42 jpm 224
 
225
		this.setPaddings(5) ;
12 david 226
 
195 david 227
		// Accesskey pour debugging
228
 
201 david 229
		commune=new ComboBox("Commune","commune\" accesskey=\"1");
195 david 230
 
20 david 231
		final String resultTplCommune = "<div class=\"search-item-commune\">{commune}</div>";
232
		commune.setTpl(resultTplCommune);
13 david 233
		commune.setMode(ComboBox.REMOTE);
234
		// commune.setPageSize(10); // Ne fonctionne pas
20 david 235
		commune.setItemSelector("div.search-item-commune");
13 david 236
		commune.setTypeAhead(true);
237
		commune.setLoadingText("Recherche...");
238
 
239
		commune.setHideTrigger(true);
132 aurelien 240
		commune.setTabIndex(1);
13 david 241
 
201 david 242
	    panneauPremierColonne.add(commune, new AnchorLayoutData("95%"));
13 david 243
 
201 david 244
	    station = new TextField("Station", "station");
132 aurelien 245
	    station.setAllowBlank(true);
246
	    station.setTabIndex(3);
201 david 247
	    panneauPremierColonne.add(station, new AnchorLayoutData("95%"));
12 david 248
 
249
	    date = new DateField("Date", "date", 100);
250
	    date.setAllowBlank(true);
110 aurelien 251
	    formatDate = "d/m/Y";
252
	    date.setFormat(formatDate) ;
132 aurelien 253
	    date.setTabIndex(5);
201 david 254
	    panneauPremierColonne.add(date, new AnchorLayoutData("60%"));
20 david 255
 
256
 
201 david 257
		espece=new ComboBox("Espèce","nom");
12 david 258
 
20 david 259
 
260
		final String resultTplEspece = "<div class=\"search-item-espece\">{nom}</div>";
261
 
262
 
263
		espece.setTpl(resultTplEspece);
264
		espece.setMode(ComboBox.REMOTE);
265
		// commune.setPageSize(10); // Ne fonctionne pas
266
		espece.setItemSelector("div.search-item-espece");
267
		espece.setTypeAhead(true);
268
		espece.setLoadingText("Recherche...");
269
 
270
		espece.setHideTrigger(true);
132 aurelien 271
		espece.setTabIndex(6);
20 david 272
 
201 david 273
	    panneauPremierColonne.add(espece, new AnchorLayoutData("95%"));
20 david 274
 
201 david 275
	    lieudit = new TextField("Lieu-dit", "lieudit");
132 aurelien 276
	    lieudit.setAllowBlank(true);
277
	    lieudit.setTabIndex(2);
201 david 278
	    panneauSecondeColonne.add(lieudit,  new AnchorLayoutData("95%"));
12 david 279
 
280
 
201 david 281
	    milieu = new TextField("Milieu", "milieu");
132 aurelien 282
	    milieu.setAllowBlank(true);
283
	    milieu.setTabIndex(4);
201 david 284
	    panneauSecondeColonne.add(milieu,  new AnchorLayoutData("95%"));
128 aurelien 285
 
286
	    comment = new TextArea("Notes", "comment");
287
	    comment.setAllowBlank(true);
288
	    comment.setHeight(50);
132 aurelien 289
	    comment.setTabIndex(7);
201 david 290
	    panneauSecondeColonne.add(comment, new AnchorLayoutData("95%") );
12 david 291
 
292
		panneauIntermediaire.add(panneauPremierColonne, new ColumnLayoutData(.5));
293
		panneauIntermediaire.add(panneauSecondeColonne, new ColumnLayoutData(.5));
294
 
295
		panneauFormulaire.add(panneauIntermediaire);
296
 
71 jpm 297
		Object[][] mode = {{"création",false} , {"modification", true} };
298
		storeMode = new SimpleStore(new String[] { "nom_mode", "mode" },
299
				mode);
300
		storeMode.load();
301
		selecteurMode.setStore(storeMode);
302
		selecteurMode.setDisplayField("nom_mode") ;
303
		selecteurMode.setLabel("mode ") ;
304
		selecteurMode.setForceSelection(true) ;
305
		selecteurMode.setValue("création") ;
306
		selecteurMode.setEditable(false) ;
97 jpm 307
		selecteurMode.setCls("x-selec-crea") ;
71 jpm 308
 
309
		bt = new Toolbar() ;
310
		bt.addSpacer() ;
311
		bt.addText("Mode de saisie ") ;
312
		bt.addField(selecteurMode) ;
313
 
132 aurelien 314
		boutonOK.setTabIndex(8);
315
		boutonAnnuler.setTabIndex(9);
74 david 316
 
71 jpm 317
 
218 david 318
		if (Ext.isIE6()) {
319
			panneauPremierColonne.setButtonAlign(Position.RIGHT);
320
			panneauPremierColonne.addButton(boutonOK);
321
			panneauSecondeColonne.setButtonAlign(Position.LEFT);
322
			panneauSecondeColonne.addButton(boutonAnnuler);
323
		}
324
		else {
325
 
326
			panneauFormulaire.addButton(boutonOK);
327
			panneauFormulaire.addButton(boutonAnnuler);
328
		}
329
 
330
 
71 jpm 331
		selecteurMode.addListener(new ComboBoxListenerAdapter() {
332
 
333
			public void onSelect(ComboBox comboBox, Record record, int index) {
334
 
335
				// et on met la valeur à jour dans la combobox
336
				comboBox.setValue(record.getAsString("nom_mode"));
337
				setModification(record.getAsString("mode")) ;
338
			}
339
 
340
		});
12 david 341
 
342
		this.add(panneauFormulaire) ;
80 jpm 343
		this.setTopToolbar(bt) ;
12 david 344
 
120 aurelien 345
		this.setAutoScroll(true);
12 david 346
 
347
 
201 david 348
 
349
		panneauFormulaire.addListener(new PanelListenerAdapter() {
350
	        public void onResize(BoxComponent component, int adjWidth, int adjHeight, int rawWidth, int rawHeight) {
351
	        	panneauIntermediaire.setWidth(rawWidth);
352
	        	panneauIntermediaire.setHeight(rawHeight);
353
	     }});
354
 
12 david 355
		// on ajoute les listeners
201 david 356
 
357
 
12 david 358
		ajouterListeners() ;
359
 
360
	}
361
 
362
	private void ajouterListeners()
94 jpm 363
	{
20 david 364
		// Listener completion communne
365
 
366
		   commune.addListener(new ComboBoxListenerAdapter() {
367
	             public void onSelect(ComboBox comboBox, Record record, int index) {
368
	                 commune.setValue(record.getAsString("commune"));
39 david 369
	                 departement=record.getAsString("departement");
20 david 370
	                 selectionCommune=true;
371
	             }
372
	         });
373
 
374
 
375
			ListenerConfig listenerConfigCommune=new ListenerConfig();
376
			listenerConfigCommune.setDelay(10);
377
			listenerConfigCommune.setStopPropagation(false);
378
			listenerConfigCommune.setStopEvent(false);
379
 
380
		    commune.addKeyPressListener(new EventCallback()	{
381
 
120 aurelien 382
	    	    public void execute(EventObject e) {
383
 
384
 
385
	    	    		switch(e.getKey()) {
386
 
132 aurelien 387
    	    				case KEY_ALT:
388
	    	    	        case KEY_CTRL:
389
	    	    	        case KEY_DOWN:
390
	    	    	        case KEY_END:
391
	    	    	        case KEY_ESCAPE:
392
	    	    	        case KEY_HOME:
393
	    	    	        case KEY_LEFT:
394
	    	    	        case KEY_PAGEDOWN:
395
	    	    	        case KEY_PAGEUP:
396
	    	    	        case KEY_RIGHT:
397
	    	    	        case KEY_SHIFT:
398
	    	    	        case KEY_TAB:
399
	    	    	        case KEY_UP:
400
 
401
	    	    	        break;
402
 
120 aurelien 403
	    	    	    	case KEY_ENTER:
404
 
20 david 405
		    	    	    	 if (selectionCommune) {
216 aurelien 406
		    	    	    		 communeModifiee= true;
20 david 407
		    	    	    		 selectionCommune=false;
408
		    	    	    	 }
120 aurelien 409
		    	    	    	else {
410
 
118 david 411
		    	    	    		validerSaisie(Champs.COMMUNE);
20 david 412
		    	    	    		// lancer mise a jour
413
		    	    	    	 }
120 aurelien 414
		    	    	    break;
415
 
416
		    	    	    default:
20 david 417
 
83 david 418
		    	    	    	  departement="";
20 david 419
		    	    	    	  obtenirListeReferentielCommune();
216 aurelien 420
		    	    	    	  communeModifiee= true;
20 david 421
 
120 aurelien 422
		    	    	    break;
423
	    	    	    }
424
	     			}
425
	    		},    listenerConfigCommune
20 david 426
			);
427
 
120 aurelien 428
		    date.addKeyPressListener(new EventCallback() {
20 david 429
 
120 aurelien 430
				public void execute(EventObject e) {
431
					// TODO Auto-generated method stub
432
					switch(e.getKey()) {
221 aurelien 433
 
434
						case KEY_ALT:
435
		    	        case KEY_CTRL:
436
		    	        case KEY_DOWN:
437
		    	        case KEY_END:
438
		    	        case KEY_ESCAPE:
439
		    	        case KEY_HOME:
440
		    	        case KEY_LEFT:
441
		    	        case KEY_PAGEDOWN:
442
		    	        case KEY_PAGEUP:
443
		    	        case KEY_RIGHT:
444
		    	        case KEY_SHIFT:
445
		    	        case KEY_TAB:
446
		    	        	if(date.getRawValue().equals(VALEURS_MULTIPLES)) {
447
		    	        		date.clearInvalid();
448
		    	        	}
449
		    	        case KEY_UP:
450
 
451
		    	        break;
120 aurelien 452
 
221 aurelien 453
	  	    	      case KEY_ENTER:
454
	  	    	    		validerSaisie(Champs.DATE);
120 aurelien 455
	  	    	    	  break;
456
 
457
	  	    	      default:
221 aurelien 458
	  					dateModifiee = true;
120 aurelien 459
					}
460
				}
461
		    });
462
 
221 aurelien 463
		    date.addListener(new DatePickerListenerAdapter() {
464
 
465
				public void onSelect(DatePicker dataPicker, Date date) {
466
					dateModifiee = true;
467
				}
468
		    });
469
 
120 aurelien 470
		    station.addKeyPressListener(new EventCallback() {
471
 
472
				public void execute(EventObject e) {
473
					// TODO Auto-generated method stub
474
					switch(e.getKey()) {
475
 
221 aurelien 476
						case KEY_ALT:
477
		    	        case KEY_CTRL:
478
		    	        case KEY_DOWN:
479
		    	        case KEY_END:
480
		    	        case KEY_ESCAPE:
481
		    	        case KEY_HOME:
482
		    	        case KEY_LEFT:
483
		    	        case KEY_PAGEDOWN:
484
		    	        case KEY_PAGEUP:
485
		    	        case KEY_RIGHT:
486
		    	        case KEY_SHIFT:
487
		    	        case KEY_TAB:
488
		    	        case KEY_UP:
489
		    	      break;
490
 
120 aurelien 491
	  	    	      case KEY_ENTER:
492
	  	    	    		validerSaisie(Champs.STATION);
493
	  	    	    	  break;
494
 
495
	  	    	      default:
221 aurelien 496
	  	    	    	  stationModifiee = true;
120 aurelien 497
					}
498
				}
499
		    });
500
 
501
 
20 david 502
 
120 aurelien 503
			// Listener completion espece
20 david 504
			espece.addListener(new ComboBoxListenerAdapter() {
505
	             public void onSelect(ComboBox comboBox, Record record, int index) {
506
	            	 espece.setValue(record.getAsString("nom"));
39 david 507
	            	 numeroNom=record.getAsString("numeroNom");
20 david 508
	                 selectionEspece=true;
128 aurelien 509
	                 observationMediateur.obtenirImageInformationExternes(numeroNom);
20 david 510
	             }
511
	         });
512
 
513
 
514
			ListenerConfig listenerConfigEspece=new ListenerConfig();
515
			listenerConfigEspece.setDelay(10);
516
			listenerConfigEspece.setStopPropagation(false);
517
			listenerConfigEspece.setStopEvent(false);
518
 
519
 
520
			espece.addKeyPressListener(new EventCallback()	{
521
 
522
		    	    public void execute(EventObject e) {
523
 
524
 
525
		    	    		  switch(e.getKey()) {
526
 
527
 
528
		    	    		  case KEY_ALT:
529
		    	    	      case KEY_CTRL:
530
		    	    	      case KEY_DOWN:
531
		    	    	      case KEY_END:
532
		    	    	      case KEY_ESCAPE:
533
		    	    	      case KEY_HOME:
534
		    	    	      case KEY_LEFT:
535
		    	    	      case KEY_PAGEDOWN:
536
		    	    	      case KEY_PAGEUP:
537
		    	    	      case KEY_RIGHT:
538
		    	    	      case KEY_SHIFT:
539
		    	    	      case KEY_TAB:
540
		    	    	      case KEY_UP:
541
 
542
		    	    	        break;
543
 
544
		    	    	      case KEY_ENTER:
545
 
140 aurelien 546
			    	    	    	if(selectionEspece) {
216 aurelien 547
			    	    	    		especeModifiee = true;
548
			    	    	    		selectionEspece=false;
140 aurelien 549
			    	    	    	}
550
			    	    	    	else {
551
			    	    	    		validerSaisie(Champs.ESPECE);
552
			    	    	    	}
20 david 553
 
554
		    	    	    	  break;
555
 
556
		    	    	      default:
557
 
83 david 558
		    	    	    	  numeroNom="";
20 david 559
		    	    	    	  obtenirListeReferentielNom();
216 aurelien 560
		    	    	    	  especeModifiee = true;
20 david 561
 
562
		    	    	        break;
563
		    	    	    }
564
 
565
 
566
 
567
		     		}
568
 
569
		    		},    listenerConfigEspece
570
 
571
			);
572
 
120 aurelien 573
			lieudit.addKeyPressListener(new EventCallback() {
20 david 574
 
120 aurelien 575
				public void execute(EventObject e) {
576
					// TODO Auto-generated method stub
577
					switch(e.getKey()) {
578
 
221 aurelien 579
					case KEY_ALT:
580
	  	    	      case KEY_CTRL:
581
	  	    	      case KEY_DOWN:
582
	  	    	      case KEY_END:
583
	  	    	      case KEY_ESCAPE:
584
	  	    	      case KEY_HOME:
585
	  	    	      case KEY_LEFT:
586
	  	    	      case KEY_PAGEDOWN:
587
	  	    	      case KEY_PAGEUP:
588
	  	    	      case KEY_RIGHT:
589
	  	    	      case KEY_SHIFT:
590
	  	    	      case KEY_TAB:
591
	  	    	      case KEY_UP:
592
 
593
  	    	        break;
594
 
120 aurelien 595
	  	    	      case KEY_ENTER:
596
	  	    	    		validerSaisie(Champs.LIEUDIT);
597
	  	    	    	  break;
598
 
599
	  	    	      default:
221 aurelien 600
	  					lieuDitModifie = true;
120 aurelien 601
					}
602
				}
603
		    });
604
 
605
			milieu.addKeyPressListener(new EventCallback() {
606
 
607
				public void execute(EventObject e) {
608
					// TODO Auto-generated method stub
609
					switch(e.getKey()) {
221 aurelien 610
 
611
						case KEY_ALT:
612
	  	    	      case KEY_CTRL:
613
	  	    	      case KEY_DOWN:
614
	  	    	      case KEY_END:
615
	  	    	      case KEY_ESCAPE:
616
	  	    	      case KEY_HOME:
617
	  	    	      case KEY_LEFT:
618
	  	    	      case KEY_PAGEDOWN:
619
	  	    	      case KEY_PAGEUP:
620
	  	    	      case KEY_RIGHT:
621
	  	    	      case KEY_SHIFT:
622
	  	    	      case KEY_TAB:
623
	  	    	      case KEY_UP:
624
 
625
	  	    	        break;
120 aurelien 626
 
627
	  	    	      case KEY_ENTER:
628
	  	    	    		validerSaisie(Champs.MILIEU);
629
	  	    	    	  break;
630
 
631
	  	    	      default:
221 aurelien 632
	  					milieuModifie = true;
120 aurelien 633
					}
634
				}
635
		    });
636
 
216 aurelien 637
			comment.addKeyPressListener(new EventCallback() {
120 aurelien 638
 
639
				public void execute(EventObject e) {
221 aurelien 640
					switch(e.getKey()) {
641
						case KEY_ALT:
642
			    	      case KEY_CTRL:
643
			    	      case KEY_DOWN:
644
			    	      case KEY_END:
645
			    	      case KEY_ESCAPE:
646
			    	      case KEY_HOME:
647
			    	      case KEY_LEFT:
648
			    	      case KEY_PAGEDOWN:
649
			    	      case KEY_PAGEUP:
650
			    	      case KEY_RIGHT:
651
			    	      case KEY_SHIFT:
652
			    	      case KEY_TAB:
653
			    	      case KEY_UP:
654
 
655
		    	        break;
656
 
657
		    	        default:
658
						commModifie = true;
659
					}
120 aurelien 660
				}
216 aurelien 661
		    });
120 aurelien 662
 
20 david 663
 
664
 
665
		boutonOK.addListener(new ButtonListenerAdapter() {
39 david 666
 
20 david 667
			public void onClick(Button button, EventObject e) {
118 david 668
 
669
				if(modification) {
216 aurelien 670
					if(masseModification) {
671
							modifierObservationEnMasse(null);
672
					} else {
673
						modifierObservation() ;
674
					}
71 jpm 675
				}
118 david 676
				else {
71 jpm 677
					ajouterObservation();
678
				}
39 david 679
 
71 jpm 680
 
20 david 681
			}
682
 
683
		});
77 jpm 684
 
685
		boutonAnnuler.addListener(new ButtonListenerAdapter() {
12 david 686
 
687
			public void onClick(Button button, EventObject e) {
688
 
77 jpm 689
				if(modification)
690
				{
691
					supprimerObservation() ;
692
				}
693
				else
694
				{
104 jpm 695
					raz();
77 jpm 696
				}
12 david 697
 
77 jpm 698
 
699
			}
700
 
12 david 701
		});
132 aurelien 702
 
703
		this.addListener(new ContainerListenerAdapter() {
704
			public void onAfterLayout(Container self) {
705
				commune.focus();
706
			}
707
		});
708
 
12 david 709
	}
710
 
711
	/**
118 david 712
	 * Validation de la saisie
713
	 */
714
 
715
	private void validerSaisie(Champs champs) {
716
 
717
		if(modification) {
216 aurelien 718
			if(masseModification) {
719
					modifierObservationEnMasse(champs);
720
			} else {
721
				modifierObservation();
722
			}
723
 
724
			raz(champs);
118 david 725
		}
726
		else {
727
			ajouterObservation();
728
			raz(champs);
729
		}
730
	}
731
 
732
	/**
12 david 733
	 * Desactive visuellement ce panneau
734
	 */
735
	public void desactiverPanneau()
736
	{
737
		this.setDisabled(true) ;
738
	}
739
 
740
	/**
741
	 * Active visuellement ce panneau
742
	 */
743
	public void activerPanneau()
744
	{
745
		this.setDisabled(false) ;
746
	}
13 david 747
 
748
	public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
749
 
49 david 750
		// si l'on a reçu une liste du referentiel commune (completion referentiel commune)
13 david 751
			if(nouvelleDonnees instanceof ListeReferentielCommune)
752
			{
753
 
754
					ListeReferentielCommune data = (ListeReferentielCommune) nouvelleDonnees ;
755
					Object[][] communeData = new Object[data.size()][2];
756
					int i = 0 ;
757
 
758
					// on la parse et on récupère les informations quiç nous interessent
759
					for (Iterator it = data.keySet().iterator(); it.hasNext();)
760
					{
761
 
762
						ReferentielCommune ref=(ReferentielCommune) data.get(it.next());
763
 
764
						communeData[i][0]= ref.getCommune();
765
						communeData[i][1]= ref.getDepartement();
766
 
767
 
768
						i++ ;
769
					}
770
 
771
					   //	  creation du store
772
					FieldDef defCommune = new StringFieldDef("commune");
773
					FieldDef defDepartement = new StringFieldDef("departement");
774
 
775
 
776
					FieldDef[] defTab = { defCommune, defDepartement};
777
 
778
					RecordDef rd = new RecordDef(defTab);
779
 
780
					final MemoryProxy dataProxy = new MemoryProxy(communeData);
781
					final ArrayReader reader = new ArrayReader(rd);
782
 
20 david 783
					Store store=new Store(dataProxy,reader);
13 david 784
					store.load() ;
785
 
132 aurelien 786
					commune.setStore(store);
13 david 787
			}
20 david 788
 
94 jpm 789
			//			 si l'on a reçu une liste du référentiel nom (complétion referentiel nom)
20 david 790
 
791
			if(nouvelleDonnees instanceof ListeReferentielNom)
792
			{
793
 
794
					ListeReferentielNom data = (ListeReferentielNom) nouvelleDonnees ;
795
					Object[][] nomData = new Object[data.size()][2];
796
					int i = 0 ;
797
 
798
					// on la parse et on récupère les informations quiç nous interessent
799
					for (Iterator it = data.keySet().iterator(); it.hasNext();)
800
					{
801
 
802
						ReferentielNom ref=(ReferentielNom) data.get(it.next());
803
 
804
						nomData[i][0]= ref.getNom();
805
						nomData[i][1]= ref.getNumeroNom();
806
 
807
 
808
						i++ ;
809
					}
810
 
811
					   //	  creation du store
812
					FieldDef defNom = new StringFieldDef("nom");
813
					FieldDef defNumeroNom = new StringFieldDef("numeroNom");
814
 
815
 
816
					FieldDef[] defTab = { defNom, defNumeroNom};
817
 
818
					RecordDef rd = new RecordDef(defTab);
819
 
820
					final MemoryProxy dataProxy = new MemoryProxy(nomData);
821
					final ArrayReader reader = new ArrayReader(rd);
822
 
823
					Store store=new Store(dataProxy,reader);
824
					store.load() ;
825
 
826
					espece.setStore(store);
827
 
828
 
829
 
830
			}
831
 
82 david 832
			// On recoit une observation dont on veut afficher le detail
833
 
71 jpm 834
			if(nouvelleDonnees instanceof Observation)
835
			{
836
				Observation obs = (Observation)nouvelleDonnees ;
837
				afficherDetailsObservation(obs) ;
838
			}
77 jpm 839
 
216 aurelien 840
			if(nouvelleDonnees instanceof ListeObservation) {
841
				ListeObservation listeObs = (ListeObservation)nouvelleDonnees;
842
				calculerAfficherDifferences(listeObs);
843
			}
844
 
82 david 845
			// Sur Mise à jour ou suppression d'une suppression ?
846
 
77 jpm 847
			if(nouvelleDonnees instanceof String)
848
			{
849
				String str = (String)nouvelleDonnees ;
107 aurelien 850
				observationMediateur.obtenirNombreObservation() ;
77 jpm 851
			}
140 aurelien 852
 
853
			if(nouvelleDonnees instanceof String[]) {
854
				String[] anumNom = (String[])nouvelleDonnees ;
855
				numeroNom = anumNom[1];
856
				espece.setValue(anumNom[0]);
857
				setModification("false");
858
			}
20 david 859
 
13 david 860
	}
861
	public void obtenirListeReferentielCommune() {
94 jpm 862
 
20 david 863
	 String com=commune.getText().replaceAll(" ","/");
864
	 com=com.replaceAll("%","");
865
 
866
	 observationMediateur.obtenirListeReferentielCommune(this,com);
13 david 867
 
868
	}
20 david 869
 
870
 
871
	public void obtenirListeReferentielNom() {
872
 
873
	  String esp=espece.getText().replaceAll(" ","/");
874
	  esp=esp.replaceAll("%","");
875
 
876
	  observationMediateur.obtenirListeReferentielNom(this,esp);
877
 
878
	}
879
 
880
 
39 david 881
	public void ajouterObservation() {
140 aurelien 882
 
883
		if(departement.equals("000null") || departement.equals("")) {
884
			String[] depCom = commune.getText().split(" ");
885
			if(depCom.length > 1) {
886
				String dep = depCom[1].replace('(', ' ');
887
				dep =dep.replace(')', ' ');
888
				dep = dep.trim();
889
				dep = dep.replace('\\',' ');
890
				dep = dep.trim();
891
 
892
				try
893
				{
894
					int nDep = Integer.parseInt(dep);
895
					if(nDep > 0 && nDep < 110) {
896
						departement = dep ;
897
					}
898
				}
899
				catch(NumberFormatException e)
900
				{
901
					departement = "" ;
902
				}
903
			}
904
		}
39 david 905
 
120 aurelien 906
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());
46 david 907
		observationMediateur.ajouterObservation(obs);
39 david 908
	}
12 david 909
 
71 jpm 910
	private void modifierObservation() {
120 aurelien 911
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());
79 david 912
		obs.setNumeroOrdre(numeroOrdre);
216 aurelien 913
 
79 david 914
		observationMediateur.modifierObservation(obs);
216 aurelien 915
 
205 aurelien 916
		selecteurMode.setValue("création");
917
		setModification("false");
918
 
71 jpm 919
	}
77 jpm 920
 
216 aurelien 921
	private void modifierObservationEnMasse(Champs champModifie) {
922
		String communeM = null;
923
		String departementM = null;
221 aurelien 924
		String numNomSelM = null;
216 aurelien 925
		String lieuDitM = null;
926
		String stationM = null;
927
		String milieuM = null;
928
		String dateM = null;
929
		String especeM = null;
930
		String commM = null;
931
 
932
		String champs = modeleMessageModif;
933
 
934
		if(communeModifiee) {
935
			communeM = commune.getText();
221 aurelien 936
 
937
			if(departement.equals("000null") || departement.equals("")) {
938
				String[] depCom = commune.getText().split(" ");
939
				if(depCom.length > 1) {
940
					String dep = depCom[1].replace('(', ' ');
941
					dep =dep.replace(')', ' ');
942
					dep = dep.trim();
943
					dep = dep.replace('\\',' ');
944
					dep = dep.trim();
945
 
946
					try
947
					{
948
						int nDep = Integer.parseInt(dep);
949
						if(nDep > 0 && nDep < 110) {
950
							departement = dep ;
951
						}
952
					}
953
					catch(NumberFormatException e)
954
					{
955
						departement = "" ;
956
					}
957
				}
958
			}
959
 
960
			departementM = departement;
216 aurelien 961
		} else {
221 aurelien 962
			champs = champs.replaceAll("commune", "");
216 aurelien 963
		}
964
 
221 aurelien 965
		if(lieuDitModifie) {
216 aurelien 966
			lieuDitM = lieudit.getText();
967
		}else {
221 aurelien 968
			champs = champs.replaceAll(":lieu-dit", "");
216 aurelien 969
		}
970
 
221 aurelien 971
		if(stationModifiee) {
216 aurelien 972
			stationM = station.getText();
973
		}else {
221 aurelien 974
			champs = champs.replaceAll(":station", "");
216 aurelien 975
		}
976
 
977
		if(milieuModifie) {
978
			milieuM = milieu.getText();
979
		}else {
221 aurelien 980
			champs = champs.replaceAll(":milieu", "");
216 aurelien 981
		}
982
 
221 aurelien 983
		if(dateModifiee && !date.getRawValue().equals(VALEURS_MULTIPLES)) {
216 aurelien 984
			dateM = date.getRawValue();
985
		}else {
221 aurelien 986
			champs = champs.replaceAll(":date", "");
216 aurelien 987
		}
988
 
989
		if(especeModifiee) {
990
			especeM = espece.getText();
221 aurelien 991
			numNomSelM = numeroNom;
216 aurelien 992
		}else {
221 aurelien 993
			champs = champs.replaceAll(":espece", "");
216 aurelien 994
		}
995
 
996
		if(commModifie) {
997
			commM = comment.getText();
998
		}else {
221 aurelien 999
			champs = champs.replaceAll(":commentaire", "");
216 aurelien 1000
		}
1001
 
221 aurelien 1002
		champs = champs.replaceAll(":",", ");
1003
		if(champs.startsWith(",")) {
1004
			champs = champs.replaceFirst(",", "");
1005
		}
216 aurelien 1006
 
221 aurelien 1007
		String message = "Voulez vous modifier le(s) champ(s) suivant(s) : "+champs+"   pour les observations selectionnées ?" ;
1008
 
216 aurelien 1009
		if(champs.trim().equals("")) {
1010
			Window.alert("Aucun champ n'a été modifié");
1011
		} else {
221 aurelien 1012
			Observation obs = new Observation(especeM,numNomSelM,communeM,departementM,lieuDitM,stationM,milieuM, commM,dateM);
216 aurelien 1013
			obs.setNumeroOrdre(numeroOrdre);
1014
			if(Window.confirm(message)) {
1015
				observationMediateur.modifierObservationEnMasse(obs);
221 aurelien 1016
				reinitialiserValeurModifiees();
216 aurelien 1017
			}
1018
		}
1019
	}
1020
 
77 jpm 1021
	private void supprimerObservation() {
1022
 
216 aurelien 1023
		observationMediateur.supprimerObservation(this, numeroOrdre);
77 jpm 1024
	}
12 david 1025
 
71 jpm 1026
 
1027
	public void afficherDetailsObservation(Observation obs)
1028
	{
104 jpm 1029
		raz() ;
216 aurelien 1030
		String idLoc ;
1031
		if(obs.getIdentifiantLocalite() != VALEURS_MULTIPLES) {
1032
			idLoc =obs.getIdentifiantLocalite().replaceAll(" ","/");
1033
			idLoc = idLoc.replaceAll("%","");
1034
			idLoc = idLoc.replaceAll("\"","");
1035
			idLoc = idLoc.replace('\\',' ');
1036
			idLoc = idLoc.trim();
1037
		} else {
1038
			idLoc = obs.getIdentifiantLocalite();
1039
		}
71 jpm 1040
 
221 aurelien 1041
		if(!obs.getDate().equals("null") && !obs.getDate().equals("000null") && !obs.getDate().equals(VALEURS_MULTIPLES)) {
71 jpm 1042
			String[] dateEtHeure = obs.getDate().split(" ", 2);
110 aurelien 1043
			if(verifierFormatDate(dateEtHeure[0])) {
1044
				date.setValue(dateEtHeure[0]) ;
1045
			}
1046
			else
1047
			{
1048
				date.setRawValue("");
1049
			}
221 aurelien 1050
		} else {
1051
			date.setRawValue(VALEURS_MULTIPLES);
1052
			date.clearInvalid();
71 jpm 1053
		}
1054
		if(!obs.getLieudit().equals("null") && !obs.getLieudit().equals("000null")) {
1055
			lieudit.setValue(obs.getLieudit()) ;
1056
		}
1057
		if(!obs.getStation().equals("null") && !obs.getStation().equals("000null")) {
1058
			station.setValue(obs.getStation()) ;
1059
		}
1060
		if(!obs.getMilieu().equals("null") && !obs.getMilieu().equals("000null")) {
1061
			milieu.setValue(obs.getMilieu()) ;
1062
		}
1063
		if(!obs.getCommentaire().equals("null") && !obs.getCommentaire().equals("000null")) {
1064
			comment.setValue(obs.getCommentaire()) ;
1065
		}
1066
		if(!obs.getLocalite().equals("null") && !obs.getLocalite().equals("000null")) {
221 aurelien 1067
			if(!idLoc.equals("000null")) {
1068
				if(!idLoc.equals(VALEURS_MULTIPLES)) {
1069
					commune.setValue(obs.getLocalite()+" ("+idLoc+")") ;
1070
				} else {
1071
					commune.setValue(VALEURS_MULTIPLES);
1072
				}
140 aurelien 1073
			}
1074
			else
1075
			{
1076
				commune.setValue(obs.getLocalite());
1077
			}
71 jpm 1078
		}
1079
		if(!obs.getIdentifiantLocalite().equals("null") && !obs.getIdentifiantLocalite().equals("000null")) {
140 aurelien 1080
			departement = idLoc;
71 jpm 1081
		}
1082
		if(!obs.getNomSaisi().equals("null") && !obs.getNomSaisi().equals("000null")) {
1083
			espece.setValue(obs.getNomSaisi()) ;
1084
		}
1085
		if(!obs.getNumeroNomenclaturalSaisi().equals("null") && !obs.getNumeroNomenclaturalSaisi().equals("000null")) {
1086
			numeroNom = obs.getNumeroNomenclaturalSaisi() ;
1087
		}
83 david 1088
		if(!obs.getNumeroOrdre().equals("null") && !obs.getNumeroOrdre().equals("000nu2ll")) {
74 david 1089
			numeroOrdre = obs.getNumeroOrdre() ;
1090
		}
1091
 
71 jpm 1092
	}
1093
 
118 david 1094
 
104 jpm 1095
	public void raz()
71 jpm 1096
	{
118 david 1097
		raz(Champs.TOUT);
1098
 
1099
	}
1100
	public void raz(Champs champs)
1101
	{
1102
		switch (champs) {
1103
 
1104
 
1105
			case DATE:
1106
				date.reset() ;
1107
				break;
1108
 
1109
			case LIEUDIT:
1110
				lieudit.reset() ;
1111
				break;
1112
 
1113
			case STATION:
1114
				station.reset() ;
1115
				break;
1116
 
1117
			case MILIEU:
1118
				milieu.reset() ;
1119
				break;
1120
 
1121
			case COMMENT:
1122
				comment.reset() ;
1123
				break;
1124
 
1125
 
1126
			case COMMUNE:
172 aurelien 1127
				commune.reset() ;
118 david 1128
				departement ="";
1129
				break;
1130
 
1131
			case ESPECE:
1132
				espece.reset();
1133
				numeroNom = "" ;
1134
				numeroOrdre = "";
1135
				break;
1136
 
1137
			case TOUT:
132 aurelien 1138
				commune.reset();
118 david 1139
				date.reset() ;
1140
				lieudit.reset() ;
1141
				station.reset() ;
1142
				milieu.reset() ;
1143
				comment.reset() ;
1144
				milieu.reset() ;
1145
				departement ="";
1146
				espece.reset();
1147
				numeroNom = "" ;
1148
				numeroOrdre = "";
1149
				break;
1150
 
1151
		}
71 jpm 1152
 
1153
	}
1154
 
1155
	private void setModification(String mode)
1156
	{
1157
		if(mode.equals("true")) {
1158
 
1159
			boutonOK.setText("Modifier") ;
1160
			setTitle("Modification") ;
77 jpm 1161
			boutonAnnuler.setText("Supprimer") ;
71 jpm 1162
			modification = true ;
97 jpm 1163
			selecteurMode.removeClass("x-selec-crea") ;
1164
			selecteurMode.setCls("x-selec-modif") ;
216 aurelien 1165
			observationMediateur.onModeModification();
71 jpm 1166
		}
1167
		else
1168
		{
120 aurelien 1169
			boutonOK.setText("Ajouter") ;
71 jpm 1170
			setTitle("Saisir") ;
77 jpm 1171
			boutonAnnuler.setText("Réinitialiser") ;
71 jpm 1172
			modification = false ;
97 jpm 1173
			selecteurMode.removeClass("x-selec-modif") ;
1174
			selecteurMode.setCls("x-selec-crea") ;
94 jpm 1175
 
132 aurelien 1176
		}
71 jpm 1177
	}
1178
 
1179
	/**
1180
	 * renvoie vrai si on est en mode modification, faux si on est en mode création
1181
	 * @return
1182
	 */
1183
	public boolean getModification()
1184
	{
1185
		return modification ;
1186
	}
110 aurelien 1187
 
216 aurelien 1188
	/**
1189
	 * renvoie vrai si on est en mode modification de masse, faux sinon
1190
	 * @return
1191
	 */
1192
	public boolean getMasseModification()
1193
	{
1194
		return masseModification ;
1195
	}
1196
 
110 aurelien 1197
	public boolean verifierFormatDate(String date) {
1198
 
132 aurelien 1199
		String regex = "[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}" ;
110 aurelien 1200
		if(date.matches(regex) && !date.equals("0000-00-00")) {
1201
			return true ;
1202
		}
1203
		else {
1204
			return false;
1205
		}
1206
	}
216 aurelien 1207
 
1208
	public void setMasseModification(boolean masseModification) {
1209
		this.masseModification = masseModification;
1210
		if(masseModification) {
1211
			reinitialiserValeurModifiees();
1212
		}
1213
	}
132 aurelien 1214
 
216 aurelien 1215
	private void calculerAfficherDifferences(ListeObservation listeObs) {
1216
 
1217
		String departement = null;
1218
		String commune = null;
1219
		String lieuDit = null;
1220
		String station = null;
1221
		String milieu = null;
1222
		String espece = null;
1223
		String date = null;
1224
		String notes = null;
1225
 
1226
		String ordreObs = "";
1227
 
1228
		for(Iterator<String> it = listeObs.keySet().iterator();it.hasNext();) {
1229
			Observation obsEnCours = listeObs.get(it.next());
1230
			departement = comparerDifferencesChamps(departement, obsEnCours.getIdentifiantLocalite());
1231
			commune = comparerDifferencesChamps(commune, obsEnCours.getLocalite());
1232
			lieuDit = comparerDifferencesChamps(lieuDit, obsEnCours.getLieudit());
1233
			station = comparerDifferencesChamps(station, obsEnCours.getStation());
1234
			milieu = comparerDifferencesChamps(milieu, obsEnCours.getMilieu());
1235
			espece = comparerDifferencesChamps(espece, obsEnCours.getNomSaisi());
1236
			date = comparerDifferencesChamps(date, obsEnCours.getDate());
1237
			notes = comparerDifferencesChamps(notes, obsEnCours.getCommentaire());
1238
 
1239
			ordreObs += obsEnCours.getNumeroOrdre()+",";
1240
		}
1241
 
1242
		Observation obs=new Observation(espece,numeroNom,commune,departement,lieuDit,station,milieu, notes,date);
1243
		obs.setNumeroOrdre(ordreObs);
1244
		rafraichir(obs, false);
1245
 
1246
	}
1247
 
1248
	private String comparerDifferencesChamps(String valeurActuelle, String nouvelleValeur) {
1249
 
1250
		String retour = "000null";
1251
 
1252
			if(valeurActuelle == null) {
1253
				retour = nouvelleValeur;
1254
			} else {
1255
				if(valeurActuelle.equals(nouvelleValeur)) {
1256
					retour = valeurActuelle;
1257
				} else {
1258
					retour = VALEURS_MULTIPLES;
1259
				}
1260
			}
1261
		return retour;
1262
	}
1263
 
1264
	private void reinitialiserValeurModifiees() {
1265
 
1266
		communeModifiee = false;
221 aurelien 1267
		lieuDitModifie = false;
1268
		stationModifiee = false;
216 aurelien 1269
		milieuModifie = false;
1270
		dateModifiee = false;
1271
		especeModifiee = false;
1272
		commModifie = false;
1273
	}
1274
 
1275
	private Field obtenirCorrespondanceChampsEnum(Champs champ) {
1276
		switch(champ) {
1277
    	case DATE:
1278
    		return date;
1279
 
1280
    	case COMMUNE:
1281
    		return commune;
1282
 
1283
		case LIEUDIT:
1284
			return lieudit;
1285
 
1286
		case STATION:
1287
			return station;
1288
 
1289
		case MILIEU:
1290
			return milieu;
1291
 
1292
		case COMMENT:
1293
			return comment;
1294
 
1295
    	case ESPECE:
1296
    		return espece;
1297
    	}
1298
		return null;
1299
	}
12 david 1300
}