Subversion Repositories eFlore/Applications.cel

Rev

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

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