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