Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 264 Rev 268
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.Date;
5
import java.util.Date;
6
import java.util.Iterator;
6
import java.util.Iterator;
7
 
7
 
8
import org.tela_botanica.client.interfaces.Rafraichissable;
8
import org.tela_botanica.client.interfaces.Rafraichissable;
9
import org.tela_botanica.client.modeles.Configuration;
9
import org.tela_botanica.client.modeles.Configuration;
10
import org.tela_botanica.client.modeles.EntiteGeographiqueObservation;
10
import org.tela_botanica.client.modeles.EntiteGeographiqueObservation;
11
import org.tela_botanica.client.modeles.ListeObservation;
11
import org.tela_botanica.client.modeles.ListeObservation;
12
import org.tela_botanica.client.modeles.ListeReferentielCommune;
12
import org.tela_botanica.client.modeles.ListeReferentielCommune;
13
import org.tela_botanica.client.modeles.ListeReferentielNom;
13
import org.tela_botanica.client.modeles.ListeReferentielNom;
14
import org.tela_botanica.client.modeles.Observation;
14
import org.tela_botanica.client.modeles.Observation;
15
import org.tela_botanica.client.modeles.ReferentielCommune;
15
import org.tela_botanica.client.modeles.ReferentielCommune;
16
import org.tela_botanica.client.modeles.ReferentielNom;
16
import org.tela_botanica.client.modeles.ReferentielNom;
17
import org.tela_botanica.client.observation.ObservationMediateur;
17
import org.tela_botanica.client.observation.ObservationMediateur;
18
 
18
 
19
import com.google.gwt.core.client.JavaScriptObject;
19
import com.google.gwt.core.client.JavaScriptObject;
20
import com.google.gwt.maps.client.geom.LatLng;
20
import com.google.gwt.maps.client.geom.LatLng;
-
 
21
import com.google.gwt.user.client.Timer;
21
import com.google.gwt.user.client.Window;
22
import com.google.gwt.user.client.Window;
-
 
23
import com.google.gwt.user.client.ui.ClickListener;
22
import com.google.gwt.user.client.ui.HTML;
24
import com.google.gwt.user.client.ui.HTML;
-
 
25
import com.google.gwt.user.client.ui.Widget;
23
import com.gwtext.client.core.EventCallback;
26
import com.gwtext.client.core.EventCallback;
24
import com.gwtext.client.core.EventObject;
27
import com.gwtext.client.core.EventObject;
25
import com.gwtext.client.core.Ext;
28
import com.gwtext.client.core.Ext;
26
import com.gwtext.client.core.ExtElement;
29
import com.gwtext.client.core.ExtElement;
-
 
30
import com.gwtext.client.core.Function;
27
import com.gwtext.client.core.ListenerConfig;
31
import com.gwtext.client.core.ListenerConfig;
28
import com.gwtext.client.core.Position;
32
import com.gwtext.client.core.Position;
29
import com.gwtext.client.data.ArrayReader;
33
import com.gwtext.client.data.ArrayReader;
30
import com.gwtext.client.data.FieldDef;
34
import com.gwtext.client.data.FieldDef;
31
import com.gwtext.client.data.MemoryProxy;
35
import com.gwtext.client.data.MemoryProxy;
32
import com.gwtext.client.data.RecordDef;
36
import com.gwtext.client.data.RecordDef;
33
import com.gwtext.client.data.SimpleStore;
37
import com.gwtext.client.data.SimpleStore;
34
import com.gwtext.client.data.Store;
38
import com.gwtext.client.data.Store;
35
import com.gwtext.client.data.StringFieldDef;
39
import com.gwtext.client.data.StringFieldDef;
36
import com.gwtext.client.widgets.BoxComponent;
40
import com.gwtext.client.widgets.BoxComponent;
37
import com.gwtext.client.widgets.Button;
41
import com.gwtext.client.widgets.Button;
38
import com.gwtext.client.widgets.Component;
42
import com.gwtext.client.widgets.Component;
39
import com.gwtext.client.widgets.Container;
43
import com.gwtext.client.widgets.Container;
40
import com.gwtext.client.widgets.DatePicker;
44
import com.gwtext.client.widgets.DatePicker;
41
import com.gwtext.client.widgets.Panel;
45
import com.gwtext.client.widgets.Panel;
42
import com.gwtext.client.widgets.ToolTip;
46
import com.gwtext.client.widgets.ToolTip;
43
import com.gwtext.client.widgets.Toolbar;
47
import com.gwtext.client.widgets.Toolbar;
44
import com.gwtext.client.widgets.Viewport;
48
import com.gwtext.client.widgets.Viewport;
45
import com.gwtext.client.widgets.event.BoxComponentListenerAdapter;
49
import com.gwtext.client.widgets.event.BoxComponentListenerAdapter;
46
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
50
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
47
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
51
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
48
import com.gwtext.client.widgets.event.DatePickerListener;
52
import com.gwtext.client.widgets.event.DatePickerListener;
49
import com.gwtext.client.widgets.event.DatePickerListenerAdapter;
53
import com.gwtext.client.widgets.event.DatePickerListenerAdapter;
50
import com.gwtext.client.widgets.event.PanelListenerAdapter;
54
import com.gwtext.client.widgets.event.PanelListenerAdapter;
51
import com.gwtext.client.widgets.form.ComboBox;
55
import com.gwtext.client.widgets.form.ComboBox;
52
import com.gwtext.client.widgets.form.DateField;
56
import com.gwtext.client.widgets.form.DateField;
53
import com.gwtext.client.widgets.form.Field;
57
import com.gwtext.client.widgets.form.Field;
54
import com.gwtext.client.widgets.form.FormPanel;
58
import com.gwtext.client.widgets.form.FormPanel;
-
 
59
import com.gwtext.client.widgets.form.Label;
55
import com.gwtext.client.widgets.form.MultiFieldPanel;
60
import com.gwtext.client.widgets.form.MultiFieldPanel;
56
import com.gwtext.client.widgets.form.TextArea;
61
import com.gwtext.client.widgets.form.TextArea;
57
import com.gwtext.client.widgets.form.TextField;
62
import com.gwtext.client.widgets.form.TextField;
58
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
63
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
-
 
64
import com.gwtext.client.widgets.form.event.TextFieldListener;
59
import com.gwtext.client.widgets.form.event.TextFieldListenerAdapter;
65
import com.gwtext.client.widgets.form.event.TextFieldListenerAdapter;
60
import com.gwtext.client.widgets.layout.AnchorLayoutData;
66
import com.gwtext.client.widgets.layout.AnchorLayoutData;
61
import com.gwtext.client.widgets.layout.ColumnLayout;
67
import com.gwtext.client.widgets.layout.ColumnLayout;
62
import com.gwtext.client.widgets.layout.ColumnLayoutData;
68
import com.gwtext.client.widgets.layout.ColumnLayoutData;
63
import com.gwtext.client.widgets.layout.FormLayout;
69
import com.gwtext.client.widgets.layout.FormLayout;
64
import com.gwtext.client.widgets.layout.RowLayout;
70
import com.gwtext.client.widgets.layout.RowLayout;
65
import com.gwtext.client.data.Record;
71
import com.gwtext.client.data.Record;
66
 
72
 
67
/**
73
/**
68
 * Panneau contenant les infos, les métadonnées et l'arbre des mots clés, il implémente l'interface rafraichissable
74
 * Panneau contenant les infos, les métadonnées et l'arbre des mots clés, il implémente l'interface rafraichissable
69
 * @author aurelien
75
 * @author aurelien
70
 *
76
 *
71
 */
77
 */
72
public class FormulaireSaisieObservationVue extends Panel implements Rafraichissable  {
78
public class FormulaireSaisieObservationVue extends Panel implements Rafraichissable  {
73
 
79
 
74
 
80
 
75
	/**
81
	/**
76
	 * Le médiateur associé à la vue
82
	 * Le médiateur associé à la vue
77
	 */
83
	 */
78
	private ObservationMediateur	observationMediateur		= null;
84
	private ObservationMediateur	observationMediateur		= null;
79
	
85
	
80
	FormPanel panneauFormulaire = null;
86
	FormPanel panneauFormulaire = null;
81
 
87
 
82
	private DateField date = null;
88
	private DateField date = null;
83
	private TextField lieudit = null;
89
	private TextField lieudit = null;
84
	private TextField station = null;
90
	private TextField station = null;
85
	private TextField milieu = null;
91
	private TextField milieu = null;
86
	private TextField comment = null;
92
	private TextField comment = null;
87
	private ComboBox  commune = null;
93
	private ComboBox  commune = null;
88
	private String departement = null;
94
	private String departement = null;
89
	private ComboBox  espece = null;
95
	private ComboBox  espece = null;
90
	private String numeroNom = null;
96
	private String numeroNom = null;
91
	private String numeroOrdre = null;
97
	private String numeroOrdre = null;
92
	
98
	
93
	private String referentielGeo = null;
99
	private String referentielGeo = null;
94
 
100
 
95
	// Pour remise a zero partielle lors d'une validation
101
	// Pour remise a zero partielle lors d'une validation
96
	
102
	
97
	private  enum Champs {
103
	private  enum Champs {
98
	    DATE, LIEUDIT, STATION, MILIEU, COMMENT, COMMUNE, ESPECE, TOUT, LATITUDE, LONGITUDE ;
104
	    DATE, LIEUDIT, STATION, MILIEU, COMMENT, COMMUNE, ESPECE, TOUT, LATITUDE, LONGITUDE ;
99
	    
105
	    
100
	    public String toString() {
106
	    public String toString() {
101
	    	
107
	    	
102
	    	switch(this) {
108
	    	switch(this) {
103
	    	case DATE:
109
	    	case DATE:
104
	    		return "date";
110
	    		return "date";
105
	    		
111
	    		
106
	    	case COMMUNE:
112
	    	case COMMUNE:
107
	    		return "commune";
113
	    		return "commune";
108
	    	
114
	    	
109
    		case LIEUDIT:
115
    		case LIEUDIT:
110
    			return "lieu dit";
116
    			return "lieu dit";
111
	    	
117
	    	
112
    		case STATION:
118
    		case STATION:
113
    			return "station";
119
    			return "station";
114
	    	
120
	    	
115
    		case MILIEU:
121
    		case MILIEU:
116
    			return "milieu";
122
    			return "milieu";
117
	    	
123
	    	
118
    		case COMMENT:
124
    		case COMMENT:
119
    			return "commentaire";
125
    			return "commentaire";
120
	    	
126
	    	
121
	    	case ESPECE:
127
	    	case ESPECE:
122
	    		return "espèce";
128
	    		return "espèce";
123
	    		
129
	    		
124
	    	case LATITUDE:
130
	    	case LATITUDE:
125
	    		return "latitude";
131
	    		return "latitude";
126
	    		
132
	    		
127
	    	case LONGITUDE:
133
	    	case LONGITUDE:
128
	    		return "longitude";
134
	    		return "longitude";
129
	    	
135
	    	
130
	    	case TOUT:
136
	    	case TOUT:
131
	    		return "date, commune, lieu dit, station, milieu, espèce, commentaire, latitude, longitude";
137
	    		return "date, commune, lieu dit, station, milieu, espèce, commentaire, latitude, longitude";
132
	    	}
138
	    	}
133
			return TOUT.toString();
139
			return TOUT.toString();
134
	    }
140
	    }
135
	};
141
	};
136
	
142
	
137
	private String formatDate = null ;
143
	private String formatDate = null ;
138
	private Button boutonOK = new Button("Créer");
144
	private Button boutonOK = new Button("Créer");
139
	private Button boutonAnnuler = new Button("Réinitialiser");
145
	private Button boutonAnnuler = new Button("Réinitialiser");
140
 
146
 
141
	private boolean selectionCommune=false;
147
	private boolean selectionCommune=false;
142
	private boolean selectionEspece=false;
148
	private boolean selectionEspece=false;
143
	
149
	
144
	private boolean modification = false ;
150
	private boolean modification = false ;
145
	private Toolbar bt = null ;
151
	private Toolbar bt = null ;
146
	
152
	
147
	private final String VALEURS_MULTIPLES = "(Valeurs multiples)";
153
	private final String VALEURS_MULTIPLES = "(Valeurs multiples)";
148
	private final String modeleMessageModif = "commune:lieu-dit:station:milieu:latitude:longitude:date:espece:commentaire";
154
	private final String modeleMessageModif = "commune:lieu-dit:station:milieu:latitude:longitude:date:espece:commentaire";
149
	private boolean communeModifiee = false;
155
	private boolean communeModifiee = false;
150
	private boolean lieuDitModifie = false;
156
	private boolean lieuDitModifie = false;
151
	private boolean stationModifiee = false;
157
	private boolean stationModifiee = false;
152
	private boolean milieuModifie = false;
158
	private boolean milieuModifie = false;
153
	private boolean dateModifiee = false;
159
	private boolean dateModifiee = false;
154
	private boolean especeModifiee = false;
160
	private boolean especeModifiee = false;
155
	private boolean commModifie = false;
161
	private boolean commModifie = false;
156
	
162
	
157
	
163
	
158
	private final int KEY_ALT = 18;
164
	private final int KEY_ALT = 18;
159
	private final int KEY_BACKSPACE = 8;
165
	private final int KEY_BACKSPACE = 8;
160
	private final int KEY_CTRL = 17;
166
	private final int KEY_CTRL = 17;
161
	private final int KEY_DELETE = 46;
167
	private final int KEY_DELETE = 46;
162
	private final int KEY_DOWN = 40;
168
	private final int KEY_DOWN = 40;
163
	private final int KEY_END = 35;
169
	private final int KEY_END = 35;
164
	private final int KEY_ENTER = 13;
170
	private final int KEY_ENTER = 13;
165
	private final int KEY_ESCAPE = 27;
171
	private final int KEY_ESCAPE = 27;
166
	private final int KEY_HOME = 36;
172
	private final int KEY_HOME = 36;
167
	private final int KEY_LEFT = 37;
173
	private final int KEY_LEFT = 37;
168
	private final int KEY_PAGEDOWN = 34;
174
	private final int KEY_PAGEDOWN = 34;
169
	private final int KEY_PAGEUP = 33;
175
	private final int KEY_PAGEUP = 33;
170
	private final int KEY_RIGHT = 39;
176
	private final int KEY_RIGHT = 39;
171
	private final int KEY_SHIFT = 16;
177
	private final int KEY_SHIFT = 16;
172
	private final int KEY_TAB = 9;
178
	private final int KEY_TAB = 9;
173
	private final int KEY_UP = 38;
179
	private final int KEY_UP = 38;
174
	
180
	
175
	
181
	
176
	/**
182
	/**
177
	 * Combobox permettant de selectionner le mode
183
	 * Combobox permettant de selectionner le mode
178
	 * modification ou bien création
184
	 * modification ou bien création
179
	 */
185
	 */
180
	private ComboBox selecteurMode = new ComboBox();
186
	private ComboBox selecteurMode = new ComboBox();
181
	
187
	
182
	Store storeMode = null ;
188
	Store storeMode = null ;
183
 
189
 
184
	/**
190
	/**
185
	 * Booleen d'instanciation
191
	 * Booleen d'instanciation
186
	 */
192
	 */
187
	boolean estInstancie = false ;
193
	boolean estInstancie = false ;
188
 
194
 
189
	private Panel panneauIntermediaire;
195
	private Panel panneauIntermediaire;
190
 
196
 
191
	private Panel panneauPremierColonne;
197
	private Panel panneauPremierColonne;
192
 
198
 
193
	private Panel panneauSecondeColonne;
199
	private Panel panneauSecondeColonne;
194
 
200
 
195
	private boolean masseModification =false ;
201
	private boolean masseModification =false ;
196
 
202
 
197
	private TextField longitude;
203
	private TextField longitude;
198
 
204
 
199
	private TextField latitude;
205
	private TextField latitude;
200
 
206
 
201
	private MultiFieldPanel coordPanel;
207
	private MultiFieldPanel coordPanel;
202
 
208
 
203
	private TextField coordonnees;
209
	private TextField coordonnees;
-
 
210
	
-
 
211
	private Label lienSelectionCommune = null;
204
 
212
 
205
	private HTML accesformulaire;
213
	private HTML accesformulaire;
206
 
214
 
207
	private HTML basculerverscarto;
215
	private HTML basculerverscarto;
208
	
216
	
209
	private boolean longlatAjoutee;
217
	private boolean longlatAjoutee;
210
 
218
 
211
	private boolean latModifiee;
219
	private boolean latModifiee;
212
 
220
 
213
	private boolean longModifiee;
221
	private boolean longModifiee;
-
 
222
 
-
 
223
	protected boolean rechercheCommuneEnCours = false;
-
 
224
 
-
 
225
	private Timer tCoord;
214
	
226
	
215
	/**
227
	/**
216
	 * Constructeur sans argument (privé car ne doit pas être utilisé)
228
	 * Constructeur sans argument (privé car ne doit pas être utilisé)
217
	 */
229
	 */
218
	@SuppressWarnings("unused")
230
	@SuppressWarnings("unused")
219
	private FormulaireSaisieObservationVue()
231
	private FormulaireSaisieObservationVue()
220
	{
232
	{
221
		super() ;
233
		super() ;
222
	}
234
	}
223
	
235
	
224
	/**
236
	/**
225
	 * Constructeur avec argument
237
	 * Constructeur avec argument
226
	 * @param im
238
	 * @param im
227
	 */
239
	 */
228
	public FormulaireSaisieObservationVue(ObservationMediateur obs)
240
	public FormulaireSaisieObservationVue(ObservationMediateur obs)
229
	{
241
	{
230
		
242
		
231
		super("Saisie");
243
		super("Saisie");
232
		// on associe le médiateur
244
		// on associe le médiateur
233
		observationMediateur = obs ;
245
		observationMediateur = obs ;
234
		
246
		
235
	     	
247
	     	
236
		panneauFormulaire = new FormPanel(Position.RIGHT);
248
		panneauFormulaire = new FormPanel(Position.RIGHT);
237
		panneauFormulaire.setBorder(false);
249
		panneauFormulaire.setBorder(false);
238
		
250
		
239
		
251
		
240
		
252
		
241
		// Panneau intermediaire qui contient deux colonnes de formulaire
253
		// Panneau intermediaire qui contient deux colonnes de formulaire
242
		
254
		
243
		panneauIntermediaire = new Panel();  
255
		panneauIntermediaire = new Panel();  
244
		
256
		
245
		if (Window.getClientWidth()> Window.getClientHeight()) {
257
		if (Window.getClientWidth()> Window.getClientHeight()) {
246
			panneauIntermediaire.setLayout(new ColumnLayout()); 
258
			panneauIntermediaire.setLayout(new ColumnLayout()); 
247
		}
259
		}
248
		else {
260
		else {
249
			panneauIntermediaire.setLayout(new RowLayout()); 
261
			panneauIntermediaire.setLayout(new RowLayout()); 
250
		}
262
		}
251
		
263
		
252
		panneauIntermediaire.setBorder(false);
264
		panneauIntermediaire.setBorder(false);
253
 
265
 
254
		if (Ext.isIE6()) {
266
		if (Ext.isIE6()) {
255
			panneauIntermediaire.setWidth(800);
267
			panneauIntermediaire.setWidth(800);
256
		}
268
		}
257
		
269
		
258
		//create first panel and add fields to it  
270
		//create first panel and add fields to it  
259
		panneauPremierColonne = new Panel();  
271
		panneauPremierColonne = new Panel();  
260
		panneauPremierColonne.setLayout(new FormLayout());  
272
		panneauPremierColonne.setLayout(new FormLayout());  
261
		panneauPremierColonne.setBorder(false);
273
		panneauPremierColonne.setBorder(false);
262
 
274
 
263
		//create second panel and add fields to it  
275
		//create second panel and add fields to it  
264
	    panneauSecondeColonne = new Panel();  
276
	    panneauSecondeColonne = new Panel();  
265
		panneauSecondeColonne.setLayout(new FormLayout());  
277
		panneauSecondeColonne.setLayout(new FormLayout());  
266
		panneauSecondeColonne.setBorder(false);
278
		panneauSecondeColonne.setBorder(false);
267
		
279
		
268
		this.setPaddings(5) ;
280
		this.setPaddings(5) ;
269
	
281
	
270
		// Accesskey pour debugging
282
		// Accesskey pour debugging
271
		
283
		
272
		commune=new ComboBox("Commune","commune\" accesskey=\"1");  
284
		commune=new ComboBox("Commune","commune\" accesskey=\"1");  
273
		
285
		
274
		final String resultTplCommune = "<div class=\"search-item-commune\">{commune}</div>";  
286
		final String resultTplCommune = "<div class=\"search-item-commune\">{commune}</div>";  
275
		commune.setTpl(resultTplCommune);
287
		commune.setTpl(resultTplCommune);
276
		commune.setMode(ComboBox.REMOTE);
288
		commune.setMode(ComboBox.REMOTE);
277
		// commune.setPageSize(10); // Ne fonctionne pas 
289
		// commune.setPageSize(10); // Ne fonctionne pas 
278
		commune.setItemSelector("div.search-item-commune");
290
		commune.setItemSelector("div.search-item-commune");
279
		commune.setTypeAhead(true);  
291
		commune.setTypeAhead(true);  
280
		commune.setLoadingText("Recherche...");  
292
		commune.setLoadingText("Recherche...");  
281
		  
293
		  
282
		commune.setHideTrigger(true);
294
		commune.setHideTrigger(true);
283
		//commune.setTabIndex(1);
295
		//commune.setTabIndex(1);
-
 
296
		
-
 
297
		  //création du lien "Accès carto" dans le formulaire	
-
 
298
		basculerverscarto = new HTML("");
-
 
299
		basculerverscarto = new HTML(" <a id=\"lien_carto\" href=\"#\" tabindex=\"2\">Localiser</a>");
-
 
300
		basculerverscarto.addStyleName("lien_actif");
-
 
301
		
-
 
302
		//création info bulle sur le lien "accès carto"
-
 
303
		ToolTip tip2 = new ToolTip();  
-
 
304
		tip2.setHtml("Via une carte, obtenez les coordonnées (longitude/latitude) de votre observation ");  
-
 
305
		tip2.applyTo(basculerverscarto.getElement());
-
 
306
		
-
 
307
		//Sur une meme ligne, ajout de plusieurs champs
284
		
308
		final MultiFieldPanel htmlCommunePanel = new MultiFieldPanel();  
-
 
309
		htmlCommunePanel.addToRow(commune,new ColumnLayoutData(0.5)); 
-
 
310
		htmlCommunePanel.addToRow(basculerverscarto,100); 
-
 
311
		htmlCommunePanel.setBorder(false);
-
 
312
		htmlCommunePanel.setId("x-commune-panel"); 
-
 
313
 
285
	    panneauPremierColonne.add(commune, new AnchorLayoutData("95%"));  
314
		panneauPremierColonne.add(htmlCommunePanel);
286
 
315
 
287
	    station = new TextField("Station", "station");  
316
	    station = new TextField("Station", "station");  
288
	    station.setAllowBlank(true);
317
	    station.setAllowBlank(true);
289
	    //station.setTabIndex(3);
-
 
-
 
318
 
290
	    panneauPremierColonne.add(station, new AnchorLayoutData("95%"));  
319
	    panneauPremierColonne.add(station, new AnchorLayoutData("95%"));  
291
	    
320
	    
292
		latitude = new TextField("X", "x", 100);
321
		latitude = new TextField("X", "x", 100);
293
		latitude.setAllowBlank(true);
322
		latitude.setAllowBlank(true);
294
	    
323
	    
295
	    longitude = new TextField("Y", "y", 100);
324
	    longitude = new TextField("Y", "y", 100);
296
		longitude.setAllowBlank(true);
325
		longitude.setAllowBlank(true);
-
 
326
		
-
 
327
		lienSelectionCommune = new Label();
-
 
328
		lienSelectionCommune.setId("conteneur_selection_commune");
-
 
329
		lienSelectionCommune.setStyleName("conteneur_selection_commune");
297
			
330
			
298
		// Panneau de type plusieurs champs de formulaire sur une meme ligne, où seront renseignés X/Y
331
		// Panneau de type plusieurs champs de formulaire sur une meme ligne, où seront renseignés X/Y
299
		coordPanel = new MultiFieldPanel(); 
332
		coordPanel = new MultiFieldPanel(); 
300
		coordPanel.setVisible(false);
333
		coordPanel.setVisible(false);
301
		coordPanel.addToRow(latitude, new ColumnLayoutData(0.5)); 
334
		coordPanel.addToRow(latitude, new ColumnLayoutData(0.3)); 
302
		coordPanel.addToRow(longitude, new ColumnLayoutData(0.5));  
335
		coordPanel.addToRow(longitude, new ColumnLayoutData(0.3));  
-
 
336
		coordPanel.addToRow(lienSelectionCommune, new ColumnLayoutData(0.4));  
303
		coordPanel.setBorder(false);
337
		coordPanel.setBorder(false);
304
		
338
		
305
		  //création du champs coordonnées	
339
		  //création du champs coordonnées	
306
		referentielGeo = Configuration.getReferentielGeo();
340
		referentielGeo = Configuration.getReferentielGeo();
307
		
341
		
308
		coordonnees = new TextField("Coordonnées ("+referentielGeo+")", "", 0);
342
		coordonnees = new TextField("Coordonnées", "", 0);
309
		coordonnees.setMaxLength(0);
343
		coordonnees.setMaxLength(0);
310
		coordonnees.setReadOnly(true);
344
		coordonnees.setReadOnly(true);
311
		coordonnees.setCls("fieldname");
345
		coordonnees.setCls("fieldname");
312
		
346
		
313
		  //création du lien "saisie X/Y" dans le formulaire
347
		  //création du lien "saisie X/Y" dans le formulaire
314
		
348
		
315
		accesformulaire = new HTML("<a id=\"lien_coord\" href=\"#\" tabindex=\"7\">Saisie X/Y</a>");
349
		accesformulaire = new HTML("<a id=\"lien_coord\" href=\"#\" tabindex=\"6\">Saisie X/Y ("+referentielGeo+")</a>");
316
		accesformulaire.addStyleName("lien");
350
		accesformulaire.addStyleName("lien_actif");
317
			
351
			
318
		//création info bulle sur le lien "saisie X/Y"
352
		//création info bulle sur le lien "saisie X/Y"
319
			ToolTip tip1 = new ToolTip();  
353
			ToolTip tip1 = new ToolTip();  
320
			tip1.setHtml("X / Y sont les longitudes / latitudes, à remplir en degrés décimaux");  
354
			tip1.setHtml("X / Y sont les longitudes / latitudes, à remplir en degrés décimaux");  
321
			tip1.applyTo(accesformulaire.getElement());
355
			tip1.applyTo(accesformulaire.getElement());
322
			
356
			
323
			//ajout d'un listener sur le lien "saisie X/Y"
357
			//ajout d'un listener sur le lien "saisie X/Y"
324
			
358
			
325
			coordPanel.addListener(new PanelListenerAdapter() {
359
			coordPanel.addListener(new PanelListenerAdapter() {
326
				
360
				
327
				public void onAfterLayout(Container c) {
361
				public void onAfterLayout(Container c) {
328
					ExtElement lienCoord = Ext.get("lien_coord");
362
					ExtElement lienCoord = Ext.get("lien_coord");
329
					lienCoord.removeAllListeners();
363
					lienCoord.removeAllListeners();
330
					lienCoord.addListener("click", new EventCallback() {
364
					lienCoord.addListener("click", new EventCallback() {
331
						public void execute(EventObject e) {
365
						public void execute(EventObject e) {
332
							coordPanel.setVisible(!coordPanel.isVisible());
366
							coordPanel.setVisible(!coordPanel.isVisible());
333
						}
367
						}
334
					}) ;
368
					}) ;
335
				
369
				
336
					ExtElement lienCarto = Ext.get("lien_carto");
370
					ExtElement lienCarto = Ext.get("lien_carto");
337
					lienCarto.removeAllListeners();
371
					lienCarto.removeAllListeners();
338
					lienCarto.addListener("click", new EventCallback() {
372
					lienCarto.addListener("click", new EventCallback() {
339
 
373
 
340
						public void execute(EventObject e) {
374
						public void execute(EventObject e) {
341
							
-
 
342
							if(coordonneesValides() == null) {
375
							
343
								if(commune.getValue() != null && !commune.getValue().equals("")) {
376
							if(commune.getValue() != null && !commune.getValue().equals("")) {
344
									obtenirInformationCommune();
377
								obtenirInformationCommune();
345
									longlatAjoutee = true;
378
								longlatAjoutee = true;
346
						
-
 
347
								} else {
-
 
348
									Window.alert("Veuillez renseigner au moins une commune ou des coordonnées pour la géolocalisation");
-
 
349
								}
379
					
350
							} else {
380
							} else {
351
								obtenirInformationCoord();
381
								Window.alert("Veuillez renseigner une commune à préciser");
352
							}
382
							}
353
						}
383
						}
354
					});
384
					});
355
				}
385
				}
356
 
386
 
357
			});
387
			});
358
			
-
 
359
			
388
						
360
			  //création du lien "Accès carto" dans le formulaire			
-
 
361
			basculerverscarto = new HTML(" <a id=\"lien_carto\" href=\"#\" tabindex=\"6\">Selection depuis une carte</a>");
-
 
362
			basculerverscarto.addStyleName("lien");
-
 
363
			
-
 
364
			//création info bulle sur le lien "accès carto"
-
 
365
			ToolTip tip2 = new ToolTip();  
-
 
366
			tip2.setHtml("Via une carte, obtenez les coordonnées (longitude/latitude) de votre observation ");  
-
 
367
			tip2.applyTo(basculerverscarto.getElement());
-
 
368
			
-
 
369
			//Sur une meme ligne, ajout de plusieurs champs
389
			//Sur une meme ligne, ajout de plusieurs champs
370
			final MultiFieldPanel htmlPanel = new MultiFieldPanel();  
390
			final MultiFieldPanel htmlPanel = new MultiFieldPanel();  
371
			htmlPanel.addToRow(coordonnees, 100); 
391
			htmlPanel.addToRow(coordonnees, 100); 
372
			htmlPanel.addToRow(basculerverscarto, new ColumnLayoutData(0.5)); 
-
 
373
			htmlPanel.addToRow(accesformulaire, new ColumnLayoutData(0.5)); 
392
			htmlPanel.addToRow(accesformulaire, new ColumnLayoutData(0.5)); 
374
			htmlPanel.setBorder(false);
393
			htmlPanel.setBorder(false);
375
			htmlPanel.setId("x-coord-panel");
394
			htmlPanel.setId("x-coord-panel");
376
			
395
			
377
		panneauPremierColonne.add(htmlPanel);
396
		panneauPremierColonne.add(htmlPanel);
378
		panneauPremierColonne.add(coordPanel);
397
		panneauPremierColonne.add(coordPanel);
379
	    
398
	    
380
	    date = new DateField("Date", "date", 100);  
399
	    date = new DateField("Date", "date", 100);  
381
	    date.setAllowBlank(true);
400
	    date.setAllowBlank(true);
382
	    formatDate = "d/m/Y";
401
	    formatDate = "d/m/Y";
383
	    date.setFormat(formatDate) ;
402
	    date.setFormat(formatDate) ;
384
	    //date.setTabIndex(5);
403
	    //date.setTabIndex(5);
385
	    panneauPremierColonne.add(date, new AnchorLayoutData("60%"));  
404
	    panneauPremierColonne.add(date, new AnchorLayoutData("60%"));  
386
 
405
 
387
	 	
406
	 	
388
		espece=new ComboBox("Espèce","nom");  
407
		espece=new ComboBox("Espèce","nom");  
389
		
408
		
390
		
409
		
391
		final String resultTplEspece = "<div class=\"search-item-espece\">{nom}</div>";  
410
		final String resultTplEspece = "<div class=\"search-item-espece\">{nom}</div>";  
392
 
411
 
393
		
412
		
394
		espece.setTpl(resultTplEspece);
413
		espece.setTpl(resultTplEspece);
395
		espece.setMode(ComboBox.REMOTE);
414
		espece.setMode(ComboBox.REMOTE);
396
		// commune.setPageSize(10); // Ne fonctionne pas 
415
		// commune.setPageSize(10); // Ne fonctionne pas 
397
		espece.setItemSelector("div.search-item-espece");
416
		espece.setItemSelector("div.search-item-espece");
398
		espece.setTypeAhead(true);  
417
		espece.setTypeAhead(true);  
399
		espece.setLoadingText("Recherche...");  
418
		espece.setLoadingText("Recherche...");  
400
		  
419
		  
401
		espece.setHideTrigger(true);
420
		espece.setHideTrigger(true);
402
		//espece.setTabIndex(6);
421
		//espece.setTabIndex(6);
403
 
422
 
404
	    panneauPremierColonne.add(espece, new AnchorLayoutData("95%"));   
423
	    panneauPremierColonne.add(espece, new AnchorLayoutData("95%"));   
405
	    
424
	    
406
	    lieudit = new TextField("Lieu-dit", "lieudit");  
425
	    lieudit = new TextField("Lieu-dit", "lieudit");  
407
	    lieudit.setAllowBlank(true);
426
	    lieudit.setAllowBlank(true);
408
	    //lieudit.setTabIndex(2);
427
	    //lieudit.setTabIndex(2);
409
	    panneauSecondeColonne.add(lieudit,  new AnchorLayoutData("95%"));  
428
	    panneauSecondeColonne.add(lieudit,  new AnchorLayoutData("95%"));  
410
	       
429
	       
411
	
430
	
412
	    milieu = new TextField("Milieu", "milieu");  
431
	    milieu = new TextField("Milieu", "milieu");  
413
	    milieu.setAllowBlank(true);
432
	    milieu.setAllowBlank(true);
414
	    //milieu.setTabIndex(4);
433
	    //milieu.setTabIndex(4);
415
	    panneauSecondeColonne.add(milieu,  new AnchorLayoutData("95%"));
434
	    panneauSecondeColonne.add(milieu,  new AnchorLayoutData("95%"));
416
	    
435
	    
417
	    comment = new TextArea("Notes", "comment");  
436
	    comment = new TextArea("Notes", "comment");  
418
	    comment.setAllowBlank(true);
437
	    comment.setAllowBlank(true);
419
	    comment.setHeight(50);
438
	    comment.setHeight(50);
420
	    //comment.setTabIndex(7);
439
	    //comment.setTabIndex(7);
421
	    panneauSecondeColonne.add(comment, new AnchorLayoutData("95%") );
440
	    panneauSecondeColonne.add(comment, new AnchorLayoutData("95%") );
422
	    
441
	    
423
	    if (Window.getClientWidth()> Window.getClientHeight()) {
442
	    if (Window.getClientWidth()> Window.getClientHeight()) {
424
			panneauIntermediaire.add(panneauPremierColonne, new ColumnLayoutData(.5));
443
			panneauIntermediaire.add(panneauPremierColonne, new ColumnLayoutData(.5));
425
			panneauIntermediaire.add(panneauSecondeColonne, new ColumnLayoutData(.5));
444
			panneauIntermediaire.add(panneauSecondeColonne, new ColumnLayoutData(.5));
426
	    }
445
	    }
427
	    else {
446
	    else {
428
			panneauIntermediaire.add(panneauPremierColonne);
447
			panneauIntermediaire.add(panneauPremierColonne);
429
			panneauIntermediaire.add(panneauSecondeColonne);
448
			panneauIntermediaire.add(panneauSecondeColonne);
430
	    	
449
	    	
431
	    }
450
	    }
432
			
451
			
433
		panneauFormulaire.add(panneauIntermediaire);
452
		panneauFormulaire.add(panneauIntermediaire);
434
		
453
		
435
		Object[][] mode = {{"création",false} , {"modification", true} };
454
		Object[][] mode = {{"création",false} , {"modification", true} };
436
		storeMode = new SimpleStore(new String[] { "nom_mode", "mode" },
455
		storeMode = new SimpleStore(new String[] { "nom_mode", "mode" },
437
				mode);
456
				mode);
438
		storeMode.load();
457
		storeMode.load();
439
		selecteurMode.setStore(storeMode);
458
		selecteurMode.setStore(storeMode);
440
		selecteurMode.setDisplayField("nom_mode") ;
459
		selecteurMode.setDisplayField("nom_mode") ;
441
		selecteurMode.setLabel("mode ") ;
460
		selecteurMode.setLabel("mode ") ;
442
		selecteurMode.setForceSelection(true) ;
461
		selecteurMode.setForceSelection(true) ;
443
		selecteurMode.setValue("création") ;
462
		selecteurMode.setValue("création") ;
444
		selecteurMode.setEditable(false) ;
463
		selecteurMode.setEditable(false) ;
445
		selecteurMode.setCls("x-selec-crea") ;
464
		selecteurMode.setCls("x-selec-crea") ;
446
		
465
		
447
		bt = new Toolbar() ;
466
		bt = new Toolbar() ;
448
		bt.addSpacer() ;
467
		bt.addSpacer() ;
449
		bt.addText("Mode de saisie ") ;
468
		bt.addText("Mode de saisie ") ;
450
		bt.addField(selecteurMode) ;
469
		bt.addField(selecteurMode) ;
451
		
-
 
452
		boutonOK.setTabIndex(8);
-
 
453
		boutonAnnuler.setTabIndex(9);
-
 
454
		
470
		
455
		
471
		
456
		if (Ext.isIE6()) {
472
		if (Ext.isIE6()) {
457
			panneauPremierColonne.setButtonAlign(Position.RIGHT);
473
			panneauPremierColonne.setButtonAlign(Position.RIGHT);
458
			panneauPremierColonne.addButton(boutonOK);
474
			panneauPremierColonne.addButton(boutonOK);
459
			panneauSecondeColonne.setButtonAlign(Position.LEFT);
475
			panneauSecondeColonne.setButtonAlign(Position.LEFT);
460
			panneauSecondeColonne.addButton(boutonAnnuler);
476
			panneauSecondeColonne.addButton(boutonAnnuler);
461
		}
477
		}
462
		else {
478
		else {
463
		
479
		
464
			panneauFormulaire.addButton(boutonOK);
480
			panneauFormulaire.addButton(boutonOK);
465
			panneauFormulaire.addButton(boutonAnnuler);		
481
			panneauFormulaire.addButton(boutonAnnuler);		
466
		}
482
		}
467
		
483
		
468
		
484
		
469
		selecteurMode.addListener(new ComboBoxListenerAdapter() {
485
		selecteurMode.addListener(new ComboBoxListenerAdapter() {
470
 
486
 
471
			public void onSelect(ComboBox comboBox, Record record, int index) {
487
			public void onSelect(ComboBox comboBox, Record record, int index) {
472
				
488
				
473
				// et on met la valeur à jour dans la combobox
489
				// et on met la valeur à jour dans la combobox
474
				comboBox.setValue(record.getAsString("nom_mode"));
490
				comboBox.setValue(record.getAsString("nom_mode"));
475
				setModification(record.getAsString("mode")) ;
491
				setModification(record.getAsString("mode")) ;
476
			}
492
			}
477
 
493
 
478
		});
494
		});
479
	
495
	
480
		this.add(panneauFormulaire) ;
496
		this.add(panneauFormulaire) ;
481
		this.setTopToolbar(bt) ;
497
		this.setTopToolbar(bt) ;
482
		
498
		
483
		this.setAutoScroll(true);
499
		this.setAutoScroll(true);
484
	
500
	
485
	
501
	
486
		
502
		
487
		panneauFormulaire.addListener(new PanelListenerAdapter() {
503
		panneauFormulaire.addListener(new PanelListenerAdapter() {
488
	        public void onResize(BoxComponent component, int adjWidth, int adjHeight, int rawWidth, int rawHeight) {
504
	        public void onResize(BoxComponent component, int adjWidth, int adjHeight, int rawWidth, int rawHeight) {
489
	        	panneauIntermediaire.setWidth(rawWidth);
505
	        	panneauIntermediaire.setWidth(rawWidth);
490
	        	panneauIntermediaire.setHeight(rawHeight);
506
	        	panneauIntermediaire.setHeight(rawHeight);
491
	     }});
507
	     }});
492
		
508
		
493
		// on ajoute les listeners
509
		// on ajoute les listeners
494
		
510
		
495
		
511
		
496
		ajouterListeners() ;
512
		ajouterListeners() ;
497
		
513
		
498
		saisieTabindex();
514
		saisieTabindex();
499
		
515
		
500
	}
516
	}
501
	
517
	
502
	private void ajouterListeners()
518
	private void ajouterListeners()
503
	{	
519
	{	
504
		// Listener completion communne 
520
		// Listener completion communne 
-
 
521
		final Rafraichissable r = this;
505
		
522
		
506
		   commune.addListener(new ComboBoxListenerAdapter() {  
523
		   commune.addListener(new ComboBoxListenerAdapter() {  
507
	             public void onSelect(ComboBox comboBox, Record record, int index) {  
524
	             public void onSelect(ComboBox comboBox, Record record, int index) {  
508
	                 commune.setValue(record.getAsString("commune"));
525
	                 commune.setValue(record.getAsString("commune"));
509
	                 departement=record.getAsString("departement");
526
	                 departement=record.getAsString("departement");
510
	                 selectionCommune=true;
527
	                 selectionCommune=true;
511
	             }  
528
	             }  
512
	         });  
529
	         });  
513
	         
530
	         
514
	        
531
	        
515
			ListenerConfig listenerConfigCommune=new ListenerConfig();
532
			ListenerConfig listenerConfigCommune=new ListenerConfig();
516
			listenerConfigCommune.setDelay(10);
533
			listenerConfigCommune.setDelay(10);
517
			listenerConfigCommune.setStopPropagation(false);
534
			listenerConfigCommune.setStopPropagation(false);
518
			listenerConfigCommune.setStopEvent(false);
535
			listenerConfigCommune.setStopEvent(false);
519
			
536
			
520
		    commune.addKeyPressListener(new EventCallback()	{
537
		    commune.addKeyPressListener(new EventCallback()	{
521
		    	
538
		    	
522
	    	    public void execute(EventObject e) {
539
	    	    public void execute(EventObject e) {
523
	    	    	
540
	    	    	
524
	    	    		  
541
	    	    		  
525
	    	    		switch(e.getKey()) {
542
	    	    		switch(e.getKey()) {
526
	    	    	      
543
	    	    	      
527
    	    				case KEY_ALT:
544
    	    				case KEY_ALT:
528
	    	    	        case KEY_CTRL:
545
	    	    	        case KEY_CTRL:
529
	    	    	        case KEY_DOWN:
546
	    	    	        case KEY_DOWN:
530
	    	    	        case KEY_END:
547
	    	    	        case KEY_END:
531
	    	    	        case KEY_ESCAPE:
548
	    	    	        case KEY_ESCAPE:
532
	    	    	        case KEY_HOME:
549
	    	    	        case KEY_HOME:
533
	    	    	        case KEY_LEFT:
550
	    	    	        case KEY_LEFT:
534
	    	    	        case KEY_PAGEDOWN:
551
	    	    	        case KEY_PAGEDOWN:
535
	    	    	        case KEY_PAGEUP:
552
	    	    	        case KEY_PAGEUP:
536
	    	    	        case KEY_RIGHT:
553
	    	    	        case KEY_RIGHT:
537
	    	    	        case KEY_SHIFT:
554
	    	    	        case KEY_SHIFT:
538
	    	    	        case KEY_TAB:
555
	    	    	        case KEY_TAB:
539
	    	    	        case KEY_UP:
556
	    	    	        case KEY_UP:
540
	    	    	    	
557
	    	    	    	
541
	    	    	        break;
558
	    	    	        break;
542
	    	    		
559
	    	    		
543
	    	    	    	case KEY_ENTER:
560
	    	    	    	case KEY_ENTER:
544
	    	    	    	  
561
	    	    	    	  
545
		    	    	    	 if (selectionCommune) {
562
		    	    	    	 if (selectionCommune) {
546
		    	    	    		 communeModifiee= true;
563
		    	    	    		 communeModifiee= true;
547
		    	    	    		 selectionCommune=false;
564
		    	    	    		 selectionCommune=false;
548
		    	    	    	 }
565
		    	    	    	 }
549
		    	    	    	else {
566
		    	    	    	else {
550
	
567
	
551
		    	    	    		validerSaisie(Champs.COMMUNE);
568
		    	    	    		validerSaisie(Champs.COMMUNE);
552
		    	    	    		// lancer mise a jour 	    	    	    		 
569
		    	    	    		// lancer mise a jour 	    	    	    		 
553
		    	    	    	 }
570
		    	    	    	 }
554
		    	    	    break;
571
		    	    	    break;
555
	    	    	       
572
	    	    	       
556
		    	    	    default:
573
		    	    	    default:
557
		    	    	    	  
574
		    	    	    	  
558
		    	    	    	  departement="";
575
		    	    	    	  departement="";
559
		    	    	    	  obtenirListeReferentielCommune();
576
		    	    	    	  obtenirListeReferentielCommune();
560
		    	    	    	  communeModifiee= true;
577
		    	    	    	  communeModifiee= true;
561
		    	    	    	  	    	    	        
578
		    	    	    	  	    	    	        
562
		    	    	    break;
579
		    	    	    break;
563
	    	    	    }
580
	    	    	    }
564
	     			}
581
	     			}
565
	    		},    listenerConfigCommune
582
	    		},    listenerConfigCommune
566
			);
583
			);
567
		    
584
		    
568
		    date.addKeyPressListener(new EventCallback() {
585
		    date.addKeyPressListener(new EventCallback() {
569
 
586
 
570
				public void execute(EventObject e) {
587
				public void execute(EventObject e) {
571
					// TODO Auto-generated method stub
588
					// TODO Auto-generated method stub
572
					switch(e.getKey()) {
589
					switch(e.getKey()) {
573
					
590
					
574
						case KEY_ALT:
591
						case KEY_ALT:
575
		    	        case KEY_CTRL:
592
		    	        case KEY_CTRL:
576
		    	        case KEY_DOWN:
593
		    	        case KEY_DOWN:
577
		    	        case KEY_END:
594
		    	        case KEY_END:
578
		    	        case KEY_ESCAPE:
595
		    	        case KEY_ESCAPE:
579
		    	        case KEY_HOME:
596
		    	        case KEY_HOME:
580
		    	        case KEY_LEFT:
597
		    	        case KEY_LEFT:
581
		    	        case KEY_PAGEDOWN:
598
		    	        case KEY_PAGEDOWN:
582
		    	        case KEY_PAGEUP:
599
		    	        case KEY_PAGEUP:
583
		    	        case KEY_RIGHT:
600
		    	        case KEY_RIGHT:
584
		    	        case KEY_SHIFT:
601
		    	        case KEY_SHIFT:
585
		    	        case KEY_TAB:
602
		    	        case KEY_TAB:
586
		    	        	if(date.getRawValue().equals(VALEURS_MULTIPLES)) {
603
		    	        	if(date.getRawValue().equals(VALEURS_MULTIPLES)) {
587
		    	        		date.clearInvalid();
604
		    	        		date.clearInvalid();
588
		    	        	}
605
		    	        	}
589
		    	        case KEY_UP:
606
		    	        case KEY_UP:
590
		    	    	
607
		    	    	
591
		    	        break;
608
		    	        break;
592
	  	    	      
609
	  	    	      
593
	  	    	      case KEY_ENTER:	  	
610
	  	    	      case KEY_ENTER:	  	
594
	  	    	    		validerSaisie(Champs.DATE); 
611
	  	    	    		validerSaisie(Champs.DATE); 
595
	  	    	    	  break;
612
	  	    	    	  break;
596
	  	    	       
613
	  	    	       
597
	  	    	      default:
614
	  	    	      default:
598
	  					dateModifiee = true;
615
	  					dateModifiee = true;
599
					}
616
					}
600
				}
617
				}
601
		    });
618
		    });
602
		    
619
		    
603
		    date.addListener(new DatePickerListenerAdapter() {
620
		    date.addListener(new DatePickerListenerAdapter() {
604
 
621
 
605
				public void onSelect(DatePicker dataPicker, Date date) {
622
				public void onSelect(DatePicker dataPicker, Date date) {
606
					dateModifiee = true;
623
					dateModifiee = true;
607
				}
624
				}
608
		    });
625
		    });
609
		    
626
		    
610
		    station.addKeyPressListener(new EventCallback() {
627
		    station.addKeyPressListener(new EventCallback() {
611
 
628
 
612
				public void execute(EventObject e) {
629
				public void execute(EventObject e) {
613
					// TODO Auto-generated method stub
630
					// TODO Auto-generated method stub
614
					switch(e.getKey()) {
631
					switch(e.getKey()) {
615
	  	    	      
632
	  	    	      
616
						case KEY_ALT:
633
						case KEY_ALT:
617
		    	        case KEY_CTRL:
634
		    	        case KEY_CTRL:
618
		    	        case KEY_DOWN:
635
		    	        case KEY_DOWN:
619
		    	        case KEY_END:
636
		    	        case KEY_END:
620
		    	        case KEY_ESCAPE:
637
		    	        case KEY_ESCAPE:
621
		    	        case KEY_HOME:
638
		    	        case KEY_HOME:
622
		    	        case KEY_LEFT:
639
		    	        case KEY_LEFT:
623
		    	        case KEY_PAGEDOWN:
640
		    	        case KEY_PAGEDOWN:
624
		    	        case KEY_PAGEUP:
641
		    	        case KEY_PAGEUP:
625
		    	        case KEY_RIGHT:
642
		    	        case KEY_RIGHT:
626
		    	        case KEY_SHIFT:
643
		    	        case KEY_SHIFT:
627
		    	        case KEY_TAB:
644
		    	        case KEY_TAB:
628
		    	        case KEY_UP:
645
		    	        case KEY_UP:
629
		    	      break;
646
		    	      break;
630
		    	      
647
		    	      
631
	  	    	      case KEY_ENTER:	  	    	    	  
648
	  	    	      case KEY_ENTER:	  	    	    	  
632
	  	    	    		validerSaisie(Champs.STATION); 	    	    		 
649
	  	    	    		validerSaisie(Champs.STATION); 	    	    		 
633
	  	    	    	  break;
650
	  	    	    	  break;
634
	  	    	       
651
	  	    	       
635
	  	    	      default:
652
	  	    	      default:
636
	  	    	    	  stationModifiee = true;
653
	  	    	    	  stationModifiee = true;
637
					}
654
					}
638
				}
655
				}
639
		    });
656
		    });
640
		    
657
		    
641
		    
658
		    
642
			
659
			
643
			// Listener completion espece 
660
			// Listener completion espece 
644
			espece.addListener(new ComboBoxListenerAdapter() {  
661
			espece.addListener(new ComboBoxListenerAdapter() {  
645
	             public void onSelect(ComboBox comboBox, Record record, int index) {  
662
	             public void onSelect(ComboBox comboBox, Record record, int index) {  
646
	            	 espece.setValue(record.getAsString("nom"));
663
	            	 espece.setValue(record.getAsString("nom"));
647
	            	 numeroNom=record.getAsString("numeroNom");
664
	            	 numeroNom=record.getAsString("numeroNom");
648
	                 selectionEspece=true;
665
	                 selectionEspece=true;
649
	                 observationMediateur.obtenirImageInformationExternes(numeroNom);
666
	                 observationMediateur.obtenirImageInformationExternes(numeroNom);
650
	             }  
667
	             }  
651
	         });  
668
	         });  
652
	         
669
	         
653
 
670
 
654
			ListenerConfig listenerConfigEspece=new ListenerConfig();
671
			ListenerConfig listenerConfigEspece=new ListenerConfig();
655
			listenerConfigEspece.setDelay(10);
672
			listenerConfigEspece.setDelay(10);
656
			listenerConfigEspece.setStopPropagation(false);
673
			listenerConfigEspece.setStopPropagation(false);
657
			listenerConfigEspece.setStopEvent(false);			
674
			listenerConfigEspece.setStopEvent(false);			
658
 
675
 
659
		
676
		
660
			espece.addKeyPressListener(new EventCallback()	{
677
			espece.addKeyPressListener(new EventCallback()	{
661
		    	
678
		    	
662
		    	    public void execute(EventObject e) {
679
		    	    public void execute(EventObject e) {
663
		    	    	
680
		    	    	
664
		    	    		  
681
		    	    		  
665
		    	    		  switch(e.getKey()) {
682
		    	    		  switch(e.getKey()) {
666
		    	    	      	    		  
683
		    	    	      	    		  
667
		    	    		  
684
		    	    		  
668
		    	    		  case KEY_ALT:
685
		    	    		  case KEY_ALT:
669
		    	    	      case KEY_CTRL:
686
		    	    	      case KEY_CTRL:
670
		    	    	      case KEY_DOWN:
687
		    	    	      case KEY_DOWN:
671
		    	    	      case KEY_END:
688
		    	    	      case KEY_END:
672
		    	    	      case KEY_ESCAPE:
689
		    	    	      case KEY_ESCAPE:
673
		    	    	      case KEY_HOME:
690
		    	    	      case KEY_HOME:
674
		    	    	      case KEY_LEFT:
691
		    	    	      case KEY_LEFT:
675
		    	    	      case KEY_PAGEDOWN:
692
		    	    	      case KEY_PAGEDOWN:
676
		    	    	      case KEY_PAGEUP:
693
		    	    	      case KEY_PAGEUP:
677
		    	    	      case KEY_RIGHT:
694
		    	    	      case KEY_RIGHT:
678
		    	    	      case KEY_SHIFT:
695
		    	    	      case KEY_SHIFT:
679
		    	    	      case KEY_TAB:
696
		    	    	      case KEY_TAB:
680
		    	    	      case KEY_UP:
697
		    	    	      case KEY_UP:
681
		    	    	    	
698
		    	    	    	
682
		    	    	        break;
699
		    	    	        break;
683
		    	    	      
700
		    	    	      
684
		    	    	      case KEY_ENTER:
701
		    	    	      case KEY_ENTER:
685
		    	    	    	  
702
		    	    	    	  
686
			    	    	    	if(selectionEspece) {
703
			    	    	    	if(selectionEspece) {
687
			    	    	    		especeModifiee = true;
704
			    	    	    		especeModifiee = true;
688
			    	    	    		selectionEspece=false;
705
			    	    	    		selectionEspece=false;
689
			    	    	    	}
706
			    	    	    	}
690
			    	    	    	else {
707
			    	    	    	else {
691
			    	    	    		validerSaisie(Champs.ESPECE); 	    	    		 
708
			    	    	    		validerSaisie(Champs.ESPECE); 	    	    		 
692
			    	    	    	}
709
			    	    	    	}
693
		    	    	    	
710
		    	    	    	
694
		    	    	    	  break;
711
		    	    	    	  break;
695
		    	    	       
712
		    	    	       
696
		    	    	      default:
713
		    	    	      default:
697
		    	    	    	  
714
		    	    	    	  
698
		    	    	    	  numeroNom="";
715
		    	    	    	  numeroNom="";
699
		    	    	    	  obtenirListeReferentielNom();
716
		    	    	    	  obtenirListeReferentielNom();
700
		    	    	    	  especeModifiee = true;
717
		    	    	    	  especeModifiee = true;
701
		    	    	    	  	    	    	        
718
		    	    	    	  	    	    	        
702
		    	    	        break;
719
		    	    	        break;
703
		    	    	    }
720
		    	    	    }
704
 
721
 
705
		    	    	 
722
		    	    	 
706
		    	    	
723
		    	    	
707
		     		}
724
		     		}
708
		    	 
725
		    	 
709
		    		},    listenerConfigEspece
726
		    		},    listenerConfigEspece
710
		    	
727
		    	
711
			);
728
			);
712
		    
729
		    
713
			lieudit.addKeyPressListener(new EventCallback() {
730
			lieudit.addKeyPressListener(new EventCallback() {
714
 
731
 
715
				public void execute(EventObject e) {
732
				public void execute(EventObject e) {
716
					// TODO Auto-generated method stub
733
					// TODO Auto-generated method stub
717
					switch(e.getKey()) {
734
					switch(e.getKey()) {
718
	  	    	      
735
	  	    	      
719
					case KEY_ALT:
736
					case KEY_ALT:
720
	  	    	      case KEY_CTRL:
737
	  	    	      case KEY_CTRL:
721
	  	    	      case KEY_DOWN:
738
	  	    	      case KEY_DOWN:
722
	  	    	      case KEY_END:
739
	  	    	      case KEY_END:
723
	  	    	      case KEY_ESCAPE:
740
	  	    	      case KEY_ESCAPE:
724
	  	    	      case KEY_HOME:
741
	  	    	      case KEY_HOME:
725
	  	    	      case KEY_LEFT:
742
	  	    	      case KEY_LEFT:
726
	  	    	      case KEY_PAGEDOWN:
743
	  	    	      case KEY_PAGEDOWN:
727
	  	    	      case KEY_PAGEUP:
744
	  	    	      case KEY_PAGEUP:
728
	  	    	      case KEY_RIGHT:
745
	  	    	      case KEY_RIGHT:
729
	  	    	      case KEY_SHIFT:
746
	  	    	      case KEY_SHIFT:
730
	  	    	      case KEY_TAB:
747
	  	    	      case KEY_TAB:
731
	  	    	      case KEY_UP:
748
	  	    	      case KEY_UP:
732
  	    	    	
749
  	    	    	
733
  	    	        break;
750
  	    	        break;
734
					
751
					
735
	  	    	      case KEY_ENTER:	  	    	    	  
752
	  	    	      case KEY_ENTER:	  	    	    	  
736
	  	    	    		validerSaisie(Champs.LIEUDIT); 	    	    		 
753
	  	    	    		validerSaisie(Champs.LIEUDIT); 	    	    		 
737
	  	    	    	  break;
754
	  	    	    	  break;
738
	  	    	       
755
	  	    	       
739
	  	    	      default:
756
	  	    	      default:
740
	  					lieuDitModifie = true;
757
	  					lieuDitModifie = true;
741
					}
758
					}
742
				}
759
				}
743
		    });
760
		    });
744
			
761
			
745
			milieu.addKeyPressListener(new EventCallback() {
762
			milieu.addKeyPressListener(new EventCallback() {
746
 
763
 
747
				public void execute(EventObject e) {
764
				public void execute(EventObject e) {
748
					// TODO Auto-generated method stub
765
					// TODO Auto-generated method stub
749
					switch(e.getKey()) {
766
					switch(e.getKey()) {
750
					
767
					
751
						case KEY_ALT:
768
						case KEY_ALT:
752
	  	    	      case KEY_CTRL:
769
	  	    	      case KEY_CTRL:
753
	  	    	      case KEY_DOWN:
770
	  	    	      case KEY_DOWN:
754
	  	    	      case KEY_END:
771
	  	    	      case KEY_END:
755
	  	    	      case KEY_ESCAPE:
772
	  	    	      case KEY_ESCAPE:
756
	  	    	      case KEY_HOME:
773
	  	    	      case KEY_HOME:
757
	  	    	      case KEY_LEFT:
774
	  	    	      case KEY_LEFT:
758
	  	    	      case KEY_PAGEDOWN:
775
	  	    	      case KEY_PAGEDOWN:
759
	  	    	      case KEY_PAGEUP:
776
	  	    	      case KEY_PAGEUP:
760
	  	    	      case KEY_RIGHT:
777
	  	    	      case KEY_RIGHT:
761
	  	    	      case KEY_SHIFT:
778
	  	    	      case KEY_SHIFT:
762
	  	    	      case KEY_TAB:
779
	  	    	      case KEY_TAB:
763
	  	    	      case KEY_UP:
780
	  	    	      case KEY_UP:
764
	  	    	    	
781
	  	    	    	
765
	  	    	        break;
782
	  	    	        break;
766
	  	    	      
783
	  	    	      
767
	  	    	      case KEY_ENTER:	  	    	    	  
784
	  	    	      case KEY_ENTER:	  	    	    	  
768
	  	    	    		validerSaisie(Champs.MILIEU); 	    	    		 
785
	  	    	    		validerSaisie(Champs.MILIEU); 	    	    		 
769
	  	    	    	  break;
786
	  	    	    	  break;
770
	  	    	       
787
	  	    	       
771
	  	    	      default:
788
	  	    	      default:
772
	  					milieuModifie = true;
789
	  					milieuModifie = true;
773
					}
790
					}
774
				}
791
				}
775
		    });
792
		    });
776
			
793
			
777
			comment.addKeyPressListener(new EventCallback() {
794
			comment.addKeyPressListener(new EventCallback() {
778
 
795
 
779
				public void execute(EventObject e) {
796
				public void execute(EventObject e) {
780
					switch(e.getKey()) { 
797
					switch(e.getKey()) { 
781
						case KEY_ALT:
798
						case KEY_ALT:
782
			    	      case KEY_CTRL:
799
			    	      case KEY_CTRL:
783
			    	      case KEY_DOWN:
800
			    	      case KEY_DOWN:
784
			    	      case KEY_END:
801
			    	      case KEY_END:
785
			    	      case KEY_ESCAPE:
802
			    	      case KEY_ESCAPE:
786
			    	      case KEY_HOME:
803
			    	      case KEY_HOME:
787
			    	      case KEY_LEFT:
804
			    	      case KEY_LEFT:
788
			    	      case KEY_PAGEDOWN:
805
			    	      case KEY_PAGEDOWN:
789
			    	      case KEY_PAGEUP:
806
			    	      case KEY_PAGEUP:
790
			    	      case KEY_RIGHT:
807
			    	      case KEY_RIGHT:
791
			    	      case KEY_SHIFT:
808
			    	      case KEY_SHIFT:
792
			    	      case KEY_TAB:
809
			    	      case KEY_TAB:
793
			    	      case KEY_UP:
810
			    	      case KEY_UP:
794
		    	    	
811
		    	    	
795
		    	        break;
812
		    	        break;
796
 
813
 
797
		    	        default:
814
		    	        default:
798
						commModifie = true;
815
						commModifie = true;
799
					}
816
					}
800
				}
817
				}
801
		    });
818
		    });
-
 
819
			
-
 
820
			tCoord = new Timer() {
-
 
821
 
-
 
822
				public void run() {
-
 
823
    	        	double[] coord = coordonneesValides();
-
 
824
    	        	if(!rechercheCommuneEnCours && coord != null && (longModifiee || latModifiee)) {
-
 
825
    	        		rechercheCommuneEnCours = true;
-
 
826
    	        		Ext.get(lienSelectionCommune.getElement()).mask("recherche");
-
 
827
    	        		observationMediateur.obtenirInformationCoord(r,LatLng.newInstance(coord[0], coord[1]));
-
 
828
    	        	}
-
 
829
				}
-
 
830
				
-
 
831
			};
802
			
832
			
803
			latitude.addKeyPressListener(new EventCallback() {
833
			latitude.addKeyPressListener(new EventCallback() {
804
 
834
 
805
				public void execute(EventObject e) {
835
				public void execute(EventObject e) {
806
					switch(e.getKey()) { 
836
					switch(e.getKey()) { 
807
						case KEY_ALT:
837
						case KEY_ALT:
808
			    	      case KEY_CTRL:
838
			    	      case KEY_CTRL:
809
			    	      case KEY_DOWN:
839
			    	      case KEY_DOWN:
810
			    	      case KEY_END:
840
			    	      case KEY_END:
811
			    	      case KEY_ESCAPE:
841
			    	      case KEY_ESCAPE:
812
			    	      case KEY_HOME:
842
			    	      case KEY_HOME:
813
			    	      case KEY_LEFT:
843
			    	      case KEY_LEFT:
814
			    	      case KEY_PAGEDOWN:
844
			    	      case KEY_PAGEDOWN:
815
			    	      case KEY_PAGEUP:
845
			    	      case KEY_PAGEUP:
816
			    	      case KEY_RIGHT:
846
			    	      case KEY_RIGHT:
817
			    	      case KEY_SHIFT:
847
			    	      case KEY_SHIFT:
818
			    	      case KEY_TAB:
848
			    	      case KEY_TAB:
819
			    	      case KEY_UP:
849
			    	      case KEY_UP:
820
		    	    	
850
		    	    	
821
		    	        break;
851
		    	        break;
822
		    	        
852
		    	        
823
			    	      case KEY_ENTER:	  	    	    	  
853
			    	      case KEY_ENTER:	  	    	    	  
824
	  	    	    		validerSaisie(Champs.LATITUDE); 	    	    		 
854
	  	    	    		validerSaisie(Champs.LATITUDE); 	    	    		 
825
	  	    	    	  break;
855
	  	    	    	  break;
826
 
856
 
827
		    	        default:
857
		    	        default:
828
						latModifiee = true;
858
						latModifiee = true;
-
 
859
	    	        	tCoord.cancel();
-
 
860
	    	        	tCoord.schedule(250);
829
					}
861
					}
830
				}
862
				}
831
		    });
863
		    });
832
			
864
			
833
			longitude.addKeyPressListener(new EventCallback() {
865
			longitude.addKeyPressListener(new EventCallback() {
834
 
866
 
835
				public void execute(EventObject e) {
867
				public void execute(EventObject e) {
836
					switch(e.getKey()) { 
868
					switch(e.getKey()) { 
-
 
869
					
837
						case KEY_ALT:
870
						case KEY_ALT:
838
			    	      case KEY_CTRL:
871
			    	      case KEY_CTRL:
839
			    	      case KEY_DOWN:
872
			    	      case KEY_DOWN:
840
			    	      case KEY_END:
873
			    	      case KEY_END:
841
			    	      case KEY_ESCAPE:
874
			    	      case KEY_ESCAPE:
842
			    	      case KEY_HOME:
875
			    	      case KEY_HOME:
843
			    	      case KEY_LEFT:
876
			    	      case KEY_LEFT:
844
			    	      case KEY_PAGEDOWN:
877
			    	      case KEY_PAGEDOWN:
845
			    	      case KEY_PAGEUP:
878
			    	      case KEY_PAGEUP:
846
			    	      case KEY_RIGHT:
879
			    	      case KEY_RIGHT:
847
			    	      case KEY_SHIFT:
880
			    	      case KEY_SHIFT:
848
			    	      case KEY_TAB:
-
 
849
			    	      case KEY_UP:
881
			    	      case KEY_UP:
850
		    	    	
-
 
-
 
882
			    	      case KEY_TAB:
851
		    	        break;
883
			    	      break;
852
		    	        
884
			    	      
853
			    	      case KEY_ENTER:	  	    	    	  
885
			    	      case KEY_ENTER:	  	    	    	  
854
		  	    	    		validerSaisie(Champs.LONGITUDE); 	    	    		 
886
		  	    	    		validerSaisie(Champs.LONGITUDE); 	    	    		 
855
		  	    	    	  break;
887
		  	    	    	break;
856
 
888
 
857
		    	        default:
889
		    	        default:
-
 
890
							longModifiee = true;
-
 
891
		    	        	tCoord.cancel();
858
						longModifiee = true;
892
		    	        	tCoord.schedule(250);
859
					}
893
					}
860
				}
894
				}
861
		    });
895
		    });
862
 
-
 
863
		  
-
 
864
 
896
 
865
		boutonOK.addListener(new ButtonListenerAdapter() {
897
		boutonOK.addListener(new ButtonListenerAdapter() {
866
			
898
			
867
			public void onClick(Button button, EventObject e) {
899
			public void onClick(Button button, EventObject e) {
868
		
900
		
869
				if(modification) {
901
				if(modification) {
870
					if(masseModification) {
902
					if(masseModification) {
871
							modifierObservationEnMasse(null);
903
							modifierObservationEnMasse(null);
872
					} else {
904
					} else {
873
						modifierObservation() ;
905
						modifierObservation() ;
874
					}
906
					}
875
				}
907
				}
876
				else {
908
				else {
877
					ajouterObservation();
909
					ajouterObservation();
878
				}
910
				}
879
				
911
				
880
				
912
				
881
			}
913
			}
882
			
914
			
883
		});
915
		});
884
		
916
		
885
		boutonAnnuler.addListener(new ButtonListenerAdapter() {
917
		boutonAnnuler.addListener(new ButtonListenerAdapter() {
886
			
918
			
887
			public void onClick(Button button, EventObject e) {
919
			public void onClick(Button button, EventObject e) {
888
				
920
				
889
				if(modification)
921
				if(modification)
890
				{
922
				{
891
					supprimerObservation() ;
923
					supprimerObservation() ;
892
				}
924
				}
893
				else
925
				else
894
				{
926
				{
895
					raz();
927
					raz();
896
				}
928
				}
897
				
-
 
898
				
-
 
899
			}
929
			}
900
			
930
			
901
		});
931
		});
902
		
932
		
903
		this.addListener(new ContainerListenerAdapter() {
933
		this.addListener(new ContainerListenerAdapter() {
904
			public void onAfterLayout(Container self) {
934
			public void onAfterLayout(Container self) {
905
				commune.focus();
935
				commune.focus();
906
			}
936
			}
907
		});	
937
		});	
908
		
938
		
909
	}
939
	}
910
	
940
	
911
	/**
941
	/**
912
	 * Validation de la saisie 
942
	 * Validation de la saisie 
913
	 */
943
	 */
914
	
944
	
915
	private void validerSaisie(Champs champs) {
945
	private void validerSaisie(Champs champs) {
916
		
946
		
917
		if(modification) {
947
		if(modification) {
918
			if(masseModification) {
948
			if(masseModification) {
919
					modifierObservationEnMasse(champs);
949
					modifierObservationEnMasse(champs);
920
			} else {
950
			} else {
921
				modifierObservation();
951
				modifierObservation();
922
			}
952
			}
923
			
953
			
924
			raz(champs);
954
			raz(champs);
925
		}
955
		}
926
		else {
956
		else {
927
			ajouterObservation();
957
			ajouterObservation();
928
			raz(champs);
958
			raz(champs);
929
		}
959
		}
930
	}
960
	}
931
	
961
	
932
	/**
962
	/**
933
	 * Desactive visuellement ce panneau
963
	 * Desactive visuellement ce panneau
934
	 */
964
	 */
935
	public void desactiverPanneau()
965
	public void desactiverPanneau()
936
	{
966
	{
937
		this.setDisabled(true) ;
967
		this.setDisabled(true) ;
938
	}
968
	}
939
	
969
	
940
	/**
970
	/**
941
	 * Active visuellement ce panneau
971
	 * Active visuellement ce panneau
942
	 */
972
	 */
943
	public void activerPanneau()
973
	public void activerPanneau()
944
	{
974
	{
945
		this.setDisabled(false) ;
975
		this.setDisabled(false) ;
946
	}
976
	}
947
 
977
 
948
	public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
978
	public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
949
		
979
		
950
		// si l'on a reçu une liste du referentiel commune (completion referentiel commune)
980
		// si l'on a reçu une liste du referentiel commune (completion referentiel commune)
951
			if(nouvelleDonnees instanceof ListeReferentielCommune)
981
			if(nouvelleDonnees instanceof ListeReferentielCommune)
952
			{
982
			{
953
				
983
				
954
					ListeReferentielCommune data = (ListeReferentielCommune) nouvelleDonnees ;
984
					ListeReferentielCommune data = (ListeReferentielCommune) nouvelleDonnees ;
955
					Object[][] communeData = new Object[data.size()][2];
985
					Object[][] communeData = new Object[data.size()][2];
956
					int i = 0 ;
986
					int i = 0 ;
957
				
987
				
958
					// on la parse et on récupère les informations quiç nous interessent
988
					// on la parse et on récupère les informations quiç nous interessent
959
					for (Iterator it = data.keySet().iterator(); it.hasNext();) 
989
					for (Iterator it = data.keySet().iterator(); it.hasNext();) 
960
					{
990
					{
961
						
991
						
962
						ReferentielCommune ref=(ReferentielCommune) data.get(it.next());
992
						ReferentielCommune ref=(ReferentielCommune) data.get(it.next());
963
						
993
						
964
						communeData[i][0]= ref.getCommune();
994
						communeData[i][0]= ref.getCommune();
965
						communeData[i][1]= ref.getDepartement();
995
						communeData[i][1]= ref.getDepartement();
966
						
996
						
967
																	
997
																	
968
						i++ ;
998
						i++ ;
969
					}
999
					}
970
					
1000
					
971
					   //	  creation du store
1001
					   //	  creation du store
972
					FieldDef defCommune = new StringFieldDef("commune");
1002
					FieldDef defCommune = new StringFieldDef("commune");
973
					FieldDef defDepartement = new StringFieldDef("departement");
1003
					FieldDef defDepartement = new StringFieldDef("departement");
974
					
1004
					
975
					
1005
					
976
					FieldDef[] defTab = { defCommune, defDepartement};
1006
					FieldDef[] defTab = { defCommune, defDepartement};
977
					
1007
					
978
					RecordDef rd = new RecordDef(defTab);
1008
					RecordDef rd = new RecordDef(defTab);
979
					
1009
					
980
					final MemoryProxy dataProxy = new MemoryProxy(communeData);
1010
					final MemoryProxy dataProxy = new MemoryProxy(communeData);
981
					final ArrayReader reader = new ArrayReader(rd);		
1011
					final ArrayReader reader = new ArrayReader(rd);		
982
					
1012
					
983
					Store store=new Store(dataProxy,reader);
1013
					Store store=new Store(dataProxy,reader);
984
					store.load() ;
1014
					store.load() ;
985
		
1015
		
986
					commune.setStore(store);
1016
					commune.setStore(store);
987
					commune.expand();
1017
					commune.expand();
988
			}
1018
			}
989
			
1019
			
990
			//			 si l'on a reçu une liste du référentiel nom (complétion referentiel nom)
1020
			//			 si l'on a reçu une liste du référentiel nom (complétion referentiel nom)
991
			
1021
			
992
			if(nouvelleDonnees instanceof ListeReferentielNom)
1022
			if(nouvelleDonnees instanceof ListeReferentielNom)
993
			{
1023
			{
994
				
1024
				
995
					ListeReferentielNom data = (ListeReferentielNom) nouvelleDonnees ;
1025
					ListeReferentielNom data = (ListeReferentielNom) nouvelleDonnees ;
996
					Object[][] nomData = new Object[data.size()][2];
1026
					Object[][] nomData = new Object[data.size()][2];
997
					int i = 0 ;
1027
					int i = 0 ;
998
				
1028
				
999
					// on la parse et on récupère les informations quiç nous interessent
1029
					// on la parse et on récupère les informations quiç nous interessent
1000
					for (Iterator it = data.keySet().iterator(); it.hasNext();) 
1030
					for (Iterator it = data.keySet().iterator(); it.hasNext();) 
1001
					{
1031
					{
1002
						
1032
						
1003
						ReferentielNom ref=(ReferentielNom) data.get(it.next());
1033
						ReferentielNom ref=(ReferentielNom) data.get(it.next());
1004
						
1034
						
1005
						nomData[i][0]= ref.getNom();
1035
						nomData[i][0]= ref.getNom();
1006
						nomData[i][1]= ref.getNumeroNom();
1036
						nomData[i][1]= ref.getNumeroNom();
1007
						
1037
						
1008
																	
1038
																	
1009
						i++ ;
1039
						i++ ;
1010
					}
1040
					}
1011
					
1041
					
1012
					   //	  creation du store
1042
					   //	  creation du store
1013
					FieldDef defNom = new StringFieldDef("nom");
1043
					FieldDef defNom = new StringFieldDef("nom");
1014
					FieldDef defNumeroNom = new StringFieldDef("numeroNom");
1044
					FieldDef defNumeroNom = new StringFieldDef("numeroNom");
1015
					
1045
					
1016
					
1046
					
1017
					FieldDef[] defTab = { defNom, defNumeroNom};
1047
					FieldDef[] defTab = { defNom, defNumeroNom};
1018
					
1048
					
1019
					RecordDef rd = new RecordDef(defTab);
1049
					RecordDef rd = new RecordDef(defTab);
1020
					
1050
					
1021
					final MemoryProxy dataProxy = new MemoryProxy(nomData);
1051
					final MemoryProxy dataProxy = new MemoryProxy(nomData);
1022
					final ArrayReader reader = new ArrayReader(rd);		
1052
					final ArrayReader reader = new ArrayReader(rd);		
1023
					
1053
					
1024
					Store store=new Store(dataProxy,reader);
1054
					Store store=new Store(dataProxy,reader);
1025
					store.load() ;
1055
					store.load() ;
1026
		
1056
		
1027
					espece.setStore(store);
1057
					espece.setStore(store);
1028
				
1058
				
1029
			}
1059
			}
1030
			
1060
			
1031
			// On recoit une observation dont on veut afficher le detail 
1061
			// On recoit une observation dont on veut afficher le detail 
1032
			
1062
			
1033
			if(nouvelleDonnees instanceof Observation)
1063
			if(nouvelleDonnees instanceof Observation)
1034
			{
1064
			{
1035
				Observation obs = (Observation)nouvelleDonnees ;
1065
				Observation obs = (Observation)nouvelleDonnees ;
1036
				afficherDetailsObservation(obs) ;
1066
				afficherDetailsObservation(obs) ;
1037
			}
1067
			}
1038
			
1068
			
1039
			if(nouvelleDonnees instanceof ListeObservation) {
1069
			if(nouvelleDonnees instanceof ListeObservation) {
1040
				ListeObservation listeObs = (ListeObservation)nouvelleDonnees;
1070
				ListeObservation listeObs = (ListeObservation)nouvelleDonnees;
1041
				calculerAfficherDifferences(listeObs);
1071
				calculerAfficherDifferences(listeObs);
1042
			}
1072
			}
1043
			
1073
			
1044
			// Sur Mise à jour ou suppression d'une suppression ?
1074
			// Sur Mise à jour ou suppression d'une suppression ?
1045
			
1075
			
1046
			if(nouvelleDonnees instanceof String)
1076
			if(nouvelleDonnees instanceof String)
1047
			{
1077
			{
1048
				String str = (String)nouvelleDonnees ;
1078
				String str = (String)nouvelleDonnees ;
1049
				observationMediateur.obtenirNombreObservation() ;
1079
				observationMediateur.obtenirNombreObservation() ;
1050
			}
1080
			}
1051
			
1081
			
1052
			if(nouvelleDonnees instanceof String[]) {
1082
			if(nouvelleDonnees instanceof String[]) {
1053
				String[] anumNom = (String[])nouvelleDonnees ;
1083
				String[] anumNom = (String[])nouvelleDonnees ;
1054
				numeroNom = anumNom[1];
1084
				numeroNom = anumNom[1];
1055
				espece.setValue(anumNom[0]);
1085
				espece.setValue(anumNom[0]);
1056
				setModification("false");
1086
				setModification("false");
1057
			}
1087
			}
1058
			
1088
			
1059
			if(nouvelleDonnees instanceof EntiteGeographiqueObservation)
1089
			if(nouvelleDonnees instanceof EntiteGeographiqueObservation)
1060
			{
1090
			{
1061
				EntiteGeographiqueObservation infosComm = (EntiteGeographiqueObservation)nouvelleDonnees ;
1091
				EntiteGeographiqueObservation infosComm = (EntiteGeographiqueObservation)nouvelleDonnees ;
-
 
1092
				if(rechercheCommuneEnCours) {
-
 
1093
					afficherIndicationCommune(infosComm);
-
 
1094
				} else {
1062
				rafraichirCommuneEtCoord(infosComm);
1095
					rafraichirCommuneEtCoord(infosComm);
-
 
1096
				}
1063
			}
1097
			}
1064
 
1098
 
1065
	}
1099
	}
1066
	
1100
	
-
 
1101
	
1067
	
1102
	private void afficherIndicationCommune(
1068
	private void rafraichirCommuneEtCoord(EntiteGeographiqueObservation infosCom) {
1103
			final EntiteGeographiqueObservation infosCom) {
-
 
1104
		
-
 
1105
		String nCommune = "";
-
 
1106
		if(infosCom != null && !infosCom.getCommune().trim().equals("")){
-
 
1107
			nCommune += infosCom.getCommune();
-
 
1108
			if(!infosCom.getIdLocalite().trim().equals(""))
-
 
1109
			nCommune += " ("+infosCom.getIdLocalite()+")";
-
 
1110
		}
-
 
1111
		lienSelectionCommune.setHtml("<a id=\"lien_selection_commune\" tabindex=\"9\">"+nCommune+"</a>");
-
 
1112
		lienSelectionCommune.setStyleName("img-curseur-depl");
-
 
1113
		Ext.get("lien_selection_commune").addListener("click",new EventCallback() {
-
 
1114
			public void execute(EventObject e) {
-
 
1115
				rafraichirCommune(infosCom);
-
 
1116
			}			
-
 
1117
		});
-
 
1118
		
-
 
1119
		Ext.get("lien_selection_commune").addListener("keypress",new EventCallback() {
-
 
1120
			public void execute(EventObject e) {
-
 
1121
				if(e.getCharCode() == KEY_ENTER) {
-
 
1122
					rafraichirCommune(infosCom);
-
 
1123
				}
-
 
1124
			}			
-
 
1125
		});
-
 
1126
		
-
 
1127
		Ext.get("lien_selection_commune").addListener("focus",new EventCallback() {
-
 
1128
			public void execute(EventObject e) {
-
 
1129
				Ext.get("lien_selection_commune").toggleClass("lien_sel");
-
 
1130
			}			
-
 
1131
		});
-
 
1132
		
-
 
1133
		Ext.get("lien_selection_commune").addListener("blur",new EventCallback() {
-
 
1134
			public void execute(EventObject e) {
-
 
1135
				Ext.get("lien_selection_commune").toggleClass("lien_sel");
-
 
1136
			}			
-
 
1137
		});
-
 
1138
 
-
 
1139
		Ext.get(lienSelectionCommune.getElement()).unmask();
-
 
1140
		rechercheCommuneEnCours = false;
-
 
1141
		latModifiee = false;
-
 
1142
		longModifiee = false;
-
 
1143
	}
-
 
1144
	
1069
		
1145
	private void rafraichirCommune(EntiteGeographiqueObservation infosCom) {
1070
		String nCommune = "";
1146
		String nCommune = "";
1071
 
1147
 
1072
		
1148
		
1073
		if(infosCom.getCommune() != null && !infosCom.getCommune().equals("")) {
1149
		if(infosCom.getCommune() != null && !infosCom.getCommune().equals("")) {
1074
			nCommune += infosCom.getCommune();
1150
			nCommune += infosCom.getCommune();
1075
		}
1151
		}
1076
		
1152
		
1077
		if(infosCom.getIdLocalite() != null && !infosCom.getIdLocalite().equals("")) {
1153
		if(infosCom.getIdLocalite() != null && !infosCom.getIdLocalite().equals("")) {
1078
			nCommune += " ("+infosCom.getIdLocalite()+")";
1154
			nCommune += " ("+infosCom.getIdLocalite()+")";
1079
			departement = infosCom.getIdLocalite();
1155
			departement = infosCom.getIdLocalite();
1080
		}
1156
		}
1081
		
-
 
1082
		commune.setValue(nCommune);
1157
		commune.setValue(nCommune);
-
 
1158
	}
-
 
1159
 
-
 
1160
	private void rafraichirCommuneEtCoord(EntiteGeographiqueObservation infosCom) {
-
 
1161
		
-
 
1162
		rafraichirCommune(infosCom);
1083
 
1163
 
1084
		if(infosCom.getLat() != null && !infosCom.getLat().equals("")) {
1164
		if(infosCom.getLat() != null && !infosCom.getLat().equals("")) {
1085
			latitude.setValue(infosCom.getLat());
1165
			latitude.setValue(infosCom.getLat());
1086
		}
1166
		}
1087
 
1167
 
1088
		if(infosCom.getLon() != null && !infosCom.getLon().equals("")) {
1168
		if(infosCom.getLon() != null && !infosCom.getLon().equals("")) {
1089
			longitude.setValue(infosCom.getLon());
1169
			longitude.setValue(infosCom.getLon());
1090
		}
1170
		}
1091
		
1171
		
1092
		coordPanel.setVisible(true);
1172
		coordPanel.setVisible(true);
1093
		
1173
		
1094
		latModifiee = true;
1174
		latModifiee = false;
1095
		longModifiee = true;
1175
		longModifiee = false;
1096
	}
1176
	}
1097
 
1177
 
1098
	public void obtenirListeReferentielCommune() {
1178
	public void obtenirListeReferentielCommune() {
1099
		
1179
		
1100
	 String com=commune.getText()/*.replaceAll(" ","/")*/;
1180
	 String com=commune.getText();
1101
	 com=com.replaceAll("%","");
1181
	 com=com.replaceAll("%","");
1102
		  
1182
		  
1103
	 observationMediateur.obtenirListeReferentielCommune(this,com);
1183
	 observationMediateur.obtenirListeReferentielCommune(this,com);
1104
	 
1184
	 
1105
	}
1185
	}
1106
	
1186
	
1107
 
1187
 
1108
	public void obtenirListeReferentielNom() {
1188
	public void obtenirListeReferentielNom() {
1109
	 
1189
	 
1110
	  String esp=espece.getText().replaceAll(" ","/*");
1190
	  String esp=espece.getText().replaceAll(" ","/*");
1111
	  esp=esp.replaceAll("%","");
1191
	  esp=esp.replaceAll("%","");
1112
		
1192
		
1113
	  observationMediateur.obtenirListeReferentielNom(this,esp);
1193
	  observationMediateur.obtenirListeReferentielNom(this,esp);
1114
	 
1194
	 
1115
	}
1195
	}
1116
   
1196
   
1117
 
1197
 
1118
	public void ajouterObservation() {
1198
	public void ajouterObservation() {
1119
		
1199
		
1120
		if(departement.equals("000null") || departement.equals("")) {
1200
		if(departement.equals("000null") || departement.equals("")) {
1121
			String[] depCom = commune.getText().split(" ");
1201
			String[] depCom = commune.getText().split(" ");
1122
			if(depCom.length > 1) {
1202
			if(depCom.length > 1) {
1123
				String dep = depCom[1].replace('(', ' ');
1203
				String dep = depCom[1].replace('(', ' ');
1124
				dep =dep.replace(')', ' ');
1204
				dep =dep.replace(')', ' ');
1125
				dep = dep.trim();
1205
				dep = dep.trim();
1126
				dep = dep.replace('\\',' ');
1206
				dep = dep.replace('\\',' ');
1127
				dep = dep.trim();
1207
				dep = dep.trim();
1128
				
1208
				
1129
				try
1209
				try
1130
				{
1210
				{
1131
					int nDep = Integer.parseInt(dep);
1211
					int nDep = Integer.parseInt(dep);
1132
					if(nDep > 0 && nDep < 110) {
1212
					if(nDep > 0 && nDep < 110) {
1133
						departement = dep ;
1213
						departement = dep ;
1134
					}
1214
					}
1135
				}
1215
				}
1136
				catch(NumberFormatException e)
1216
				catch(NumberFormatException e)
1137
				{
1217
				{
1138
					departement = "" ;
1218
					departement = "" ;
1139
				}
1219
				}
1140
			}
1220
			}
1141
		}
1221
		}
1142
 
1222
 
1143
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());	
1223
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());	
1144
		
1224
		
1145
		String[] coords = getValeurCoordonnees();
1225
		String[] coords = getValeurCoordonnees();
1146
		
1226
		
1147
		obs.setCoordonneeX(coords[0]);
1227
		obs.setCoordonneeX(coords[0]);
1148
		obs.setCoordonneeY(coords[1]);
1228
		obs.setCoordonneeY(coords[1]);
1149
		
1229
		
1150
		observationMediateur.ajouterObservation(obs);
1230
		observationMediateur.ajouterObservation(obs);
1151
	}
1231
	}
1152
	
1232
	
1153
	private void modifierObservation() {
1233
	private void modifierObservation() {
1154
		
1234
		
1155
		if(departement.equals("000null") || departement.equals("")) {
1235
		if(departement.equals("000null") || departement.equals("")) {
1156
			String[] depCom = commune.getText().split(" ");
1236
			String[] depCom = commune.getText().split(" ");
1157
			if(depCom.length > 1) {
1237
			if(depCom.length > 1) {
1158
				String dep = depCom[1].replace('(', ' ');
1238
				String dep = depCom[1].replace('(', ' ');
1159
				dep =dep.replace(')', ' ');
1239
				dep =dep.replace(')', ' ');
1160
				dep = dep.trim();
1240
				dep = dep.trim();
1161
				dep = dep.replace('\\',' ');
1241
				dep = dep.replace('\\',' ');
1162
				dep = dep.trim();
1242
				dep = dep.trim();
1163
				
1243
				
1164
				try
1244
				try
1165
				{
1245
				{
1166
					int nDep = Integer.parseInt(dep);
1246
					int nDep = Integer.parseInt(dep);
1167
					if(nDep > 0 && nDep < 110) {
1247
					if(nDep > 0 && nDep < 110) {
1168
						departement = dep ;
1248
						departement = dep ;
1169
					}
1249
					}
1170
				}
1250
				}
1171
				catch(NumberFormatException e)
1251
				catch(NumberFormatException e)
1172
				{
1252
				{
1173
					departement = "" ;
1253
					departement = "" ;
1174
				}
1254
				}
1175
			}
1255
			}
1176
		}
1256
		}
1177
		
1257
		
1178
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());
1258
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getRawValue());
1179
		obs.setNumeroOrdre(numeroOrdre);
1259
		obs.setNumeroOrdre(numeroOrdre);
1180
		
1260
		
1181
		String[] coords = getValeurCoordonnees();
1261
		String[] coords = getValeurCoordonnees();
1182
		
1262
		
1183
		obs.setCoordonneeX(coords[0]);
1263
		obs.setCoordonneeX(coords[0]);
1184
		obs.setCoordonneeY(coords[1]);
1264
		obs.setCoordonneeY(coords[1]);
1185
		
1265
		
1186
		observationMediateur.modifierObservation(obs);
1266
		observationMediateur.modifierObservation(obs);
1187
 
1267
 
1188
		selecteurMode.setValue("création");
1268
		selecteurMode.setValue("création");
1189
		setModification("false");
1269
		setModification("false");
1190
		
1270
		
1191
	}
1271
	}
1192
	
1272
	
1193
	private void modifierObservationEnMasse(Champs champModifie) {
1273
	private void modifierObservationEnMasse(Champs champModifie) {
1194
		String communeM = null;
1274
		String communeM = null;
1195
		String departementM = null;
1275
		String departementM = null;
1196
		String numNomSelM = null;
1276
		String numNomSelM = null;
1197
		String lieuDitM = null;
1277
		String lieuDitM = null;
1198
		String stationM = null;
1278
		String stationM = null;
1199
		String milieuM = null;
1279
		String milieuM = null;
1200
		String dateM = null;
1280
		String dateM = null;
1201
		String especeM = null;
1281
		String especeM = null;
1202
		String commM = null; 
1282
		String commM = null; 
1203
		String latM = null;
1283
		String latM = null;
1204
		String longM = null;
1284
		String longM = null;
1205
		
1285
		
1206
		String champs = modeleMessageModif;
1286
		String champs = modeleMessageModif;
1207
			
1287
			
1208
		if(communeModifiee) {
1288
		if(communeModifiee) {
1209
			communeM = commune.getText();
1289
			communeM = commune.getText();
1210
			
1290
			
1211
			if(departement.equals("000null") || departement.equals("")) {
1291
			if(departement.equals("000null") || departement.equals("")) {
1212
				String[] depCom = commune.getText().split(" ");
1292
				String[] depCom = commune.getText().split(" ");
1213
				if(depCom.length > 1) {
1293
				if(depCom.length > 1) {
1214
					String dep = depCom[1].replace('(', ' ');
1294
					String dep = depCom[1].replace('(', ' ');
1215
					dep =dep.replace(')', ' ');
1295
					dep =dep.replace(')', ' ');
1216
					dep = dep.trim();
1296
					dep = dep.trim();
1217
					dep = dep.replace('\\',' ');
1297
					dep = dep.replace('\\',' ');
1218
					dep = dep.trim();
1298
					dep = dep.trim();
1219
					
1299
					
1220
					try
1300
					try
1221
					{
1301
					{
1222
						int nDep = Integer.parseInt(dep);
1302
						int nDep = Integer.parseInt(dep);
1223
						if(nDep > 0 && nDep < 110) {
1303
						if(nDep > 0 && nDep < 110) {
1224
							departement = dep ;
1304
							departement = dep ;
1225
						}
1305
						}
1226
					}
1306
					}
1227
					catch(NumberFormatException e)
1307
					catch(NumberFormatException e)
1228
					{
1308
					{
1229
						departement = "" ;
1309
						departement = "" ;
1230
					}
1310
					}
1231
				}
1311
				}
1232
			}
1312
			}
1233
			
1313
			
1234
			departementM = departement;
1314
			departementM = departement;
1235
		} else {
1315
		} else {
1236
			champs = champs.replaceAll("commune", "");
1316
			champs = champs.replaceAll("commune", "");
1237
		}
1317
		}
1238
		
1318
		
1239
		if(lieuDitModifie) {
1319
		if(lieuDitModifie) {
1240
			lieuDitM = lieudit.getText();
1320
			lieuDitM = lieudit.getText();
1241
		}else {
1321
		}else {
1242
			champs = champs.replaceAll(":lieu-dit", "");
1322
			champs = champs.replaceAll(":lieu-dit", "");
1243
		}
1323
		}
1244
		
1324
		
1245
		if(stationModifiee) {
1325
		if(stationModifiee) {
1246
			stationM = station.getText();
1326
			stationM = station.getText();
1247
		}else {
1327
		}else {
1248
			champs = champs.replaceAll(":station", "");
1328
			champs = champs.replaceAll(":station", "");
1249
		}
1329
		}
1250
 
1330
 
1251
		if(milieuModifie) {
1331
		if(milieuModifie) {
1252
			milieuM = milieu.getText();
1332
			milieuM = milieu.getText();
1253
		}else {
1333
		}else {
1254
			champs = champs.replaceAll(":milieu", "");
1334
			champs = champs.replaceAll(":milieu", "");
1255
		}
1335
		}
1256
 
1336
 
1257
		if(dateModifiee && !date.getRawValue().equals(VALEURS_MULTIPLES)) {
1337
		if(dateModifiee && !date.getRawValue().equals(VALEURS_MULTIPLES)) {
1258
			dateM = date.getRawValue();
1338
			dateM = date.getRawValue();
1259
		}else {
1339
		}else {
1260
			champs = champs.replaceAll(":date", "");
1340
			champs = champs.replaceAll(":date", "");
1261
		}
1341
		}
1262
 
1342
 
1263
		if(especeModifiee) {
1343
		if(especeModifiee) {
1264
			especeM = espece.getText();
1344
			especeM = espece.getText();
1265
			numNomSelM = numeroNom;
1345
			numNomSelM = numeroNom;
1266
		}else {
1346
		}else {
1267
			champs = champs.replaceAll(":espece", "");
1347
			champs = champs.replaceAll(":espece", "");
1268
		}
1348
		}
1269
 
1349
 
1270
		if(commModifie) {
1350
		if(commModifie) {
1271
			commM = comment.getText();
1351
			commM = comment.getText();
1272
		}else {
1352
		}else {
1273
			champs = champs.replaceAll(":commentaire", "");
1353
			champs = champs.replaceAll(":commentaire", "");
1274
		}
1354
		}
1275
		
1355
		
1276
		if(latModifiee) {
1356
		if(latModifiee) {
1277
			latM = latitude.getText();
1357
			latM = latitude.getText();
1278
		}else {
1358
		}else {
1279
			champs = champs.replaceAll(":latitude", "");
1359
			champs = champs.replaceAll(":latitude", "");
1280
		}
1360
		}
1281
		
1361
		
1282
		if(longModifiee) {
1362
		if(longModifiee) {
1283
			longM = longitude.getText();
1363
			longM = longitude.getText();
1284
		}else {
1364
		}else {
1285
			champs = champs.replaceAll(":longitude", "");
1365
			champs = champs.replaceAll(":longitude", "");
1286
		}
1366
		}
1287
		
1367
		
1288
		champs = champs.replaceAll(":",", ");
1368
		champs = champs.replaceAll(":",", ");
1289
		if(champs.startsWith(",")) {
1369
		if(champs.startsWith(",")) {
1290
			champs = champs.replaceFirst(",", "");
1370
			champs = champs.replaceFirst(",", "");
1291
		}
1371
		}
1292
		
1372
		
1293
		String message = "Voulez vous modifier le(s) champ(s) suivant(s) : "+champs+"   pour les observations selectionnées ?" ;
1373
		String message = "Voulez vous modifier le(s) champ(s) suivant(s) : "+champs+"   pour les observations selectionnées ?" ;
1294
		
1374
		
1295
		if(champs.trim().equals("")) {
1375
		if(champs.trim().equals("")) {
1296
			Window.alert("Aucun champ n'a été modifié");
1376
			Window.alert("Aucun champ n'a été modifié");
1297
		} else {
1377
		} else {
1298
			Observation obs = new Observation(especeM,numNomSelM,communeM,departementM,lieuDitM,stationM,milieuM, commM,dateM);
1378
			Observation obs = new Observation(especeM,numNomSelM,communeM,departementM,lieuDitM,stationM,milieuM, commM,dateM);
1299
			obs.setNumeroOrdre(numeroOrdre);
1379
			obs.setNumeroOrdre(numeroOrdre);
1300
			obs.setCoordonneeX(latM);
1380
			obs.setCoordonneeX(latM);
1301
			obs.setCoordonneeY(longM);
1381
			obs.setCoordonneeY(longM);
1302
			if(Window.confirm(message)) {
1382
			if(Window.confirm(message)) {
1303
				observationMediateur.modifierObservationEnMasse(obs);
1383
				observationMediateur.modifierObservationEnMasse(obs);
1304
				reinitialiserValeurModifiees();
1384
				reinitialiserValeurModifiees();
1305
			}
1385
			}
1306
		}
1386
		}
1307
	}
1387
	}
1308
	
1388
	
1309
	private void supprimerObservation() {
1389
	private void supprimerObservation() {
1310
		
1390
		
1311
		observationMediateur.supprimerObservation(this, numeroOrdre);
1391
		observationMediateur.supprimerObservation(this, numeroOrdre);
1312
	}
1392
	}
1313
 
1393
 
1314
	
1394
	
1315
	public void afficherDetailsObservation(Observation obs)
1395
	public void afficherDetailsObservation(Observation obs)
1316
	{
1396
	{
1317
		raz() ;
1397
		raz() ;
1318
		String idLoc ;
1398
		String idLoc ;
1319
		if(obs.getIdentifiantLocalite() != VALEURS_MULTIPLES) {
1399
		if(obs.getIdentifiantLocalite() != VALEURS_MULTIPLES) {
1320
			idLoc =obs.getIdentifiantLocalite().replaceAll(" ","/");
1400
			idLoc =obs.getIdentifiantLocalite().replaceAll(" ","/");
1321
			idLoc = idLoc.replaceAll("%","");
1401
			idLoc = idLoc.replaceAll("%","");
1322
			idLoc = idLoc.replaceAll("\"","");
1402
			idLoc = idLoc.replaceAll("\"","");
1323
			idLoc = idLoc.replace('\\',' ');
1403
			idLoc = idLoc.replace('\\',' ');
1324
			idLoc = idLoc.trim();
1404
			idLoc = idLoc.trim();
1325
		} else {
1405
		} else {
1326
			idLoc = obs.getIdentifiantLocalite();
1406
			idLoc = obs.getIdentifiantLocalite();
1327
		}
1407
		}
1328
		
1408
		
1329
		if(!obs.getDate().equals("null") && !obs.getDate().equals("000null") && !obs.getDate().equals(VALEURS_MULTIPLES)) {
1409
		if(!obs.getDate().equals("null") && !obs.getDate().equals("000null") && !obs.getDate().equals(VALEURS_MULTIPLES)) {
1330
			String[] dateEtHeure = obs.getDate().split(" ", 2);
1410
			String[] dateEtHeure = obs.getDate().split(" ", 2);
1331
			if(verifierFormatDate(dateEtHeure[0])) {
1411
			if(verifierFormatDate(dateEtHeure[0])) {
1332
				date.setValue(dateEtHeure[0]) ;
1412
				date.setValue(dateEtHeure[0]) ;
1333
			}
1413
			}
1334
			else
1414
			else
1335
			{
1415
			{
1336
				date.setRawValue(""); 
1416
				date.setRawValue(""); 
1337
			}
1417
			}
1338
		} else {
1418
		} else {
1339
			date.setRawValue(VALEURS_MULTIPLES);
1419
			date.setRawValue(VALEURS_MULTIPLES);
1340
			date.clearInvalid();
1420
			date.clearInvalid();
1341
		}
1421
		}
1342
		if(!obs.getLieudit().equals("null") && !obs.getLieudit().equals("000null")) {
1422
		if(!obs.getLieudit().equals("null") && !obs.getLieudit().equals("000null")) {
1343
			lieudit.setValue(obs.getLieudit()) ;
1423
			lieudit.setValue(obs.getLieudit()) ;
1344
		}
1424
		}
1345
		if(!obs.getStation().equals("null") && !obs.getStation().equals("000null")) {
1425
		if(!obs.getStation().equals("null") && !obs.getStation().equals("000null")) {
1346
			station.setValue(obs.getStation()) ;
1426
			station.setValue(obs.getStation()) ;
1347
		}
1427
		}
1348
		if(!obs.getMilieu().equals("null") && !obs.getMilieu().equals("000null")) {
1428
		if(!obs.getMilieu().equals("null") && !obs.getMilieu().equals("000null")) {
1349
			milieu.setValue(obs.getMilieu()) ;
1429
			milieu.setValue(obs.getMilieu()) ;
1350
		}
1430
		}
1351
		if(!obs.getCommentaire().equals("null") && !obs.getCommentaire().equals("000null")) {
1431
		if(!obs.getCommentaire().equals("null") && !obs.getCommentaire().equals("000null")) {
1352
			comment.setValue(obs.getCommentaire()) ;
1432
			comment.setValue(obs.getCommentaire()) ;
1353
		}
1433
		}
1354
		if(!obs.getLocalite().equals("null") && !obs.getLocalite().equals("000null")) {
1434
		if(!obs.getLocalite().equals("null") && !obs.getLocalite().equals("000null")) {
1355
			if(!idLoc.equals("000null")) {
1435
			if(!idLoc.equals("000null")) {
1356
				if(!idLoc.equals(VALEURS_MULTIPLES)) {
1436
				if(!idLoc.equals(VALEURS_MULTIPLES)) {
1357
					commune.setValue(obs.getLocalite()+" ("+idLoc+")") ;
1437
					commune.setValue(obs.getLocalite()+" ("+idLoc+")") ;
1358
				} else {
1438
				} else {
1359
					commune.setValue(VALEURS_MULTIPLES);
1439
					commune.setValue(VALEURS_MULTIPLES);
1360
				}
1440
				}
1361
			}
1441
			}
1362
			else
1442
			else
1363
			{
1443
			{
1364
				commune.setValue(obs.getLocalite());
1444
				commune.setValue(obs.getLocalite());
1365
			}
1445
			}
1366
		}
1446
		}
1367
		if(!obs.getIdentifiantLocalite().equals("null") && !obs.getIdentifiantLocalite().equals("000null")) {
1447
		if(!obs.getIdentifiantLocalite().equals("null") && !obs.getIdentifiantLocalite().equals("000null")) {
1368
			departement = idLoc;
1448
			departement = idLoc;
1369
		}
1449
		}
1370
		if(!obs.getNomSaisi().equals("null") && !obs.getNomSaisi().equals("000null")) {
1450
		if(!obs.getNomSaisi().equals("null") && !obs.getNomSaisi().equals("000null")) {
1371
			espece.setValue(obs.getNomSaisi()) ;
1451
			espece.setValue(obs.getNomSaisi()) ;
1372
		}
1452
		}
1373
		if(!obs.getNumeroNomenclaturalSaisi().equals("null") && !obs.getNumeroNomenclaturalSaisi().equals("000null")) {
1453
		if(!obs.getNumeroNomenclaturalSaisi().equals("null") && !obs.getNumeroNomenclaturalSaisi().equals("000null")) {
1374
			numeroNom = obs.getNumeroNomenclaturalSaisi() ;
1454
			numeroNom = obs.getNumeroNomenclaturalSaisi() ;
1375
		}
1455
		}
1376
		if(!obs.getNumeroOrdre().equals("null") && !obs.getNumeroOrdre().equals("000nu2ll")) {
1456
		if(!obs.getNumeroOrdre().equals("null") && !obs.getNumeroOrdre().equals("000nu2ll")) {
1377
			numeroOrdre = obs.getNumeroOrdre() ;
1457
			numeroOrdre = obs.getNumeroOrdre() ;
1378
		}
1458
		}
1379
		
1459
		
1380
		if(!obs.getCoordonneeX().equals("null") && !obs.getCoordonneeX().equals("000null")
1460
		if(!obs.getCoordonneeX().equals("null") && !obs.getCoordonneeX().equals("000null")
1381
				&& !obs.getCoordonneeY().equals("null") && !obs.getCoordonneeY().equals("000null")) {
1461
				&& !obs.getCoordonneeY().equals("null") && !obs.getCoordonneeY().equals("000null")) {
1382
			latitude.setValue(obs.getCoordonneeX()) ;
1462
			latitude.setValue(obs.getCoordonneeX()) ;
1383
			longitude.setValue(obs.getCoordonneeY()) ;
1463
			longitude.setValue(obs.getCoordonneeY()) ;
1384
		}	
1464
		}	
1385
	}
1465
	}
1386
	
1466
	
1387
	
1467
	
1388
	public void raz()
1468
	public void raz()
1389
	{
1469
	{
1390
		raz(Champs.TOUT);
1470
		raz(Champs.TOUT);
1391
		
1471
		
1392
	}
1472
	}
1393
	public void raz(Champs champs)
1473
	public void raz(Champs champs)
1394
	{
1474
	{
1395
		switch (champs) {
1475
		switch (champs) {
1396
		
1476
		
1397
		
1477
		
1398
			case DATE:
1478
			case DATE:
1399
				date.reset() ;
1479
				date.reset() ;
1400
				break;
1480
				break;
1401
		
1481
		
1402
			case LIEUDIT:
1482
			case LIEUDIT:
1403
				lieudit.reset() ;
1483
				lieudit.reset() ;
1404
				break;
1484
				break;
1405
		
1485
		
1406
			case STATION:
1486
			case STATION:
1407
				station.reset() ;
1487
				station.reset() ;
1408
				break;
1488
				break;
1409
		
1489
		
1410
			case MILIEU:
1490
			case MILIEU:
1411
				milieu.reset() ;
1491
				milieu.reset() ;
1412
				break;
1492
				break;
1413
		
1493
		
1414
			case COMMENT:
1494
			case COMMENT:
1415
				comment.reset() ;
1495
				comment.reset() ;
1416
				break;
1496
				break;
1417
 
1497
 
1418
 
1498
 
1419
			case COMMUNE:
1499
			case COMMUNE:
1420
				commune.reset() ;
1500
				commune.reset() ;
1421
				departement ="";
1501
				departement ="";
-
 
1502
				latitude.reset();
-
 
1503
				longitude.reset();
1422
				break;
1504
				break;
1423
				
1505
				
1424
			case ESPECE:
1506
			case ESPECE:
1425
				espece.reset();
1507
				espece.reset();
1426
				numeroNom = "" ;
1508
				numeroNom = "" ;
1427
				numeroOrdre = "";
1509
				numeroOrdre = "";
1428
				break;
1510
				break;
1429
				
1511
				
1430
			case LATITUDE:
1512
			case LATITUDE:
1431
				latitude.reset();
1513
				latitude.reset();
-
 
1514
				afficherIndicationCommune(null);
1432
				break;
1515
				break;
1433
				
1516
				
1434
			case LONGITUDE:
1517
			case LONGITUDE:
1435
				longitude.reset();
1518
				longitude.reset();
-
 
1519
				afficherIndicationCommune(null);
1436
				break;
1520
				break;
1437
				
1521
				
1438
			case TOUT:
1522
			case TOUT:
1439
				commune.reset();
1523
				commune.reset();
1440
				date.reset() ;
1524
				date.reset() ;
1441
				lieudit.reset() ;
1525
				lieudit.reset() ;
1442
				station.reset() ;
1526
				station.reset() ;
1443
				milieu.reset() ;
1527
				milieu.reset() ;
1444
				comment.reset() ;
1528
				comment.reset() ;
1445
				milieu.reset() ;
1529
				milieu.reset() ;
1446
				latitude.reset();
1530
				latitude.reset();
1447
				longitude.reset();
1531
				longitude.reset();
1448
				departement ="";
1532
				departement ="";
1449
				espece.reset();
1533
				espece.reset();
1450
				numeroNom = "" ;
1534
				numeroNom = "" ;
1451
				numeroOrdre = "";
1535
				numeroOrdre = "";
-
 
1536
				afficherIndicationCommune(null);
1452
				break;
1537
				break;
1453
 
1538
 
1454
		}
1539
		}
1455
		
1540
		
1456
	}
1541
	}
1457
	
1542
	
1458
	private void setModification(String mode)
1543
	private void setModification(String mode)
1459
	{
1544
	{
1460
		if(mode.equals("true")) {
1545
		if(mode.equals("true")) {
1461
 
1546
 
1462
			boutonOK.setText("Modifier") ;
1547
			boutonOK.setText("Modifier") ;
1463
			setTitle("Modification") ;
1548
			setTitle("Modification") ;
1464
			boutonAnnuler.setText("Supprimer") ;
1549
			boutonAnnuler.setText("Supprimer") ;
1465
			modification = true ;
1550
			modification = true ;
1466
			selecteurMode.removeClass("x-selec-crea") ;
1551
			selecteurMode.removeClass("x-selec-crea") ;
1467
			selecteurMode.setCls("x-selec-modif") ;
1552
			selecteurMode.setCls("x-selec-modif") ;
1468
			observationMediateur.onModeModification();
1553
			observationMediateur.onModeModification();
1469
		}
1554
		}
1470
		else
1555
		else
1471
		{
1556
		{
1472
			boutonOK.setText("Créer") ;
1557
			boutonOK.setText("Créer") ;
1473
			setTitle("Saisir") ;
1558
			setTitle("Saisir") ;
1474
			boutonAnnuler.setText("Réinitialiser") ;
1559
			boutonAnnuler.setText("Réinitialiser") ;
1475
			modification = false ;
1560
			modification = false ;
1476
			selecteurMode.removeClass("x-selec-modif") ;
1561
			selecteurMode.removeClass("x-selec-modif") ;
1477
			selecteurMode.setCls("x-selec-crea") ;
1562
			selecteurMode.setCls("x-selec-crea") ;
1478
			observationMediateur.onModeCreation();
1563
			observationMediateur.onModeCreation();
1479
		}	
1564
		}	
1480
	}
1565
	}
1481
	
1566
	
1482
	/**
1567
	/**
1483
	 * renvoie vrai si on est en mode modification, faux si on est en mode création
1568
	 * renvoie vrai si on est en mode modification, faux si on est en mode création
1484
	 * @return
1569
	 * @return
1485
	 */
1570
	 */
1486
	public boolean getModification()
1571
	public boolean getModification()
1487
	{
1572
	{
1488
		return modification ;
1573
		return modification ;
1489
	}
1574
	}
1490
	
1575
	
1491
	/**
1576
	/**
1492
	 * renvoie vrai si on est en mode modification de masse, faux sinon
1577
	 * renvoie vrai si on est en mode modification de masse, faux sinon
1493
	 * @return
1578
	 * @return
1494
	 */
1579
	 */
1495
	public boolean getMasseModification()
1580
	public boolean getMasseModification()
1496
	{
1581
	{
1497
		return masseModification ;
1582
		return masseModification ;
1498
	}
1583
	}
1499
	
1584
	
1500
	public boolean verifierFormatDate(String date) {
1585
	public boolean verifierFormatDate(String date) {
1501
		
1586
		
1502
		String regex = "[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}" ;
1587
		String regex = "[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}" ;
1503
		if(date.matches(regex) && !date.equals("0000-00-00")) {
1588
		if(date.matches(regex) && !date.equals("0000-00-00")) {
1504
			return true ;
1589
			return true ;
1505
		}
1590
		}
1506
		else {
1591
		else {
1507
			return false;
1592
			return false;
1508
		}
1593
		}
1509
	}
1594
	}
1510
 
1595
 
1511
	public void setMasseModification(boolean masseModification) {
1596
	public void setMasseModification(boolean masseModification) {
1512
		this.masseModification = masseModification;
1597
		this.masseModification = masseModification;
1513
		if(masseModification) {
1598
		if(masseModification) {
1514
			reinitialiserValeurModifiees();
1599
			reinitialiserValeurModifiees();
1515
		}
1600
		}
1516
	}
1601
	}
1517
	
1602
	
1518
	private void calculerAfficherDifferences(ListeObservation listeObs) {
1603
	private void calculerAfficherDifferences(ListeObservation listeObs) {
1519
		
1604
		
1520
		String departement = null;
1605
		String departement = null;
1521
		String commune = null;
1606
		String commune = null;
1522
		String lieuDit = null;
1607
		String lieuDit = null;
1523
		String station = null;
1608
		String station = null;
1524
		String milieu = null;
1609
		String milieu = null;
1525
		String espece = null;
1610
		String espece = null;
1526
		String date = null;
1611
		String date = null;
1527
		String notes = null;
1612
		String notes = null;
1528
		String lat = null;
1613
		String lat = null;
1529
		String lon = null;
1614
		String lon = null;
1530
		
1615
		
1531
		String ordreObs = "";
1616
		String ordreObs = "";
1532
		
1617
		
1533
		for(Iterator<String> it = listeObs.keySet().iterator();it.hasNext();) {
1618
		for(Iterator<String> it = listeObs.keySet().iterator();it.hasNext();) {
1534
			Observation obsEnCours = listeObs.get(it.next());
1619
			Observation obsEnCours = listeObs.get(it.next());
1535
			departement = comparerDifferencesChamps(departement, obsEnCours.getIdentifiantLocalite());
1620
			departement = comparerDifferencesChamps(departement, obsEnCours.getIdentifiantLocalite());
1536
			commune = comparerDifferencesChamps(commune, obsEnCours.getLocalite());
1621
			commune = comparerDifferencesChamps(commune, obsEnCours.getLocalite());
1537
			lieuDit = comparerDifferencesChamps(lieuDit, obsEnCours.getLieudit());
1622
			lieuDit = comparerDifferencesChamps(lieuDit, obsEnCours.getLieudit());
1538
			station = comparerDifferencesChamps(station, obsEnCours.getStation());
1623
			station = comparerDifferencesChamps(station, obsEnCours.getStation());
1539
			milieu = comparerDifferencesChamps(milieu, obsEnCours.getMilieu());
1624
			milieu = comparerDifferencesChamps(milieu, obsEnCours.getMilieu());
1540
			espece = comparerDifferencesChamps(espece, obsEnCours.getNomSaisi()); 
1625
			espece = comparerDifferencesChamps(espece, obsEnCours.getNomSaisi()); 
1541
			date = comparerDifferencesChamps(date, obsEnCours.getDate());
1626
			date = comparerDifferencesChamps(date, obsEnCours.getDate());
1542
			notes = comparerDifferencesChamps(notes, obsEnCours.getCommentaire());
1627
			notes = comparerDifferencesChamps(notes, obsEnCours.getCommentaire());
1543
			lat = comparerDifferencesChamps(lat, obsEnCours.getCoordonneeX());
1628
			lat = comparerDifferencesChamps(lat, obsEnCours.getCoordonneeX());
1544
			lon = comparerDifferencesChamps(lon, obsEnCours.getCoordonneeY());
1629
			lon = comparerDifferencesChamps(lon, obsEnCours.getCoordonneeY());
1545
			
1630
			
1546
			ordreObs += obsEnCours.getNumeroOrdre()+",";
1631
			ordreObs += obsEnCours.getNumeroOrdre()+",";
1547
		}
1632
		}
1548
		
1633
		
1549
		Observation obs=new Observation(espece,numeroNom,commune,departement,lieuDit,station,milieu, notes,date);
1634
		Observation obs=new Observation(espece,numeroNom,commune,departement,lieuDit,station,milieu, notes,date);
1550
		obs.setNumeroOrdre(ordreObs);
1635
		obs.setNumeroOrdre(ordreObs);
1551
		obs.setCoordonneeX(lat);
1636
		obs.setCoordonneeX(lat);
1552
		obs.setCoordonneeY(lon);
1637
		obs.setCoordonneeY(lon);
1553
		rafraichir(obs, false);
1638
		rafraichir(obs, false);
1554
		
1639
		
1555
	}
1640
	}
1556
	
1641
	
1557
	private String comparerDifferencesChamps(String valeurActuelle, String nouvelleValeur) {
1642
	private String comparerDifferencesChamps(String valeurActuelle, String nouvelleValeur) {
1558
		
1643
		
1559
		String retour = "000null";
1644
		String retour = "000null";
1560
		
1645
		
1561
			if(valeurActuelle == null) {
1646
			if(valeurActuelle == null) {
1562
				retour = nouvelleValeur;
1647
				retour = nouvelleValeur;
1563
			} else {
1648
			} else {
1564
				if(valeurActuelle.equals(nouvelleValeur)) {
1649
				if(valeurActuelle.equals(nouvelleValeur)) {
1565
					retour = valeurActuelle;
1650
					retour = valeurActuelle;
1566
				} else {
1651
				} else {
1567
					retour = VALEURS_MULTIPLES;
1652
					retour = VALEURS_MULTIPLES;
1568
				}
1653
				}
1569
			}
1654
			}
1570
		return retour;
1655
		return retour;
1571
	}
1656
	}
1572
	
1657
	
1573
	private void reinitialiserValeurModifiees() {
1658
	private void reinitialiserValeurModifiees() {
1574
		
1659
		
1575
		communeModifiee = false;
1660
		communeModifiee = false;
1576
		lieuDitModifie = false;
1661
		lieuDitModifie = false;
1577
		stationModifiee = false;
1662
		stationModifiee = false;
1578
		milieuModifie = false;
1663
		milieuModifie = false;
1579
		dateModifiee = false;
1664
		dateModifiee = false;
1580
		especeModifiee = false;
1665
		especeModifiee = false;
1581
		commModifie = false;
1666
		commModifie = false;
1582
		latModifiee = false;
1667
		latModifiee = false;
1583
		longModifiee = false;
1668
		longModifiee = false;
1584
	}
1669
	}
1585
	
1670
	
1586
	public void saisieTabindex()
1671
	public void saisieTabindex()
1587
	{
1672
	{
1588
		
1673
		
1589
		selecteurMode.setTabIndex(0);
1674
		selecteurMode.setTabIndex(0);
1590
		commune.setTabIndex(1);
1675
		commune.setTabIndex(1);
1591
		lieudit.setTabIndex(2);
1676
		lieudit.setTabIndex(3);
1592
		station.setTabIndex(3);
1677
		station.setTabIndex(4);
1593
		milieu.setTabIndex(4);
1678
		milieu.setTabIndex(5);
1594
		coordonnees.setTabIndex(-1);
1679
		coordonnees.setTabIndex(-1);
1595
		coordonnees.addListener(new TextFieldListenerAdapter() {
1680
		coordonnees.addListener(new TextFieldListenerAdapter() {
1596
 
1681
 
1597
			public void onFocus(Field field) {
1682
			public void onFocus(Field field) {
1598
				if(coordPanel.isVisible()) {
1683
				if(coordPanel.isVisible()) {
1599
					latitude.focus();
1684
					latitude.focus();
1600
				} else {
1685
				} else {
1601
					Ext.get("lien_carto").focus();
1686
					Ext.get("lien_carto").focus();
1602
				}
1687
				}
1603
			}	
1688
			}	
1604
		});
1689
		});
1605
			
1690
			
1606
		latitude.setTabIndex(8);
1691
		latitude.setTabIndex(7);
1607
		longitude.setTabIndex(9);
1692
		longitude.setTabIndex(8);
1608
		comment.setTabIndex(10);
1693
		comment.setTabIndex(10);
1609
		date.setTabIndex(11);
1694
		date.setTabIndex(11);
1610
		espece.setTabIndex(12);
1695
		espece.setTabIndex(12);
1611
		boutonOK.setTabIndex(13);
1696
		boutonOK.setTabIndex(13);
1612
		boutonAnnuler.setTabIndex(14);
1697
		boutonAnnuler.setTabIndex(14);
1613
		
1698
		
1614
	}
1699
	}
1615
	
1700
	
1616
	private void obtenirInformationCoord() {
1701
	private void obtenirInformationCoord() {
1617
		if(coordonneesValides() != null) {
1702
		if(coordonneesValides() != null) {
1618
			observationMediateur.obtenirInformationCoord(LatLng.newInstance(coordonneesValides()[0],coordonneesValides()[1]));
1703
			observationMediateur.obtenirInformationCoord(LatLng.newInstance(coordonneesValides()[0],coordonneesValides()[1]));
1619
		} else {
1704
		} else {
1620
			Window.alert("Les coordonnées saisies sont invalides");
1705
			Window.alert("Les coordonnées saisies sont invalides");
1621
		}
1706
		}
1622
 
1707
 
1623
	}
1708
	}
1624
	
1709
	
1625
	private void obtenirInformationCommune() {
1710
	private void obtenirInformationCommune() {
1626
		observationMediateur.obtenirInformationCommune(commune.getValue(), obtenirDepartementAPartirChampCommune());
1711
		observationMediateur.obtenirInformationCommune(commune.getValue(), obtenirDepartementAPartirChampCommune());
1627
	}
1712
	}
1628
	
1713
	
1629
	private double[] coordonneesValides() {
1714
	private double[] coordonneesValides() {
1630
		
1715
		
1631
		try {
1716
		try {
1632
						
1717
						
1633
			double lat = Double.parseDouble(latitude.getValueAsString().replaceAll(",", "."));
1718
			double lat = Double.parseDouble(latitude.getValueAsString().replaceAll(",", "."));
1634
			double lon = Double.parseDouble(longitude.getValueAsString().replaceAll(",", "."));
1719
			double lon = Double.parseDouble(longitude.getValueAsString().replaceAll(",", "."));
1635
			
1720
			
1636
			double[] coord = {lat, lon};
1721
			double[] coord = {lat, lon};
1637
			return coord;
1722
			return coord;
1638
			
1723
			
1639
		} catch (NumberFormatException ne) {
1724
		} catch (NumberFormatException ne) {
1640
			return null;
1725
			return null;
1641
		}
1726
		}
1642
	}
1727
	}
1643
	
1728
	
1644
	private String[] getValeurCoordonnees() {
1729
	private String[] getValeurCoordonnees() {
1645
		double[] coDouble = coordonneesValides();
1730
		double[] coDouble = coordonneesValides();
1646
		
1731
		
1647
		if(coDouble != null) {
1732
		if(coDouble != null) {
1648
			String[] coord = {coDouble[0]+"",coDouble[1]+""};
1733
			String[] coord = {coDouble[0]+"",coDouble[1]+""};
1649
			return coord;
1734
			return coord;
1650
		} else {
1735
		} else {
1651
			String[] coord = {"000null","000null" };
1736
			String[] coord = {"000null","000null" };
1652
			return coord;
1737
			return coord;
1653
		}
1738
		}
1654
	}
1739
	}
1655
	
1740
	
1656
	private String obtenirDepartementAPartirChampCommune() {
1741
	private String obtenirDepartementAPartirChampCommune() {
1657
		
1742
		
1658
		String dep = "";
1743
		String dep = "";
1659
		
1744
		
1660
		if(departement.equals("000null") || departement.equals("")) {
1745
		if(departement.equals("000null") || departement.equals("")) {
1661
					
1746
					
1662
			String[] depCom = commune.getText().split(" ");
1747
			String[] depCom = commune.getText().split(" ");
1663
			if(depCom.length > 1) {
1748
			if(depCom.length > 1) {
1664
				dep = depCom[1].replace('(', ' ');
1749
				dep = depCom[1].replace('(', ' ');
1665
			} else {
1750
			} else {
1666
				dep = "";
1751
				dep = "";
1667
			}
1752
			}
1668
		} else {
1753
		} else {
1669
			dep = departement;
1754
			dep = departement;
1670
		}
1755
		}
1671
		
1756
		
1672
		dep = dep.replace(')', ' ');
1757
		dep = dep.replace(')', ' ');
1673
		dep = dep.trim();
1758
		dep = dep.trim();
1674
		dep = dep.replace('\\',' ');
1759
		dep = dep.replace('\\',' ');
1675
		dep = dep.trim();
1760
		dep = dep.trim();
1676
		
1761
		
1677
		try
1762
		try
1678
		{
1763
		{
1679
			int nDep = Integer.parseInt(dep);
1764
			int nDep = Integer.parseInt(dep);
1680
			if(nDep > 0 && nDep < 110) {
1765
			if(nDep > 0 && nDep < 110) {
1681
				departement = dep ;
1766
				departement = dep ;
1682
			}
1767
			}
1683
			
1768
			
1684
			if(departement.length() == 1) {
1769
			if(departement.length() == 1) {
1685
				departement = "0"+departement;
1770
				departement = "0"+departement;
1686
			}
1771
			}
1687
		}
1772
		}
1688
		catch(NumberFormatException e)
1773
		catch(NumberFormatException e)
1689
		{
1774
		{
1690
			departement = "" ;
1775
			departement = "" ;
1691
		}
1776
		}
1692
		
1777
		
1693
		return departement;
1778
		return departement;
1694
	}
1779
	}
1695
	
-
 
1696
	/*private Field obtenirCorrespondanceChampsEnum(Champs champ) {
1780
	
1697
		switch(champ) {
-
 
1698
    	case DATE:
-
 
1699
    		return date;
-
 
1700
    		
-
 
1701
    	case COMMUNE:
1781
	public String getCommune() {
1702
    		return commune;
1782
		return commune.getValue();
1703
    	
-
 
1704
		case LIEUDIT:
-
 
1705
			return lieudit;
1783
	}
1706
    	
-
 
1707
		case STATION:
1784
	
1708
			return station;
-
 
1709
    	
-
 
1710
		case MILIEU:
1785
	public String getDepartement() {
1711
			return milieu;
1786
		return obtenirDepartementAPartirChampCommune();
1712
    	
-
 
1713
		case COMMENT:
-
 
1714
			return comment;
1787
	}
1715
    	
-
 
1716
    	case ESPECE:
1788
 
1717
    		return espece;
-
 
1718
    	}
1789
	public boolean communeInitialisee() {
1719
		return null;
1790
		return communeModifiee;
1720
	}*/
1791
	}
1721
}
1792
}