Subversion Repositories eFlore/Applications.cel

Rev

Rev 224 | 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
 
82 david 830
			// On recoit une observation dont on veut afficher le detail
831
 
71 jpm 832
			if(nouvelleDonnees instanceof Observation)
833
			{
834
				Observation obs = (Observation)nouvelleDonnees ;
835
				afficherDetailsObservation(obs) ;
836
			}
77 jpm 837
 
216 aurelien 838
			if(nouvelleDonnees instanceof ListeObservation) {
839
				ListeObservation listeObs = (ListeObservation)nouvelleDonnees;
840
				calculerAfficherDifferences(listeObs);
841
			}
842
 
82 david 843
			// Sur Mise à jour ou suppression d'une suppression ?
844
 
77 jpm 845
			if(nouvelleDonnees instanceof String)
846
			{
847
				String str = (String)nouvelleDonnees ;
107 aurelien 848
				observationMediateur.obtenirNombreObservation() ;
77 jpm 849
			}
140 aurelien 850
 
851
			if(nouvelleDonnees instanceof String[]) {
852
				String[] anumNom = (String[])nouvelleDonnees ;
853
				numeroNom = anumNom[1];
854
				espece.setValue(anumNom[0]);
855
				setModification("false");
856
			}
20 david 857
 
13 david 858
	}
859
	public void obtenirListeReferentielCommune() {
94 jpm 860
 
20 david 861
	 String com=commune.getText().replaceAll(" ","/");
862
	 com=com.replaceAll("%","");
863
 
864
	 observationMediateur.obtenirListeReferentielCommune(this,com);
13 david 865
 
866
	}
20 david 867
 
868
 
869
	public void obtenirListeReferentielNom() {
870
 
871
	  String esp=espece.getText().replaceAll(" ","/");
872
	  esp=esp.replaceAll("%","");
873
 
874
	  observationMediateur.obtenirListeReferentielNom(this,esp);
875
 
876
	}
877
 
878
 
39 david 879
	public void ajouterObservation() {
140 aurelien 880
 
881
		if(departement.equals("000null") || departement.equals("")) {
882
			String[] depCom = commune.getText().split(" ");
883
			if(depCom.length > 1) {
884
				String dep = depCom[1].replace('(', ' ');
885
				dep =dep.replace(')', ' ');
886
				dep = dep.trim();
887
				dep = dep.replace('\\',' ');
888
				dep = dep.trim();
889
 
890
				try
891
				{
892
					int nDep = Integer.parseInt(dep);
893
					if(nDep > 0 && nDep < 110) {
894
						departement = dep ;
895
					}
896
				}
897
				catch(NumberFormatException e)
898
				{
899
					departement = "" ;
900
				}
901
			}
902
		}
39 david 903
 
120 aurelien 904
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());
46 david 905
		observationMediateur.ajouterObservation(obs);
39 david 906
	}
12 david 907
 
71 jpm 908
	private void modifierObservation() {
229 aurelien 909
 
910
		if(departement.equals("000null") || departement.equals("")) {
911
			String[] depCom = commune.getText().split(" ");
912
			if(depCom.length > 1) {
913
				String dep = depCom[1].replace('(', ' ');
914
				dep =dep.replace(')', ' ');
915
				dep = dep.trim();
916
				dep = dep.replace('\\',' ');
917
				dep = dep.trim();
918
 
919
				try
920
				{
921
					int nDep = Integer.parseInt(dep);
922
					if(nDep > 0 && nDep < 110) {
923
						departement = dep ;
924
					}
925
				}
926
				catch(NumberFormatException e)
927
				{
928
					departement = "" ;
929
				}
930
			}
931
		}
932
 
120 aurelien 933
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());
79 david 934
		obs.setNumeroOrdre(numeroOrdre);
216 aurelien 935
 
79 david 936
		observationMediateur.modifierObservation(obs);
216 aurelien 937
 
205 aurelien 938
		selecteurMode.setValue("création");
939
		setModification("false");
940
 
71 jpm 941
	}
77 jpm 942
 
216 aurelien 943
	private void modifierObservationEnMasse(Champs champModifie) {
944
		String communeM = null;
945
		String departementM = null;
221 aurelien 946
		String numNomSelM = null;
216 aurelien 947
		String lieuDitM = null;
948
		String stationM = null;
949
		String milieuM = null;
950
		String dateM = null;
951
		String especeM = null;
952
		String commM = null;
953
 
954
		String champs = modeleMessageModif;
955
 
956
		if(communeModifiee) {
957
			communeM = commune.getText();
221 aurelien 958
 
959
			if(departement.equals("000null") || departement.equals("")) {
960
				String[] depCom = commune.getText().split(" ");
961
				if(depCom.length > 1) {
962
					String dep = depCom[1].replace('(', ' ');
963
					dep =dep.replace(')', ' ');
964
					dep = dep.trim();
965
					dep = dep.replace('\\',' ');
966
					dep = dep.trim();
967
 
968
					try
969
					{
970
						int nDep = Integer.parseInt(dep);
971
						if(nDep > 0 && nDep < 110) {
972
							departement = dep ;
973
						}
974
					}
975
					catch(NumberFormatException e)
976
					{
977
						departement = "" ;
978
					}
979
				}
980
			}
981
 
982
			departementM = departement;
216 aurelien 983
		} else {
221 aurelien 984
			champs = champs.replaceAll("commune", "");
216 aurelien 985
		}
986
 
221 aurelien 987
		if(lieuDitModifie) {
216 aurelien 988
			lieuDitM = lieudit.getText();
989
		}else {
221 aurelien 990
			champs = champs.replaceAll(":lieu-dit", "");
216 aurelien 991
		}
992
 
221 aurelien 993
		if(stationModifiee) {
216 aurelien 994
			stationM = station.getText();
995
		}else {
221 aurelien 996
			champs = champs.replaceAll(":station", "");
216 aurelien 997
		}
998
 
999
		if(milieuModifie) {
1000
			milieuM = milieu.getText();
1001
		}else {
221 aurelien 1002
			champs = champs.replaceAll(":milieu", "");
216 aurelien 1003
		}
1004
 
221 aurelien 1005
		if(dateModifiee && !date.getRawValue().equals(VALEURS_MULTIPLES)) {
216 aurelien 1006
			dateM = date.getRawValue();
1007
		}else {
221 aurelien 1008
			champs = champs.replaceAll(":date", "");
216 aurelien 1009
		}
1010
 
1011
		if(especeModifiee) {
1012
			especeM = espece.getText();
221 aurelien 1013
			numNomSelM = numeroNom;
216 aurelien 1014
		}else {
221 aurelien 1015
			champs = champs.replaceAll(":espece", "");
216 aurelien 1016
		}
1017
 
1018
		if(commModifie) {
1019
			commM = comment.getText();
1020
		}else {
221 aurelien 1021
			champs = champs.replaceAll(":commentaire", "");
216 aurelien 1022
		}
1023
 
221 aurelien 1024
		champs = champs.replaceAll(":",", ");
1025
		if(champs.startsWith(",")) {
1026
			champs = champs.replaceFirst(",", "");
1027
		}
216 aurelien 1028
 
221 aurelien 1029
		String message = "Voulez vous modifier le(s) champ(s) suivant(s) : "+champs+"   pour les observations selectionnées ?" ;
1030
 
216 aurelien 1031
		if(champs.trim().equals("")) {
1032
			Window.alert("Aucun champ n'a été modifié");
1033
		} else {
221 aurelien 1034
			Observation obs = new Observation(especeM,numNomSelM,communeM,departementM,lieuDitM,stationM,milieuM, commM,dateM);
216 aurelien 1035
			obs.setNumeroOrdre(numeroOrdre);
1036
			if(Window.confirm(message)) {
1037
				observationMediateur.modifierObservationEnMasse(obs);
221 aurelien 1038
				reinitialiserValeurModifiees();
216 aurelien 1039
			}
1040
		}
1041
	}
1042
 
77 jpm 1043
	private void supprimerObservation() {
1044
 
216 aurelien 1045
		observationMediateur.supprimerObservation(this, numeroOrdre);
77 jpm 1046
	}
12 david 1047
 
71 jpm 1048
 
1049
	public void afficherDetailsObservation(Observation obs)
1050
	{
104 jpm 1051
		raz() ;
216 aurelien 1052
		String idLoc ;
1053
		if(obs.getIdentifiantLocalite() != VALEURS_MULTIPLES) {
1054
			idLoc =obs.getIdentifiantLocalite().replaceAll(" ","/");
1055
			idLoc = idLoc.replaceAll("%","");
1056
			idLoc = idLoc.replaceAll("\"","");
1057
			idLoc = idLoc.replace('\\',' ');
1058
			idLoc = idLoc.trim();
1059
		} else {
1060
			idLoc = obs.getIdentifiantLocalite();
1061
		}
71 jpm 1062
 
221 aurelien 1063
		if(!obs.getDate().equals("null") && !obs.getDate().equals("000null") && !obs.getDate().equals(VALEURS_MULTIPLES)) {
71 jpm 1064
			String[] dateEtHeure = obs.getDate().split(" ", 2);
110 aurelien 1065
			if(verifierFormatDate(dateEtHeure[0])) {
1066
				date.setValue(dateEtHeure[0]) ;
1067
			}
1068
			else
1069
			{
1070
				date.setRawValue("");
1071
			}
221 aurelien 1072
		} else {
1073
			date.setRawValue(VALEURS_MULTIPLES);
1074
			date.clearInvalid();
71 jpm 1075
		}
1076
		if(!obs.getLieudit().equals("null") && !obs.getLieudit().equals("000null")) {
1077
			lieudit.setValue(obs.getLieudit()) ;
1078
		}
1079
		if(!obs.getStation().equals("null") && !obs.getStation().equals("000null")) {
1080
			station.setValue(obs.getStation()) ;
1081
		}
1082
		if(!obs.getMilieu().equals("null") && !obs.getMilieu().equals("000null")) {
1083
			milieu.setValue(obs.getMilieu()) ;
1084
		}
1085
		if(!obs.getCommentaire().equals("null") && !obs.getCommentaire().equals("000null")) {
1086
			comment.setValue(obs.getCommentaire()) ;
1087
		}
1088
		if(!obs.getLocalite().equals("null") && !obs.getLocalite().equals("000null")) {
221 aurelien 1089
			if(!idLoc.equals("000null")) {
1090
				if(!idLoc.equals(VALEURS_MULTIPLES)) {
1091
					commune.setValue(obs.getLocalite()+" ("+idLoc+")") ;
1092
				} else {
1093
					commune.setValue(VALEURS_MULTIPLES);
1094
				}
140 aurelien 1095
			}
1096
			else
1097
			{
1098
				commune.setValue(obs.getLocalite());
1099
			}
71 jpm 1100
		}
1101
		if(!obs.getIdentifiantLocalite().equals("null") && !obs.getIdentifiantLocalite().equals("000null")) {
140 aurelien 1102
			departement = idLoc;
71 jpm 1103
		}
1104
		if(!obs.getNomSaisi().equals("null") && !obs.getNomSaisi().equals("000null")) {
1105
			espece.setValue(obs.getNomSaisi()) ;
1106
		}
1107
		if(!obs.getNumeroNomenclaturalSaisi().equals("null") && !obs.getNumeroNomenclaturalSaisi().equals("000null")) {
1108
			numeroNom = obs.getNumeroNomenclaturalSaisi() ;
1109
		}
83 david 1110
		if(!obs.getNumeroOrdre().equals("null") && !obs.getNumeroOrdre().equals("000nu2ll")) {
74 david 1111
			numeroOrdre = obs.getNumeroOrdre() ;
1112
		}
1113
 
71 jpm 1114
	}
1115
 
118 david 1116
 
104 jpm 1117
	public void raz()
71 jpm 1118
	{
118 david 1119
		raz(Champs.TOUT);
1120
 
1121
	}
1122
	public void raz(Champs champs)
1123
	{
1124
		switch (champs) {
1125
 
1126
 
1127
			case DATE:
1128
				date.reset() ;
1129
				break;
1130
 
1131
			case LIEUDIT:
1132
				lieudit.reset() ;
1133
				break;
1134
 
1135
			case STATION:
1136
				station.reset() ;
1137
				break;
1138
 
1139
			case MILIEU:
1140
				milieu.reset() ;
1141
				break;
1142
 
1143
			case COMMENT:
1144
				comment.reset() ;
1145
				break;
1146
 
1147
 
1148
			case COMMUNE:
172 aurelien 1149
				commune.reset() ;
118 david 1150
				departement ="";
1151
				break;
1152
 
1153
			case ESPECE:
1154
				espece.reset();
1155
				numeroNom = "" ;
1156
				numeroOrdre = "";
1157
				break;
1158
 
1159
			case TOUT:
132 aurelien 1160
				commune.reset();
118 david 1161
				date.reset() ;
1162
				lieudit.reset() ;
1163
				station.reset() ;
1164
				milieu.reset() ;
1165
				comment.reset() ;
1166
				milieu.reset() ;
1167
				departement ="";
1168
				espece.reset();
1169
				numeroNom = "" ;
1170
				numeroOrdre = "";
1171
				break;
1172
 
1173
		}
71 jpm 1174
 
1175
	}
1176
 
1177
	private void setModification(String mode)
1178
	{
1179
		if(mode.equals("true")) {
1180
 
1181
			boutonOK.setText("Modifier") ;
1182
			setTitle("Modification") ;
77 jpm 1183
			boutonAnnuler.setText("Supprimer") ;
71 jpm 1184
			modification = true ;
97 jpm 1185
			selecteurMode.removeClass("x-selec-crea") ;
1186
			selecteurMode.setCls("x-selec-modif") ;
216 aurelien 1187
			observationMediateur.onModeModification();
71 jpm 1188
		}
1189
		else
1190
		{
120 aurelien 1191
			boutonOK.setText("Ajouter") ;
71 jpm 1192
			setTitle("Saisir") ;
77 jpm 1193
			boutonAnnuler.setText("Réinitialiser") ;
71 jpm 1194
			modification = false ;
97 jpm 1195
			selecteurMode.removeClass("x-selec-modif") ;
1196
			selecteurMode.setCls("x-selec-crea") ;
94 jpm 1197
 
132 aurelien 1198
		}
71 jpm 1199
	}
1200
 
1201
	/**
1202
	 * renvoie vrai si on est en mode modification, faux si on est en mode création
1203
	 * @return
1204
	 */
1205
	public boolean getModification()
1206
	{
1207
		return modification ;
1208
	}
110 aurelien 1209
 
216 aurelien 1210
	/**
1211
	 * renvoie vrai si on est en mode modification de masse, faux sinon
1212
	 * @return
1213
	 */
1214
	public boolean getMasseModification()
1215
	{
1216
		return masseModification ;
1217
	}
1218
 
110 aurelien 1219
	public boolean verifierFormatDate(String date) {
1220
 
132 aurelien 1221
		String regex = "[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}" ;
110 aurelien 1222
		if(date.matches(regex) && !date.equals("0000-00-00")) {
1223
			return true ;
1224
		}
1225
		else {
1226
			return false;
1227
		}
1228
	}
216 aurelien 1229
 
1230
	public void setMasseModification(boolean masseModification) {
1231
		this.masseModification = masseModification;
1232
		if(masseModification) {
1233
			reinitialiserValeurModifiees();
1234
		}
1235
	}
132 aurelien 1236
 
216 aurelien 1237
	private void calculerAfficherDifferences(ListeObservation listeObs) {
1238
 
1239
		String departement = null;
1240
		String commune = null;
1241
		String lieuDit = null;
1242
		String station = null;
1243
		String milieu = null;
1244
		String espece = null;
1245
		String date = null;
1246
		String notes = null;
1247
 
1248
		String ordreObs = "";
1249
 
1250
		for(Iterator<String> it = listeObs.keySet().iterator();it.hasNext();) {
1251
			Observation obsEnCours = listeObs.get(it.next());
1252
			departement = comparerDifferencesChamps(departement, obsEnCours.getIdentifiantLocalite());
1253
			commune = comparerDifferencesChamps(commune, obsEnCours.getLocalite());
1254
			lieuDit = comparerDifferencesChamps(lieuDit, obsEnCours.getLieudit());
1255
			station = comparerDifferencesChamps(station, obsEnCours.getStation());
1256
			milieu = comparerDifferencesChamps(milieu, obsEnCours.getMilieu());
1257
			espece = comparerDifferencesChamps(espece, obsEnCours.getNomSaisi());
1258
			date = comparerDifferencesChamps(date, obsEnCours.getDate());
1259
			notes = comparerDifferencesChamps(notes, obsEnCours.getCommentaire());
1260
 
1261
			ordreObs += obsEnCours.getNumeroOrdre()+",";
1262
		}
1263
 
1264
		Observation obs=new Observation(espece,numeroNom,commune,departement,lieuDit,station,milieu, notes,date);
1265
		obs.setNumeroOrdre(ordreObs);
1266
		rafraichir(obs, false);
1267
 
1268
	}
1269
 
1270
	private String comparerDifferencesChamps(String valeurActuelle, String nouvelleValeur) {
1271
 
1272
		String retour = "000null";
1273
 
1274
			if(valeurActuelle == null) {
1275
				retour = nouvelleValeur;
1276
			} else {
1277
				if(valeurActuelle.equals(nouvelleValeur)) {
1278
					retour = valeurActuelle;
1279
				} else {
1280
					retour = VALEURS_MULTIPLES;
1281
				}
1282
			}
1283
		return retour;
1284
	}
1285
 
1286
	private void reinitialiserValeurModifiees() {
1287
 
1288
		communeModifiee = false;
221 aurelien 1289
		lieuDitModifie = false;
1290
		stationModifiee = false;
216 aurelien 1291
		milieuModifie = false;
1292
		dateModifiee = false;
1293
		especeModifiee = false;
1294
		commModifie = false;
1295
	}
1296
 
1297
	private Field obtenirCorrespondanceChampsEnum(Champs champ) {
1298
		switch(champ) {
1299
    	case DATE:
1300
    		return date;
1301
 
1302
    	case COMMUNE:
1303
    		return commune;
1304
 
1305
		case LIEUDIT:
1306
			return lieudit;
1307
 
1308
		case STATION:
1309
			return station;
1310
 
1311
		case MILIEU:
1312
			return milieu;
1313
 
1314
		case COMMENT:
1315
			return comment;
1316
 
1317
    	case ESPECE:
1318
    		return espece;
1319
    	}
1320
		return null;
1321
	}
12 david 1322
}