Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2734 Rev 2737
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.HashMap;
6
import java.util.HashMap;
7
import java.util.Iterator;
7
import java.util.Iterator;
8
import java.util.List;
8
import java.util.List;
9
import java.util.Map;
9
import java.util.Map;
10
 
10
 
11
import org.tela_botanica.client.CarnetEnLigneMediateur;
11
import org.tela_botanica.client.CarnetEnLigneMediateur;
12
import org.tela_botanica.client.i18n.Msg;
12
import org.tela_botanica.client.i18n.Msg;
13
import org.tela_botanica.client.interfaces.Rafraichissable;
13
import org.tela_botanica.client.interfaces.Rafraichissable;
14
import org.tela_botanica.client.modeles.dao.ImageInformationRepartitionAsynchroneDAO;
14
import org.tela_botanica.client.modeles.dao.ImageInformationRepartitionAsynchroneDAO;
15
import org.tela_botanica.client.modeles.dao.ListeReferentielChampsEtendusDAO;
15
import org.tela_botanica.client.modeles.dao.ListeReferentielChampsEtendusDAO;
16
import org.tela_botanica.client.modeles.dao.ListeReferentielLocaliteAsynchroneDAO;
16
import org.tela_botanica.client.modeles.dao.ListeReferentielLocaliteAsynchroneDAO;
17
import org.tela_botanica.client.modeles.dao.ListeReferentielNomAsynchroneDAO;
17
import org.tela_botanica.client.modeles.dao.ListeReferentielNomAsynchroneDAO;
18
import org.tela_botanica.client.modeles.dao.ListeReferentielPersoAsynchroneDAO;
18
import org.tela_botanica.client.modeles.dao.ListeReferentielPersoAsynchroneDAO;
19
import org.tela_botanica.client.modeles.objets.ChampEtendu;
19
import org.tela_botanica.client.modeles.objets.ChampEtendu;
20
import org.tela_botanica.client.modeles.objets.Configuration;
20
import org.tela_botanica.client.modeles.objets.Configuration;
21
import org.tela_botanica.client.modeles.objets.EntiteGeographiqueObservation;
21
import org.tela_botanica.client.modeles.objets.EntiteGeographiqueObservation;
22
import org.tela_botanica.client.modeles.objets.ListeObservation;
22
import org.tela_botanica.client.modeles.objets.ListeObservation;
23
import org.tela_botanica.client.modeles.objets.Observation;
23
import org.tela_botanica.client.modeles.objets.Observation;
24
import org.tela_botanica.client.modeles.objets.Ontologies;
24
import org.tela_botanica.client.modeles.objets.Ontologies;
25
import org.tela_botanica.client.modeles.objets.ReferentielLocalite;
25
import org.tela_botanica.client.modeles.objets.ReferentielLocalite;
26
import org.tela_botanica.client.modeles.objets.ReferentielNom;
26
import org.tela_botanica.client.modeles.objets.ReferentielNom;
27
import org.tela_botanica.client.modeles.objets.ListeReferentielPerso.TypesReferentiels;
27
import org.tela_botanica.client.modeles.objets.ListeReferentielPerso.TypesReferentiels;
28
import org.tela_botanica.client.observation.ObservationMediateur;
28
import org.tela_botanica.client.observation.ObservationMediateur;
29
import org.tela_botanica.client.util.ChampSaisieEtendu;
29
import org.tela_botanica.client.util.ChampSaisieEtendu;
30
import org.tela_botanica.client.util.FormulaireSaisieChampEtendu;
30
import org.tela_botanica.client.util.FormulaireSaisieChampEtendu;
31
import org.tela_botanica.client.util.Util;
31
import org.tela_botanica.client.util.Util;
32
import org.tela_botanica.client.util.autocompletion.AutoCompletionComboBox;
32
import org.tela_botanica.client.util.autocompletion.AutoCompletionComboBox;
33
 
33
 
34
import com.google.gwt.core.client.Callback;
34
import com.google.gwt.core.client.Callback;
35
import com.google.gwt.event.dom.client.ClickEvent;
35
import com.google.gwt.event.dom.client.ClickEvent;
36
import com.google.gwt.event.dom.client.ClickHandler;
36
import com.google.gwt.event.dom.client.ClickHandler;
37
import com.google.gwt.http.client.Response;
37
import com.google.gwt.http.client.Response;
38
import com.google.gwt.user.client.Timer;
38
import com.google.gwt.user.client.Timer;
39
import com.google.gwt.user.client.Window;
39
import com.google.gwt.user.client.Window;
40
import com.google.gwt.user.client.ui.HTML;
40
import com.google.gwt.user.client.ui.HTML;
41
import com.google.gwt.user.client.ui.PopupPanel;
41
import com.google.gwt.user.client.ui.PopupPanel;
42
import com.gwtext.client.core.EventCallback;
42
import com.gwtext.client.core.EventCallback;
43
import com.gwtext.client.core.EventObject;
43
import com.gwtext.client.core.EventObject;
44
import com.gwtext.client.core.Ext;
44
import com.gwtext.client.core.Ext;
45
import com.gwtext.client.core.ExtElement;
45
import com.gwtext.client.core.ExtElement;
46
import com.gwtext.client.core.ListenerConfig;
46
import com.gwtext.client.core.ListenerConfig;
47
import com.gwtext.client.core.Position;
47
import com.gwtext.client.core.Position;
48
import com.gwtext.client.widgets.BoxComponent;
48
import com.gwtext.client.widgets.BoxComponent;
49
import com.gwtext.client.widgets.Button;
49
import com.gwtext.client.widgets.Button;
50
import com.gwtext.client.widgets.Container;
50
import com.gwtext.client.widgets.Container;
51
import com.gwtext.client.widgets.DatePicker;
51
import com.gwtext.client.widgets.DatePicker;
52
import com.gwtext.client.widgets.Panel;
52
import com.gwtext.client.widgets.Panel;
53
import com.gwtext.client.widgets.ToolTip;
53
import com.gwtext.client.widgets.ToolTip;
54
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
54
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
55
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
55
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
56
import com.gwtext.client.widgets.event.DatePickerListenerAdapter;
56
import com.gwtext.client.widgets.event.DatePickerListenerAdapter;
57
import com.gwtext.client.widgets.event.PanelListenerAdapter;
57
import com.gwtext.client.widgets.event.PanelListenerAdapter;
58
import com.gwtext.client.widgets.form.ComboBox;
58
import com.gwtext.client.widgets.form.ComboBox;
59
import com.gwtext.client.widgets.form.DateField;
59
import com.gwtext.client.widgets.form.DateField;
60
import com.gwtext.client.widgets.form.Field;
60
import com.gwtext.client.widgets.form.Field;
61
import com.gwtext.client.widgets.form.FormPanel;
61
import com.gwtext.client.widgets.form.FormPanel;
62
import com.gwtext.client.widgets.form.Label;
62
import com.gwtext.client.widgets.form.Label;
63
import com.gwtext.client.widgets.form.MultiFieldPanel;
63
import com.gwtext.client.widgets.form.MultiFieldPanel;
64
import com.gwtext.client.widgets.form.TextArea;
64
import com.gwtext.client.widgets.form.TextArea;
65
import com.gwtext.client.widgets.form.TextField;
65
import com.gwtext.client.widgets.form.TextField;
66
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
66
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
67
import com.gwtext.client.widgets.form.event.TextFieldListenerAdapter;
67
import com.gwtext.client.widgets.form.event.TextFieldListenerAdapter;
68
import com.gwtext.client.widgets.layout.AnchorLayoutData;
68
import com.gwtext.client.widgets.layout.AnchorLayoutData;
69
import com.gwtext.client.widgets.layout.ColumnLayout;
69
import com.gwtext.client.widgets.layout.ColumnLayout;
70
import com.gwtext.client.widgets.layout.ColumnLayoutData;
70
import com.gwtext.client.widgets.layout.ColumnLayoutData;
71
import com.gwtext.client.widgets.layout.FormLayout;
71
import com.gwtext.client.widgets.layout.FormLayout;
72
import com.gwtext.client.widgets.layout.RowLayout;
72
import com.gwtext.client.widgets.layout.RowLayout;
73
import com.gwtext.client.data.Record;
73
import com.gwtext.client.data.Record;
74
 
74
 
75
/**
75
/**
76
 * Panneau contenant les infos, les métadonnées et l'arbre des mots clés, il implémente l'interface rafraichissable
76
 * Panneau contenant les infos, les métadonnées et l'arbre des mots clés, il implémente l'interface rafraichissable
77
 * @author aurelien
77
 * @author aurelien
78
 *
78
 *
79
 */
79
 */
80
public class FormulaireSaisieObservationVue extends Panel implements Rafraichissable  {
80
public class FormulaireSaisieObservationVue extends Panel implements Rafraichissable  {
81
 
81
 
82
 
82
 
83
	/**
83
	/**
84
	 * Le médiateur associé à la vue
84
	 * Le médiateur associé à la vue
85
	 */
85
	 */
86
	private ObservationMediateur	observationMediateur		= null;
86
	private ObservationMediateur	observationMediateur		= null;
87
 
87
 
88
	FormPanel panneauFormulaire = null;
88
	FormPanel panneauFormulaire = null;
89
 
89
 
90
	private DateField date = null;
90
	private DateField date = null;
91
	private AutoCompletionComboBox lieudit = null;
91
	private AutoCompletionComboBox lieudit = null;
92
	private AutoCompletionComboBox station = null;
92
	private AutoCompletionComboBox station = null;
93
	private AutoCompletionComboBox milieu = null;
93
	private AutoCompletionComboBox milieu = null;
94
	private TextField comment = null;
94
	private TextField comment = null;
95
	private AutoCompletionComboBox  localite = null;
95
	private AutoCompletionComboBox  localite = null;
96
	private Button effacerLocalite = null;
-
 
97
	
96
	
98
	private String codeLocalite = null;
97
	private String codeLocalite = null;
99
	private String pays = null;
98
	private String pays = null;
100
	
99
	
101
	private AutoCompletionComboBox  espece = null;
100
	private AutoCompletionComboBox  espece = null;
102
	private Map<String, ReferentielNom> referentielNom = null;
101
	private Map<String, ReferentielNom> referentielNom = null;
103
	private Map<String, ReferentielLocalite> referentielLocalite = null;
102
	private Map<String, ReferentielLocalite> referentielLocalite = null;
104
	
103
	
105
	private String numeroNom = null;
104
	private String numeroNom = null;
106
	private String numeroOrdre = null;
105
	private String numeroOrdre = null;
107
	private String referentielTaxo = null;
106
	private String referentielTaxo = null;
108
	private String referentielGeo = null;
107
	private String referentielGeo = null;
109
	
108
	
110
	private Map<String, String> avertissementPresence = new HashMap<String, String>();
109
	private Map<String, String> avertissementPresence = new HashMap<String, String>();
111
	private boolean enRequeteChrologie = false;
110
	private boolean enRequeteChrologie = false;
112
 
111
 
113
	// Pour remise a zero partielle lors d'une validation
112
	// Pour remise a zero partielle lors d'une validation
114
 
113
 
115
	private enum Champs {
114
	private enum Champs {
116
	    DATE, LIEUDIT, STATION, MILIEU, COMMENT, LOCALITE, ESPECE, TOUT, LATITUDE, LONGITUDE, ALTITUDE, ABONDANCE, CERTITUDE, REFERENTIELTAXO, PHENOLOGIE;
115
	    DATE, LIEUDIT, STATION, MILIEU, COMMENT, LOCALITE, ESPECE, TOUT, LATITUDE, LONGITUDE, ALTITUDE, ABONDANCE, CERTITUDE, REFERENTIELTAXO, PHENOLOGIE;
117
 
116
 
118
	    @Override
117
	    @Override
119
		public String toString() {
118
		public String toString() {
120
	    
119
	    
121
	    	switch(this) {
120
	    	switch(this) {
122
	    	case DATE:
121
	    	case DATE:
123
	    		return "date";
122
	    		return "date";
124
	    
123
	    
125
	    	case LOCALITE:
124
	    	case LOCALITE:
126
	    		return "localite";
125
	    		return "localite";
127
	    
126
	    
128
    		case LIEUDIT:
127
    		case LIEUDIT:
129
    			return "lieu dit";
128
    			return "lieu dit";
130
	    
129
	    
131
    		case STATION:
130
    		case STATION:
132
    			return "station";
131
    			return "station";
133
	    
132
	    
134
    		case MILIEU:
133
    		case MILIEU:
135
    			return "milieu";
134
    			return "milieu";
136
	    
135
	    
137
    		case COMMENT:
136
    		case COMMENT:
138
    			return "notes";
137
    			return "notes";
139
	    
138
	    
140
	    	case ESPECE:
139
	    	case ESPECE:
141
	    		return "espèce";
140
	    		return "espèce";
142
	    
141
	    
143
	    	case LATITUDE:
142
	    	case LATITUDE:
144
	    		return "latitude";
143
	    		return "latitude";
145
	    
144
	    
146
	    	case LONGITUDE:
145
	    	case LONGITUDE:
147
	    		return "longitude";
146
	    		return "longitude";
148
	    
147
	    
149
	    	case ALTITUDE:
148
	    	case ALTITUDE:
150
	    		return "altitude";
149
	    		return "altitude";
151
	    
150
	    
152
	    	case ABONDANCE:
151
	    	case ABONDANCE:
153
	    		return "abondance";
152
	    		return "abondance";
154
	    
153
	    
155
	    	case CERTITUDE:
154
	    	case CERTITUDE:
156
	    		return "identification";
155
	    		return "identification";
157
	    
156
	    
158
	    	case REFERENTIELTAXO:
157
	    	case REFERENTIELTAXO:
159
	    		return "referentiel";
158
	    		return "referentiel";
160
	    
159
	    
161
	    	case PHENOLOGIE:
160
	    	case PHENOLOGIE:
162
	    		return "phenologie";
161
	    		return "phenologie";
163
	    
162
	    
164
	    	case TOUT:
163
	    	case TOUT:
165
	    		return "date, localite, lieu dit, station, milieu, espèce, notes, latitude, longitude, altitude, abondance, identification, referentiel, phenologie";
164
	    		return "date, localite, lieu dit, station, milieu, espèce, notes, latitude, longitude, altitude, abondance, identification, referentiel, phenologie";
166
	    	}
165
	    	}
167
			return TOUT.toString();
166
			return TOUT.toString();
168
	    }
167
	    }
169
	};
168
	};
170
 
169
 
171
	private String formatDate = null ;
170
	private String formatDate = null ;
172
	private Button boutonOK = new Button(Msg.get("creer"));
171
	private Button boutonOK = new Button(Msg.get("creer"));
173
	private Button boutonModifier = new Button(Msg.get("modifier"));
172
	private Button boutonModifier = new Button(Msg.get("modifier"));
174
	private Button boutonSupprimer = new Button(Msg.get("supprimer"));
173
	private Button boutonSupprimer = new Button(Msg.get("supprimer"));
175
	private Button boutonReinitialiser = new Button(Msg.get("reinitialiser"));
174
	private Button boutonReinitialiser = new Button(Msg.get("reinitialiser"));
176
 
175
 
177
	private boolean selectionlocalite=false;
176
	private boolean selectionlocalite=false;
178
	private boolean selectionEspece=false;
177
	private boolean selectionEspece=false;
179
	private boolean selectionAbondance = false;
178
	private boolean selectionAbondance = false;
180
	private boolean selectionCertitude = false;
179
	private boolean selectionCertitude = false;
181
	private boolean selectionPhenologie = false;
180
	private boolean selectionPhenologie = false;
182
 
181
 
183
	private final String VALEURS_MULTIPLES = "("+Msg.get("valeurs-multiples")+")";
182
	private final String VALEURS_MULTIPLES = "("+Msg.get("valeurs-multiples")+")";
184
	private final String modeleMessageModif = "localite:lieu-dit:station:milieu:latitude:longitude:altitude:date:espece:notes:abondance:identification:referentiel:phenologie";
183
	private final String modeleMessageModif = "localite:lieu-dit:station:milieu:latitude:longitude:altitude:date:espece:notes:abondance:identification:referentiel:phenologie";
185
	private boolean localiteModifiee = false;
184
	private boolean localiteModifiee = false;
186
	private boolean lieuDitModifie = false;
185
	private boolean lieuDitModifie = false;
187
	private boolean stationModifiee = false;
186
	private boolean stationModifiee = false;
188
	private boolean milieuModifie = false;
187
	private boolean milieuModifie = false;
189
	private boolean dateModifiee = false;
188
	private boolean dateModifiee = false;
190
	private boolean especeModifiee = false;
189
	private boolean especeModifiee = false;
191
	private boolean commModifie = false;
190
	private boolean commModifie = false;
192
	private boolean abondanceModifiee = false;
191
	private boolean abondanceModifiee = false;
193
	private boolean certitudeModifiee = false;
192
	private boolean certitudeModifiee = false;
194
	private boolean referentielTaxoModifie = false;
193
	private boolean referentielTaxoModifie = false;
195
	private boolean phenologieModifiee = false;;
194
	private boolean phenologieModifiee = false;;
196
 
195
 
197
	private final int KEY_ALT = 18;
196
	private final int KEY_ALT = 18;
198
	private final int KEY_BACKSPACE = 8;
197
	private final int KEY_BACKSPACE = 8;
199
	private final int KEY_CTRL = 17;
198
	private final int KEY_CTRL = 17;
200
	private final int KEY_DELETE = 46;
199
	private final int KEY_DELETE = 46;
201
	private final int KEY_DOWN = 40;
200
	private final int KEY_DOWN = 40;
202
	private final int KEY_END = 35;
201
	private final int KEY_END = 35;
203
	private final int KEY_ENTER = 13;
202
	private final int KEY_ENTER = 13;
204
	private final int KEY_ESCAPE = 27;
203
	private final int KEY_ESCAPE = 27;
205
	private final int KEY_HOME = 36;
204
	private final int KEY_HOME = 36;
206
	private final int KEY_LEFT = 37;
205
	private final int KEY_LEFT = 37;
207
	private final int KEY_PAGEDOWN = 34;
206
	private final int KEY_PAGEDOWN = 34;
208
	private final int KEY_PAGEUP = 33;
207
	private final int KEY_PAGEUP = 33;
209
	private final int KEY_RIGHT = 39;
208
	private final int KEY_RIGHT = 39;
210
	private final int KEY_SHIFT = 16;
209
	private final int KEY_SHIFT = 16;
211
	private final int KEY_TAB = 9;
210
	private final int KEY_TAB = 9;
212
	private final int KEY_UP = 38;
211
	private final int KEY_UP = 38;
213
 
212
 
214
	/**
213
	/**
215
	 * Booleen d'instanciation
214
	 * Booleen d'instanciation
216
	 */
215
	 */
217
	boolean estInstancie = false ;
216
	boolean estInstancie = false ;
218
 
217
 
219
	private Panel panneauIntermediaire;
218
	private Panel panneauIntermediaire;
220
 
219
 
221
	private Panel panneauPremierColonne;
220
	private Panel panneauPremierColonne;
222
 
221
 
223
	private Panel panneauSecondeColonne;
222
	private Panel panneauSecondeColonne;
224
 
223
 
225
	private TextField longitude;
224
	private TextField longitude;
226
 
225
 
227
	private TextField latitude;
226
	private TextField latitude;
228
 
227
 
229
	private TextField altitude;
228
	private TextField altitude;
230
 
229
 
231
	private MultiFieldPanel htmllocalitePanel = null;
230
	private MultiFieldPanel htmllocalitePanel = null;
232
 
231
 
233
	private MultiFieldPanel coordPanel;
232
	private MultiFieldPanel coordPanel;
234
 
233
 
235
	private TextField coordonnees;
234
	private TextField coordonnees;
236
 
235
 
237
	private Label lienSelectionlocalite = null;
236
	private Label lienSelectionlocalite = null;
238
 
237
 
239
	private HTML afficherFormulaireLatLon;
238
	private HTML afficherFormulaireLatLon;
240
 
239
 
241
	private HTML basculerverscarto;
240
	private HTML basculerverscarto;
242
 
241
 
243
	private boolean longlatAjoutee;
242
	private boolean longlatAjoutee;
244
 
243
 
245
	private boolean latModifiee;
244
	private boolean latModifiee;
246
 
245
 
247
	private boolean longModifiee;
246
	private boolean longModifiee;
248
 
247
 
249
	private boolean altModifiee;
248
	private boolean altModifiee;
250
 
249
 
251
	protected boolean recherchelocaliteEnCours = false;
250
	protected boolean recherchelocaliteEnCours = false;
252
 
251
 
253
	private Timer tCoord;
252
	private Timer tCoord;
254
 
253
 
255
	private ComboBox selecteurAbondance = null;
254
	private ComboBox selecteurAbondance = null;
256
 
255
 
257
	private ComboBox selecteurCertitude = null;
256
	private ComboBox selecteurCertitude = null;
258
 
257
 
259
	private ComboBox selecteurReferentielTaxo = null;
258
	private ComboBox selecteurReferentielTaxo = null;
260
 
259
 
261
	private ComboBox selecteurStadePheno = null;
260
	private ComboBox selecteurStadePheno = null;
262
 
261
 
263
	private boolean selectionMultiple = false;
262
	private boolean selectionMultiple = false;
264
 
263
 
265
	private HTML lienAfficherChampsEtendus = null;
264
	private HTML lienAfficherChampsEtendus = null;
266
	private HTML lienAjouterChampsEtendus = null;
265
	private HTML lienAjouterChampsEtendus = null;
267
 
266
 
268
	Panel conteneurChampEtenduGauche = null;
267
	Panel conteneurChampEtenduGauche = null;
269
	Panel conteneurChampEtenduDroite = null;
268
	Panel conteneurChampEtenduDroite = null;
270
 
269
 
271
	private boolean afficherChampsEtendus = false;
270
	private boolean afficherChampsEtendus = false;
272
	private boolean afficherLienAjoutChampsEtendus = false;
271
	private boolean afficherLienAjoutChampsEtendus = false;
273
	private boolean premierAffichage = true;
272
	private boolean premierAffichage = true;
274
 
273
 
275
	private PopupPanel popUpAjoutChampEtendu = new PopupPanel();
274
	private PopupPanel popUpAjoutChampEtendu = new PopupPanel();
276
	
275
	
277
	private Map<String, ChampSaisieEtendu> listeChampsEtendus;
276
	private Map<String, ChampSaisieEtendu> listeChampsEtendus;
278
 
277
 
279
	/**
278
	/**
280
	 * Constructeur sans argument (privé car ne doit pas être utilisé)
279
	 * Constructeur sans argument (privé car ne doit pas être utilisé)
281
	 */
280
	 */
282
	@SuppressWarnings("unused")
281
	@SuppressWarnings("unused")
283
	private FormulaireSaisieObservationVue()
282
	private FormulaireSaisieObservationVue()
284
	{
283
	{
285
		super() ;
284
		super() ;
286
	}
285
	}
287
 
286
 
288
	/**
287
	/**
289
	 * Constructeur avec argument
288
	 * Constructeur avec argument
290
	 * @param im
289
	 * @param im
291
	 */
290
	 */
292
	public FormulaireSaisieObservationVue(ObservationMediateur obs)
291
	public FormulaireSaisieObservationVue(ObservationMediateur obs)
293
	{
292
	{
294
		super(Msg.get("saisie"));
293
		super(Msg.get("saisie"));
295
		// on associe le médiateur
294
		// on associe le médiateur
296
		observationMediateur = obs ;
295
		observationMediateur = obs ;
297
 
296
 
298
		referentielTaxo = obs.getRefTaxSelectionne().getCode();
297
		referentielTaxo = obs.getRefTaxSelectionne().getCode();
299
	     
298
	     
300
		panneauFormulaire = new FormPanel(Position.RIGHT);
299
		panneauFormulaire = new FormPanel(Position.RIGHT);
301
		panneauFormulaire.setBorder(false);
300
		panneauFormulaire.setBorder(false);
302
 
301
 
303
		// Panneau intermediaire qui contient deux colonnes de formulaire
302
		// Panneau intermediaire qui contient deux colonnes de formulaire
304
		panneauIntermediaire = new Panel();
303
		panneauIntermediaire = new Panel();
305
 
304
 
306
		if (Window.getClientWidth()> Window.getClientHeight()) {
305
		if (Window.getClientWidth()> Window.getClientHeight()) {
307
			panneauIntermediaire.setLayout(new ColumnLayout());
306
			panneauIntermediaire.setLayout(new ColumnLayout());
308
		}
307
		}
309
		else {
308
		else {
310
			panneauIntermediaire.setLayout(new RowLayout());
309
			panneauIntermediaire.setLayout(new RowLayout());
311
		}
310
		}
312
 
311
 
313
		panneauIntermediaire.setBorder(false);
312
		panneauIntermediaire.setBorder(false);
314
 
313
 
315
		//création du panneau formulaire de gauche auquels on ajoute les champs
314
		//création du panneau formulaire de gauche auquels on ajoute les champs
316
		panneauPremierColonne = new Panel();
315
		panneauPremierColonne = new Panel();
317
		panneauPremierColonne.setLayout(new FormLayout());
316
		panneauPremierColonne.setLayout(new FormLayout());
318
		panneauPremierColonne.setBorder(false);
317
		panneauPremierColonne.setBorder(false);
319
 
318
 
320
		//création du panneau formulaire de droite
319
		//création du panneau formulaire de droite
321
	    panneauSecondeColonne = new Panel();
320
	    panneauSecondeColonne = new Panel();
322
		panneauSecondeColonne.setLayout(new FormLayout());
321
		panneauSecondeColonne.setLayout(new FormLayout());
323
		panneauSecondeColonne.setBorder(false);
322
		panneauSecondeColonne.setBorder(false);
324
 
323
 
325
		this.setPaddings(5) ;
324
		this.setPaddings(5) ;
326
 
325
 
327
		// Accesskey pour debugging
326
		// Accesskey pour debugging
328
		localite = new AutoCompletionComboBox(Msg.get("localite"), ListeReferentielLocaliteAsynchroneDAO.getUrlReferentielLocalites()) {			
327
		localite = new AutoCompletionComboBox(Msg.get("localite"), ListeReferentielLocaliteAsynchroneDAO.getUrlReferentielLocalites()) {			
329
			@Override
328
			@Override
330
			protected Map<String, String> parserResultatRequete(Response response) {
329
			protected Map<String, String> parserResultatRequete(Response response) {
331
				referentielLocalite = Util.parserRetourReferentielLocaliteIndexeParNom(response);
330
				referentielLocalite = Util.parserRetourReferentielLocaliteIndexeParNom(response);
332
				return Util.convertirListeReferentielLocaliteVersMap(referentielLocalite);
331
				return Util.convertirListeReferentielLocaliteVersMap(referentielLocalite);
333
			}
332
			}
334
			
333
			
335
			@Override
334
			@Override
336
			public void onSelectionValeur() {
335
			public void onSelectionValeur() {
337
				localiteModifiee = true;
336
				localiteModifiee = true;
338
				surSelectionLocalite();
337
				surSelectionLocalite();
339
				verifierPresenceTaxonSaisi();
338
				verifierPresenceTaxonSaisi();
340
			}
339
			}
341
			
340
			
342
			@Override
341
			@Override
343
			protected void onModificationValeur() {
342
			protected void onModificationValeur() {
344
				localiteModifiee = true;
343
				localiteModifiee = true;	
345
				verifierPresenceTaxonSaisi();
344
				verifierPresenceTaxonSaisi();
346
			}
345
			}
347
 
346
 
348
			@Override
347
			@Override
349
			public void onValidationSaisie() {
348
			public void onValidationSaisie() {
350
				validerSaisie(Champs.LOCALITE);
349
				validerSaisie(Champs.LOCALITE);
351
			}
350
			}
352
		};
351
		};
353
 
-
 
354
		// Bouton pour supprimer totalement la localisation d'une obs (zone géo + coords)
-
 
355
		effacerLocalite = new Button("X", new ButtonListenerAdapter() {
-
 
356
			public void onClick(Button button, EventObject e) {
-
 
357
				localite.setText("");
-
 
358
				localite.setValue("");
-
 
359
				localiteModifiee = true;
-
 
360
				latitude.setValue("");
-
 
361
				latModifiee = true;
-
 
362
				longitude.setValue("");
-
 
363
				longModifiee = true;
-
 
364
				altitude.setValue("");
-
 
365
				altModifiee = true;
-
 
366
			}
-
 
367
		});
-
 
368
		effacerLocalite.setTooltip("Supprimer la localisation de l'observation (localité, coordonnées, altitude)");
352
 
369
 
353
 
370
		//création du lien "Accès carto" dans le formulaire;
354
		//création du lien "Accès carto" dans le formulaire;
371
		basculerverscarto = new HTML(" <a id=\"lien_carto\" title=\""+Msg.get("aide-lien-localiser")+"\" href=\"#\" tabindex=\"2\">"+Msg.get("localiser-zone")+"</a>");
355
		basculerverscarto = new HTML(" <a id=\"lien_carto\" title=\""+Msg.get("aide-lien-localiser")+"\" href=\"#\" tabindex=\"2\">"+Msg.get("localiser-zone")+"</a>");
372
		basculerverscarto.addStyleName("lien_actif");
356
		basculerverscarto.addStyleName("lien_actif");
373
 
357
 
374
		//création info bulle sur le lien "accès carto"
358
		//création info bulle sur le lien "accès carto"
375
		ToolTip tip2 = new ToolTip();
359
		ToolTip tip2 = new ToolTip();
376
		tip2.setHtml(Msg.get("aide-lien-localiser"));
360
		tip2.setHtml(Msg.get("aide-lien-localiser"));
377
		tip2.applyTo(basculerverscarto.getElement());
361
		tip2.applyTo(basculerverscarto.getElement());
378
 
362
 
379
		//Sur une meme ligne, ajout de plusieurs champs
363
		//Sur une meme ligne, ajout de plusieurs champs
380
		htmllocalitePanel = new MultiFieldPanel();
364
		htmllocalitePanel = new MultiFieldPanel();
381
 
365
 
382
		//int largeurlocalite = Window.getClientWidth()/5;
366
		int largeurlocalite = Window.getClientWidth()/4;
383
		htmllocalitePanel.addToRow(localite, 280);
-
 
384
		htmllocalitePanel.addToRow(effacerLocalite, 150);
367
		htmllocalitePanel.addToRow(localite, largeurlocalite);
385
		htmllocalitePanel.addToRow(basculerverscarto, 130);
368
		htmllocalitePanel.addToRow(basculerverscarto, 160);
386
 
369
 
387
		htmllocalitePanel.setBorder(false);
370
		htmllocalitePanel.setBorder(false);
388
		htmllocalitePanel.setId("x-localite-panel");
371
		htmllocalitePanel.setId("x-localite-panel");
389
 
372
 
390
		panneauPremierColonne.add(htmllocalitePanel);
373
		panneauPremierColonne.add(htmllocalitePanel);
391
 
374
 
392
	    station = new AutoCompletionComboBox(Msg.get("station"), ListeReferentielPersoAsynchroneDAO.getUrlReferentielPerso(TypesReferentiels.REFERENTIEL_STATION)) {			
375
	    station = new AutoCompletionComboBox(Msg.get("station"), ListeReferentielPersoAsynchroneDAO.getUrlReferentielPerso(TypesReferentiels.REFERENTIEL_STATION)) {			
393
			@Override
376
			@Override
394
			protected Map<String, String> parserResultatRequete(Response response) {
377
			protected Map<String, String> parserResultatRequete(Response response) {
395
				return Util.parserRetourReferentielPerso(response);
378
				return Util.parserRetourReferentielPerso(response);
396
			}
379
			}
397
			
380
			
398
			@Override
381
			@Override
399
			public void onSelectionValeur() {
382
			public void onSelectionValeur() {
400
				stationModifiee = true;
383
				stationModifiee = true;
401
			}
384
			}
402
			
385
			
403
			@Override
386
			@Override
404
			protected void onModificationValeur() {
387
			protected void onModificationValeur() {
405
				stationModifiee = true;	
388
				stationModifiee = true;	
406
			}
389
			}
407
 
390
 
408
			@Override
391
			@Override
409
			public void onValidationSaisie() {
392
			public void onValidationSaisie() {
410
				validerSaisie(Champs.STATION);
393
				validerSaisie(Champs.STATION);
411
			}
394
			}
412
 
395
 
413
			@Override
396
			@Override
414
			protected String preTraiterUrlRequete(String urlRequete, String valeur) {
397
			protected String preTraiterUrlRequete(String urlRequete, String valeur) {
415
				return ListeReferentielPersoAsynchroneDAO.formaterUrlRequeteAutoCompletionPerso(urlRequete, valeur);
398
				return ListeReferentielPersoAsynchroneDAO.formaterUrlRequeteAutoCompletionPerso(urlRequete, valeur);
416
			}  
399
			}  
417
		};
400
		};
418
	    panneauPremierColonne.add(station, new AnchorLayoutData("95%"));
401
	    panneauPremierColonne.add(station, new AnchorLayoutData("95%"));
419
 
402
 
420
		latitude = new TextField(Msg.get("lat"), "lat");
403
		latitude = new TextField(Msg.get("lat"), "lat");
421
		latitude.setGrowMax(70);
404
		latitude.setGrowMax(70);
422
		latitude.setAllowBlank(true);
405
		latitude.setAllowBlank(true);
423
 
406
 
424
	    longitude = new TextField(Msg.get("lon"), "lon");
407
	    longitude = new TextField(Msg.get("lon"), "lon");
425
	    longitude.setGrowMax(70);
408
	    longitude.setGrowMax(70);
426
		longitude.setAllowBlank(true);
409
		longitude.setAllowBlank(true);
427
 
410
 
428
		altitude = new TextField(Msg.get("alt"), "alt");
411
		altitude = new TextField(Msg.get("alt"), "alt");
429
		altitude.setGrowMax(70);
412
		altitude.setGrowMax(70);
430
		altitude.setAllowBlank(true);
413
		altitude.setAllowBlank(true);
431
 
414
 
432
		lienSelectionlocalite = new Label("");
415
		lienSelectionlocalite = new Label("");
433
 
416
 
434
 
417
 
435
		lienSelectionlocalite.setId("conteneur_selection_localite");
418
		lienSelectionlocalite.setId("conteneur_selection_localite");
436
		lienSelectionlocalite.setStyleName("conteneur_selection_localite");
419
		lienSelectionlocalite.setStyleName("conteneur_selection_localite");
437
		lienSelectionlocalite.addStyleName("lien_actif");
420
		lienSelectionlocalite.addStyleName("lien_actif");
438
 
421
 
439
		// Panneau de type plusieurs champs de formulaire sur une meme ligne, où seront renseignés Lat/Lon
422
		// Panneau de type plusieurs champs de formulaire sur une meme ligne, où seront renseignés Lat/Lon
440
		coordPanel = new MultiFieldPanel();
423
		coordPanel = new MultiFieldPanel();
441
		coordPanel.setPaddings(0, 0, 0, 10);
424
		coordPanel.setPaddings(0, 0, 0, 10);
442
		coordPanel.setVisible(false);
425
		coordPanel.setVisible(false);
443
 
426
 
444
		final double largeur ;
427
		final double largeur ;
445
		largeur = 120;
428
		largeur = 120;
446
 
429
 
447
		coordPanel.addToRow(latitude, new ColumnLayoutData(largeur));
430
		coordPanel.addToRow(latitude, new ColumnLayoutData(largeur));
448
		coordPanel.addToRow(longitude, new ColumnLayoutData(largeur));
431
		coordPanel.addToRow(longitude, new ColumnLayoutData(largeur));
449
		coordPanel.addToRow(lienSelectionlocalite, new ColumnLayoutData(largeur));
432
		coordPanel.addToRow(lienSelectionlocalite, new ColumnLayoutData(largeur));
450
		lienSelectionlocalite.addClass("lien_decale");
433
		lienSelectionlocalite.addClass("lien_decale");
451
		coordPanel.setBorder(false);
434
		coordPanel.setBorder(false);
452
 
435
 
453
		coordPanel.addToRow(altitude, new ColumnLayoutData(largeur));
436
		coordPanel.addToRow(altitude, new ColumnLayoutData(largeur));
454
 
437
 
455
		  //création du champs coordonnées
438
		  //création du champs coordonnées
456
		referentielGeo = Configuration.getReferentielGeo();
439
		referentielGeo = Configuration.getReferentielGeo();
457
 
440
 
458
		coordonnees = new TextField(Msg.get("coordonnees"), "", 0);
441
		coordonnees = new TextField(Msg.get("coordonnees"), "", 0);
459
		coordonnees.setMaxLength(0);
442
		coordonnees.setMaxLength(0);
460
		coordonnees.setReadOnly(true);
443
		coordonnees.setReadOnly(true);
461
		coordonnees.setCls("fieldname");
444
		coordonnees.setCls("fieldname");
462
 
445
 
463
		//création du lien "saisie X/Y" dans le formulaire
446
		//création du lien "saisie X/Y" dans le formulaire
464
		afficherFormulaireLatLon = new HTML("<span style=\"padding-left:30px;\" class=\"conteneur_lien_afficher_lat_lon\">" +
447
		afficherFormulaireLatLon = new HTML("<span style=\"padding-left:30px;\" class=\"conteneur_lien_afficher_lat_lon\">" +
465
				"<a title=\""+Msg.get("indication-formulaire-lat-lon")+"\" class=\"lien_actif\" id=\"lien_coord\" href=\"#\" tabindex=\"6\">"+Msg.get("saisie-lat-lon")+" ("+referentielGeo+")</a>" +
448
				"<a title=\""+Msg.get("indication-formulaire-lat-lon")+"\" class=\"lien_actif\" id=\"lien_coord\" href=\"#\" tabindex=\"6\">"+Msg.get("saisie-lat-lon")+" ("+referentielGeo+")</a>" +
466
				"<span><span style=\"padding-left:20px\" class=\"conteneur_lien_localiser_lat_lon\">"+
449
				"<span><span style=\"padding-left:20px\" class=\"conteneur_lien_localiser_lat_lon\">"+
467
				"<a title=\""+Msg.get("indication-formulaire-localiser")+"\" class=\"lien_actif\" id=\"lien_carto_coord\" href=\"#\" tabindex=\"7\">"+Msg.get("localiser-la-carte")+"</a>"+
450
				"<a title=\""+Msg.get("indication-formulaire-localiser")+"\" class=\"lien_actif\" id=\"lien_carto_coord\" href=\"#\" tabindex=\"7\">"+Msg.get("localiser-la-carte")+"</a>"+
468
				"</span>");
451
				"</span>");
469
 
452
 
470
			//ajout d'un listener sur le lien "saisie X/Y"
453
			//ajout d'un listener sur le lien "saisie X/Y"
471
			coordPanel.addListener(new PanelListenerAdapter() {
454
			coordPanel.addListener(new PanelListenerAdapter() {
472
 
455
 
473
				@Override
456
				@Override
474
				public void onAfterLayout(Container c) {
457
				public void onAfterLayout(Container c) {
475
					surPremierAffichageCoordPanel(largeur);
458
					surPremierAffichageCoordPanel(largeur);
476
				}
459
				}
477
			});
460
			});
478
 
461
 
479
		//Sur une meme ligne, ajout de plusieurs champs
462
		//Sur une meme ligne, ajout de plusieurs champs
480
		final MultiFieldPanel htmlPanel = new MultiFieldPanel();
463
		final MultiFieldPanel htmlPanel = new MultiFieldPanel();
481
 
464
 
482
		htmlPanel.addToRow(coordonnees, 100);
465
		htmlPanel.addToRow(coordonnees, 100);
483
		htmlPanel.addToRow(afficherFormulaireLatLon, new ColumnLayoutData(0.9));
466
		htmlPanel.addToRow(afficherFormulaireLatLon, new ColumnLayoutData(0.9));
484
		htmlPanel.setBorder(false);
467
		htmlPanel.setBorder(false);
485
		htmlPanel.setId("x-coord-panel");
468
		htmlPanel.setId("x-coord-panel");
486
 
469
 
487
		panneauPremierColonne.add(htmlPanel);
470
		panneauPremierColonne.add(htmlPanel);
488
		panneauPremierColonne.add(coordPanel);
471
		panneauPremierColonne.add(coordPanel);
489
 
472
 
490
	    date = new DateField(Msg.get("date"), "date", 250);
473
	    date = new DateField(Msg.get("date"), "date", 250);
491
	    date.setAllowBlank(true);
474
	    date.setAllowBlank(true);
492
	    formatDate = "d/m/Y";
475
	    formatDate = "d/m/Y";
493
	    date.setFormat(formatDate);
476
	    date.setFormat(formatDate);
494
	    date.setTitle(Msg.get("indication-format-date"));
477
	    date.setTitle(Msg.get("indication-format-date"));
495
	    date.setMaxValue(new Date());
478
	    date.setMaxValue(new Date());
496
	    //date.setTabIndex(5);
479
	    //date.setTabIndex(5);
497
	    panneauPremierColonne.add(date, new AnchorLayoutData("55%"));
480
	    panneauPremierColonne.add(date, new AnchorLayoutData("55%"));
498
 
481
 
499
 
482
 
500
	    final String champsListeTpl = "<div class=\"x-combo-list-item search-item-tpl\" title=\"{label}\">{label}</div>";
483
	    final String champsListeTpl = "<div class=\"x-combo-list-item search-item-tpl\" title=\"{label}\">{label}</div>";
501
 
484
 
502
	    // Selection d'un référentiel par défaut (le premier spécifié dans la config)
485
	    // Selection d'un référentiel par défaut (le premier spécifié dans la config)
503
	    referentielTaxo = Configuration.getReferentielsDispos().get(0).getCode();
486
	    referentielTaxo = Configuration.getReferentielsDispos().get(0).getCode();
504
	    selecteurReferentielTaxo = new ComboBox();
487
	    selecteurReferentielTaxo = new ComboBox();
505
	    selecteurReferentielTaxo.setCls("champ-separation");
488
	    selecteurReferentielTaxo.setCls("champ-separation");
506
	    selecteurReferentielTaxo.setLabel(Msg.get("referentiel"));
489
	    selecteurReferentielTaxo.setLabel(Msg.get("referentiel"));
507
	    selecteurReferentielTaxo.setStore(Ontologies.getValeursReferentiel());
490
	    selecteurReferentielTaxo.setStore(Ontologies.getValeursReferentiel());
508
	    selecteurReferentielTaxo.setValue(referentielTaxo);
491
	    selecteurReferentielTaxo.setValue(referentielTaxo);
509
	    selecteurReferentielTaxo.setDisplayField("label") ;
492
	    selecteurReferentielTaxo.setDisplayField("label") ;
510
	    selecteurReferentielTaxo.setValueField("valeur");
493
	    selecteurReferentielTaxo.setValueField("valeur");
511
	    selecteurReferentielTaxo.setEditable(false);
494
	    selecteurReferentielTaxo.setEditable(false);
512
	    selecteurReferentielTaxo.setHideTrigger(false);
495
	    selecteurReferentielTaxo.setHideTrigger(false);
513
	    selecteurReferentielTaxo.setForceSelection(true);
496
	    selecteurReferentielTaxo.setForceSelection(true);
514
	    selecteurReferentielTaxo.setTpl(champsListeTpl);
497
	    selecteurReferentielTaxo.setTpl(champsListeTpl);
515
	    
498
	    
516
		espece = new AutoCompletionComboBox(Msg.get("espece"), ListeReferentielNomAsynchroneDAO.getBaseUrlReferentielNom()) {			
499
		espece = new AutoCompletionComboBox(Msg.get("espece"), ListeReferentielNomAsynchroneDAO.getBaseUrlReferentielNom()) {			
517
			@Override
500
			@Override
518
			protected Map<String, String> parserResultatRequete(Response response) {
501
			protected Map<String, String> parserResultatRequete(Response response) {
519
				// TODO: bien penser à l'unicité des clés, ici on suppose que 
502
				// TODO: bien penser à l'unicité des clés, ici on suppose que 
520
				// genre espèce auteur suffit mais quelquefois on peut avoir des doublons
503
				// genre espèce auteur suffit mais quelquefois on peut avoir des doublons
521
				referentielNom = Util.parserRetourReferentielNomIndexeParNom(response);
504
				referentielNom = Util.parserRetourReferentielNomIndexeParNom(response);
522
				return Util.convertirListeReferentielNomVersMap(referentielNom);
505
				return Util.convertirListeReferentielNomVersMap(referentielNom);
523
			}
506
			}
524
			
507
			
525
			@Override
508
			@Override
526
			public void onSelectionValeur() {
509
			public void onSelectionValeur() {
527
				especeModifiee = true;
510
				especeModifiee = true;
528
				surSelectionEspece();
511
				surSelectionEspece();
529
				verifierPresenceTaxonSaisi();
512
				verifierPresenceTaxonSaisi();
530
			}
513
			}
531
			
514
			
532
			@Override
515
			@Override
533
			protected void onModificationValeur() {
516
			protected void onModificationValeur() {
534
				especeModifiee = true;	
517
				especeModifiee = true;	
535
				// Pour éviter qu'un mauvais nn ne soit gardé lors d'une modification
518
				// Pour éviter qu'un mauvais nn ne soit gardé lors d'une modification
536
				// vers un nom ne faisant pas partie du référentiel
519
				// vers un nom ne faisant pas partie du référentiel
537
				numeroNom = null;
520
				numeroNom = null;
538
				String cle = espece.getValue();
-
 
539
				if(referentielNom.containsKey(cle)) {
521
				if(referentielNom.containsKey(espece.getText())) {
540
					numeroNom = referentielNom.get(cle).getNumeroNom();
522
					numeroNom = referentielNom.get(espece.getText()).getNumeroNom();
541
				}
523
				}
542
				verifierPresenceTaxonSaisi();
524
				verifierPresenceTaxonSaisi();
543
			}
525
			}
544
 
526
 
545
			@Override
527
			@Override
546
			public void onValidationSaisie() {
528
			public void onValidationSaisie() {
547
				validerSaisie(Champs.ESPECE);
529
				validerSaisie(Champs.ESPECE);
548
			}  
530
			}  
549
			
531
			
550
			@Override
532
			@Override
551
			protected String preTraiterUrlRequete(String urlRequete, String valeur) {
533
			protected String preTraiterUrlRequete(String urlRequete, String valeur) {
552
				return ListeReferentielNomAsynchroneDAO.formaterUrlAutoCompletionReferentielNom(urlRequete, referentielTaxo, valeur);
534
				return ListeReferentielNomAsynchroneDAO.formaterUrlAutoCompletionReferentielNom(urlRequete, referentielTaxo, valeur);
553
			}
535
			}
554
			
536
			
555
			@Override
537
			@Override
556
			protected String preTraiterValeurAvantAffichage(String cle) {
538
			protected String preTraiterValeurAvantAffichage(String valeur) {
557
				ReferentielNom nomValeur = referentielNom.get(cle);
539
				ReferentielNom nomValeur = referentielNom.get(valeur);
558
				String valeurAffichee = nomValeur.getNom();
540
				String valeurAffichee = nomValeur.getNom();
559
				// Pour afficher les noms retenus en gras
541
				// Pour afficher les noms retenus en gras
560
				if (nomValeur.estRetenu()) {
542
				if (nomValeur.estRetenu()) {
561
					valeurAffichee = "<span class=\"nomRetenu\">"+nomValeur.getNom().trim()+"</span>";
543
					valeurAffichee = "<span class=\"nomRetenu\">"+nomValeur.getNom().trim()+"</span>";
562
				}
544
				}
563
				return valeurAffichee;
545
				return valeurAffichee;
564
			}
546
			}
565
	    };
547
	    };
566
 
548
 
567
	    Panel panelSeparationPp = new Panel();
549
	    Panel panelSeparationPp = new Panel();
568
	    panelSeparationPp.setHeight(15);
550
	    panelSeparationPp.setHeight(15);
569
	    panelSeparationPp.setBorder(false);
551
	    panelSeparationPp.setBorder(false);
570
 
552
 
571
	    panneauPremierColonne.add(panelSeparationPp);
553
	    panneauPremierColonne.add(panelSeparationPp);
572
	    panneauPremierColonne.add(selecteurReferentielTaxo, new AnchorLayoutData("85%"));
554
	    panneauPremierColonne.add(selecteurReferentielTaxo, new AnchorLayoutData("85%"));
573
	    panneauPremierColonne.add(espece, new AnchorLayoutData("95%"));
555
	    panneauPremierColonne.add(espece, new AnchorLayoutData("95%"));
574
 
556
 
575
	    selecteurAbondance = new ComboBox();
557
	    selecteurAbondance = new ComboBox();
576
	    selecteurAbondance.setCls("champ-separation");
558
	    selecteurAbondance.setCls("champ-separation");
577
	    selecteurAbondance.setLabel(Msg.get("abondance"));
559
	    selecteurAbondance.setLabel(Msg.get("abondance"));
578
	    selecteurAbondance.setStore(Ontologies.getValeursAbondance());
560
	    selecteurAbondance.setStore(Ontologies.getValeursAbondance());
579
	    selecteurAbondance.setDisplayField("label") ;
561
	    selecteurAbondance.setDisplayField("label") ;
580
	    selecteurAbondance.setValueField("valeur");
562
	    selecteurAbondance.setValueField("valeur");
581
	    selecteurAbondance.setEditable(true);
563
	    selecteurAbondance.setEditable(true);
582
	    selecteurAbondance.setHideTrigger(false);
564
	    selecteurAbondance.setHideTrigger(false);
583
	    selecteurAbondance.setForceSelection(false);
565
	    selecteurAbondance.setForceSelection(false);
584
	    selecteurAbondance.setTpl(champsListeTpl);
566
	    selecteurAbondance.setTpl(champsListeTpl);
585
	    panneauPremierColonne.add(selecteurAbondance,  new AnchorLayoutData("95%"));
567
	    panneauPremierColonne.add(selecteurAbondance,  new AnchorLayoutData("95%"));
586
	    
568
	    
587
	    lieudit = new AutoCompletionComboBox(Msg.get("lieu-dit"), ListeReferentielPersoAsynchroneDAO.getUrlReferentielPerso(TypesReferentiels.REFERENTIEL_LIEU_DIT)) {			
569
	    lieudit = new AutoCompletionComboBox(Msg.get("lieu-dit"), ListeReferentielPersoAsynchroneDAO.getUrlReferentielPerso(TypesReferentiels.REFERENTIEL_LIEU_DIT)) {			
588
			@Override
570
			@Override
589
			protected Map<String, String> parserResultatRequete(Response response) {
571
			protected Map<String, String> parserResultatRequete(Response response) {
590
				return Util.parserRetourReferentielPerso(response);
572
				return Util.parserRetourReferentielPerso(response);
591
			}
573
			}
592
			
574
			
593
			@Override
575
			@Override
594
			public void onSelectionValeur() {
576
			public void onSelectionValeur() {
595
				lieuDitModifie = true;
577
				lieuDitModifie = true;
596
			}
578
			}
597
			
579
			
598
			@Override
580
			@Override
599
			protected void onModificationValeur() {
581
			protected void onModificationValeur() {
600
				lieuDitModifie = true;	
582
				lieuDitModifie = true;	
601
			}
583
			}
602
 
584
 
603
			@Override
585
			@Override
604
			public void onValidationSaisie() {
586
			public void onValidationSaisie() {
605
				validerSaisie(Champs.LIEUDIT);
587
				validerSaisie(Champs.LIEUDIT);
606
			}  
588
			}  
607
			
589
			
608
			@Override
590
			@Override
609
			protected String preTraiterUrlRequete(String urlRequete, String valeur) {
591
			protected String preTraiterUrlRequete(String urlRequete, String valeur) {
610
				return ListeReferentielPersoAsynchroneDAO.formaterUrlRequeteAutoCompletionPerso(urlRequete, valeur);
592
				return ListeReferentielPersoAsynchroneDAO.formaterUrlRequeteAutoCompletionPerso(urlRequete, valeur);
611
			}
593
			}
612
		};
594
		};
613
	    panneauSecondeColonne.add(lieudit,  new AnchorLayoutData("95%"));
595
	    panneauSecondeColonne.add(lieudit,  new AnchorLayoutData("95%"));
614
	       
596
	       
615
	    milieu = new AutoCompletionComboBox(Msg.get("milieu"), ListeReferentielPersoAsynchroneDAO.getUrlReferentielPerso(TypesReferentiels.REFERENTIEL_MILIEU)) {			
597
	    milieu = new AutoCompletionComboBox(Msg.get("milieu"), ListeReferentielPersoAsynchroneDAO.getUrlReferentielPerso(TypesReferentiels.REFERENTIEL_MILIEU)) {			
616
			@Override
598
			@Override
617
			protected Map<String, String> parserResultatRequete(Response response) {
599
			protected Map<String, String> parserResultatRequete(Response response) {
618
				return Util.parserRetourReferentielPerso(response);
600
				return Util.parserRetourReferentielPerso(response);
619
			}
601
			}
620
			
602
			
621
			@Override
603
			@Override
622
			public void onSelectionValeur() {
604
			public void onSelectionValeur() {
623
				milieuModifie = true;
605
				milieuModifie = true;
624
			}
606
			}
625
			
607
			
626
			@Override
608
			@Override
627
			protected void onModificationValeur() {
609
			protected void onModificationValeur() {
628
				milieuModifie = true;	
610
				milieuModifie = true;	
629
			}
611
			}
630
 
612
 
631
			@Override
613
			@Override
632
			public void onValidationSaisie() {
614
			public void onValidationSaisie() {
633
				validerSaisie(Champs.MILIEU);
615
				validerSaisie(Champs.MILIEU);
634
			}  
616
			}  
635
			
617
			
636
			@Override
618
			@Override
637
			protected String preTraiterUrlRequete(String urlRequete, String valeur) {
619
			protected String preTraiterUrlRequete(String urlRequete, String valeur) {
638
				return ListeReferentielPersoAsynchroneDAO.formaterUrlRequeteAutoCompletionPerso(urlRequete, valeur);
620
				return ListeReferentielPersoAsynchroneDAO.formaterUrlRequeteAutoCompletionPerso(urlRequete, valeur);
639
			}
621
			}
640
	    };
622
	    };
641
	    panneauSecondeColonne.add(milieu,  new AnchorLayoutData("95%"));
623
	    panneauSecondeColonne.add(milieu,  new AnchorLayoutData("95%"));
642
 
624
 
643
	    comment = new TextArea(Msg.get("notes"), "comment");
625
	    comment = new TextArea(Msg.get("notes"), "comment");
644
	    comment.setAllowBlank(true);
626
	    comment.setAllowBlank(true);
645
	    comment.setHeight(50);
627
	    comment.setHeight(50);
646
 
628
 
647
	    panneauSecondeColonne.add(comment, new AnchorLayoutData("95%") );
629
	    panneauSecondeColonne.add(comment, new AnchorLayoutData("95%") );
648
 
630
 
649
	    Panel panelSeparationPs = new Panel();
631
	    Panel panelSeparationPs = new Panel();
650
	    panelSeparationPs.setHeight(39);
632
	    panelSeparationPs.setHeight(39);
651
	    panelSeparationPs.setBorder(false);
633
	    panelSeparationPs.setBorder(false);
652
 
634
 
653
	    panneauSecondeColonne.add(panelSeparationPs);
635
	    panneauSecondeColonne.add(panelSeparationPs);
654
 
636
 
655
	    selecteurCertitude = new ComboBox();
637
	    selecteurCertitude = new ComboBox();
656
	    selecteurCertitude.setLabel(Msg.get("identification"));
638
	    selecteurCertitude.setLabel(Msg.get("identification"));
657
	    selecteurCertitude.setStore(Ontologies.getValeursCertitude());
639
	    selecteurCertitude.setStore(Ontologies.getValeursCertitude());
658
	    selecteurCertitude.setDisplayField("label") ;
640
	    selecteurCertitude.setDisplayField("label") ;
659
	    selecteurCertitude.setValueField("valeur");
641
	    selecteurCertitude.setValueField("valeur");
660
	    selecteurCertitude.setEditable(true);
642
	    selecteurCertitude.setEditable(true);
661
	    selecteurCertitude.setHideTrigger(false);
643
	    selecteurCertitude.setHideTrigger(false);
662
	    selecteurCertitude.setForceSelection(false);
644
	    selecteurCertitude.setForceSelection(false);
663
	    selecteurCertitude.setTpl(champsListeTpl);
645
	    selecteurCertitude.setTpl(champsListeTpl);
664
	    panneauSecondeColonne.add(selecteurCertitude, new AnchorLayoutData("95%"));
646
	    panneauSecondeColonne.add(selecteurCertitude, new AnchorLayoutData("95%"));
665
 
647
 
666
	    selecteurStadePheno = new ComboBox();
648
	    selecteurStadePheno = new ComboBox();
667
	    selecteurStadePheno.setLabel(Msg.get("phenologie"));
649
	    selecteurStadePheno.setLabel(Msg.get("phenologie"));
668
	    selecteurStadePheno.setStore(Ontologies.getValeursPhenologie());
650
	    selecteurStadePheno.setStore(Ontologies.getValeursPhenologie());
669
	    selecteurStadePheno.setDisplayField("label") ;
651
	    selecteurStadePheno.setDisplayField("label") ;
670
	    selecteurStadePheno.setValueField("valeur");
652
	    selecteurStadePheno.setValueField("valeur");
671
	    selecteurStadePheno.setEditable(true);
653
	    selecteurStadePheno.setEditable(true);
672
	    selecteurStadePheno.setHideTrigger(false);
654
	    selecteurStadePheno.setHideTrigger(false);
673
	    selecteurStadePheno.setForceSelection(false);
655
	    selecteurStadePheno.setForceSelection(false);
674
	    selecteurStadePheno.setTpl(champsListeTpl);
656
	    selecteurStadePheno.setTpl(champsListeTpl);
675
	    panneauSecondeColonne.add(selecteurStadePheno, new AnchorLayoutData("95%"));
657
	    panneauSecondeColonne.add(selecteurStadePheno, new AnchorLayoutData("95%"));
676
 
658
 
677
	    if (Window.getClientWidth() > Window.getClientHeight() || Window.getClientWidth() < 800) {
659
	    if (Window.getClientWidth() > Window.getClientHeight() || Window.getClientWidth() < 800) {
678
			panneauIntermediaire.add(panneauPremierColonne, new ColumnLayoutData(.5));
660
			panneauIntermediaire.add(panneauPremierColonne, new ColumnLayoutData(.5));
679
			panneauIntermediaire.add(panneauSecondeColonne, new ColumnLayoutData(.5));
661
			panneauIntermediaire.add(panneauSecondeColonne, new ColumnLayoutData(.5));
680
	    }
662
	    }
681
	    else {
663
	    else {
682
			panneauIntermediaire.add(panneauPremierColonne);
664
			panneauIntermediaire.add(panneauPremierColonne);
683
			panneauIntermediaire.add(panneauSecondeColonne);   
665
			panneauIntermediaire.add(panneauSecondeColonne);   
684
	    }
666
	    }
685
 
667
 
686
		panneauFormulaire.add(panneauIntermediaire);
668
		panneauFormulaire.add(panneauIntermediaire);
687
		
669
		
688
		if (Ext.isIE()) {
670
		if (Ext.isIE()) {
689
			panneauPremierColonne.setButtonAlign(Position.RIGHT);
671
			panneauPremierColonne.setButtonAlign(Position.RIGHT);
690
			panneauPremierColonne.addButton(boutonOK);
672
			panneauPremierColonne.addButton(boutonOK);
691
			panneauPremierColonne.addButton(boutonModifier);
673
			panneauPremierColonne.addButton(boutonModifier);
692
			panneauPremierColonne.addButton(boutonSupprimer);
674
			panneauPremierColonne.addButton(boutonSupprimer);
693
			panneauSecondeColonne.setButtonAlign(Position.LEFT);
675
			panneauSecondeColonne.setButtonAlign(Position.LEFT);
694
			panneauPremierColonne.addButton(boutonReinitialiser);
676
			panneauPremierColonne.addButton(boutonReinitialiser);
695
		}
677
		}
696
		else {
678
		else {
697
			panneauFormulaire.addButton(boutonOK);
679
			panneauFormulaire.addButton(boutonOK);
698
			panneauFormulaire.addButton(boutonModifier);
680
			panneauFormulaire.addButton(boutonModifier);
699
			panneauFormulaire.addButton(boutonSupprimer);
681
			panneauFormulaire.addButton(boutonSupprimer);
700
			panneauFormulaire.addButton(boutonReinitialiser);
682
			panneauFormulaire.addButton(boutonReinitialiser);
701
		}
683
		}
702
 
684
 
703
		this.add(panneauFormulaire) ;
685
		this.add(panneauFormulaire) ;
704
 
686
 
705
		this.setAutoScroll(true);
687
		this.setAutoScroll(true);
706
 
688
 
707
 
689
 
708
		panneauFormulaire.addListener(new PanelListenerAdapter() {
690
		panneauFormulaire.addListener(new PanelListenerAdapter() {
709
	        @Override
691
	        @Override
710
			public void onResize(BoxComponent component, int adjWidth, int adjHeight, int rawWidth, int rawHeight) {
692
			public void onResize(BoxComponent component, int adjWidth, int adjHeight, int rawWidth, int rawHeight) {
711
	        	panneauIntermediaire.setWidth(rawWidth);
693
	        	panneauIntermediaire.setWidth(rawWidth);
712
	        	panneauIntermediaire.setHeight(rawHeight);
694
	        	panneauIntermediaire.setHeight(rawHeight);
713
	        
695
	        
714
	        	panneauPremierColonne.doLayout();
696
	        	panneauPremierColonne.doLayout();
715
	        	panneauSecondeColonne.doLayout();
697
	        	panneauSecondeColonne.doLayout();
716
	        		        
698
	        		        
717
	        	htmllocalitePanel.doLayout();
699
	        	htmllocalitePanel.doLayout();
718
	        	htmlPanel.doLayout();
700
	        	htmlPanel.doLayout();
719
	        	
701
	        	
720
				redimensionnerChampsEtendus();
702
				redimensionnerChampsEtendus();
721
	        
703
	        
722
	        	doLayout();
704
	        	doLayout();
723
	        }
705
	        }
724
	    });
706
	    });
725
 
707
 
726
		lienAfficherChampsEtendus = new HTML(Msg.get("afficher-champs-etendus"));
708
		lienAfficherChampsEtendus = new HTML(Msg.get("afficher-champs-etendus"));
727
		lienAfficherChampsEtendus.setStyleName("img-curseur-depl");
709
		lienAfficherChampsEtendus.setStyleName("img-curseur-depl");
728
		lienAfficherChampsEtendus.setStyleName("lienAfficherChampsEtendus");
710
		lienAfficherChampsEtendus.setStyleName("lienAfficherChampsEtendus");
729
		lienAfficherChampsEtendus.setVisible(false);
711
		lienAfficherChampsEtendus.setVisible(false);
730
 
712
 
731
		lienAfficherChampsEtendus.addClickHandler(new ClickHandler() {
713
		lienAfficherChampsEtendus.addClickHandler(new ClickHandler() {
732
			@Override
714
			@Override
733
			public void onClick(ClickEvent event) {
715
			public void onClick(ClickEvent event) {
734
				if(afficherChampsEtendus) {
716
				if(afficherChampsEtendus) {
735
					afficherChampsEtendus = false;
717
					afficherChampsEtendus = false;
736
					if(conteneurChampEtenduGauche != null && conteneurChampEtenduDroite != null) {
718
					if(conteneurChampEtenduGauche != null && conteneurChampEtenduDroite != null) {
737
						conteneurChampEtenduGauche.hide();
719
						conteneurChampEtenduGauche.hide();
738
						conteneurChampEtenduDroite.hide();
720
						conteneurChampEtenduDroite.hide();
739
					}
721
					}
740
					lienAfficherChampsEtendus.setText(Msg.get("afficher-champs-etendus"));
722
					lienAfficherChampsEtendus.setText(Msg.get("afficher-champs-etendus"));
741
 
723
 
742
				} else {
724
				} else {
743
					afficherChampsEtendus = true;
725
					afficherChampsEtendus = true;
744
					if(conteneurChampEtenduGauche != null && conteneurChampEtenduDroite != null) {
726
					if(conteneurChampEtenduGauche != null && conteneurChampEtenduDroite != null) {
745
						conteneurChampEtenduGauche.show();
727
						conteneurChampEtenduGauche.show();
746
						conteneurChampEtenduDroite.show();
728
						conteneurChampEtenduDroite.show();
747
						redimensionnerChampsEtendus();
729
						redimensionnerChampsEtendus();
748
					}
730
					}
749
					lienAfficherChampsEtendus.setText(Msg.get("cacher-champs-etendus"));
731
					lienAfficherChampsEtendus.setText(Msg.get("cacher-champs-etendus"));
750
				}
732
				}
751
			}
733
			}
752
		});
734
		});
753
		
735
		
754
		if(Configuration.saisieChampsEtendusActivee()) {
736
		if(Configuration.saisieChampsEtendusActivee()) {
755
			// Chargement du cache des correspondances cles/labels du catalogue
737
			// Chargement du cache des correspondances cles/labels du catalogue
756
			ListeReferentielChampsEtendusDAO lrceDao = new ListeReferentielChampsEtendusDAO(null);
738
			ListeReferentielChampsEtendusDAO lrceDao = new ListeReferentielChampsEtendusDAO(null);
757
			lrceDao.obtenirGroupesChampsEtendus(this);
739
			lrceDao.obtenirGroupesChampsEtendus(this);
758
			lrceDao.obtenirCatalogueChampsEtendus(this);
740
			lrceDao.obtenirCatalogueChampsEtendus(this);
759
			
741
			
760
			lienAjouterChampsEtendus = new HTML(Msg.get("ajouter-champ-etendu"));
742
			lienAjouterChampsEtendus = new HTML(Msg.get("ajouter-champ-etendu"));
761
			lienAjouterChampsEtendus.addStyleName("lienAjouterChampEtendu");
743
			lienAjouterChampsEtendus.addStyleName("lienAjouterChampEtendu");
762
			lienAjouterChampsEtendus.setVisible(true);
744
			lienAjouterChampsEtendus.setVisible(true);
763
			panneauPremierColonne.add(lienAjouterChampsEtendus);
745
			panneauPremierColonne.add(lienAjouterChampsEtendus);
764
			gererLienAjoutChampsEtendus();
746
			gererLienAjoutChampsEtendus();
765
		}
747
		}
766
		
748
		
767
		panneauPremierColonne.add(lienAfficherChampsEtendus);
749
		panneauPremierColonne.add(lienAfficherChampsEtendus);
768
		panneauPremierColonne.addListener(new PanelListenerAdapter() {
750
		panneauPremierColonne.addListener(new PanelListenerAdapter() {
769
			@Override
751
			@Override
770
			public void onAfterLayout(Container c) {
752
			public void onAfterLayout(Container c) {
771
				if(premierAffichage) {
753
				if(premierAffichage) {
772
					lienAfficherChampsEtendus.setVisible(false);
754
					lienAfficherChampsEtendus.setVisible(false);
773
					premierAffichage = false;
755
					premierAffichage = false;
774
				}
756
				}
775
			}
757
			}
776
		});
758
		});
777
 
759
 
778
		ajouterListeners() ;
760
		ajouterListeners() ;
779
		ajouterToolTipsBoutons();
761
		ajouterToolTipsBoutons();
780
		saisieTabindex();
762
		saisieTabindex();
781
	}
763
	}
782
	
764
	
783
	protected void surSelectionEspece() {
765
	protected void surSelectionEspece() {
784
		//String cle = espece.getText();
-
 
785
		String cle = espece.getValue();
-
 
786
		ReferentielNom nom = referentielNom.get(cle);
766
		ReferentielNom nom = referentielNom.get(espece.getText());
787
		// Bricolage immonde : sans ça, la combobox affiche la clef au lieu d'afficher
-
 
788
		// la valeur - WTF?? - pas trouvé moyen de faire mieux (attention aux effets
-
 
789
		// de bord dégueus)
-
 
790
		espece.setText(nom.getNom());
-
 
791
		// retour à la vie normale
-
 
792
		numeroNom = nom.getNumeroNom();
767
		numeroNom = nom.getNumeroNom();
793
		selectionEspece = true;
768
		selectionEspece = true;
794
		observationMediateur.obtenirImageInformationExternes(referentielTaxo, numeroNom);
769
		observationMediateur.obtenirImageInformationExternes(referentielTaxo, numeroNom);
795
	}
770
	}
796
	
771
	
797
	protected void surSelectionLocalite() {
772
	protected void surSelectionLocalite() {
798
		ReferentielLocalite infosLoc = referentielLocalite.get(localite.getText());
773
		ReferentielLocalite infosLoc = referentielLocalite.get(localite.getText());
799
        codeLocalite = infosLoc.getCodeLocalite();
774
        codeLocalite = infosLoc.getCodeLocalite();
800
        selectionlocalite=true;
775
        selectionlocalite=true;
801
	}
776
	}
802
 
777
 
803
	private void gererLienAjoutChampsEtendus() {	
778
	private void gererLienAjoutChampsEtendus() {	
804
		popUpAjoutChampEtendu.setStylePrimaryName("popup_champ_etendu");
779
		popUpAjoutChampEtendu.setStylePrimaryName("popup_champ_etendu");
805
		lienAjouterChampsEtendus.addClickHandler(new ClickHandler() {
780
		lienAjouterChampsEtendus.addClickHandler(new ClickHandler() {
806
			@Override
781
			@Override
807
			public void onClick(ClickEvent event) {
782
			public void onClick(ClickEvent event) {
808
				FormulaireSaisieChampEtendu formChamp = new FormulaireSaisieChampEtendu() {	
783
				FormulaireSaisieChampEtendu formChamp = new FormulaireSaisieChampEtendu() {	
809
					
784
					
810
					@Override
785
					@Override
811
					public void surValidation(ChampSaisieEtendu champ) {
786
					public void surValidation(ChampSaisieEtendu champ) {
812
						ajouterChampEtenduAuFormulaire(champ, true);
787
						ajouterChampEtenduAuFormulaire(champ, true);
813
						popUpAjoutChampEtendu.clear();
788
						popUpAjoutChampEtendu.clear();
814
						popUpAjoutChampEtendu.hide();
789
						popUpAjoutChampEtendu.hide();
815
					}
790
					}
816
					
791
					
817
					@Override
792
					@Override
818
					public void surAjout(ChampSaisieEtendu champ) {
793
					public void surAjout(ChampSaisieEtendu champ) {
819
						ajouterChampEtenduAuFormulaire(champ, false);
794
						ajouterChampEtenduAuFormulaire(champ, false);
820
					}
795
					}
821
 
796
 
822
					@Override
797
					@Override
823
					public void surAnnulation() {
798
					public void surAnnulation() {
824
						popUpAjoutChampEtendu.clear();
799
						popUpAjoutChampEtendu.clear();
825
						popUpAjoutChampEtendu.hide();
800
						popUpAjoutChampEtendu.hide();
826
					}
801
					}
827
 
802
 
828
					@Override
803
					@Override
829
					public void surAjoutMultiple(List<ChampSaisieEtendu> champs) {
804
					public void surAjoutMultiple(List<ChampSaisieEtendu> champs) {
830
						for (Iterator<ChampSaisieEtendu> iterator = champs.iterator(); iterator.hasNext();) {
805
						for (Iterator<ChampSaisieEtendu> iterator = champs.iterator(); iterator.hasNext();) {
831
							ChampSaisieEtendu champSaisieEtendu = (ChampSaisieEtendu) iterator.next();
806
							ChampSaisieEtendu champSaisieEtendu = (ChampSaisieEtendu) iterator.next();
832
							ajouterChampEtenduAuFormulaire(champSaisieEtendu, false);
807
							ajouterChampEtenduAuFormulaire(champSaisieEtendu, false);
833
						}
808
						}
834
					}
809
					}
835
 
810
 
836
					@Override
811
					@Override
837
					public void surValidationMultiple(List<ChampSaisieEtendu> champs) {
812
					public void surValidationMultiple(List<ChampSaisieEtendu> champs) {
838
						for (Iterator<ChampSaisieEtendu> iterator = champs.iterator(); iterator.hasNext();) {
813
						for (Iterator<ChampSaisieEtendu> iterator = champs.iterator(); iterator.hasNext();) {
839
							ChampSaisieEtendu champSaisieEtendu = (ChampSaisieEtendu) iterator.next();
814
							ChampSaisieEtendu champSaisieEtendu = (ChampSaisieEtendu) iterator.next();
840
							ajouterChampEtenduAuFormulaire(champSaisieEtendu, false);
815
							ajouterChampEtenduAuFormulaire(champSaisieEtendu, false);
841
						}
816
						}
842
						popUpAjoutChampEtendu.clear();
817
						popUpAjoutChampEtendu.clear();
843
						popUpAjoutChampEtendu.hide();
818
						popUpAjoutChampEtendu.hide();
844
					}
819
					}
845
				};
820
				};
846
				popUpAjoutChampEtendu.add(formChamp);
821
				popUpAjoutChampEtendu.add(formChamp);
847
				popUpAjoutChampEtendu.center();		
822
				popUpAjoutChampEtendu.center();		
848
				popUpAjoutChampEtendu.setModal(true);
823
				popUpAjoutChampEtendu.setModal(true);
849
				popUpAjoutChampEtendu.show();
824
				popUpAjoutChampEtendu.show();
850
				formChamp.redimensionner(popUpAjoutChampEtendu.getOffsetWidth() - 13);
825
				formChamp.redimensionner(popUpAjoutChampEtendu.getOffsetWidth() - 13);
851
			}
826
			}
852
		});
827
		});
853
	}
828
	}
854
	
829
	
855
	private void ajouterChampEtenduAuFormulaire(ChampSaisieEtendu nChamp, boolean fermerPopup) {
830
	private void ajouterChampEtenduAuFormulaire(ChampSaisieEtendu nChamp, boolean fermerPopup) {
856
		ChampEtendu chet = new ChampEtendu(nChamp.getCle(), nChamp.getLabel(), "");
831
		ChampEtendu chet = new ChampEtendu(nChamp.getCle(), nChamp.getLabel(), "");
857
		Map<String, ChampEtendu> champsEt = getValeursChampsEtendus();
832
		Map<String, ChampEtendu> champsEt = getValeursChampsEtendus();
858
		if(!champsEt.containsKey(chet.getCle())) {
833
		if(!champsEt.containsKey(chet.getCle())) {
859
			champsEt.put(chet.getCle(), chet);
834
			champsEt.put(chet.getCle(), chet);
860
			afficherChampsEtendus = true;
835
			afficherChampsEtendus = true;
861
			if(fermerPopup) {
836
			if(fermerPopup) {
862
				afficherChampsEtendus(champsEt, chet);
837
				afficherChampsEtendus(champsEt, chet);
863
				popUpAjoutChampEtendu.clear();
838
				popUpAjoutChampEtendu.clear();
864
				popUpAjoutChampEtendu.hide();
839
				popUpAjoutChampEtendu.hide();
865
			} else {
840
			} else {
866
				afficherChampsEtendus(champsEt, null);
841
				afficherChampsEtendus(champsEt, null);
867
			}
842
			}
868
		} else {
843
		} else {
869
			String[] stParams = {chet.getLabel()};
844
			String[] stParams = {chet.getLabel()};
870
			Window.alert(Msg.get("indication-champ-etendu-existe-deja", stParams));
845
			Window.alert(Msg.get("indication-champ-etendu-existe-deja", stParams));
871
		}
846
		}
872
	}
847
	}
873
 
848
 
874
	private void ajouterToolTipsBoutons() {
849
	private void ajouterToolTipsBoutons() {
875
		boutonOK.setTitle(Msg.get("indication-bouton-creer-obs"));
850
		boutonOK.setTitle(Msg.get("indication-bouton-creer-obs"));
876
		boutonModifier.setTitle(Msg.get("indication-bouton-modifier-obs"));
851
		boutonModifier.setTitle(Msg.get("indication-bouton-modifier-obs"));
877
		boutonSupprimer.setTitle(Msg.get("indication-bouton-supprimer-obs"));
852
		boutonSupprimer.setTitle(Msg.get("indication-bouton-supprimer-obs"));
878
		boutonReinitialiser.setTitle(Msg.get("indication-bouton-reinitialiser-obs"));
853
		boutonReinitialiser.setTitle(Msg.get("indication-bouton-reinitialiser-obs"));
879
	}
854
	}
880
 
855
 
881
	private void surPremierAffichageCoordPanel(final double largeur) {
856
	private void surPremierAffichageCoordPanel(final double largeur) {
882
		ExtElement lienCoord = Ext.get("lien_coord");
857
		ExtElement lienCoord = Ext.get("lien_coord");
883
		lienCoord.removeAllListeners();
858
		lienCoord.removeAllListeners();
884
		lienCoord.addListener("click", new EventCallback() {
859
		lienCoord.addListener("click", new EventCallback() {
885
			@Override
860
			@Override
886
			public void execute(EventObject e) {
861
			public void execute(EventObject e) {
887
 
862
 
888
				coordPanel.setVisible(!coordPanel.isVisible());
863
				coordPanel.setVisible(!coordPanel.isVisible());
889
 
864
 
890
				if(Ext.isIE()) {
865
				if(Ext.isIE()) {
891
					latitude.focus();
866
					latitude.focus();
892
				}
867
				}
893
 
868
 
894
				CarnetEnLigneMediateur.fireResize();
869
				CarnetEnLigneMediateur.fireResize();
895
			}
870
			}
896
		}) ;
871
		}) ;
897
 
872
 
898
		ExtElement lienCartoCoord = Ext.get("lien_carto_coord");
873
		ExtElement lienCartoCoord = Ext.get("lien_carto_coord");
899
		lienCartoCoord.removeAllListeners();
874
		lienCartoCoord.removeAllListeners();
900
		lienCartoCoord.addListener("click", new EventCallback() {
875
		lienCartoCoord.addListener("click", new EventCallback() {
901
			@Override
876
			@Override
902
			public void execute(EventObject e) {
877
			public void execute(EventObject e) {
903
				obtenirInformationCoord();
878
				obtenirInformationCoord();
904
			}
879
			}
905
		}) ;
880
		}) ;
906
 
881
 
907
		ExtElement lienCarto = Ext.get("lien_carto");
882
		ExtElement lienCarto = Ext.get("lien_carto");
908
		lienCarto.removeAllListeners();
883
		lienCarto.removeAllListeners();
909
		lienCarto.addListener("click", new EventCallback() {
884
		lienCarto.addListener("click", new EventCallback() {
910
 
885
 
911
			@Override
886
			@Override
912
			public void execute(EventObject e) {
887
			public void execute(EventObject e) {
913
 
888
 
914
				if(localite.getText() != null && !localite.getText().equals("")) {
889
				if(localite.getText() != null && !localite.getText().equals("")) {
915
					obtenirInformationLocalite();
890
					obtenirInformationLocalite();
916
					longlatAjoutee = true;
891
					longlatAjoutee = true;
917
				} else {
892
				} else {
918
					Window.alert(Msg.get("indication-localite-vide-invalide"));
893
					Window.alert(Msg.get("indication-localite-vide-invalide"));
919
				}
894
				}
920
			}
895
			}
921
		});
896
		});
922
 
897
 
923
		if(!Ext.isIE() && Window.getClientWidth() < 1200) {
898
		if(!Ext.isIE() && Window.getClientWidth() < 1200) {
924
 
899
 
925
			int largeurN = (int)largeur;
900
			int largeurN = (int)largeur;
926
 
901
 
927
			latitude.setWidth(largeurN+"px");
902
			latitude.setWidth(largeurN+"px");
928
			longitude.setWidth(largeurN+"px");
903
			longitude.setWidth(largeurN+"px");
929
			lienSelectionlocalite.setWidth(largeurN+"px");
904
			lienSelectionlocalite.setWidth(largeurN+"px");
930
		}
905
		}
931
	}
906
	}
932
 
907
 
933
	private void ajouterListeners()
908
	private void ajouterListeners()
934
	{
909
	{
935
		// Listener completion communne
910
		// Listener completion communne
936
		final Rafraichissable r = this;
911
		final Rafraichissable r = this;
937
		  
912
		  
938
		ListenerConfig listenerConfiglocalite=new ListenerConfig();
913
		ListenerConfig listenerConfiglocalite=new ListenerConfig();
939
		listenerConfiglocalite.setDelay(200);
914
		listenerConfiglocalite.setDelay(200);
940
		listenerConfiglocalite.setStopPropagation(false);
915
		listenerConfiglocalite.setStopPropagation(false);
941
		listenerConfiglocalite.setStopEvent(false);
916
		listenerConfiglocalite.setStopEvent(false);
942
 
917
 
943
	    date.addListener(new DatePickerListenerAdapter() {
918
	    date.addListener(new DatePickerListenerAdapter() {
944
 
919
 
945
			@Override
920
			@Override
946
			public void onSelect(DatePicker dataPicker, Date date) {
921
			public void onSelect(DatePicker dataPicker, Date date) {
947
				dateModifiee = true;
922
				dateModifiee = true;
948
			}
923
			}
949
	    });
924
	    });
950
 
925
 
951
	    ListenerConfig listenerConfigAutocompletion=new ListenerConfig();
926
	    ListenerConfig listenerConfigAutocompletion=new ListenerConfig();
952
	    listenerConfigAutocompletion.setDelay(200);
927
	    listenerConfigAutocompletion.setDelay(200);
953
	    listenerConfigAutocompletion.setStopPropagation(false);
928
	    listenerConfigAutocompletion.setStopPropagation(false);
954
	    listenerConfigAutocompletion.setStopEvent(false);
929
	    listenerConfigAutocompletion.setStopEvent(false);
955
 
930
 
956
		ListenerConfig listenerConfigEspece=new ListenerConfig();
931
		ListenerConfig listenerConfigEspece=new ListenerConfig();
957
		listenerConfigEspece.setDelay(10);
932
		listenerConfigEspece.setDelay(10);
958
		listenerConfigEspece.setStopPropagation(false);
933
		listenerConfigEspece.setStopPropagation(false);
959
		listenerConfigEspece.setStopEvent(false);
934
		listenerConfigEspece.setStopEvent(false);
960
 
935
 
961
		tCoord = new Timer() {
936
		tCoord = new Timer() {
962
 
937
 
963
			@Override
938
			@Override
964
			public void run() {
939
			public void run() {
965
	        	double[] coord = coordonneesValides();
940
	        	double[] coord = coordonneesValides();
966
	        	if(!recherchelocaliteEnCours && coord != null && (longModifiee || latModifiee)) {
941
	        	if(!recherchelocaliteEnCours && coord != null && (longModifiee || latModifiee)) {
967
	        		recherchelocaliteEnCours = true;
942
	        		recherchelocaliteEnCours = true;
968
	        		Ext.get(lienSelectionlocalite.getElement()).mask(Msg.get("recherche"));
943
	        		Ext.get(lienSelectionlocalite.getElement()).mask(Msg.get("recherche"));
969
	        		observationMediateur.obtenirInformationCoord(r,coord[0], coord[1]);
944
	        		observationMediateur.obtenirInformationCoord(r,coord[0], coord[1]);
970
	        	}
945
	        	}
971
			}
946
			}
972
 
947
 
973
		};
948
		};
974
 
949
 
975
	    ajouterListenerChampEvenementsClavier(date);
950
	    ajouterListenerChampEvenementsClavier(date);
976
		ajouterListenerChampEvenementsClavier(selecteurReferentielTaxo);
951
		ajouterListenerChampEvenementsClavier(selecteurReferentielTaxo);
977
		ajouterListenerChampEvenementsClavier(comment);
952
		ajouterListenerChampEvenementsClavier(comment);
978
		ajouterListenerChampEvenementsClavier(latitude);
953
		ajouterListenerChampEvenementsClavier(latitude);
979
		ajouterListenerChampEvenementsClavier(longitude);
954
		ajouterListenerChampEvenementsClavier(longitude);
980
		ajouterListenerChampEvenementsClavier(altitude);
955
		ajouterListenerChampEvenementsClavier(altitude);
981
		ajouterListenerChampEvenementsClavier(selecteurAbondance);
956
		ajouterListenerChampEvenementsClavier(selecteurAbondance);
982
		ajouterListenerChampEvenementsClavier(selecteurCertitude);
957
		ajouterListenerChampEvenementsClavier(selecteurCertitude);
983
		ajouterListenerChampEvenementsClavier(selecteurStadePheno);
958
		ajouterListenerChampEvenementsClavier(selecteurStadePheno);
984
		ajouterListenerChampsCombobox();
959
		ajouterListenerChampsCombobox();
985
 
960
 
986
		boutonOK.addListener(new ButtonListenerAdapter() {
961
		boutonOK.addListener(new ButtonListenerAdapter() {
987
			@Override
962
			@Override
988
			public void onClick(Button button, EventObject e) {
963
			public void onClick(Button button, EventObject e) {
989
				ajouterObservation();
964
				ajouterObservation();
990
			}
965
			}
991
		});
966
		});
992
 
967
 
993
		boutonModifier.addListener(new ButtonListenerAdapter() {
968
		boutonModifier.addListener(new ButtonListenerAdapter() {
994
			@Override
969
			@Override
995
			public void onClick(Button button, EventObject e) {
970
			public void onClick(Button button, EventObject e) {
996
				if(selectionMultiple) {
971
				if(selectionMultiple) {
997
					modifierObservationEnMasse();
972
					modifierObservationEnMasse();
998
				} else {
973
				} else {
999
					modifierObservation() ;
974
					modifierObservation() ;
1000
				}
975
				}
1001
			}
976
			}
1002
		});
977
		});
1003
 
978
 
1004
		boutonSupprimer.addListener(new ButtonListenerAdapter() {
979
		boutonSupprimer.addListener(new ButtonListenerAdapter() {
1005
			@Override
980
			@Override
1006
			public void onClick(Button button, EventObject e) {
981
			public void onClick(Button button, EventObject e) {
1007
				if(!selectionMultiple) {
982
				if(!selectionMultiple) {
1008
					supprimerObservation();
983
					supprimerObservation();
1009
				} else {
984
				} else {
1010
					observationMediateur.supprimerObservations();
985
					observationMediateur.supprimerObservations();
1011
				}
986
				}
1012
			}
987
			}
1013
		});
988
		});
1014
 
989
 
1015
		boutonReinitialiser.addListener(new ButtonListenerAdapter() {
990
		boutonReinitialiser.addListener(new ButtonListenerAdapter() {
1016
			@Override
991
			@Override
1017
			public void onClick(Button button, EventObject e) {
992
			public void onClick(Button button, EventObject e) {
1018
					setSelectionMultiple(false);
993
					setSelectionMultiple(false);
1019
					raz();
994
					raz();
1020
			}
995
			}
1021
		});
996
		});
1022
 
997
 
1023
		this.addListener(new ContainerListenerAdapter() {
998
		this.addListener(new ContainerListenerAdapter() {
1024
			@Override
999
			@Override
1025
			public void onAfterLayout(Container self) {
1000
			public void onAfterLayout(Container self) {
1026
				localite.focus();
1001
				localite.focus();
1027
			}
1002
			}
1028
		});
1003
		});
1029
	}
1004
	}
1030
 
1005
 
1031
	private void ajouterListenerChampsCombobox() {
1006
	private void ajouterListenerChampsCombobox() {
1032
		selecteurReferentielTaxo.addListener(new ComboBoxListenerAdapter() {
1007
		selecteurReferentielTaxo.addListener(new ComboBoxListenerAdapter() {
1033
             @Override
1008
             @Override
1034
			public void onSelect(ComboBox comboBox, Record record, int index) {
1009
			public void onSelect(ComboBox comboBox, Record record, int index) {
1035
            	 referentielTaxo = record.getAsString("valeur");
1010
            	 referentielTaxo = record.getAsString("valeur");
1036
                 observationMediateur.setRefTaxSelectionne(index);
1011
                 observationMediateur.setRefTaxSelectionne(index);
1037
                 referentielTaxoModifie = true;
1012
                 referentielTaxoModifie = true;
1038
             }
1013
             }
1039
         });
1014
         });
1040
 
1015
 
1041
		selecteurAbondance.addListener(new ComboBoxListenerAdapter() {
1016
		selecteurAbondance.addListener(new ComboBoxListenerAdapter() {
1042
			@Override
1017
			@Override
1043
			public void onSelect(ComboBox comboBox, Record record, int index) {
1018
			public void onSelect(ComboBox comboBox, Record record, int index) {
1044
                 selectionAbondance=true;
1019
                 selectionAbondance=true;
1045
                 abondanceModifiee = true;
1020
                 abondanceModifiee = true;
1046
             }
1021
             }
1047
         });
1022
         });
1048
 
1023
 
1049
		selecteurCertitude.addListener(new ComboBoxListenerAdapter() {
1024
		selecteurCertitude.addListener(new ComboBoxListenerAdapter() {
1050
 
1025
 
1051
			@Override
1026
			@Override
1052
			public void onSelect(ComboBox comboBox, Record record, int index) {
1027
			public void onSelect(ComboBox comboBox, Record record, int index) {
1053
                 selectionCertitude=true;
1028
                 selectionCertitude=true;
1054
                 certitudeModifiee = true;
1029
                 certitudeModifiee = true;
1055
             }
1030
             }
1056
         });
1031
         });
1057
 
1032
 
1058
		selecteurStadePheno.addListener(new ComboBoxListenerAdapter() {
1033
		selecteurStadePheno.addListener(new ComboBoxListenerAdapter() {
1059
			@Override
1034
			@Override
1060
			public void onSelect(ComboBox comboBox, Record record, int index) {
1035
			public void onSelect(ComboBox comboBox, Record record, int index) {
1061
                 selectionPhenologie=true;
1036
                 selectionPhenologie=true;
1062
                 phenologieModifiee = true;
1037
                 phenologieModifiee = true;
1063
             }
1038
             }
1064
         });
1039
         });
1065
	}
1040
	}
1066
 
1041
 
1067
	private void ajouterListenerChampEvenementsClavier(final TextField champ) {
1042
	private void ajouterListenerChampEvenementsClavier(final TextField champ) {
1068
		champ.addKeyPressListener(new EventCallback() {
1043
		champ.addKeyPressListener(new EventCallback() {
1069
			@Override
1044
			@Override
1070
			public void execute(EventObject e) {
1045
			public void execute(EventObject e) {
1071
				surEvenementClavier(e, champ);
1046
				surEvenementClavier(e, champ);
1072
			}
1047
			}
1073
	    });
1048
	    });
1074
	}
1049
	}
1075
 
1050
 
1076
	private void ajouterListenerChampEvenementsClavier(final TextField champ, final ListenerConfig config) {
1051
	private void ajouterListenerChampEvenementsClavier(final TextField champ, final ListenerConfig config) {
1077
		champ.addKeyPressListener(new EventCallback() {
1052
		champ.addKeyPressListener(new EventCallback() {
1078
			@Override
1053
			@Override
1079
			public void execute(EventObject e) {
1054
			public void execute(EventObject e) {
1080
				surEvenementClavier(e, champ);
1055
				surEvenementClavier(e, champ);
1081
			}
1056
			}
1082
	    }, config);
1057
	    }, config);
1083
	}
1058
	}
1084
 
1059
 
1085
	private void surEvenementClavier(EventObject e, TextField champ) {
1060
	private void surEvenementClavier(EventObject e, TextField champ) {
1086
		switch(e.getKey()) {
1061
		switch(e.getKey()) {
1087
			case KEY_ALT:
1062
			case KEY_ALT:
1088
			case KEY_CTRL:
1063
			case KEY_CTRL:
1089
			case KEY_DOWN:
1064
			case KEY_DOWN:
1090
			case KEY_END:
1065
			case KEY_END:
1091
			case KEY_ESCAPE:
1066
			case KEY_ESCAPE:
1092
			case KEY_HOME:
1067
			case KEY_HOME:
1093
			case KEY_LEFT:
1068
			case KEY_LEFT:
1094
			case KEY_PAGEDOWN:
1069
			case KEY_PAGEDOWN:
1095
			case KEY_PAGEUP:
1070
			case KEY_PAGEUP:
1096
			case KEY_RIGHT:
1071
			case KEY_RIGHT:
1097
			case KEY_SHIFT:
1072
			case KEY_SHIFT:
1098
			case KEY_TAB:
1073
			case KEY_TAB:
1099
			case KEY_UP:
1074
			case KEY_UP:
1100
	        break;
1075
	        break;
1101
 
1076
 
1102
		    case KEY_ENTER:
1077
		    case KEY_ENTER:
1103
		    	surEvenementClavierToucheEntree(champ);
1078
		    	surEvenementClavierToucheEntree(champ);
1104
		    	break;
1079
		    	break;
1105
 
1080
 
1106
	        default:
1081
	        default:
1107
	        	gererEvenementClavierDefaut(champ);
1082
	        	gererEvenementClavierDefaut(champ);
1108
	        break;
1083
	        break;
1109
		}
1084
		}
1110
	}
1085
	}
1111
 
1086
 
1112
	private void surEvenementClavierToucheEntree(TextField champ) {
1087
	private void surEvenementClavierToucheEntree(TextField champ) {
1113
		//TODO: faire un switch ou une enum
1088
		//TODO: faire un switch ou une enum
1114
		if(champ.equals(selecteurStadePheno)) {
1089
		if(champ.equals(selecteurStadePheno)) {
1115
			if(!selectionPhenologie) {
1090
			if(!selectionPhenologie) {
1116
  	    		validerSaisie(Champs.PHENOLOGIE); 
1091
  	    		validerSaisie(Champs.PHENOLOGIE); 
1117
	    	} else {
1092
	    	} else {
1118
	    		selectionPhenologie = false;
1093
	    		selectionPhenologie = false;
1119
	    	}
1094
	    	}
1120
		}
1095
		}
1121
 
1096
 
1122
		if(champ.equals(selecteurCertitude)) {
1097
		if(champ.equals(selecteurCertitude)) {
1123
			if(!selectionCertitude) {
1098
			if(!selectionCertitude) {
1124
		    		validerSaisie(Champs.CERTITUDE); 
1099
		    		validerSaisie(Champs.CERTITUDE); 
1125
	    	} else {
1100
	    	} else {
1126
	    		selectionCertitude = false;
1101
	    		selectionCertitude = false;
1127
	    	}
1102
	    	}
1128
		}
1103
		}
1129
 
1104
 
1130
		if(champ.equals(selecteurAbondance)) {
1105
		if(champ.equals(selecteurAbondance)) {
1131
			if(!selectionAbondance) {
1106
			if(!selectionAbondance) {
1132
		    	validerSaisie(Champs.ABONDANCE); 
1107
		    	validerSaisie(Champs.ABONDANCE); 
1133
	    	} else {
1108
	    	} else {
1134
	    		selectionAbondance = false;
1109
	    		selectionAbondance = false;
1135
	    	}
1110
	    	}
1136
		}
1111
		}
1137
 
1112
 
1138
		if(champ.equals(longitude)) {
1113
		if(champ.equals(longitude)) {
1139
			validerSaisie(Champs.LONGITUDE);
1114
			validerSaisie(Champs.LONGITUDE);
1140
		}
1115
		}
1141
 
1116
 
1142
		if(champ.equals(latitude)) {  	    	    
1117
		if(champ.equals(latitude)) {  	    	    
1143
	    	validerSaisie(Champs.LATITUDE);
1118
	    	validerSaisie(Champs.LATITUDE);
1144
		}
1119
		}
1145
 
1120
 
1146
		if(champ.equals(altitude)) {  	    	    
1121
		if(champ.equals(altitude)) {  	    	    
1147
	    	validerSaisie(Champs.ALTITUDE);
1122
	    	validerSaisie(Champs.ALTITUDE);
1148
		}
1123
		}
1149
 
1124
 
1150
		if(champ.equals(espece)) {
1125
		if(champ.equals(espece)) {
1151
			if(selectionEspece) {
1126
			if(selectionEspece) {
1152
	    		especeModifiee = true;
1127
	    		especeModifiee = true;
1153
	    		selectionEspece=false;
1128
	    		selectionEspece=false;
1154
	    	}
1129
	    	}
1155
	    	else {
1130
	    	else {
1156
	    		validerSaisie(Champs.ESPECE); 	    	    
1131
	    		validerSaisie(Champs.ESPECE); 	    	    
1157
	    	}
1132
	    	}
1158
		}
1133
		}
1159
 
1134
 
1160
		if(champ.equals(selecteurReferentielTaxo)) {
1135
		if(champ.equals(selecteurReferentielTaxo)) {
1161
			validerSaisie(Champs.REFERENTIELTAXO);
1136
			validerSaisie(Champs.REFERENTIELTAXO);
1162
		}
1137
		}
1163
 
1138
 
1164
		if(champ.equals(date)) {
1139
		if(champ.equals(date)) {
1165
			validerSaisie(Champs.DATE);
1140
			validerSaisie(Champs.DATE);
1166
		}
1141
		}
1167
 
1142
 
1168
		if(champ.equals(localite)) {
1143
		if(champ.equals(localite)) {
1169
			if(champ.equals(localite)) {
1144
			if(champ.equals(localite)) {
1170
				if (selectionlocalite) {
1145
				if (selectionlocalite) {
1171
		    		 localiteModifiee= true;
1146
		    		 localiteModifiee= true;
1172
		    		 selectionlocalite=false;
1147
		    		 selectionlocalite=false;
1173
		    	 }
1148
		    	 }
1174
		    	else {
1149
		    	else {
1175
		    		validerSaisie(Champs.LOCALITE);
1150
		    		validerSaisie(Champs.LOCALITE);
1176
		    	 }
1151
		    	 }
1177
			}
1152
			}
1178
		}
1153
		}
1179
	}
1154
	}
1180
 
1155
 
1181
	private void gererEvenementClavierDefaut(TextField champ) {
1156
	private void gererEvenementClavierDefaut(TextField champ) {
1182
		//TODO: faire un switch ou une enum
1157
		//TODO: faire un switch ou une enum
1183
		if(champ.equals(selecteurStadePheno)) {
1158
		if(champ.equals(selecteurStadePheno)) {
1184
			selecteurStadePheno.setRawValue(selecteurStadePheno.getRawValue());
1159
			selecteurStadePheno.setRawValue(selecteurStadePheno.getRawValue());
1185
			selecteurStadePheno.setValue(selecteurStadePheno.getRawValue());
1160
			selecteurStadePheno.setValue(selecteurStadePheno.getRawValue());
1186
			phenologieModifiee = true;
1161
			phenologieModifiee = true;
1187
			selectionPhenologie = false;
1162
			selectionPhenologie = false;
1188
		}
1163
		}
1189
 
1164
 
1190
		if(champ.equals(selecteurCertitude)) {
1165
		if(champ.equals(selecteurCertitude)) {
1191
			selecteurCertitude.setRawValue(selecteurCertitude.getRawValue());
1166
			selecteurCertitude.setRawValue(selecteurCertitude.getRawValue());
1192
	    	selecteurCertitude.setValue(selecteurCertitude.getRawValue());
1167
	    	selecteurCertitude.setValue(selecteurCertitude.getRawValue());
1193
	    	certitudeModifiee = true;
1168
	    	certitudeModifiee = true;
1194
	    	selectionCertitude = false;
1169
	    	selectionCertitude = false;
1195
		}
1170
		}
1196
 
1171
 
1197
		if(champ.equals(selecteurAbondance)) {
1172
		if(champ.equals(selecteurAbondance)) {
1198
			selecteurAbondance.setRawValue(selecteurAbondance.getRawValue());
1173
			selecteurAbondance.setRawValue(selecteurAbondance.getRawValue());
1199
	    	selecteurAbondance.setValue(selecteurAbondance.getRawValue());
1174
	    	selecteurAbondance.setValue(selecteurAbondance.getRawValue());
1200
	    	abondanceModifiee = true;
1175
	    	abondanceModifiee = true;
1201
	    	selectionAbondance = false;
1176
	    	selectionAbondance = false;
1202
		}
1177
		}
1203
 
1178
 
1204
		if(champ.equals(longitude)) {
1179
		if(champ.equals(longitude)) {
1205
			longModifiee = true;
1180
			longModifiee = true;
1206
        	tCoord.cancel();
1181
        	tCoord.cancel();
1207
        	tCoord.schedule(250);
1182
        	tCoord.schedule(250);
1208
		}
1183
		}
1209
 
1184
 
1210
		if(champ.equals(latitude)) {  	    	    
1185
		if(champ.equals(latitude)) {  	    	    
1211
			latModifiee = true;
1186
			latModifiee = true;
1212
	      	tCoord.cancel();
1187
	      	tCoord.cancel();
1213
	      	tCoord.schedule(250);
1188
	      	tCoord.schedule(250);
1214
		}
1189
		}
1215
 
1190
 
1216
		if(champ.equals(altitude)) {  	    	    
1191
		if(champ.equals(altitude)) {  	    	    
1217
			altModifiee = true;  
1192
			altModifiee = true;  
1218
		}
1193
		}
1219
 
1194
 
1220
		if(champ.equals(comment)) {
1195
		if(champ.equals(comment)) {
1221
			commModifie = true;
1196
			commModifie = true;
1222
		}
1197
		}
1223
 
1198
 
1224
		if(champ.equals(espece)) {
1199
		if(champ.equals(espece)) {
1225
			numeroNom="";
1200
			numeroNom="";
1226
	    	especeModifiee = true;
1201
	    	especeModifiee = true;
1227
		}
1202
		}
1228
 
1203
 
1229
		if(champ.equals(selecteurReferentielTaxo)) {
1204
		if(champ.equals(selecteurReferentielTaxo)) {
1230
			referentielTaxoModifie = true;
1205
			referentielTaxoModifie = true;
1231
		}
1206
		}
1232
 
1207
 
1233
		if(champ.equals(date)) {
1208
		if(champ.equals(date)) {
1234
			dateModifiee = true;
1209
			dateModifiee = true;
1235
		}
1210
		}
1236
 
1211
 
1237
		if(champ.equals(localite)) {
1212
		if(champ.equals(localite)) {
1238
			codeLocalite="";
1213
			codeLocalite="";
1239
	    	localite.collapse();
1214
	    	localite.collapse();
1240
	    	localiteModifiee= true;
1215
	    	localiteModifiee= true;
1241
		}
1216
		}
1242
	}
1217
	}
1243
 
1218
 
1244
	/**
1219
	/**
1245
	 * Validation de la saisie
1220
	 * Validation de la saisie
1246
	 */
1221
	 */
1247
 
1222
 
1248
	private void validerSaisie(Champs champs) {
1223
	private void validerSaisie(Champs champs) {
1249
		if(!selectionMultiple) {
1224
		if(!selectionMultiple) {
1250
			ajouterObservation();
1225
			ajouterObservation();
1251
			raz(champs);
1226
			raz(champs);
1252
		} else {
1227
		} else {
1253
			modifierObservationEnMasse();
1228
			modifierObservationEnMasse();
1254
		}
1229
		}
1255
	}
1230
	}
1256
 
1231
 
1257
	/**
1232
	/**
1258
	 * Desactive visuellement ce panneau
1233
	 * Desactive visuellement ce panneau
1259
	 */
1234
	 */
1260
	public void desactiverPanneau()
1235
	public void desactiverPanneau()
1261
	{
1236
	{
1262
		this.setDisabled(true) ;
1237
		this.setDisabled(true) ;
1263
	}
1238
	}
1264
 
1239
 
1265
	/**
1240
	/**
1266
	 * Active visuellement ce panneau
1241
	 * Active visuellement ce panneau
1267
	 */
1242
	 */
1268
	public void activerPanneau()
1243
	public void activerPanneau()
1269
	{
1244
	{
1270
		this.setDisabled(false) ;
1245
		this.setDisabled(false) ;
1271
	}
1246
	}
1272
 
1247
 
1273
	@Override
1248
	@Override
1274
	public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
1249
	public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
1275
 
1250
 
1276
		// On recoit une observation dont on veut afficher le detail
1251
		// On recoit une observation dont on veut afficher le detail
1277
		if(nouvelleDonnees instanceof Observation)
1252
		if(nouvelleDonnees instanceof Observation)
1278
		{
1253
		{
1279
			Observation obs = (Observation)nouvelleDonnees ;
1254
			Observation obs = (Observation)nouvelleDonnees ;
1280
			setSelectionMultiple(false);
1255
			setSelectionMultiple(false);
1281
			afficherDetailsObservation(obs) ;
1256
			afficherDetailsObservation(obs) ;
1282
		}
1257
		}
1283
 
1258
 
1284
		if(nouvelleDonnees instanceof ListeObservation) {
1259
		if(nouvelleDonnees instanceof ListeObservation) {
1285
 
1260
 
1286
			ListeObservation listeObs = (ListeObservation)nouvelleDonnees;
1261
			ListeObservation listeObs = (ListeObservation)nouvelleDonnees;
1287
			setSelectionMultiple(true);
1262
			setSelectionMultiple(true);
1288
			calculerAfficherDifferences(listeObs);
1263
			calculerAfficherDifferences(listeObs);
1289
		}
1264
		}
1290
 
1265
 
1291
		if(nouvelleDonnees instanceof String)
1266
		if(nouvelleDonnees instanceof String)
1292
		{
1267
		{
1293
			String str = (String)nouvelleDonnees ;
1268
			String str = (String)nouvelleDonnees ;
1294
			observationMediateur.obtenirNombreObservation() ;
1269
			observationMediateur.obtenirNombreObservation() ;
1295
		}
1270
		}
1296
 
1271
 
1297
		if(nouvelleDonnees instanceof String[]) {
1272
		if(nouvelleDonnees instanceof String[]) {
1298
			String[] anumNom = (String[])nouvelleDonnees ;
1273
			String[] anumNom = (String[])nouvelleDonnees ;
1299
			numeroNom = anumNom[1];
1274
			numeroNom = anumNom[1];
1300
			espece.setValue(anumNom[0]);
1275
			espece.setValue(anumNom[0]);
1301
		}
1276
		}
1302
 
1277
 
1303
		if(nouvelleDonnees instanceof EntiteGeographiqueObservation)
1278
		if(nouvelleDonnees instanceof EntiteGeographiqueObservation)
1304
		{
1279
		{
1305
			EntiteGeographiqueObservation infosComm = (EntiteGeographiqueObservation)nouvelleDonnees ;
1280
			EntiteGeographiqueObservation infosComm = (EntiteGeographiqueObservation)nouvelleDonnees ;
1306
			if(recherchelocaliteEnCours) {
1281
			if(recherchelocaliteEnCours) {
1307
				afficherIndicationlocalite(infosComm);
1282
				afficherIndicationlocalite(infosComm);
1308
			} else {
1283
			} else {
1309
				rafraichirlocaliteEtCoord(infosComm);
1284
				rafraichirlocaliteEtCoord(infosComm);
1310
			}
1285
			}
1311
		}
1286
		}
1312
	}
1287
	}
1313
 
1288
 
1314
	private void afficherIndicationlocalite(
1289
	private void afficherIndicationlocalite(
1315
			final EntiteGeographiqueObservation infosCom) {
1290
			final EntiteGeographiqueObservation infosCom) {
1316
 
1291
 
1317
		String nlocalite = "";
1292
		String nlocalite = "";
1318
		if(infosCom != null && infosCom.getZoneGeo() != null && !infosCom.getZoneGeo().trim().isEmpty()) {
1293
		if(infosCom != null && infosCom.getZoneGeo() != null && !infosCom.getZoneGeo().trim().isEmpty()) {
1319
			nlocalite += infosCom.getZoneGeo();
1294
			nlocalite += infosCom.getZoneGeo();
1320
			if(infosCom.getIdZoneGeo() != null && !infosCom.getIdZoneGeo().trim().isEmpty()) {
1295
			if(infosCom.getIdZoneGeo() != null && !infosCom.getIdZoneGeo().trim().isEmpty()) {
1321
				if(Util.estUnDepartement(infosCom.getIdZoneGeo())) {
1296
				if(Util.estUnDepartement(infosCom.getIdZoneGeo())) {
1322
					nlocalite += " ("+Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo())+")";
1297
					nlocalite += " ("+Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo())+")";
1323
				} else if(infosCom.getPays() != null && !infosCom.getPays().trim().isEmpty()) {
1298
				} else if(infosCom.getPays() != null && !infosCom.getPays().trim().isEmpty()) {
1324
					nlocalite += " ("+infosCom.getPays()+")";
1299
					nlocalite += " ("+infosCom.getPays()+")";
1325
				}
1300
				}
1326
			} else if(infosCom.getPays() != null && !infosCom.getPays().trim().isEmpty()) {
1301
			} else if(infosCom.getPays() != null && !infosCom.getPays().trim().isEmpty()) {
1327
				nlocalite += " ("+infosCom.getPays()+")";
1302
				nlocalite += " ("+infosCom.getPays()+")";
1328
			}
1303
			}
1329
 
1304
 
1330
			lienSelectionlocalite.setHtml("<a id=\"lien_selection_localite\" tabindex=\"9\">"+nlocalite+"</a>");
1305
			lienSelectionlocalite.setHtml("<a id=\"lien_selection_localite\" tabindex=\"9\">"+nlocalite+"</a>");
1331
			lienSelectionlocalite.setStyleName("img-curseur-depl");
1306
			lienSelectionlocalite.setStyleName("img-curseur-depl");
1332
 
1307
 
1333
			Ext.get("lien_selection_localite").addListener("click",new EventCallback() {
1308
			Ext.get("lien_selection_localite").addListener("click",new EventCallback() {
1334
				@Override
1309
				@Override
1335
				public void execute(EventObject e) {
1310
				public void execute(EventObject e) {
1336
					rafraichirlocalite(infosCom);
1311
					rafraichirlocalite(infosCom);
1337
				}
1312
				}
1338
			});
1313
			});
1339
 
1314
 
1340
			Ext.get("lien_selection_localite").addListener("keypress",new EventCallback() {
1315
			Ext.get("lien_selection_localite").addListener("keypress",new EventCallback() {
1341
				@Override
1316
				@Override
1342
				public void execute(EventObject e) {
1317
				public void execute(EventObject e) {
1343
					if(e.getCharCode() == KEY_ENTER) {
1318
					if(e.getCharCode() == KEY_ENTER) {
1344
						rafraichirlocalite(infosCom);
1319
						rafraichirlocalite(infosCom);
1345
					}
1320
					}
1346
				}
1321
				}
1347
			});
1322
			});
1348
 
1323
 
1349
			Ext.get("lien_selection_localite").addListener("focus",new EventCallback() {
1324
			Ext.get("lien_selection_localite").addListener("focus",new EventCallback() {
1350
				@Override
1325
				@Override
1351
				public void execute(EventObject e) {
1326
				public void execute(EventObject e) {
1352
					Ext.get("lien_selection_localite").toggleClass("lien_sel");
1327
					Ext.get("lien_selection_localite").toggleClass("lien_sel");
1353
				}
1328
				}
1354
			});
1329
			});
1355
 
1330
 
1356
			Ext.get("lien_selection_localite").addListener("blur",new EventCallback() {
1331
			Ext.get("lien_selection_localite").addListener("blur",new EventCallback() {
1357
				@Override
1332
				@Override
1358
				public void execute(EventObject e) {
1333
				public void execute(EventObject e) {
1359
					Ext.get("lien_selection_localite").toggleClass("lien_sel");
1334
					Ext.get("lien_selection_localite").toggleClass("lien_sel");
1360
				}
1335
				}
1361
			});
1336
			});
1362
 
1337
 
1363
		} else {
1338
		} else {
1364
			if(recherchelocaliteEnCours) {
1339
			if(recherchelocaliteEnCours) {
1365
				lienSelectionlocalite.setHtml("<span id=\"aucune_selection_localite\"> "+Msg.get("erreur-localisation")+" </span>");
1340
				lienSelectionlocalite.setHtml("<span id=\"aucune_selection_localite\"> "+Msg.get("erreur-localisation")+" </span>");
1366
			} else {
1341
			} else {
1367
				lienSelectionlocalite.setHtml("<span id=\"aucune_selection_localite\"> </span>");
1342
				lienSelectionlocalite.setHtml("<span id=\"aucune_selection_localite\"> </span>");
1368
			}
1343
			}
1369
		}
1344
		}
1370
 
1345
 
1371
		Ext.get(lienSelectionlocalite.getElement()).unmask();
1346
		Ext.get(lienSelectionlocalite.getElement()).unmask();
1372
		recherchelocaliteEnCours = false;
1347
		recherchelocaliteEnCours = false;
1373
	}
1348
	}
1374
 
1349
 
1375
	private void rafraichirlocalite(EntiteGeographiqueObservation infosCom) {
1350
	private void rafraichirlocalite(EntiteGeographiqueObservation infosCom) {
1376
		String nlocalite = "";
1351
		String nlocalite = "";
1377
 
1352
 
1378
		if(infosCom.getZoneGeo() != null && !infosCom.getZoneGeo().equals("")) {
1353
		if(infosCom.getZoneGeo() != null && !infosCom.getZoneGeo().equals("")) {
1379
			nlocalite += infosCom.getZoneGeo();
1354
			nlocalite += infosCom.getZoneGeo();
1380
		}
1355
		}
1381
		
1356
		
1382
		if(infosCom.getIdZoneGeo() != null && Util.estUnDepartement(infosCom.getIdZoneGeo())) {
1357
		if(infosCom.getIdZoneGeo() != null && Util.estUnDepartement(infosCom.getIdZoneGeo())) {
1383
			String codeGeoFormate = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo());
1358
			String codeGeoFormate = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo());
1384
			nlocalite += " ("+codeGeoFormate+")";
1359
			nlocalite += " ("+codeGeoFormate+")";
1385
			codeLocalite = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo());
1360
			codeLocalite = Util.convertirChaineZoneGeoVersDepartement(infosCom.getIdZoneGeo());
1386
		} else if(infosCom.getPays() != null && !infosCom.getPays().trim().isEmpty()) {
1361
		} else if(infosCom.getPays() != null && !infosCom.getPays().trim().isEmpty()) {
1387
			nlocalite += " ("+infosCom.getPays()+")";
1362
			nlocalite += " ("+infosCom.getPays()+")";
1388
		}
1363
		}
1389
		
1364
		
1390
		if (!nlocalite.isEmpty()) {
1365
		if (!nlocalite.isEmpty()) {
1391
			// Vide ou null, on remplace !
1366
			// Vide ou null, on remplace !
1392
			if(localite.getText() == null || localite.getText().trim().isEmpty()) {
1367
			if(localite.getText() == null || localite.getText().trim().isEmpty()) {
1393
				localite.setValue(nlocalite);
1368
				localite.setValue(nlocalite);
1394
			} else {
1369
			} else {
1395
				// Afin de pas effacer un pays précédemment saisi, si on a déjà saisi une localité
1370
				// Afin de pas effacer un pays précédemment saisi, si on a déjà saisi une localité
1396
				// avec le même nom mais avec un pays, on ne remplace rien
1371
				// avec le même nom mais avec un pays, on ne remplace rien
1397
				if(localite.getText() != null && !localite.getText().contains(nlocalite)) {
1372
				if(localite.getText() != null && !localite.getText().contains(nlocalite)) {
1398
					localite.setValue(nlocalite);
1373
					localite.setValue(nlocalite);
1399
				}
1374
				}
1400
			}
1375
			}
1401
 
1376
 
1402
			localiteModifiee = true;
1377
			localiteModifiee = true;
1403
		}
1378
		}
1404
	}
1379
	}
1405
 
1380
 
1406
	// Se déclenche au retour de la "localisation sur la carte"
1381
	// Se déclenche au retour de la "localisation sur la carte"
1407
	private void rafraichirlocaliteEtCoord(EntiteGeographiqueObservation infosCom) {
1382
	private void rafraichirlocaliteEtCoord(EntiteGeographiqueObservation infosCom) {
1408
		
1383
		
1409
		rafraichirlocalite(infosCom);
1384
		rafraichirlocalite(infosCom);
1410
		if(infosCom.getLat() != null && !infosCom.getLat().equals("")) {
1385
		if(infosCom.getLat() != null && !infosCom.getLat().equals("")) {
1411
			latitude.setValue(Util.tronquerNombrePourAffichage("" + infosCom.getLat(), 5));
1386
			latitude.setValue(Util.tronquerNombrePourAffichage("" + infosCom.getLat(), 5));
1412
		}
1387
		}
1413
 
1388
 
1414
		if(infosCom.getLon() != null && !infosCom.getLon().equals("")) {
1389
		if(infosCom.getLon() != null && !infosCom.getLon().equals("")) {
1415
			longitude.setValue(Util.tronquerNombrePourAffichage("" + infosCom.getLon(), 5));
1390
			longitude.setValue(Util.tronquerNombrePourAffichage("" + infosCom.getLon(), 5));
1416
		}
1391
		}
1417
 
1392
 
1418
		latModifiee = true;
1393
		latModifiee = true;
1419
		longModifiee = true;
1394
		longModifiee = true;
1420
 
1395
 
1421
		coordPanel.setVisible(true);
1396
		coordPanel.setVisible(true);
1422
	}
1397
	}
1423
 
1398
 
1424
	public void ajouterObservation() {
1399
	public void ajouterObservation() {
1425
 
1400
 
1426
		if(date.getRawValue() != null && !date.getRawValue().equals("") && !Util.verifierDateFormatCel(date.getRawValue())) {
1401
		if(date.getRawValue() != null && !date.getRawValue().equals("") && !Util.verifierDateFormatCel(date.getRawValue())) {
1427
			Window.alert(Msg.get("indication-date-invalide"));
1402
			Window.alert(Msg.get("indication-date-invalide"));
1428
			date.setInvalidText(Msg.get("date-invalide"));
1403
			date.setInvalidText(Msg.get("date-invalide"));
1429
			return;
1404
			return;
1430
		}
1405
		}
1431
 
1406
 
1432
		affecterCodeLocaliteOuPays();
1407
		affecterCodeLocaliteOuPays();
1433
 
1408
 
1434
		String dateObs = Util.remplacerSeparateursDateFormatCel(date.getRawValue());
1409
		String dateObs = Util.remplacerSeparateursDateFormatCel(date.getRawValue());
1435
 
1410
 
1436
		Observation obs=new Observation(espece.getText(),numeroNom,localite.getText(),codeLocalite,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),dateObs);
1411
		Observation obs=new Observation(espece.getText(),numeroNom,localite.getText(),codeLocalite,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),dateObs);
1437
 
1412
 
1438
		String[] coords = getValeurCoordonnees();
1413
		String[] coords = getValeurCoordonnees();
1439
		obs.setPays(pays);
1414
		obs.setPays(pays);
1440
		obs.setLatitude(coords[0]);
1415
		obs.setLatitude(coords[0]);
1441
		obs.setLongitude(coords[1]);
1416
		obs.setLongitude(coords[1]);
1442
		obs.setAltitude(altitude.getText());
1417
		obs.setAltitude(altitude.getText());
1443
 
1418
 
1444
		obs.setAbondance(getAbondance());
1419
		obs.setAbondance(getAbondance());
1445
		obs.setCertitude(getCertitude());
1420
		obs.setCertitude(getCertitude());
1446
		obs.setPhenologie(getPhenologie());
1421
		obs.setPhenologie(getPhenologie());
1447
 
1422
 
1448
		obs.setReferentielTaxo(Ontologies.getInfosReferentielNomParCode(referentielTaxo).getCodeVersionComplet());
1423
		obs.setReferentielTaxo(Ontologies.getInfosReferentielNomParCode(referentielTaxo).getCodeVersionComplet());
1449
		obs.setChampsEtendus(getValeursChampsEtendus());
1424
		obs.setChampsEtendus(getValeursChampsEtendus());
1450
 
1425
 
1451
		observationMediateur.ajouterObservation(obs);
1426
		observationMediateur.ajouterObservation(obs);
1452
	}
1427
	}
1453
 
1428
 
1454
	private void modifierObservation() {
1429
	private void modifierObservation() {
1455
		if(!Window.confirm(Msg.get("question-modifier-observation")+" ?")) {
1430
		if(!Window.confirm(Msg.get("question-modifier-observation")+" ?")) {
1456
			return;
1431
			return;
1457
		}
1432
		}
1458
 
1433
 
1459
		if(date.getRawValue() != null && !date.getRawValue().equals("") && !Util.verifierDateFormatCel(date.getRawValue())) {
1434
		if(date.getRawValue() != null && !date.getRawValue().equals("") && !Util.verifierDateFormatCel(date.getRawValue())) {
1460
			Window.alert(Msg.get("indication-date-invalide"));
1435
			Window.alert(Msg.get("indication-date-invalide"));
1461
			date.setInvalidText(Msg.get("date-invalide"));
1436
			date.setInvalidText(Msg.get("date-invalide"));
1462
			return;
1437
			return;
1463
		}
1438
		}
1464
 
1439
 
1465
		affecterCodeLocaliteOuPays();
1440
		affecterCodeLocaliteOuPays();
1466
		
1441
		
1467
		String dateObs = Util.remplacerSeparateursDateFormatCel(date.getRawValue());
1442
		String dateObs = Util.remplacerSeparateursDateFormatCel(date.getRawValue());
1468
 
1443
 
1469
		Observation obs=new Observation(espece.getText(),numeroNom,localite.getText(),codeLocalite,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),dateObs);
1444
		Observation obs=new Observation(espece.getText(),numeroNom,localite.getText(),codeLocalite,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),dateObs);
1470
		obs.setNumeroOrdre(numeroOrdre);
1445
		obs.setNumeroOrdre(numeroOrdre);
1471
 
1446
 
1472
		String[] coords = getValeurCoordonnees();
1447
		String[] coords = getValeurCoordonnees();
1473
 
1448
 
1474
		obs.setPays(pays);
1449
		obs.setPays(pays);
1475
		obs.setLatitude(coords[0]);
1450
		obs.setLatitude(coords[0]);
1476
		obs.setLongitude(coords[1]);
1451
		obs.setLongitude(coords[1]);
1477
		obs.setAltitude(altitude.getText());
1452
		obs.setAltitude(altitude.getText());
1478
 
1453
 
1479
		obs.setAbondance(getAbondance());
1454
		obs.setAbondance(getAbondance());
1480
		obs.setCertitude(getCertitude());
1455
		obs.setCertitude(getCertitude());
1481
		obs.setPhenologie(getPhenologie());
1456
		obs.setPhenologie(getPhenologie());
1482
		obs.setReferentielTaxo(getReferentielTaxo());
1457
		obs.setReferentielTaxo(getReferentielTaxo());
1483
		obs.setChampsEtendus(getValeursChampsEtendus());
1458
		obs.setChampsEtendus(getValeursChampsEtendus());
1484
 
1459
 
1485
		observationMediateur.modifierObservation(obs);
1460
		observationMediateur.modifierObservation(obs);
1486
	}
1461
	}
1487
 
1462
 
1488
	private void affecterCodeLocaliteOuPays() {
1463
	private void affecterCodeLocaliteOuPays() {
1489
		
1464
		
1490
		codeLocalite = "";
1465
		codeLocalite = "";
1491
		pays = "";
1466
		pays = "";
1492
		
1467
		
1493
		// Soit un numéro de département, soit un code de pays à deux lettres
1468
		// Soit un numéro de département, soit un code de pays à deux lettres
1494
		String[] codeCom = localite.getText().split(" ");
1469
		String[] codeCom = localite.getText().split(" ");
1495
		if(codeCom.length > 1 && ressembleAUnCodePaysOuDepartement(codeCom[codeCom.length - 1])) {
1470
		if(codeCom.length > 1 && ressembleAUnCodePaysOuDepartement(codeCom[codeCom.length - 1])) {
1496
			String codeLoc = codeCom[codeCom.length - 1].replace('(', ' ');
1471
			String codeLoc = codeCom[codeCom.length - 1].replace('(', ' ');
1497
			codeLoc = codeLoc.replace(')', ' ').trim().replace('\\',' ').trim();
1472
			codeLoc = codeLoc.replace(')', ' ').trim().replace('\\',' ').trim();
1498
 
1473
 
1499
			if(Util.estUnDepartement(codeLoc)) {
1474
			if(Util.estUnDepartement(codeLoc)) {
1500
				codeLocalite = codeLoc ;
1475
				codeLocalite = codeLoc ;
1501
			} else {
1476
			} else {
1502
				pays = codeLoc.toUpperCase();
1477
				pays = codeLoc.toUpperCase();
1503
			}
1478
			}
1504
		}
1479
		}
1505
	}
1480
	}
1506
	
1481
	
1507
	private boolean ressembleAUnCodePaysOuDepartement(String s) {	
1482
	private boolean ressembleAUnCodePaysOuDepartement(String s) {	
1508
		String sP = s.replace("(", "").replace(")", "").trim();
1483
		String sP = s.replace("(", "").replace(")", "").trim();
1509
		
1484
		
1510
		boolean contientDesParentheses = s.contains("(") && s.contains(")");
1485
		boolean contientDesParentheses = s.contains("(") && s.contains(")");
1511
		boolean estUnCodePays = !Util.estUnNombre(sP) && (sP.length() == 2);
1486
		boolean estUnCodePays = !Util.estUnNombre(sP) && (sP.length() == 2);
1512
		boolean estUnCodeDepartement = Util.estUnNombre(sP) && (sP.length() >= 1 && sP.length() <= 5);
1487
		boolean estUnCodeDepartement = Util.estUnNombre(sP) && (sP.length() >= 1 && sP.length() <= 5);
1513
		
1488
		
1514
		return contientDesParentheses && (estUnCodePays || estUnCodeDepartement);
1489
		return contientDesParentheses && (estUnCodePays || estUnCodeDepartement);
1515
	}
1490
	}
1516
 
1491
 
1517
	private void modifierObservationEnMasse() {
1492
	private void modifierObservationEnMasse() {
1518
 
1493
 
1519
		//TODO: factoriser
1494
		//TODO: factoriser
1520
		String paysM = null;
1495
		String paysM = null;
1521
		String localiteM = null;
1496
		String localiteM = null;
1522
		String codeLocaliteM = null;
1497
		String codeLocaliteM = null;
1523
		String numNomSelM = null;
1498
		String numNomSelM = null;
1524
		String lieuDitM = null;
1499
		String lieuDitM = null;
1525
		String stationM = null;
1500
		String stationM = null;
1526
		String milieuM = null;
1501
		String milieuM = null;
1527
		String dateM = null;
1502
		String dateM = null;
1528
		String especeM = null;
1503
		String especeM = null;
1529
		String commM = null;
1504
		String commM = null;
1530
		String latM = null;
1505
		String latM = null;
1531
		String longM = null;
1506
		String longM = null;
1532
		String altM = null;
1507
		String altM = null;
1533
		String abondanceM = null;
1508
		String abondanceM = null;
1534
		String certitudeM = null;
1509
		String certitudeM = null;
1535
		String referentielTaxoM = null;
1510
		String referentielTaxoM = null;
1536
		String phenologieM = null;
1511
		String phenologieM = null;
1537
 
1512
 
1538
		String champs = modeleMessageModif;
1513
		String champs = modeleMessageModif;
1539
 
1514
 
1540
		if(localiteModifiee && ! localite.getRawValue().equals(VALEURS_MULTIPLES)) {
1515
		if(localiteModifiee && ! localite.getRawValue().equals(VALEURS_MULTIPLES)) {
1541
			
1516
			
1542
			localiteM = localite.getText();	
1517
			localiteM = localite.getText();	
1543
			
1518
			
1544
			// Soit un numéro de département, soit un code de pays à deux lettres
1519
			// Soit un numéro de département, soit un code de pays à deux lettres
1545
			String[] codeCom = localite.getText().split(" ");
1520
			String[] codeCom = localite.getText().split(" ");
1546
			if(codeCom.length > 1) {
1521
			if(codeCom.length > 1) {
1547
				String codeLoc = codeCom[1].replace('(', ' ');
1522
				String codeLoc = codeCom[1].replace('(', ' ');
1548
				codeLoc = codeLoc.replace(')', ' ').trim().replace('\\',' ').trim();
1523
				codeLoc = codeLoc.replace(')', ' ').trim().replace('\\',' ').trim();
1549
 
1524
 
1550
				if(Util.estUnDepartement(codeLoc)) {
1525
				if(Util.estUnDepartement(codeLoc)) {
1551
					codeLocaliteM = codeLoc ;
1526
					codeLocaliteM = codeLoc ;
1552
				} else {
1527
				} else {
1553
					paysM = codeLoc;
1528
					paysM = codeLoc;
1554
				}
1529
				}
1555
			}
1530
			}
1556
		}
1531
		}
1557
		else {
1532
		else {
1558
			champs = champs.replaceAll("localite", "");
1533
			champs = champs.replaceAll("localite", "");
1559
		}
1534
		}
1560
 
1535
 
1561
		if(lieuDitModifie && ! lieudit.getRawValue().equals(VALEURS_MULTIPLES)) {
1536
		if(lieuDitModifie && ! lieudit.getRawValue().equals(VALEURS_MULTIPLES)) {
1562
			lieuDitM = lieudit.getText();
1537
			lieuDitM = lieudit.getText();
1563
		} else {
1538
		} else {
1564
			champs = champs.replaceAll(":lieu-dit", "");
1539
			champs = champs.replaceAll(":lieu-dit", "");
1565
		}
1540
		}
1566
 
1541
 
1567
		if(stationModifiee && ! station.getRawValue().equals(VALEURS_MULTIPLES)) {
1542
		if(stationModifiee && ! station.getRawValue().equals(VALEURS_MULTIPLES)) {
1568
			stationM = station.getText();
1543
			stationM = station.getText();
1569
		} else {
1544
		} else {
1570
			champs = champs.replaceAll(":station", "");
1545
			champs = champs.replaceAll(":station", "");
1571
		}
1546
		}
1572
 
1547
 
1573
		if(milieuModifie && ! milieu.getRawValue().equals(VALEURS_MULTIPLES)) {
1548
		if(milieuModifie && ! milieu.getRawValue().equals(VALEURS_MULTIPLES)) {
1574
			milieuM = milieu.getText();
1549
			milieuM = milieu.getText();
1575
		} else {
1550
		} else {
1576
			champs = champs.replaceAll(":milieu", "");
1551
			champs = champs.replaceAll(":milieu", "");
1577
		}
1552
		}
1578
 
1553
 
1579
		if(dateModifiee && ! date.getRawValue().equals(VALEURS_MULTIPLES)) {
1554
		if(dateModifiee && ! date.getRawValue().equals(VALEURS_MULTIPLES)) {
1580
			dateM = date.getRawValue();
1555
			dateM = date.getRawValue();
1581
			dateM = Util.remplacerSeparateursDateFormatCel(dateM);
1556
			dateM = Util.remplacerSeparateursDateFormatCel(dateM);
1582
		} else {
1557
		} else {
1583
			champs = champs.replaceAll(":date", "");
1558
			champs = champs.replaceAll(":date", "");
1584
		}
1559
		}
1585
 
1560
 
1586
		if(especeModifiee && ! espece.getRawValue().equals(VALEURS_MULTIPLES)) {
1561
		if(especeModifiee && ! espece.getRawValue().equals(VALEURS_MULTIPLES)) {
1587
			especeM = espece.getText();
1562
			especeM = espece.getText();
1588
			numNomSelM = numeroNom;
1563
			numNomSelM = numeroNom;
1589
		} else {
1564
		} else {
1590
			champs = champs.replaceAll(":espece", "");
1565
			champs = champs.replaceAll(":espece", "");
1591
		}
1566
		}
1592
 
1567
 
1593
		if(commModifie && ! comment.getRawValue().equals(VALEURS_MULTIPLES)) {
1568
		if(commModifie && ! comment.getRawValue().equals(VALEURS_MULTIPLES)) {
1594
			commM = comment.getText();
1569
			commM = comment.getText();
1595
		} else {
1570
		} else {
1596
			champs = champs.replaceAll(":notes", "");
1571
			champs = champs.replaceAll(":notes", "");
1597
		}
1572
		}
1598
 
1573
 
1599
		if(latModifiee && ! latitude.getRawValue().equals(VALEURS_MULTIPLES)) {
1574
		if(latModifiee && ! latitude.getRawValue().equals(VALEURS_MULTIPLES)) {
1600
			latM = latitude.getText();
1575
			latM = latitude.getText();
1601
		} else {
1576
		} else {
1602
			champs = champs.replaceAll(":latitude", "");
1577
			champs = champs.replaceAll(":latitude", "");
1603
		}
1578
		}
1604
 
1579
 
1605
		if(altModifiee && ! altitude.getRawValue().equals(VALEURS_MULTIPLES)) {
1580
		if(altModifiee && ! altitude.getRawValue().equals(VALEURS_MULTIPLES)) {
1606
			altM = altitude.getText();
1581
			altM = altitude.getText();
1607
		} else {
1582
		} else {
1608
			champs = champs.replaceAll(":altitude", "");
1583
			champs = champs.replaceAll(":altitude", "");
1609
		}
1584
		}
1610
 
1585
 
1611
		if(longModifiee && ! longitude.getRawValue().equals(VALEURS_MULTIPLES)) {
1586
		if(longModifiee && ! longitude.getRawValue().equals(VALEURS_MULTIPLES)) {
1612
			longM = longitude.getText();
1587
			longM = longitude.getText();
1613
		} else {
1588
		} else {
1614
			champs = champs.replaceAll(":longitude", "");
1589
			champs = champs.replaceAll(":longitude", "");
1615
		}
1590
		}
1616
 
1591
 
1617
		if(abondanceModifiee && !selecteurAbondance.getRawValue().equals(VALEURS_MULTIPLES)) {
1592
		if(abondanceModifiee && !selecteurAbondance.getRawValue().equals(VALEURS_MULTIPLES)) {
1618
			abondanceM = getAbondance();
1593
			abondanceM = getAbondance();
1619
		} else {
1594
		} else {
1620
			champs = champs.replaceAll(":abondance", "");
1595
			champs = champs.replaceAll(":abondance", "");
1621
		}
1596
		}
1622
 
1597
 
1623
		if(certitudeModifiee && !selecteurCertitude.getRawValue().equals(VALEURS_MULTIPLES)) {
1598
		if(certitudeModifiee && !selecteurCertitude.getRawValue().equals(VALEURS_MULTIPLES)) {
1624
			certitudeM = getCertitude();
1599
			certitudeM = getCertitude();
1625
		} else {
1600
		} else {
1626
			champs = champs.replaceAll(":identification", "");
1601
			champs = champs.replaceAll(":identification", "");
1627
		}
1602
		}
1628
 
1603
 
1629
		if(referentielTaxoModifie && !selecteurReferentielTaxo.getRawValue().equals(VALEURS_MULTIPLES)) {
1604
		if(referentielTaxoModifie && !selecteurReferentielTaxo.getRawValue().equals(VALEURS_MULTIPLES)) {
1630
			referentielTaxoM = getReferentielTaxo();
1605
			referentielTaxoM = getReferentielTaxo();
1631
		} else {
1606
		} else {
1632
			champs = champs.replaceAll(":referentiel", "");
1607
			champs = champs.replaceAll(":referentiel", "");
1633
		}
1608
		}
1634
 
1609
 
1635
		if(phenologieModifiee && !selecteurStadePheno.getRawValue().equals(VALEURS_MULTIPLES)) {
1610
		if(phenologieModifiee && !selecteurStadePheno.getRawValue().equals(VALEURS_MULTIPLES)) {
1636
			phenologieM = getPhenologie();
1611
			phenologieM = getPhenologie();
1637
		} else {
1612
		} else {
1638
			champs = champs.replaceAll(":phenologie", "");
1613
			champs = champs.replaceAll(":phenologie", "");
1639
		}
1614
		}
1640
		
1615
		
1641
		// TODO : trouver un meilleur système que ça pour gérer le message
1616
		// TODO : trouver un meilleur système que ça pour gérer le message
1642
		// affiché
1617
		// affiché
1643
		String[] champsSt = champs.split(":");
1618
		String[] champsSt = champs.split(":");
1644
		String champsTraduits = "";
1619
		String champsTraduits = "";
1645
		for (int i = 0; i < champsSt.length; i++) {
1620
		for (int i = 0; i < champsSt.length; i++) {
1646
			// TODO: vérifier pourquoi des fois la chaîne est vide
1621
			// TODO: vérifier pourquoi des fois la chaîne est vide
1647
			// ou faire mieux, trouver un meilleur système comme écrit au dessus !
1622
			// ou faire mieux, trouver un meilleur système comme écrit au dessus !
1648
			if(!champsSt[i].trim().isEmpty()) {
1623
			if(!champsSt[i].trim().isEmpty()) {
1649
				champsTraduits += Msg.get(champsSt[i]);
1624
				champsTraduits += Msg.get(champsSt[i]);
1650
				champsTraduits += (i != champsSt.length - 1) ? ", " : "";
1625
				champsTraduits += (i != champsSt.length - 1) ? ", " : "";
1651
			}
1626
			}
1652
		}
1627
		}
1653
 
1628
 
1654
		String[] stParams = {champsTraduits};
1629
		String[] stParams = {champsTraduits};
1655
		String message = Msg.get("question-modifier-champs-observation", stParams)+" ?" ;
1630
		String message = Msg.get("question-modifier-champs-observation", stParams)+" ?" ;
1656
 
1631
 
1657
		if(champs.trim().equals("")) {
1632
		if(champs.trim().equals("")) {
1658
			Window.alert(Msg.get("indication-aucun-champ-modifie"));
1633
			Window.alert(Msg.get("indication-aucun-champ-modifie"));
1659
		} else {
1634
		} else {
1660
			Observation obs = new Observation(especeM,numNomSelM,localiteM,codeLocaliteM,lieuDitM,stationM,milieuM, commM,dateM);
1635
			Observation obs = new Observation(especeM,numNomSelM,localiteM,codeLocaliteM,lieuDitM,stationM,milieuM, commM,dateM);
1661
			obs.setPays(paysM);
1636
			obs.setPays(paysM);
1662
			obs.setNumeroOrdre(numeroOrdre);
1637
			obs.setNumeroOrdre(numeroOrdre);
1663
			obs.setLatitude(latM);
1638
			obs.setLatitude(latM);
1664
			obs.setLongitude(longM);
1639
			obs.setLongitude(longM);
1665
			obs.setAltitude(altM);
1640
			obs.setAltitude(altM);
1666
			obs.setAbondance(abondanceM);
1641
			obs.setAbondance(abondanceM);
1667
			obs.setCertitude(certitudeM);
1642
			obs.setCertitude(certitudeM);
1668
			// Afin de transmettre un ensemble cohérent on force aussi
1643
			// Afin de transmettre un ensemble cohérent on force aussi
1669
			// l'envoi du référentiel en cas de maj de l'espèce
1644
			// l'envoi du référentiel en cas de maj de l'espèce
1670
			if(especeModifiee) {
1645
			if(especeModifiee) {
1671
				referentielTaxoM = getReferentielTaxo();
1646
				referentielTaxoM = getReferentielTaxo();
1672
			}
1647
			}
1673
			obs.setReferentielTaxo(referentielTaxoM);
1648
			obs.setReferentielTaxo(referentielTaxoM);
1674
			obs.setPhenologie(phenologieM);
1649
			obs.setPhenologie(phenologieM);
1675
			if(Window.confirm(message)) {
1650
			if(Window.confirm(message)) {
1676
				observationMediateur.modifierObservationEnMasse(obs);
1651
				observationMediateur.modifierObservationEnMasse(obs);
1677
				reinitialiserValeurModifiees();
1652
				reinitialiserValeurModifiees();
1678
			}
1653
			}
1679
		}
1654
		}
1680
	}
1655
	}
1681
 
1656
 
1682
	private void supprimerObservation() {
1657
	private void supprimerObservation() {
1683
		observationMediateur.supprimerObservation(this, numeroOrdre);
1658
		observationMediateur.supprimerObservation(this, numeroOrdre);
1684
	}
1659
	}
1685
 
1660
 
1686
	public void afficherDetailsObservation(Observation obs)
1661
	public void afficherDetailsObservation(Observation obs)
1687
	{
1662
	{
1688
		raz() ;
1663
		raz() ;
1689
		String idLoc ;
1664
		String idLoc ;
1690
		if(obs.getIdentifiantLocalite() != VALEURS_MULTIPLES) {
1665
		if(obs.getIdentifiantLocalite() != VALEURS_MULTIPLES) {
1691
			idLoc = obs.getIdentifiantLocalite().replaceAll(" ","/");
1666
			idLoc = obs.getIdentifiantLocalite().replaceAll(" ","/");
1692
			idLoc = idLoc.replaceAll("%","");
1667
			idLoc = idLoc.replaceAll("%","");
1693
			idLoc = idLoc.replaceAll("\"","");
1668
			idLoc = idLoc.replaceAll("\"","");
1694
			idLoc = idLoc.replace('\\',' ');
1669
			idLoc = idLoc.replace('\\',' ');
1695
			idLoc = idLoc.trim();
1670
			idLoc = idLoc.trim();
1696
			if(idLoc.length() == 5) {
1671
			if(idLoc.length() == 5) {
1697
				idLoc = idLoc.substring(0,2);
1672
				idLoc = idLoc.substring(0,2);
1698
			}
1673
			}
1699
		} else {
1674
		} else {
1700
			idLoc = obs.getIdentifiantLocalite();
1675
			idLoc = obs.getIdentifiantLocalite();
1701
			if(idLoc.length() == 5) {
1676
			if(idLoc.length() == 5) {
1702
				idLoc = idLoc.substring(0,2);
1677
				idLoc = idLoc.substring(0,2);
1703
			}
1678
			}
1704
		}
1679
		}
1705
		
1680
		
1706
		if(obs.getIdentifiantLocalite().isEmpty() && !obs.getPays().isEmpty()) {
1681
		if(obs.getIdentifiantLocalite().isEmpty() && !obs.getPays().isEmpty()) {
1707
			idLoc = obs.getPays();
1682
			idLoc = obs.getPays();
1708
		}
1683
		}
1709
 
1684
 
1710
		if(!obs.getDate().equals("null") && !obs.getDate().equals("000null") && !obs.getDate().equals(VALEURS_MULTIPLES)) {
1685
		if(!obs.getDate().equals("null") && !obs.getDate().equals("000null") && !obs.getDate().equals(VALEURS_MULTIPLES)) {
1711
			String[] dateEtHeure = obs.getDate().split(" ", 2);
1686
			String[] dateEtHeure = obs.getDate().split(" ", 2);
1712
			if(verifierFormatDate(dateEtHeure[0])) {
1687
			if(verifierFormatDate(dateEtHeure[0])) {
1713
				date.setValue(dateEtHeure[0]) ;
1688
				date.setValue(dateEtHeure[0]) ;
1714
			}
1689
			}
1715
			else
1690
			else
1716
			{
1691
			{
1717
				date.setRawValue("");
1692
				date.setRawValue("");
1718
			}
1693
			}
1719
		} else {
1694
		} else {
1720
			date.setRawValue(VALEURS_MULTIPLES);
1695
			date.setRawValue(VALEURS_MULTIPLES);
1721
			date.clearInvalid();
1696
			date.clearInvalid();
1722
		}
1697
		}
1723
		if(!obs.getLieudit().equals("null") && !obs.getLieudit().equals("000null")) {
1698
		if(!obs.getLieudit().equals("null") && !obs.getLieudit().equals("000null")) {
1724
			lieudit.setValue(obs.getLieudit()) ;
1699
			lieudit.setValue(obs.getLieudit()) ;
1725
		}
1700
		}
1726
		if(!obs.getStation().equals("null") && !obs.getStation().equals("000null")) {
1701
		if(!obs.getStation().equals("null") && !obs.getStation().equals("000null")) {
1727
			station.setValue(obs.getStation()) ;
1702
			station.setValue(obs.getStation()) ;
1728
		}
1703
		}
1729
		if(!obs.getMilieu().equals("null") && !obs.getMilieu().equals("000null")) {
1704
		if(!obs.getMilieu().equals("null") && !obs.getMilieu().equals("000null")) {
1730
			milieu.setValue(obs.getMilieu()) ;
1705
			milieu.setValue(obs.getMilieu()) ;
1731
		}
1706
		}
1732
		if(!obs.getCommentaire().equals("null") && !obs.getCommentaire().equals("000null")) {
1707
		if(!obs.getCommentaire().equals("null") && !obs.getCommentaire().equals("000null")) {
1733
 
1708
 
1734
			comment.setRawValue(Util.remplacerSautsDeligneMalEncodes(obs.getCommentaire()));
1709
			comment.setRawValue(Util.remplacerSautsDeligneMalEncodes(obs.getCommentaire()));
1735
 
1710
 
1736
		}
1711
		}
1737
		if(!obs.getLocalite().equals("null") && !obs.getLocalite().equals("000null")) {
1712
		if(!obs.getLocalite().equals("null") && !obs.getLocalite().equals("000null")) {
1738
			if(!idLoc.equals("000null") && !idLoc.equals("")) {
1713
			if(!idLoc.equals("000null") && !idLoc.equals("")) {
1739
				if(!idLoc.equals(VALEURS_MULTIPLES)) {
1714
				if(!idLoc.equals(VALEURS_MULTIPLES)) {
1740
					localite.setValue(obs.getLocalite()+" ("+idLoc+")") ;
1715
					localite.setValue(obs.getLocalite()+" ("+idLoc+")") ;
1741
				} else {
1716
				} else {
1742
					localite.setValue(VALEURS_MULTIPLES);
1717
					localite.setValue(VALEURS_MULTIPLES);
1743
				}
1718
				}
1744
			}
1719
			}
1745
			else
1720
			else
1746
			{
1721
			{
1747
				localite.setValue(obs.getLocalite());
1722
				localite.setValue(obs.getLocalite());
1748
			}
1723
			}
1749
		}
1724
		}
1750
		if(!obs.getIdentifiantLocalite().equals("null") && !obs.getIdentifiantLocalite().equals("000null")) {
1725
		if(!obs.getIdentifiantLocalite().equals("null") && !obs.getIdentifiantLocalite().equals("000null")) {
1751
			codeLocalite = idLoc;
1726
			codeLocalite = idLoc;
1752
		}
1727
		}
1753
		if(!obs.getNomSaisi().equals("null") && !obs.getNomSaisi().equals("000null")) {
1728
		if(!obs.getNomSaisi().equals("null") && !obs.getNomSaisi().equals("000null")) {
1754
			espece.setValue(obs.getNomSaisi()) ;
1729
			espece.setValue(obs.getNomSaisi()) ;
1755
		}
1730
		}
1756
		if(!obs.getNumeroNomenclaturalSaisi().equals("null") && !obs.getNumeroNomenclaturalSaisi().equals("000null")) {
1731
		if(!obs.getNumeroNomenclaturalSaisi().equals("null") && !obs.getNumeroNomenclaturalSaisi().equals("000null")) {
1757
			numeroNom = obs.getNumeroNomenclaturalSaisi() ;
1732
			numeroNom = obs.getNumeroNomenclaturalSaisi() ;
1758
		}
1733
		}
1759
		if(!obs.getNumeroOrdre().equals("null") && !obs.getNumeroOrdre().equals("000null")) {
1734
		if(!obs.getNumeroOrdre().equals("null") && !obs.getNumeroOrdre().equals("000null")) {
1760
			numeroOrdre = obs.getNumeroOrdre() ;
1735
			numeroOrdre = obs.getNumeroOrdre() ;
1761
		}
1736
		}
1762
 
1737
 
1763
		if(doitAfficherLatLon(obs)) {
1738
		if(doitAfficherLatLon(obs)) {
1764
			latitude.setValue(Util.formaterNombre(obs.getLatitude())) ;
1739
			latitude.setValue(Util.formaterNombre(obs.getLatitude())) ;
1765
			longitude.setValue(Util.formaterNombre(obs.getLongitude())) ;
1740
			longitude.setValue(Util.formaterNombre(obs.getLongitude())) ;
1766
		}
1741
		}
1767
 
1742
 
1768
		if(!obs.getAltitude().isEmpty() && !obs.getAltitude().equals("null") && !obs.getAltitude().equals("000null")) {
1743
		if(!obs.getAltitude().isEmpty() && !obs.getAltitude().equals("null") && !obs.getAltitude().equals("000null")) {
1769
			altitude.setValue(Util.formaterNombre(obs.getAltitude())) ;
1744
			altitude.setValue(Util.formaterNombre(obs.getAltitude())) ;
1770
		}
1745
		}
1771
 
1746
 
1772
		selecteurAbondance.getStore().load();
1747
		selecteurAbondance.getStore().load();
1773
		selecteurAbondance.setValue(obs.getAbondance());
1748
		selecteurAbondance.setValue(obs.getAbondance());
1774
 
1749
 
1775
		selecteurCertitude.getStore().load();
1750
		selecteurCertitude.getStore().load();
1776
		selecteurCertitude.setValue(obs.getCertitude());
1751
		selecteurCertitude.setValue(obs.getCertitude());
1777
 
1752
 
1778
		selecteurStadePheno.getStore().load();
1753
		selecteurStadePheno.getStore().load();
1779
		selecteurStadePheno.setValue(obs.getPhenologie());
1754
		selecteurStadePheno.setValue(obs.getPhenologie());
1780
 
1755
 
1781
		selecteurReferentielTaxo.getStore().load();
1756
		selecteurReferentielTaxo.getStore().load();
1782
		if(obs.getReferentielTaxo() != VALEURS_MULTIPLES) {
1757
		if(obs.getReferentielTaxo() != VALEURS_MULTIPLES) {
1783
			referentielTaxo = obs.getCodeCourtReferentielTaxo();
1758
			referentielTaxo = obs.getCodeCourtReferentielTaxo();
1784
			if(referentielTaxo == null || referentielTaxo.isEmpty()) {
1759
			if(referentielTaxo == null || referentielTaxo.isEmpty()) {
1785
			    referentielTaxo = Configuration.getReferentielsDispos().get(0).getCode();
1760
			    referentielTaxo = Configuration.getReferentielsDispos().get(0).getCode();
1786
			}
1761
			}
1787
			selecteurReferentielTaxo.setValue(referentielTaxo);
1762
			selecteurReferentielTaxo.setValue(referentielTaxo);
1788
		} else {
1763
		} else {
1789
			referentielTaxo = "";
1764
			referentielTaxo = "";
1790
			selecteurReferentielTaxo.setRawValue(VALEURS_MULTIPLES);
1765
			selecteurReferentielTaxo.setRawValue(VALEURS_MULTIPLES);
1791
		}
1766
		}
1792
 
1767
 
1793
		afficherChampsEtendus(obs.getChampsEtendus(), null);
1768
		afficherChampsEtendus(obs.getChampsEtendus(), null);
1794
	}
1769
	}
1795
 
1770
 
1796
	private boolean doitAfficherLatLon(Observation obs) {
1771
	private boolean doitAfficherLatLon(Observation obs) {
1797
		return !obs.getLatitude().isEmpty() &&
1772
		return !obs.getLatitude().isEmpty() &&
1798
				!obs.getLatitude().equals("null") &&
1773
				!obs.getLatitude().equals("null") &&
1799
				!obs.getLatitude().equals("000null") &&
1774
				!obs.getLatitude().equals("000null") &&
1800
				!Util.estZero(obs.getLatitude()) &&
1775
				!Util.estZero(obs.getLatitude()) &&
1801
				!obs.getLongitude().isEmpty() &&
1776
				!obs.getLongitude().isEmpty() &&
1802
				!obs.getLongitude().equals("null") &&
1777
				!obs.getLongitude().equals("null") &&
1803
				!obs.getLongitude().equals("000null") &&
1778
				!obs.getLongitude().equals("000null") &&
1804
				!Util.estZero(obs.getLongitude());
1779
				!Util.estZero(obs.getLongitude());
1805
	}
1780
	}
1806
 
1781
 
1807
	private void viderChampsEtendus() {
1782
	private void viderChampsEtendus() {
1808
		if(listeChampsEtendus != null) {
1783
		if(listeChampsEtendus != null) {
1809
			for (Iterator<String> it = listeChampsEtendus.keySet().iterator(); it.hasNext();) {
1784
			for (Iterator<String> it = listeChampsEtendus.keySet().iterator(); it.hasNext();) {
1810
				ChampSaisieEtendu champEtendu = listeChampsEtendus.get(it.next());
1785
				ChampSaisieEtendu champEtendu = listeChampsEtendus.get(it.next());
1811
				champEtendu.destroy();
1786
				champEtendu.destroy();
1812
			}
1787
			}
1813
			if(conteneurChampEtenduGauche != null && conteneurChampEtenduDroite != null) {
1788
			if(conteneurChampEtenduGauche != null && conteneurChampEtenduDroite != null) {
1814
				conteneurChampEtenduGauche.clear();
1789
				conteneurChampEtenduGauche.clear();
1815
				conteneurChampEtenduDroite.clear();
1790
				conteneurChampEtenduDroite.clear();
1816
				panneauPremierColonne.remove(conteneurChampEtenduGauche);
1791
				panneauPremierColonne.remove(conteneurChampEtenduGauche);
1817
				panneauSecondeColonne.remove(conteneurChampEtenduDroite);
1792
				panneauSecondeColonne.remove(conteneurChampEtenduDroite);
1818
			}
1793
			}
1819
			listeChampsEtendus = null;
1794
			listeChampsEtendus = null;
1820
		}
1795
		}
1821
	}
1796
	}
1822
 
1797
 
1823
	private void afficherChampsEtendus(Map<String, ChampEtendu> champsEtendus, ChampEtendu champsAFocus) {
1798
	private void afficherChampsEtendus(Map<String, ChampEtendu> champsEtendus, ChampEtendu champsAFocus) {
1824
		champsEtendus = Util.trierListeChampsEtendus(champsEtendus);
1799
		champsEtendus = Util.trierListeChampsEtendus(champsEtendus);
1825
		viderChampsEtendus();
1800
		viderChampsEtendus();
1826
 
1801
 
1827
		FormLayout flmd = new FormLayout();
1802
		FormLayout flmd = new FormLayout();
1828
		flmd.setLabelWidth(150);
1803
		flmd.setLabelWidth(150);
1829
 
1804
 
1830
		FormLayout flmg = new FormLayout();
1805
		FormLayout flmg = new FormLayout();
1831
		flmg.setLabelWidth(150);
1806
		flmg.setLabelWidth(150);
1832
 
1807
 
1833
		conteneurChampEtenduGauche = new Panel();
1808
		conteneurChampEtenduGauche = new Panel();
1834
		conteneurChampEtenduGauche.setLayout(flmg);
1809
		conteneurChampEtenduGauche.setLayout(flmg);
1835
		conteneurChampEtenduDroite = new Panel();
1810
		conteneurChampEtenduDroite = new Panel();
1836
		conteneurChampEtenduDroite.setLayout(flmd);
1811
		conteneurChampEtenduDroite.setLayout(flmd);
1837
 
1812
 
1838
		conteneurChampEtenduGauche.setAutoWidth(true);
1813
		conteneurChampEtenduGauche.setAutoWidth(true);
1839
		conteneurChampEtenduGauche.setStyle("conteneurChampsEtendus");
1814
		conteneurChampEtenduGauche.setStyle("conteneurChampsEtendus");
1840
		conteneurChampEtenduGauche.setBodyBorder(false);
1815
		conteneurChampEtenduGauche.setBodyBorder(false);
1841
		conteneurChampEtenduDroite.setAutoWidth(true);
1816
		conteneurChampEtenduDroite.setAutoWidth(true);
1842
		conteneurChampEtenduDroite.setStyle("conteneurChampsEtendus");
1817
		conteneurChampEtenduDroite.setStyle("conteneurChampsEtendus");
1843
		conteneurChampEtenduDroite.setBodyBorder(false);
1818
		conteneurChampEtenduDroite.setBodyBorder(false);
1844
 
1819
 
1845
		// pour corriger le décalage sur le panneau induit par le lien d'affichage
1820
		// pour corriger le décalage sur le panneau induit par le lien d'affichage
1846
		conteneurChampEtenduDroite.setPaddings(42, 0, 0, 0);
1821
		conteneurChampEtenduDroite.setPaddings(42, 0, 0, 0);
1847
 
1822
 
1848
		if(champsEtendus != null && champsEtendus.size() > 0) {
1823
		if(champsEtendus != null && champsEtendus.size() > 0) {
1849
			lienAfficherChampsEtendus.setVisible(true);
1824
			lienAfficherChampsEtendus.setVisible(true);
1850
			listeChampsEtendus = new HashMap<String, ChampSaisieEtendu>(champsEtendus.size());
1825
			listeChampsEtendus = new HashMap<String, ChampSaisieEtendu>(champsEtendus.size());
1851
			HashMap<String, String> correspondancesClesLabel = ListeReferentielChampsEtendusDAO.cacheClesLabels;
1826
			HashMap<String, String> correspondancesClesLabel = ListeReferentielChampsEtendusDAO.cacheClesLabels;
1852
			boolean gauche = true;
1827
			boolean gauche = true;
1853
			for (Iterator<String> iterator = champsEtendus.keySet().iterator(); iterator.hasNext();) {
1828
			for (Iterator<String> iterator = champsEtendus.keySet().iterator(); iterator.hasNext();) {
1854
				
1829
				
1855
				String id = iterator.next();
1830
				String id = iterator.next();
1856
				ChampEtendu champ = champsEtendus.get(id);
1831
				ChampEtendu champ = champsEtendus.get(id);
1857
				
1832
				
1858
				String valeur = champ.getValeur();
1833
				String valeur = champ.getValeur();
1859
				String label = id;
1834
				String label = id;
1860
				
1835
				
1861
				// Si le champ possède un clé déjà définie par le catalogue, elle lui sera affectée
1836
				// Si le champ possède un clé déjà définie par le catalogue, elle lui sera affectée
1862
				// sinon on la formate en la "déchamotant" et en ajoutant des espaces
1837
				// sinon on la formate en la "déchamotant" et en ajoutant des espaces
1863
				if(correspondancesClesLabel.containsKey(id)) {
1838
				if(correspondancesClesLabel.containsKey(id)) {
1864
					label = correspondancesClesLabel.get(id);
1839
					label = correspondancesClesLabel.get(id);
1865
				} else {
1840
				} else {
1866
					label = Util.formaterCleChampsEtenduPourAffichage(label);
1841
					label = Util.formaterCleChampsEtenduPourAffichage(label);
1867
				}
1842
				}
1868
 
1843
 
1869
				ChampSaisieEtendu champTexteEtendu = new ChampSaisieEtendu(label, id, ListeReferentielChampsEtendusDAO.getUrlRequeteValeursChampEtendu(id));
1844
				ChampSaisieEtendu champTexteEtendu = new ChampSaisieEtendu(label, id, ListeReferentielChampsEtendusDAO.getUrlRequeteValeursChampEtendu(id));
1870
				if(champ.equals(champsAFocus)) {
1845
				if(champ.equals(champsAFocus)) {
1871
					champTexteEtendu.focus();
1846
					champTexteEtendu.focus();
1872
				}
1847
				}
1873
				
1848
				
1874
				champTexteEtendu.setId(id);
1849
				champTexteEtendu.setId(id);
1875
				champTexteEtendu.setValue(valeur);
1850
				champTexteEtendu.setValue(valeur);
1876
				if(gauche) {
1851
				if(gauche) {
1877
					conteneurChampEtenduGauche.add(champTexteEtendu);
1852
					conteneurChampEtenduGauche.add(champTexteEtendu);
1878
				} else {
1853
				} else {
1879
					conteneurChampEtenduDroite.add(champTexteEtendu);
1854
					conteneurChampEtenduDroite.add(champTexteEtendu);
1880
				}
1855
				}
1881
				listeChampsEtendus.put(id, champTexteEtendu);
1856
				listeChampsEtendus.put(id, champTexteEtendu);
1882
				gauche = !gauche;
1857
				gauche = !gauche;
1883
			}
1858
			}
1884
 
1859
 
1885
			panneauPremierColonne.add(conteneurChampEtenduGauche);
1860
			panneauPremierColonne.add(conteneurChampEtenduGauche);
1886
			panneauSecondeColonne.add(conteneurChampEtenduDroite);
1861
			panneauSecondeColonne.add(conteneurChampEtenduDroite);
1887
 
1862
 
1888
			if(!afficherChampsEtendus) {
1863
			if(!afficherChampsEtendus) {
1889
				conteneurChampEtenduGauche.setVisible(false);
1864
				conteneurChampEtenduGauche.setVisible(false);
1890
				conteneurChampEtenduDroite.setVisible(false);
1865
				conteneurChampEtenduDroite.setVisible(false);
1891
			} else {
1866
			} else {
1892
				redimensionnerChampsEtendus();
1867
				redimensionnerChampsEtendus();
1893
			}
1868
			}
1894
		} else {
1869
		} else {
1895
			lienAfficherChampsEtendus.setVisible(false);
1870
			lienAfficherChampsEtendus.setVisible(false);
1896
		}
1871
		}
1897
		doLayout();
1872
		doLayout();
1898
	}
1873
	}
1899
	
1874
	
1900
	private void redimensionnerChampsEtendus() {
1875
	private void redimensionnerChampsEtendus() {
1901
		int largeur = conteneurChampEtenduGauche.getWidth();
1876
		int largeur = conteneurChampEtenduGauche.getWidth();
1902
		if(largeur <= 0) {
1877
		if(largeur <= 0) {
1903
			Timer t = new Timer() {		
1878
			Timer t = new Timer() {		
1904
				@Override
1879
				@Override
1905
				public void run() {
1880
				public void run() {
1906
					redimensionnerChampsEtendus();
1881
					redimensionnerChampsEtendus();
1907
				}
1882
				}
1908
			};
1883
			};
1909
			t.schedule(150);
1884
			t.schedule(150);
1910
		} else {
1885
		} else {
1911
			for (Iterator<String> iterator = listeChampsEtendus.keySet().iterator(); iterator
1886
			for (Iterator<String> iterator = listeChampsEtendus.keySet().iterator(); iterator
1912
					.hasNext();) {
1887
					.hasNext();) {
1913
				ChampSaisieEtendu ch = listeChampsEtendus.get(iterator.next());
1888
				ChampSaisieEtendu ch = listeChampsEtendus.get(iterator.next());
1914
				ch.redimensionner(largeur - 15);	
1889
				ch.redimensionner(largeur - 15);	
1915
				if(ch.getFieldWidth() < ch.getLabelWidth()) {
1890
				if(ch.getFieldWidth() < ch.getLabelWidth()) {
1916
					ch.addClass("panneauModePetiteLargeur");
1891
					ch.addClass("panneauModePetiteLargeur");
1917
					ch.agrandirChamp(largeur - 82);
1892
					ch.agrandirChamp(largeur - 82);
1918
				} else {
1893
				} else {
1919
					//ch.removeClass("panneauModePetiteLargeur");
1894
					//ch.removeClass("panneauModePetiteLargeur");
1920
				}
1895
				}
1921
			}
1896
			}
1922
		}
1897
		}
1923
	}
1898
	}
1924
 
1899
 
1925
	private Map<String, ChampEtendu> getValeursChampsEtendus() {
1900
	private Map<String, ChampEtendu> getValeursChampsEtendus() {
1926
		Map<String, ChampEtendu> valeursChampsEtendus = new HashMap<String, ChampEtendu>();
1901
		Map<String, ChampEtendu> valeursChampsEtendus = new HashMap<String, ChampEtendu>();
1927
		if(listeChampsEtendus != null) {
1902
		if(listeChampsEtendus != null) {
1928
			for (Iterator<String> it = listeChampsEtendus.keySet().iterator(); it.hasNext();) {
1903
			for (Iterator<String> it = listeChampsEtendus.keySet().iterator(); it.hasNext();) {
1929
				String cle = it.next();
1904
				String cle = it.next();
1930
				ChampSaisieEtendu champTexteEtendu = listeChampsEtendus.get(cle);
1905
				ChampSaisieEtendu champTexteEtendu = listeChampsEtendus.get(cle);
1931
				String label = champTexteEtendu.getLabel();
1906
				String label = champTexteEtendu.getLabel();
1932
				String valeur = champTexteEtendu.getRawValue();
1907
				String valeur = champTexteEtendu.getRawValue();
1933
				ChampEtendu champEtendu = new ChampEtendu(cle, label, valeur);
1908
				ChampEtendu champEtendu = new ChampEtendu(cle, label, valeur);
1934
				valeursChampsEtendus.put(cle, champEtendu);
1909
				valeursChampsEtendus.put(cle, champEtendu);
1935
			}
1910
			}
1936
		}
1911
		}
1937
		return valeursChampsEtendus;
1912
		return valeursChampsEtendus;
1938
	}
1913
	}
1939
 
1914
 
1940
	public void raz()
1915
	public void raz()
1941
	{
1916
	{
1942
		raz(Champs.TOUT);
1917
		raz(Champs.TOUT);
1943
 
1918
 
1944
	}
1919
	}
1945
	public void raz(Champs champs)
1920
	public void raz(Champs champs)
1946
	{
1921
	{
1947
		switch (champs) {
1922
		switch (champs) {
1948
			case DATE:
1923
			case DATE:
1949
				date.reset() ;
1924
				date.reset() ;
1950
				break;
1925
				break;
1951
 
1926
 
1952
			case LIEUDIT:
1927
			case LIEUDIT:
1953
				lieudit.reset() ;
1928
				lieudit.reset() ;
1954
				break;
1929
				break;
1955
 
1930
 
1956
			case STATION:
1931
			case STATION:
1957
				station.reset() ;
1932
				station.reset() ;
1958
				break;
1933
				break;
1959
 
1934
 
1960
			case MILIEU:
1935
			case MILIEU:
1961
				milieu.reset() ;
1936
				milieu.reset() ;
1962
				break;
1937
				break;
1963
 
1938
 
1964
			case COMMENT:
1939
			case COMMENT:
1965
				comment.reset() ;
1940
				comment.reset() ;
1966
				break;
1941
				break;
1967
 
1942
 
1968
			case LOCALITE:
1943
			case LOCALITE:
1969
				localite.reset() ;
1944
				localite.reset() ;
1970
				codeLocalite ="";
1945
				codeLocalite ="";
1971
				pays="";
1946
				pays="";
1972
				latitude.reset();
1947
				latitude.reset();
1973
				longitude.reset();
1948
				longitude.reset();
1974
				break;
1949
				break;
1975
 
1950
 
1976
			case ESPECE:
1951
			case ESPECE:
1977
				espece.reset();
1952
				espece.reset();
1978
				numeroNom = "" ;
1953
				numeroNom = "" ;
1979
				numeroOrdre = "";
1954
				numeroOrdre = "";
1980
				break;
1955
				break;
1981
 
1956
 
1982
			case LATITUDE:
1957
			case LATITUDE:
1983
				latitude.reset();
1958
				latitude.reset();
1984
				afficherIndicationlocalite(null);
1959
				afficherIndicationlocalite(null);
1985
				break;
1960
				break;
1986
 
1961
 
1987
			case LONGITUDE:
1962
			case LONGITUDE:
1988
				longitude.reset();
1963
				longitude.reset();
1989
				afficherIndicationlocalite(null);
1964
				afficherIndicationlocalite(null);
1990
				break;
1965
				break;
1991
 
1966
 
1992
			case ALTITUDE:
1967
			case ALTITUDE:
1993
				altitude.reset();
1968
				altitude.reset();
1994
				break;
1969
				break;
1995
 
1970
 
1996
			case ABONDANCE:
1971
			case ABONDANCE:
1997
				selecteurAbondance.setValue("");
1972
				selecteurAbondance.setValue("");
1998
				break;
1973
				break;
1999
 
1974
 
2000
			case CERTITUDE:
1975
			case CERTITUDE:
2001
				selecteurCertitude.setValue("");
1976
				selecteurCertitude.setValue("");
2002
				break;
1977
				break;
2003
 
1978
 
2004
			case REFERENTIELTAXO:
1979
			case REFERENTIELTAXO:
2005
				selecteurReferentielTaxo.setValue("");
1980
				selecteurReferentielTaxo.setValue("");
2006
				break;
1981
				break;
2007
 
1982
 
2008
			case PHENOLOGIE:
1983
			case PHENOLOGIE:
2009
				selecteurStadePheno.setValue("");
1984
				selecteurStadePheno.setValue("");
2010
				break;
1985
				break;
2011
 
1986
 
2012
			case TOUT:
1987
			case TOUT:
2013
				localite.reset();
1988
				localite.reset();
2014
				date.reset() ;
1989
				date.reset() ;
2015
				lieudit.reset() ;
1990
				lieudit.reset() ;
2016
				station.reset() ;
1991
				station.reset() ;
2017
				milieu.reset() ;
1992
				milieu.reset() ;
2018
				comment.reset() ;
1993
				comment.reset() ;
2019
				milieu.reset() ;
1994
				milieu.reset() ;
2020
				latitude.reset();
1995
				latitude.reset();
2021
				longitude.reset();
1996
				longitude.reset();
2022
				altitude.reset();
1997
				altitude.reset();
2023
				pays="";
1998
				pays="";
2024
				codeLocalite ="";
1999
				codeLocalite ="";
2025
				espece.reset();
2000
				espece.reset();
2026
				selecteurAbondance.clearValue();
2001
				selecteurAbondance.clearValue();
2027
				selecteurCertitude.clearValue();
2002
				selecteurCertitude.clearValue();
2028
				selecteurReferentielTaxo.clearValue();
2003
				selecteurReferentielTaxo.clearValue();
2029
				selecteurStadePheno.clearValue();
2004
				selecteurStadePheno.clearValue();
2030
				referentielTaxo = "";
2005
				referentielTaxo = "";
2031
				numeroNom = "" ;
2006
				numeroNom = "" ;
2032
				numeroOrdre = "";
2007
				numeroOrdre = "";
2033
				afficherIndicationlocalite(null);
2008
				afficherIndicationlocalite(null);
2034
				break;
2009
				break;
2035
 
2010
 
2036
		}
2011
		}
2037
 
2012
 
2038
	}
2013
	}
2039
 
2014
 
2040
	public boolean verifierFormatDate(String date) {
2015
	public boolean verifierFormatDate(String date) {
2041
 
2016
 
2042
		String regex = "[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}" ;
2017
		String regex = "[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}" ;
2043
		if(date.matches(regex) && !date.equals("0000-00-00")) {
2018
		if(date.matches(regex) && !date.equals("0000-00-00")) {
2044
			return true ;
2019
			return true ;
2045
		}
2020
		}
2046
		else {
2021
		else {
2047
			return false;
2022
			return false;
2048
		}
2023
		}
2049
	}
2024
	}
2050
 
2025
 
2051
	public void setSelectionMultiple(boolean selectionMultiple) {
2026
	public void setSelectionMultiple(boolean selectionMultiple) {
2052
		this.selectionMultiple = selectionMultiple;
2027
		this.selectionMultiple = selectionMultiple;
2053
		if(!selectionMultiple) {
2028
		if(!selectionMultiple) {
2054
			boutonReinitialiser.enable();
2029
			boutonReinitialiser.enable();
2055
			boutonOK.enable();
2030
			boutonOK.enable();
2056
		} else {
2031
		} else {
2057
			boutonReinitialiser.disable();
2032
			boutonReinitialiser.disable();
2058
			boutonOK.disable();
2033
			boutonOK.disable();
2059
		}
2034
		}
2060
	}
2035
	}
2061
 
2036
 
2062
	public boolean getSelectionMultiple() {
2037
	public boolean getSelectionMultiple() {
2063
		return selectionMultiple;
2038
		return selectionMultiple;
2064
	}
2039
	}
2065
 
2040
 
2066
	private void calculerAfficherDifferences(ListeObservation listeObs) {
2041
	private void calculerAfficherDifferences(ListeObservation listeObs) {
2067
 
2042
 
2068
		String codeLocalite = null;
2043
		String codeLocalite = null;
2069
		String pays = null;
2044
		String pays = null;
2070
		String localite = null;
2045
		String localite = null;
2071
		String lieuDit = null;
2046
		String lieuDit = null;
2072
		String station = null;
2047
		String station = null;
2073
		String milieu = null;
2048
		String milieu = null;
2074
		String espece = null;
2049
		String espece = null;
2075
		String date = null;
2050
		String date = null;
2076
		String notes = null;
2051
		String notes = null;
2077
		String lat = null;
2052
		String lat = null;
2078
		String lon = null;
2053
		String lon = null;
2079
		String alt = null;
2054
		String alt = null;
2080
		String abondance = null;
2055
		String abondance = null;
2081
		String certitude = null;
2056
		String certitude = null;
2082
		String referentielTaxo = null;
2057
		String referentielTaxo = null;
2083
		String phenologie = null;
2058
		String phenologie = null;
2084
 
2059
 
2085
		String ordreObs = "";
2060
		String ordreObs = "";
2086
 
2061
 
2087
		for(Iterator<String> it = listeObs.keySet().iterator();it.hasNext();) {
2062
		for(Iterator<String> it = listeObs.keySet().iterator();it.hasNext();) {
2088
			Observation obsEnCours = listeObs.get(it.next());
2063
			Observation obsEnCours = listeObs.get(it.next());
2089
			pays = comparerDifferencesChamps(pays, obsEnCours.getPays());
2064
			pays = comparerDifferencesChamps(pays, obsEnCours.getPays());
2090
			codeLocalite = comparerDifferencesChamps(codeLocalite, obsEnCours.getIdentifiantLocalite());
2065
			codeLocalite = comparerDifferencesChamps(codeLocalite, obsEnCours.getIdentifiantLocalite());
2091
			localite = comparerDifferencesChamps(localite, obsEnCours.getLocalite());
2066
			localite = comparerDifferencesChamps(localite, obsEnCours.getLocalite());
2092
			lieuDit = comparerDifferencesChamps(lieuDit, obsEnCours.getLieudit());
2067
			lieuDit = comparerDifferencesChamps(lieuDit, obsEnCours.getLieudit());
2093
			station = comparerDifferencesChamps(station, obsEnCours.getStation());
2068
			station = comparerDifferencesChamps(station, obsEnCours.getStation());
2094
			milieu = comparerDifferencesChamps(milieu, obsEnCours.getMilieu());
2069
			milieu = comparerDifferencesChamps(milieu, obsEnCours.getMilieu());
2095
			espece = comparerDifferencesChamps(espece, obsEnCours.getNomSaisi());
2070
			espece = comparerDifferencesChamps(espece, obsEnCours.getNomSaisi());
2096
			date = comparerDifferencesChamps(date, obsEnCours.getDate());
2071
			date = comparerDifferencesChamps(date, obsEnCours.getDate());
2097
			notes = comparerDifferencesChamps(notes, obsEnCours.getCommentaire());
2072
			notes = comparerDifferencesChamps(notes, obsEnCours.getCommentaire());
2098
			lat = comparerDifferencesChamps(lat, obsEnCours.getLatitude());
2073
			lat = comparerDifferencesChamps(lat, obsEnCours.getLatitude());
2099
			lon = comparerDifferencesChamps(lon, obsEnCours.getLongitude());
2074
			lon = comparerDifferencesChamps(lon, obsEnCours.getLongitude());
2100
			alt = comparerDifferencesChamps(alt, obsEnCours.getAltitude());
2075
			alt = comparerDifferencesChamps(alt, obsEnCours.getAltitude());
2101
			abondance = comparerDifferencesChamps(abondance, obsEnCours.getAbondance());
2076
			abondance = comparerDifferencesChamps(abondance, obsEnCours.getAbondance());
2102
			certitude = comparerDifferencesChamps(certitude, obsEnCours.getCertitude());
2077
			certitude = comparerDifferencesChamps(certitude, obsEnCours.getCertitude());
2103
			referentielTaxo = comparerDifferencesChamps(referentielTaxo, obsEnCours.getReferentielTaxo());
2078
			referentielTaxo = comparerDifferencesChamps(referentielTaxo, obsEnCours.getReferentielTaxo());
2104
			phenologie = comparerDifferencesChamps(phenologie, obsEnCours.getPhenologie());
2079
			phenologie = comparerDifferencesChamps(phenologie, obsEnCours.getPhenologie());
2105
 
2080
 
2106
			ordreObs += obsEnCours.getNumeroOrdre()+",";
2081
			ordreObs += obsEnCours.getNumeroOrdre()+",";
2107
		}
2082
		}
2108
 
2083
 
2109
		Observation obs=new Observation(espece,numeroNom,localite,codeLocalite,lieuDit,station,milieu, notes,date);
2084
		Observation obs=new Observation(espece,numeroNom,localite,codeLocalite,lieuDit,station,milieu, notes,date);
2110
		obs.setPays(pays);
2085
		obs.setPays(pays);
2111
		obs.setNumeroOrdre(ordreObs);
2086
		obs.setNumeroOrdre(ordreObs);
2112
		obs.setLatitude(lat);
2087
		obs.setLatitude(lat);
2113
		obs.setLongitude(lon);
2088
		obs.setLongitude(lon);
2114
		obs.setAltitude(alt);
2089
		obs.setAltitude(alt);
2115
		obs.setAbondance(abondance);
2090
		obs.setAbondance(abondance);
2116
		obs.setCertitude(certitude);
2091
		obs.setCertitude(certitude);
2117
		obs.setReferentielTaxo(referentielTaxo);
2092
		obs.setReferentielTaxo(referentielTaxo);
2118
		obs.setPhenologie(phenologie);
2093
		obs.setPhenologie(phenologie);
2119
		afficherDetailsObservation(obs);
2094
		afficherDetailsObservation(obs);
2120
	}
2095
	}
2121
 
2096
 
2122
	private String comparerDifferencesChamps(String valeurActuelle, String nouvelleValeur) {
2097
	private String comparerDifferencesChamps(String valeurActuelle, String nouvelleValeur) {
2123
 
2098
 
2124
		String retour = "";
2099
		String retour = "";
2125
 
2100
 
2126
			if(valeurActuelle == null) {
2101
			if(valeurActuelle == null) {
2127
				retour = nouvelleValeur;
2102
				retour = nouvelleValeur;
2128
			} else {
2103
			} else {
2129
				if(valeurActuelle.equals(nouvelleValeur)) {
2104
				if(valeurActuelle.equals(nouvelleValeur)) {
2130
					retour = valeurActuelle;
2105
					retour = valeurActuelle;
2131
				} else {
2106
				} else {
2132
					retour = VALEURS_MULTIPLES;
2107
					retour = VALEURS_MULTIPLES;
2133
				}
2108
				}
2134
			}
2109
			}
2135
		return retour;
2110
		return retour;
2136
	}
2111
	}
2137
 
2112
 
2138
	private void reinitialiserValeurModifiees() {
2113
	private void reinitialiserValeurModifiees() {
2139
		localiteModifiee = false;
2114
		localiteModifiee = false;
2140
		lieuDitModifie = false;
2115
		lieuDitModifie = false;
2141
		stationModifiee = false;
2116
		stationModifiee = false;
2142
		milieuModifie = false;
2117
		milieuModifie = false;
2143
		dateModifiee = false;
2118
		dateModifiee = false;
2144
		especeModifiee = false;
2119
		especeModifiee = false;
2145
		commModifie = false;
2120
		commModifie = false;
2146
		latModifiee = false;
2121
		latModifiee = false;
2147
		longModifiee = false;
2122
		longModifiee = false;
2148
		altModifiee = false;
2123
		altModifiee = false;
2149
		abondanceModifiee = false;
2124
		abondanceModifiee = false;
2150
		certitudeModifiee = false;
2125
		certitudeModifiee = false;
2151
		referentielTaxoModifie = false;
2126
		referentielTaxoModifie = false;
2152
		phenologieModifiee = false;
2127
		phenologieModifiee = false;
2153
	}
2128
	}
2154
 
2129
 
2155
	public void saisieTabindex()
2130
	public void saisieTabindex()
2156
	{
2131
	{
2157
		localite.setTabIndex(1);
2132
		localite.setTabIndex(1);
2158
		lieudit.setTabIndex(3);
2133
		lieudit.setTabIndex(3);
2159
		station.setTabIndex(4);
2134
		station.setTabIndex(4);
2160
		milieu.setTabIndex(5);
2135
		milieu.setTabIndex(5);
2161
		coordonnees.setTabIndex(-1);
2136
		coordonnees.setTabIndex(-1);
2162
		coordonnees.addListener(new TextFieldListenerAdapter() {
2137
		coordonnees.addListener(new TextFieldListenerAdapter() {
2163
 
2138
 
2164
			@Override
2139
			@Override
2165
			public void onFocus(Field field) {
2140
			public void onFocus(Field field) {
2166
				if(coordPanel.isVisible()) {
2141
				if(coordPanel.isVisible()) {
2167
					latitude.focus();
2142
					latitude.focus();
2168
				} else {
2143
				} else {
2169
					Ext.get("lien_carto").focus();
2144
					Ext.get("lien_carto").focus();
2170
				}
2145
				}
2171
			}
2146
			}
2172
		});
2147
		});
2173
 
2148
 
2174
		latitude.setTabIndex(8);
2149
		latitude.setTabIndex(8);
2175
		longitude.setTabIndex(9);
2150
		longitude.setTabIndex(9);
2176
		altitude.setTabIndex(10);
2151
		altitude.setTabIndex(10);
2177
		comment.setTabIndex(11);
2152
		comment.setTabIndex(11);
2178
		date.setTabIndex(12);
2153
		date.setTabIndex(12);
2179
		espece.setTabIndex(13);
2154
		espece.setTabIndex(13);
2180
		selecteurCertitude.setTabIndex(14);
2155
		selecteurCertitude.setTabIndex(14);
2181
		selecteurAbondance.setTabIndex(15);
2156
		selecteurAbondance.setTabIndex(15);
2182
		selecteurStadePheno.setTabIndex(16);
2157
		selecteurStadePheno.setTabIndex(16);
2183
		boutonOK.setTabIndex(17);
2158
		boutonOK.setTabIndex(17);
2184
		boutonReinitialiser.setTabIndex(18);
2159
		boutonReinitialiser.setTabIndex(18);
2185
 
2160
 
2186
	}
2161
	}
2187
 
2162
 
2188
	private void obtenirInformationCoord() {
2163
	private void obtenirInformationCoord() {
2189
		if(coordonneesValides() != null) {
2164
		if(coordonneesValides() != null) {
2190
			observationMediateur.obtenirInformationCoord(coordonneesValides()[0],coordonneesValides()[1]);
2165
			observationMediateur.obtenirInformationCoord(coordonneesValides()[0],coordonneesValides()[1]);
2191
		} else {
2166
		} else {
2192
			// Centrage de la carte sur une zone correspondant plus ou moins au référentiel.
2167
			// Centrage de la carte sur une zone correspondant plus ou moins au référentiel.
2193
			// En dur car la config est tellement mal foutue que j'ai envie de me pendre.
2168
			// En dur car la config est tellement mal foutue que j'ai envie de me pendre.
2194
			String referentiel = this.getReferentielTaxo();
2169
			String referentiel = this.getReferentielTaxo();
2195
			String referentielRacine = referentiel.substring(0, referentiel.indexOf(':'));
2170
			String referentielRacine = referentiel.substring(0, referentiel.indexOf(':'));
2196
			Double lat = null, lon = null;
2171
			Double lat = null, lon = null;
2197
			int zoom = 6;
2172
			int zoom = 6;
2198
			switch(referentielRacine) {
2173
			switch(referentielRacine) {
2199
				case "bdtre" :
2174
				case "bdtre" :
2200
					lat = -21.10;
2175
					lat = -21.10;
2201
					lon = 55.30;
2176
					lon = 55.30;
2202
					zoom = 7;
2177
					zoom = 7;
2203
				break;
2178
				break;
2204
				case "isfan" :
2179
				case "isfan" :
2205
					lat = 29.28358;
2180
					lat = 29.28358;
2206
					lon = 10.21884;
2181
					lon = 10.21884;
2207
					zoom = 5;
2182
					zoom = 5;
2208
					break;
2183
					break;
2209
				case "apd" :
2184
				case "apd" :
2210
					lat = 8.75624;
2185
					lat = 8.75624;
2211
					lon = 1.80176;
2186
					lon = 1.80176;
2212
					zoom = 5;
2187
					zoom = 5;
2213
					break;
2188
					break;
2214
				case "bdtxa" :
2189
				case "bdtxa" :
2215
					lat = 14.6;
2190
					lat = 14.6;
2216
					lon = -61.08334;
2191
					lon = -61.08334;
2217
					zoom = 7;
2192
					zoom = 7;
2218
					break;
2193
					break;
2219
				case "lbf" :
2194
				case "lbf" :
2220
					lat = 33.53;
2195
					lat = 33.53;
2221
					lon = 35.30;
2196
					lon = 35.30;
2222
					zoom = 7;
2197
					zoom = 7;
2223
					break;
2198
					break;
2224
				case "bdtfx" :
2199
				case "bdtfx" :
2225
				default:
2200
				default:
2226
					lat = 47.0504;
2201
					lat = 47.0504;
2227
					lon = 2.2347;
2202
					lon = 2.2347;
2228
					zoom = 6;
2203
					zoom = 6;
2229
			}
2204
			}
2230
			if (lat != null && lon != null) {
2205
			if (lat != null && lon != null) {
2231
				// centrage sur la zone
2206
				// centrage sur la zone
2232
				EntiteGeographiqueObservation infos = new EntiteGeographiqueObservation();
2207
				EntiteGeographiqueObservation infos = new EntiteGeographiqueObservation();
2233
				infos.setLon("" + lon);
2208
				infos.setLon("" + lon);
2234
				infos.setLat("" + lat);
2209
				infos.setLat("" + lat);
2235
				infos.setZoom(zoom);
2210
				infos.setZoom(zoom);
2236
				observationMediateur.rafraichirFenetreCartoSurPoint(infos);
2211
				observationMediateur.rafraichirFenetreCartoSurPoint(infos);
2237
			} else {
2212
			} else {
2238
				// affichage par défaut au cas où on n'aurait pas trouvé de coordonnées pour centrer
2213
				// affichage par défaut au cas où on n'aurait pas trouvé de coordonnées pour centrer
2239
				observationMediateur.afficherFenetreCarto();
2214
				observationMediateur.afficherFenetreCarto();
2240
			}
2215
			}
2241
		}
2216
		}
2242
	}
2217
	}
2243
 
2218
 
2244
	private void obtenirInformationLocalite() {
2219
	private void obtenirInformationLocalite() {
2245
		String idLoc = obtenirIdLocalite();
2220
		String idLoc = obtenirIdLocalite();
2246
		observationMediateur.obtenirInformationLocalite(getlocaliteSansIdLoc(), idLoc);
2221
		observationMediateur.obtenirInformationLocalite(getlocaliteSansIdLoc(), idLoc);
2247
	}
2222
	}
2248
	
2223
	
2249
	private String obtenirIdLocalite() {
2224
	private String obtenirIdLocalite() {
2250
		String idLoc = "";
2225
		String idLoc = "";
2251
		
2226
		
2252
		// Soit un numéro de département, soit un code de pays à deux lettres
2227
		// Soit un numéro de département, soit un code de pays à deux lettres
2253
		String[] codeCom = localite.getText().split(" ");
2228
		String[] codeCom = localite.getText().split(" ");
2254
		if(codeCom.length > 1 && ressembleAUnCodePaysOuDepartement(codeCom[codeCom.length - 1])) {
2229
		if(codeCom.length > 1 && ressembleAUnCodePaysOuDepartement(codeCom[codeCom.length - 1])) {
2255
			String codeLoc = codeCom[codeCom.length - 1].replace('(', ' ');
2230
			String codeLoc = codeCom[codeCom.length - 1].replace('(', ' ');
2256
			codeLoc = codeLoc.replace(')', ' ').trim().replace('\\',' ').trim();
2231
			codeLoc = codeLoc.replace(')', ' ').trim().replace('\\',' ').trim();
2257
 
2232
 
2258
			if(Util.estUnNombre(codeLoc)) {
2233
			if(Util.estUnNombre(codeLoc)) {
2259
				idLoc = codeLoc ;
2234
				idLoc = codeLoc ;
2260
			} else {
2235
			} else {
2261
				idLoc = codeLoc.toUpperCase();
2236
				idLoc = codeLoc.toUpperCase();
2262
			}
2237
			}
2263
		}
2238
		}
2264
		
2239
		
2265
		return idLoc;
2240
		return idLoc;
2266
	}
2241
	}
2267
 
2242
 
2268
	public double[] coordonneesValides() {
2243
	public double[] coordonneesValides() {
2269
		try {
2244
		try {
2270
 
2245
 
2271
			double lat = Double.parseDouble(latitude.getValueAsString().replaceAll(",", "."));
2246
			double lat = Double.parseDouble(latitude.getValueAsString().replaceAll(",", "."));
2272
			double lon = Double.parseDouble(longitude.getValueAsString().replaceAll(",", "."));
2247
			double lon = Double.parseDouble(longitude.getValueAsString().replaceAll(",", "."));
2273
 
2248
 
2274
			double[] coord = {lat, lon};
2249
			double[] coord = {lat, lon};
2275
			return coord;
2250
			return coord;
2276
 
2251
 
2277
		} catch (NumberFormatException ne) {
2252
		} catch (NumberFormatException ne) {
2278
			return null;
2253
			return null;
2279
		}
2254
		}
2280
	}
2255
	}
2281
 
2256
 
2282
	private String[] getValeurCoordonnees() {
2257
	private String[] getValeurCoordonnees() {
2283
		double[] coDouble = coordonneesValides();
2258
		double[] coDouble = coordonneesValides();
2284
 
2259
 
2285
		if(coDouble != null) {
2260
		if(coDouble != null) {
2286
			String[] coord = {coDouble[0]+"",coDouble[1]+""};
2261
			String[] coord = {coDouble[0]+"",coDouble[1]+""};
2287
			return coord;
2262
			return coord;
2288
		} else {
2263
		} else {
2289
			String[] coord = {"","" };
2264
			String[] coord = {"","" };
2290
			return coord;
2265
			return coord;
2291
		}
2266
		}
2292
	}
2267
	}
2293
 
2268
 
2294
	public String getlocalite() {
2269
	public String getlocalite() {
2295
 
2270
 
2296
		String valeurlocalite = "";
2271
		String valeurlocalite = "";
2297
 
2272
 
2298
		if(localite.getText() != null) {
2273
		if(localite.getText() != null) {
2299
			valeurlocalite = localite.getText();
2274
			valeurlocalite = localite.getText();
2300
		}
2275
		}
2301
		return valeurlocalite;
2276
		return valeurlocalite;
2302
	}
2277
	}
2303
 
2278
 
2304
	public String getlocaliteSansIdLoc() {
2279
	public String getlocaliteSansIdLoc() {
2305
		return Util.supprimerChaineIdLocalite(getlocalite());
2280
		return Util.supprimerChaineIdLocalite(getlocalite());
2306
	}
2281
	}
2307
 
2282
 
2308
	private String getValeurChampListeLibre(ComboBox champ) {
2283
	private String getValeurChampListeLibre(ComboBox champ) {
2309
		String valeurChamp = champ.getValue();
2284
		String valeurChamp = champ.getValue();
2310
		String valeurChampBrute = champ.getRawValue();
2285
		String valeurChampBrute = champ.getRawValue();
2311
 
2286
 
2312
		// Test idiot qui permet de savoir si l'on utilise la valeur saisie directement ou bien la valeur
2287
		// Test idiot qui permet de savoir si l'on utilise la valeur saisie directement ou bien la valeur
2313
		// selectionnee car lors du setValue sur le keypress, gwtext ne prends pas en compte le dernier
2288
		// selectionnee car lors du setValue sur le keypress, gwtext ne prends pas en compte le dernier
2314
		// caractère
2289
		// caractère
2315
		if(valeurChampBrute.trim().length() == 0) {
2290
		if(valeurChampBrute.trim().length() == 0) {
2316
			valeurChamp = "";
2291
			valeurChamp = "";
2317
		} else {
2292
		} else {
2318
			if(valeurChamp != null && valeurChamp.length() > 0) {
2293
			if(valeurChamp != null && valeurChamp.length() > 0) {
2319
				if(valeurChamp.equals(valeurChampBrute.substring(0, valeurChampBrute.length() -1))) {
2294
				if(valeurChamp.equals(valeurChampBrute.substring(0, valeurChampBrute.length() -1))) {
2320
					valeurChamp = champ.getRawValue();
2295
					valeurChamp = champ.getRawValue();
2321
				}
2296
				}
2322
			}
2297
			}
2323
		}
2298
		}
2324
		return valeurChamp;
2299
		return valeurChamp;
2325
	}
2300
	}
2326
 
2301
 
2327
	public String getAbondance() {
2302
	public String getAbondance() {
2328
		return getValeurChampListeLibre(selecteurAbondance);
2303
		return getValeurChampListeLibre(selecteurAbondance);
2329
	}
2304
	}
2330
 
2305
 
2331
	public String getCertitude() {
2306
	public String getCertitude() {
2332
		return getValeurChampListeLibre(selecteurCertitude);
2307
		return getValeurChampListeLibre(selecteurCertitude);
2333
	}
2308
	}
2334
 
2309
 
2335
	public String getPhenologie() {
2310
	public String getPhenologie() {
2336
		return getValeurChampListeLibre(selecteurStadePheno);
2311
		return getValeurChampListeLibre(selecteurStadePheno);
2337
	}
2312
	}
2338
 
2313
 
2339
	public String getReferentielTaxo() {
2314
	public String getReferentielTaxo() {
2340
		String codeCourt = getValeurChampListeLibre(selecteurReferentielTaxo);
2315
		String codeCourt = getValeurChampListeLibre(selecteurReferentielTaxo);
2341
		return Ontologies.getInfosReferentielNomParCode(codeCourt).getCodeVersionComplet();
2316
		return Ontologies.getInfosReferentielNomParCode(codeCourt).getCodeVersionComplet();
2342
	}
2317
	}
2343
 
2318
 
2344
	public boolean localiteInitialisee() {
2319
	public boolean localiteInitialisee() {
2345
		return localiteModifiee;
2320
		return localiteModifiee;
2346
	}
2321
	}
2347
 
2322
 
2348
	public void redimensionnerFormulaire() {
2323
	public void redimensionnerFormulaire() {
2349
		afficherFormulaireLatLon.setWidth(panneauIntermediaire.getWidth()+"px");
2324
		afficherFormulaireLatLon.setWidth(panneauIntermediaire.getWidth()+"px");
2350
		panneauPremierColonne.doLayout();
2325
		panneauPremierColonne.doLayout();
2351
		panneauSecondeColonne.doLayout();
2326
		panneauSecondeColonne.doLayout();
2352
		panneauIntermediaire.doLayout();
2327
		panneauIntermediaire.doLayout();
2353
 
2328
 
2354
		doLayout();
2329
		doLayout();
2355
	}
2330
	}
2356
	
2331
	
2357
	private void verifierPresenceTaxonSaisi() {
2332
	private void verifierPresenceTaxonSaisi() {
2358
		affecterCodeLocaliteOuPays();
2333
		affecterCodeLocaliteOuPays();
2359
		if(!enRequeteChrologie && !codeLocalite.isEmpty() && numeroNom != null && !numeroNom.isEmpty()) {
2334
		if(!enRequeteChrologie && !codeLocalite.isEmpty() && numeroNom != null && !numeroNom.isEmpty()) {
2360
			enRequeteChrologie = true;
2335
			enRequeteChrologie = true;
2361
			// Pour le moment, si on a un code localité, c'est qu'on est en France
2336
			// Pour le moment, si on a un code localité, c'est qu'on est en France
2362
			final String paysStr = pays.isEmpty() ? "FR" : pays;
2337
			final String paysStr = pays.isEmpty() ? "FR" : pays;
2363
			final String cleCache = numeroNom.trim()+paysStr.trim()+codeLocalite.trim();
2338
			final String cleCache = numeroNom.trim()+paysStr.trim()+codeLocalite.trim();
2364
 
2339
 
2365
			// Pour éviter de vérifier et d'afficher plus d'une fois l'avertissement de présence
2340
			// Pour éviter de vérifier et d'afficher plus d'une fois l'avertissement de présence
2366
			if(!avertissementPresence.containsKey(numeroNom.trim()+paysStr.trim()+codeLocalite.trim())) {
2341
			if(!avertissementPresence.containsKey(numeroNom.trim()+paysStr.trim()+codeLocalite.trim())) {
2367
				// Pour l'instant c'est toujours France mais il serait bon un jour d'avoir une chorologie multi pays.
2342
				// Pour l'instant c'est toujours France mais il serait bon un jour d'avoir une chorologie multi pays.
2368
				// donc ça ne coute rien de le gérer déjà ici dans l'interface
2343
				// donc ça ne coute rien de le gérer déjà ici dans l'interface
2369
				ImageInformationRepartitionAsynchroneDAO.taxonEstPresentDansZoneGeo(referentielTaxo, numeroNom, paysStr, codeLocalite, new Callback<String, String>() {			
2344
				ImageInformationRepartitionAsynchroneDAO.taxonEstPresentDansZoneGeo(referentielTaxo, numeroNom, paysStr, codeLocalite, new Callback<String, String>() {			
2370
					@Override
2345
					@Override
2371
					public void onSuccess(String result) {
2346
					public void onSuccess(String result) {
2372
						
2347
						
2373
						// En cas d'absence d'infos sur la zone le service retourne "" (chaîne vide)
2348
						// En cas d'absence d'infos sur la zone le service retourne "" (chaîne vide)
2374
						// En cas de non signalement dans la zone, il retourne 0, 
2349
						// En cas de non signalement dans la zone, il retourne 0, 
2375
						// En cas de présence, il retourne 1 
2350
						// En cas de présence, il retourne 1 
2376
						if(result.equals("0")) {
2351
						if(result.equals("0")) {
2377
							// L'absence explicite est le seul cas qui nous interesse
2352
							// L'absence explicite est le seul cas qui nous interesse
2378
							String[] stParams = {espece.getText(), codeLocalite, Configuration.getChorologieAvertissementCourriel()};
2353
							String[] stParams = {espece.getText(), codeLocalite, Configuration.getChorologieAvertissementCourriel()};
2379
							String message = Msg.get("indication-premiere-presence", stParams);
2354
							String message = Msg.get("indication-premiere-presence", stParams);
2380
							
2355
							
2381
							Window.alert(message);
2356
							Window.alert(message);
2382
						}
2357
						}
2383
 
2358
 
2384
						avertissementPresence.put(cleCache, result);
2359
						avertissementPresence.put(cleCache, result);
2385
						enRequeteChrologie = false;
2360
						enRequeteChrologie = false;
2386
					}
2361
					}
2387
					
2362
					
2388
					@Override
2363
					@Override
2389
					public void onFailure(String reason) {
2364
					public void onFailure(String reason) {
2390
						enRequeteChrologie = false;
2365
						enRequeteChrologie = false;
2391
					}
2366
					}
2392
				});
2367
				});
2393
			} else {
2368
			} else {
2394
				enRequeteChrologie = false;
2369
				enRequeteChrologie = false;
2395
			}
2370
			}
2396
		}
2371
		}
2397
	}
2372
	}
2398
}
2373
}