Subversion Repositories eFlore/Applications.cel

Rev

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

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