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