195 |
david |
1 |
package org.tela_botanica.client.vues.observation;
|
12 |
david |
2 |
|
|
|
3 |
|
46 |
david |
4 |
import java.util.Iterator;
|
|
|
5 |
|
655 |
aurelien |
6 |
import org.tela_botanica.client.Util;
|
46 |
david |
7 |
import org.tela_botanica.client.modeles.ListeObservation;
|
|
|
8 |
import org.tela_botanica.client.modeles.Observation;
|
12 |
david |
9 |
import org.tela_botanica.client.observation.ObservationMediateur;
|
195 |
david |
10 |
import org.tela_botanica.client.vues.BarrePaginationVue;
|
59 |
david |
11 |
import org.tela_botanica.client.interfaces.ListePaginable;
|
12 |
david |
12 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
|
|
13 |
import org.tela_botanica.client.interfaces.VueListable;
|
133 |
aurelien |
14 |
|
337 |
aurelien |
15 |
import com.google.gwt.core.client.GWT;
|
301 |
david |
16 |
import com.google.gwt.user.client.Window;
|
128 |
aurelien |
17 |
import com.gwtext.client.core.EventCallback;
|
41 |
jpm |
18 |
import com.gwtext.client.core.EventObject;
|
12 |
david |
19 |
import com.gwtext.client.core.Ext;
|
|
|
20 |
import com.gwtext.client.core.ExtElement;
|
46 |
david |
21 |
import com.gwtext.client.data.ArrayReader;
|
12 |
david |
22 |
import com.gwtext.client.data.FieldDef;
|
238 |
aurelien |
23 |
import com.gwtext.client.data.IntegerFieldDef;
|
46 |
david |
24 |
import com.gwtext.client.data.MemoryProxy;
|
12 |
david |
25 |
import com.gwtext.client.data.Record;
|
|
|
26 |
import com.gwtext.client.data.RecordDef;
|
|
|
27 |
import com.gwtext.client.data.Store;
|
|
|
28 |
import com.gwtext.client.data.StringFieldDef;
|
318 |
aurelien |
29 |
import com.gwtext.client.dd.DragData;
|
337 |
aurelien |
30 |
import com.gwtext.client.dd.DragDropConfig;
|
318 |
aurelien |
31 |
import com.gwtext.client.dd.DragSource;
|
|
|
32 |
import com.gwtext.client.dd.DropTarget;
|
|
|
33 |
import com.gwtext.client.dd.DropTargetConfig;
|
128 |
aurelien |
34 |
import com.gwtext.client.widgets.Button;
|
12 |
david |
35 |
import com.gwtext.client.widgets.Component;
|
275 |
aurelien |
36 |
import com.gwtext.client.widgets.Panel;
|
101 |
jpm |
37 |
import com.gwtext.client.widgets.Tool;
|
128 |
aurelien |
38 |
import com.gwtext.client.widgets.Toolbar;
|
|
|
39 |
import com.gwtext.client.widgets.ToolbarButton;
|
|
|
40 |
import com.gwtext.client.widgets.ToolbarTextItem;
|
|
|
41 |
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
|
|
|
42 |
import com.gwtext.client.widgets.event.PanelListenerAdapter;
|
41 |
jpm |
43 |
import com.gwtext.client.widgets.grid.CellMetadata;
|
12 |
david |
44 |
import com.gwtext.client.widgets.grid.ColumnConfig;
|
|
|
45 |
import com.gwtext.client.widgets.grid.ColumnModel;
|
318 |
aurelien |
46 |
import com.gwtext.client.widgets.grid.GridDragData;
|
12 |
david |
47 |
import com.gwtext.client.widgets.grid.GridPanel;
|
41 |
jpm |
48 |
import com.gwtext.client.widgets.grid.Renderer;
|
133 |
aurelien |
49 |
import com.gwtext.client.widgets.grid.event.GridListenerAdapter;
|
337 |
aurelien |
50 |
import com.gwtext.client.widgets.grid.event.GridRowListener;
|
41 |
jpm |
51 |
import com.gwtext.client.widgets.grid.event.GridRowListenerAdapter;
|
337 |
aurelien |
52 |
import com.gwtext.client.widgets.tree.TreeDragData;
|
|
|
53 |
import com.gwtext.client.widgets.tree.TreeNode;
|
12 |
david |
54 |
|
|
|
55 |
/**
|
|
|
56 |
* Liste d'observation composée de ligne d'observation
|
|
|
57 |
* l'interface rafraichissable et l'interface vueListable
|
|
|
58 |
*
|
|
|
59 |
* @author David Delon 2008
|
|
|
60 |
*/
|
|
|
61 |
public class ListeObservationVue extends GridPanel implements Rafraichissable,
|
59 |
david |
62 |
VueListable, ListePaginable {
|
12 |
david |
63 |
|
|
|
64 |
/**
|
|
|
65 |
* Le médiateur associé à la vue
|
|
|
66 |
*/
|
|
|
67 |
private ObservationMediateur observationMediateur = null;
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
/**
|
|
|
71 |
* Config de colonne
|
|
|
72 |
*/
|
|
|
73 |
private ColumnConfig etatObservation;
|
|
|
74 |
/**
|
|
|
75 |
* Config de colonne
|
|
|
76 |
*/
|
|
|
77 |
private ColumnConfig nomSaisiObservation;
|
|
|
78 |
/**
|
|
|
79 |
* Config de colonne
|
|
|
80 |
*/
|
|
|
81 |
private ColumnConfig nomRetenuObservation;
|
|
|
82 |
/**
|
|
|
83 |
* Config de colonne
|
|
|
84 |
*/
|
|
|
85 |
private ColumnConfig lieuObservation;
|
|
|
86 |
/**
|
|
|
87 |
* Config de colonne
|
|
|
88 |
*/
|
|
|
89 |
private ColumnConfig dateObservation;
|
|
|
90 |
/**
|
|
|
91 |
* Config de colonne
|
|
|
92 |
*/
|
|
|
93 |
private ColumnConfig ordreObservation;
|
|
|
94 |
/**
|
|
|
95 |
* Modele de colonnes
|
|
|
96 |
*/
|
|
|
97 |
private ColumnModel modeleColonnes;
|
|
|
98 |
|
82 |
david |
99 |
|
12 |
david |
100 |
/**
|
|
|
101 |
* Store qui contient les données à afficher
|
|
|
102 |
*/
|
|
|
103 |
private Store st = null;
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
/**
|
|
|
107 |
* Barre de pagination
|
|
|
108 |
*/
|
59 |
david |
109 |
private BarrePaginationVue bt = null ;
|
12 |
david |
110 |
|
|
|
111 |
/**
|
46 |
david |
112 |
* Numéro de page en cours
|
|
|
113 |
*/
|
|
|
114 |
private int pageEncours = 0 ;
|
|
|
115 |
/**
|
|
|
116 |
* Nombre de pages totales
|
|
|
117 |
*/
|
|
|
118 |
private int pageMax = 1 ;
|
|
|
119 |
/**
|
|
|
120 |
* Taille de page (par défaut 20)
|
|
|
121 |
*/
|
|
|
122 |
private int taillePage = 20 ;
|
|
|
123 |
/**
|
|
|
124 |
* Nombre d'éléments total correspondant à la requete
|
|
|
125 |
*/
|
|
|
126 |
private int nbElements = 0 ;
|
|
|
127 |
|
82 |
david |
128 |
private ListeObservation cacheListeObservation = null;
|
46 |
david |
129 |
|
101 |
jpm |
130 |
private Tool exporterObservations = null ;
|
|
|
131 |
|
133 |
aurelien |
132 |
private final int KEY_ENTER = 13;
|
|
|
133 |
|
206 |
aurelien |
134 |
private String modeleLieu = "IDLOCCOMMUNE, LIEUDIT, STATION";
|
250 |
aurelien |
135 |
|
|
|
136 |
|
|
|
137 |
private boolean tailleInitialisee = false ;
|
206 |
aurelien |
138 |
|
46 |
david |
139 |
/**
|
12 |
david |
140 |
* Constructeur sans arguments (privé car ne doit pas être utilisé)
|
|
|
141 |
*/
|
59 |
david |
142 |
@SuppressWarnings("unused")
|
12 |
david |
143 |
private ListeObservationVue()
|
|
|
144 |
{
|
|
|
145 |
super() ;
|
|
|
146 |
}
|
|
|
147 |
|
|
|
148 |
/**
|
|
|
149 |
* Constructeur avec argument
|
|
|
150 |
* @param im le médiateur à associer
|
|
|
151 |
*/
|
|
|
152 |
public ListeObservationVue(ObservationMediateur obs) {
|
|
|
153 |
|
|
|
154 |
this.observationMediateur = obs;
|
|
|
155 |
|
318 |
aurelien |
156 |
setId("x-list-obs");
|
|
|
157 |
|
12 |
david |
158 |
setHeader(true);
|
53 |
david |
159 |
|
12 |
david |
160 |
|
|
|
161 |
// on place la barre de pagination
|
59 |
david |
162 |
bt = new BarrePaginationVue(this);
|
|
|
163 |
bt.setLabelElement("Observations");
|
|
|
164 |
bt.setTaillePageParDefaut(20);
|
128 |
aurelien |
165 |
bt.setIntervallesPages(new String[] {"400","200", "100" , "50" , "20", "10"}) ;
|
94 |
jpm |
166 |
|
128 |
aurelien |
167 |
Toolbar barreActions = new Toolbar();
|
146 |
aurelien |
168 |
ToolbarButton publier = new ToolbarButton("Rendre publiques");
|
|
|
169 |
publier.addListener(new ButtonListenerAdapter() {
|
128 |
aurelien |
170 |
public void onClick(Button b, EventObject e) {
|
146 |
aurelien |
171 |
observationMediateur.transmettreObservations(true);
|
128 |
aurelien |
172 |
}
|
|
|
173 |
});
|
146 |
aurelien |
174 |
|
|
|
175 |
ToolbarButton privatiser = new ToolbarButton("Rendre privées");
|
|
|
176 |
privatiser.addListener(new ButtonListenerAdapter() {
|
|
|
177 |
public void onClick(Button b, EventObject e) {
|
|
|
178 |
observationMediateur.transmettreObservations(false);
|
|
|
179 |
}
|
|
|
180 |
});
|
|
|
181 |
|
128 |
aurelien |
182 |
ToolbarButton supprimer = new ToolbarButton("Supprimer");
|
|
|
183 |
supprimer.addListener(new ButtonListenerAdapter() {
|
|
|
184 |
public void onClick(Button b, EventObject e) {
|
|
|
185 |
observationMediateur.supprimerObservations();
|
|
|
186 |
}
|
|
|
187 |
});
|
|
|
188 |
|
437 |
aurelien |
189 |
ToolbarButton importer = new ToolbarButton("Importer");
|
|
|
190 |
importer.addListener(new ButtonListenerAdapter() {
|
|
|
191 |
public void onClick(Button b, EventObject e) {
|
|
|
192 |
observationMediateur.afficherFormulaireImportObservation();
|
|
|
193 |
}
|
|
|
194 |
});
|
|
|
195 |
|
128 |
aurelien |
196 |
ToolbarTextItem exporter = new ToolbarTextItem("<a href=\"#\" id=\"lienExport\"> Exporter </a>");
|
|
|
197 |
|
146 |
aurelien |
198 |
barreActions.addButton(publier);
|
|
|
199 |
barreActions.addButton(privatiser);
|
128 |
aurelien |
200 |
barreActions.addSpacer();
|
|
|
201 |
barreActions.addButton(supprimer);
|
|
|
202 |
barreActions.addSpacer();
|
437 |
aurelien |
203 |
barreActions.addButton(importer);
|
|
|
204 |
barreActions.addSpacer();
|
128 |
aurelien |
205 |
barreActions.addItem(exporter);
|
|
|
206 |
|
140 |
aurelien |
207 |
this.setTopToolbar(barreActions) ;
|
|
|
208 |
this.setBottomToolbar(bt);
|
128 |
aurelien |
209 |
|
129 |
aurelien |
210 |
this.setCollapsible(true);
|
|
|
211 |
this.setTitleCollapse(true);
|
101 |
jpm |
212 |
|
94 |
jpm |
213 |
this.setTitle("Observations") ;
|
12 |
david |
214 |
|
|
|
215 |
// on construit le modèle de colonnes
|
|
|
216 |
|
|
|
217 |
// Le store suivant est ensuite remplacé par le store contenant les données obtenus depuis le serveur (cf rafraichir)
|
|
|
218 |
|
41 |
jpm |
219 |
Renderer colRend = new Renderer() {
|
|
|
220 |
|
|
|
221 |
public String render(Object value, CellMetadata cellMetadata,
|
|
|
222 |
Record record, int rowIndex, int colNum, Store store) {
|
|
|
223 |
|
|
|
224 |
if(value == null || value.equals("null") || value.equals("000null") || value.equals("0000-00-00 00:00:00")) {
|
|
|
225 |
|
|
|
226 |
return "" ;
|
|
|
227 |
}
|
|
|
228 |
else
|
|
|
229 |
{
|
|
|
230 |
|
|
|
231 |
}
|
|
|
232 |
|
|
|
233 |
return value.toString() ;
|
|
|
234 |
}
|
|
|
235 |
|
|
|
236 |
} ;
|
12 |
david |
237 |
|
133 |
aurelien |
238 |
Renderer dateRend = new Renderer() {
|
|
|
239 |
|
|
|
240 |
public String render(Object value, CellMetadata cellMetadata,
|
|
|
241 |
Record record, int rowIndex, int colNum, Store store) {
|
|
|
242 |
|
|
|
243 |
if(value == null || value.equals("null") || value.equals("000null") || value.equals("0000-00-00 00:00:00")) {
|
|
|
244 |
|
|
|
245 |
return "" ;
|
|
|
246 |
}
|
|
|
247 |
else
|
|
|
248 |
{
|
|
|
249 |
String dateEntiere = value.toString() ;
|
|
|
250 |
String[] dateEtHeure = dateEntiere.split(" ", 2);
|
|
|
251 |
if(verifierFormatDate(dateEtHeure[0])) {
|
|
|
252 |
String[] dateFormateeTab = dateEtHeure[0].split("-",3);
|
|
|
253 |
return dateFormateeTab[2]+"/"+dateFormateeTab[1]+"/"+dateFormateeTab[0] ;
|
|
|
254 |
}
|
|
|
255 |
}
|
|
|
256 |
|
|
|
257 |
return value.toString() ;
|
|
|
258 |
}
|
|
|
259 |
|
|
|
260 |
} ;
|
|
|
261 |
|
128 |
aurelien |
262 |
etatObservation = new ColumnConfig("Transmis", "etat_observation", 20, true, new Renderer() {
|
41 |
jpm |
263 |
|
|
|
264 |
public String render(Object value, CellMetadata cellMetadata,
|
|
|
265 |
Record record, int rowIndex, int colNum, Store store) {
|
|
|
266 |
if(value.equals("1"))
|
|
|
267 |
{
|
128 |
aurelien |
268 |
return "<img src=\"tela.png\"/></img>" ;
|
41 |
jpm |
269 |
}
|
|
|
270 |
else
|
|
|
271 |
{
|
|
|
272 |
return "" ;
|
|
|
273 |
}
|
|
|
274 |
}
|
|
|
275 |
|
|
|
276 |
});
|
|
|
277 |
nomSaisiObservation = new ColumnConfig("Nom saisi", "nomSaisi_observation", 200, true, colRend);
|
|
|
278 |
nomRetenuObservation = new ColumnConfig("Nom retenu", "nomRetenu_observation", 200, true, colRend);
|
|
|
279 |
lieuObservation = new ColumnConfig("Lieu", "lieu_observation", 200, true, colRend);
|
133 |
aurelien |
280 |
dateObservation = new ColumnConfig("Date", "date_observation", 120, true, dateRend);
|
41 |
jpm |
281 |
ordreObservation = new ColumnConfig("Ordre", "ordre_observation", 50, true, colRend);
|
42 |
jpm |
282 |
|
12 |
david |
283 |
|
|
|
284 |
// on associe le modèle de colonnes
|
|
|
285 |
|
|
|
286 |
ColumnConfig[] cm = {etatObservation, nomSaisiObservation, nomRetenuObservation, lieuObservation, dateObservation, ordreObservation};
|
|
|
287 |
|
|
|
288 |
modeleColonnes = new ColumnModel(cm);
|
|
|
289 |
|
|
|
290 |
this.setColumnModel(modeleColonnes);
|
|
|
291 |
|
|
|
292 |
this.setAutoScroll(true);
|
|
|
293 |
this.setEnableColumnResize(true);
|
|
|
294 |
|
|
|
295 |
// creation du store
|
52 |
david |
296 |
|
12 |
david |
297 |
FieldDef defEtatObservation = new StringFieldDef("etat_observation");
|
|
|
298 |
FieldDef defNomSaisiObservation = new StringFieldDef("nomSaisi_observation");
|
|
|
299 |
FieldDef defNomRetenuObservation = new StringFieldDef("nomRetenu_observation");
|
|
|
300 |
FieldDef defLieuObservation = new StringFieldDef("lieu_observation");
|
|
|
301 |
FieldDef defDateObservation = new StringFieldDef("date_observation");
|
238 |
aurelien |
302 |
FieldDef defOrdreObservation = new IntegerFieldDef("ordre_observation");
|
12 |
david |
303 |
|
|
|
304 |
|
|
|
305 |
FieldDef[] defTab = { defEtatObservation, defNomSaisiObservation, defNomRetenuObservation,
|
|
|
306 |
defLieuObservation, defDateObservation, defOrdreObservation };
|
|
|
307 |
|
|
|
308 |
RecordDef rd = new RecordDef(defTab);
|
|
|
309 |
st = new Store(rd);
|
|
|
310 |
|
|
|
311 |
// on associe le store
|
|
|
312 |
|
|
|
313 |
this.setStore(st);
|
|
|
314 |
this.getView().setAutoFill(true);
|
42 |
jpm |
315 |
this.getView().setForceFit(true) ;
|
337 |
aurelien |
316 |
|
12 |
david |
317 |
// on crée un masque de chargement qui s'affichera lors des mises à jour
|
|
|
318 |
this.setLoadMask("Chargement");
|
|
|
319 |
|
|
|
320 |
// on ajoute les listeners
|
|
|
321 |
ajouterListeners();
|
|
|
322 |
|
318 |
aurelien |
323 |
configDragAndDrop();
|
|
|
324 |
|
12 |
david |
325 |
}
|
|
|
326 |
|
|
|
327 |
|
|
|
328 |
/**
|
|
|
329 |
* Ajoute les listeners pour la gestion des évènements
|
|
|
330 |
*/
|
|
|
331 |
private void ajouterListeners() {
|
41 |
jpm |
332 |
|
|
|
333 |
this.addGridRowListener(new GridRowListenerAdapter() {
|
12 |
david |
334 |
|
|
|
335 |
// gestion du clic sur une ligne
|
41 |
jpm |
336 |
public void onRowClick(GridPanel grid, int rowIndex,
|
|
|
337 |
EventObject e) {
|
216 |
aurelien |
338 |
// on notifie le médiateur et on lui passe le numéro de ligne
|
301 |
david |
339 |
|
|
|
340 |
|
|
|
341 |
Record rd = st.getAt(rowIndex);
|
|
|
342 |
|
71 |
jpm |
343 |
String ordreObservation = rd.getAsString("ordre_observation") ;
|
301 |
david |
344 |
|
82 |
david |
345 |
observationMediateur.onClicListeObservation(rowIndex,ordreObservation);
|
41 |
jpm |
346 |
|
12 |
david |
347 |
}
|
41 |
jpm |
348 |
|
12 |
david |
349 |
// gestion du clic droit
|
|
|
350 |
public void onRowContextMenu(GridPanel grid, int rowIndex,
|
|
|
351 |
EventObject e) {
|
|
|
352 |
// on stoppe l'évenement pour empecher le navigateur d'afficher son propre menu
|
|
|
353 |
e.stopEvent() ;
|
|
|
354 |
// on notifie le médiateur en lui passant l'évenement
|
54 |
david |
355 |
observationMediateur.montrerContextMenu(e);
|
12 |
david |
356 |
}
|
|
|
357 |
|
|
|
358 |
// gestion du double clic
|
|
|
359 |
public void onRowDblClick(GridPanel grid, int rowIndex,
|
|
|
360 |
EventObject e) {
|
|
|
361 |
// on notifie le médiateur en lui passant le numéro de ligne
|
54 |
david |
362 |
observationMediateur.doubleClicListeObservation(rowIndex);
|
12 |
david |
363 |
}
|
41 |
jpm |
364 |
|
12 |
david |
365 |
});
|
|
|
366 |
|
133 |
aurelien |
367 |
this.addGridListener(new GridListenerAdapter() {
|
|
|
368 |
public void onKeyPress(EventObject e) {
|
|
|
369 |
if(e.getKey() == KEY_ENTER) {
|
|
|
370 |
Record rd = getSelectionModel().getSelected();
|
|
|
371 |
int rowIndex = st.indexOf(rd);
|
|
|
372 |
String ordreObservation = rd.getAsString("ordre_observation") ;
|
|
|
373 |
observationMediateur.onClicListeObservation(rowIndex, ordreObservation);
|
|
|
374 |
}
|
|
|
375 |
}
|
|
|
376 |
});
|
|
|
377 |
|
128 |
aurelien |
378 |
this.addListener(new PanelListenerAdapter() {
|
|
|
379 |
public void onRender(Component c) {
|
|
|
380 |
|
|
|
381 |
ExtElement lienExport = Ext.get("lienExport") ;
|
|
|
382 |
lienExport.addListener("click", new EventCallback() {
|
12 |
david |
383 |
|
128 |
aurelien |
384 |
public void execute(EventObject e) {
|
|
|
385 |
|
|
|
386 |
observationMediateur.exporterObservations();
|
|
|
387 |
}
|
|
|
388 |
|
|
|
389 |
});
|
12 |
david |
390 |
}
|
128 |
aurelien |
391 |
});
|
275 |
aurelien |
392 |
|
|
|
393 |
this.addListener(new PanelListenerAdapter() {
|
|
|
394 |
public void onBodyResize(Panel panel, java.lang.String width, java.lang.String height) {
|
318 |
aurelien |
395 |
doLayout();
|
275 |
aurelien |
396 |
}
|
|
|
397 |
});
|
12 |
david |
398 |
}
|
318 |
aurelien |
399 |
|
|
|
400 |
/**
|
|
|
401 |
* Configure le drag 'n drop pour la liste
|
|
|
402 |
*/
|
|
|
403 |
private void configDragAndDrop()
|
|
|
404 |
{
|
12 |
david |
405 |
|
337 |
aurelien |
406 |
setDdGroup("ObsMotsClesGroup");
|
|
|
407 |
setEnableDragDrop(true);
|
|
|
408 |
setDragDropText("Glissez les observations sélectionnées sur un projet pour les lier");
|
318 |
aurelien |
409 |
// on fabrique la nouvelle configuration
|
|
|
410 |
// les éléments sur lesquels on fait du drag 'n drop doivent tous avoir le même ddGroup
|
|
|
411 |
DropTargetConfig dtc = new DropTargetConfig();
|
|
|
412 |
dtc.setdDdGroup("ObsMotsClesGroup");
|
337 |
aurelien |
413 |
dtc.setTarget(true);
|
|
|
414 |
|
|
|
415 |
DragDropConfig ddc = new DragDropConfig();
|
318 |
aurelien |
416 |
|
|
|
417 |
//La drop target permet de gérer l'évenement onDrop sur l'élement courant
|
|
|
418 |
@SuppressWarnings("unused")
|
|
|
419 |
DropTarget tg = new DropTarget(this, dtc)
|
|
|
420 |
{
|
|
|
421 |
public boolean notifyDrop(DragSource source, EventObject e, DragData data){
|
|
|
422 |
|
337 |
aurelien |
423 |
// si on reçoit des données provenant d'un arbre
|
|
|
424 |
// on les convertit
|
|
|
425 |
if(data instanceof TreeDragData) {
|
|
|
426 |
TreeDragData tdd = (TreeDragData)data ;
|
|
|
427 |
|
|
|
428 |
TreeNode treeNode = tdd.getTreeNode();
|
|
|
429 |
String idMc = treeNode.getId();
|
|
|
430 |
|
|
|
431 |
int index = getView().findRowIndex(e);
|
351 |
aurelien |
432 |
if(index < 0) {
|
|
|
433 |
return true;
|
|
|
434 |
}
|
|
|
435 |
|
337 |
aurelien |
436 |
Record obsRd = getStore().getRecordAt(index);
|
351 |
aurelien |
437 |
if(obsRd == null) {
|
|
|
438 |
return true;
|
|
|
439 |
}
|
337 |
aurelien |
440 |
|
|
|
441 |
String ordreObs = obsRd.getAsString("ordre_observation");
|
|
|
442 |
|
|
|
443 |
if(ordreObs != null) {
|
|
|
444 |
observationMediateur.gererDDMotCleSurObs(ordreObs, idMc);
|
|
|
445 |
return true ;
|
|
|
446 |
} else {
|
|
|
447 |
return true;
|
|
|
448 |
}
|
|
|
449 |
}
|
|
|
450 |
return true;
|
318 |
aurelien |
451 |
}
|
|
|
452 |
|
|
|
453 |
public String notifyOver(DragSource source, EventObject e, DragData data){
|
337 |
aurelien |
454 |
|
|
|
455 |
if(data instanceof TreeDragData) {
|
|
|
456 |
TreeDragData tdd = (TreeDragData)data ;
|
|
|
457 |
|
|
|
458 |
TreeNode treeNode = tdd.getTreeNode();
|
|
|
459 |
String idMc = treeNode.getId();
|
|
|
460 |
|
|
|
461 |
int index = getView().findRowIndex(e);
|
|
|
462 |
if(index < 0) {
|
|
|
463 |
return "x-dd-drop-nodrop";
|
|
|
464 |
}
|
|
|
465 |
|
|
|
466 |
Record obsRd = getStore().getRecordAt(index);
|
|
|
467 |
|
351 |
aurelien |
468 |
if(obsRd == null) {
|
|
|
469 |
return "x-dd-drop-nodrop";
|
|
|
470 |
}
|
|
|
471 |
|
337 |
aurelien |
472 |
String ordreObs = obsRd.getAsString("ordre_observation");
|
|
|
473 |
|
|
|
474 |
if(ordreObs != null) {
|
|
|
475 |
return observationMediateur.gererOverDDMotCleSurObs(ordreObs, idMc);
|
|
|
476 |
}
|
|
|
477 |
}
|
|
|
478 |
|
|
|
479 |
return "x-dd-drop-nodrop";
|
318 |
aurelien |
480 |
}
|
|
|
481 |
};
|
|
|
482 |
}
|
|
|
483 |
|
12 |
david |
484 |
/**
|
|
|
485 |
* Méthode héritée de l'interface VueListable
|
|
|
486 |
* Sélectionne les observations dans la liste suivant les identifiants donnés en paramètres
|
|
|
487 |
*/
|
|
|
488 |
|
|
|
489 |
public String[] getIdSelectionnees() {
|
|
|
490 |
|
|
|
491 |
Record[] selection = this.getSelectionModel().getSelections();
|
|
|
492 |
int taille = selection.length;
|
|
|
493 |
String id_selection[] = new String[taille];
|
|
|
494 |
|
|
|
495 |
for (int i = 0; i < selection.length; i++) {
|
|
|
496 |
|
|
|
497 |
id_selection[i] = selection[i].getAsString("ordre_observation");
|
|
|
498 |
}
|
|
|
499 |
|
|
|
500 |
return id_selection;
|
|
|
501 |
}
|
|
|
502 |
|
|
|
503 |
|
|
|
504 |
|
|
|
505 |
/**
|
|
|
506 |
* Sélectionne des enregistrements donné
|
|
|
507 |
* @param sel un tableau d'enregistrement à selectionner
|
|
|
508 |
*/
|
|
|
509 |
public void selectionnerEnregistrements(Record[] sel) {
|
|
|
510 |
|
|
|
511 |
getSelectionModel().clearSelections();
|
|
|
512 |
getSelectionModel().selectRecords(sel);
|
|
|
513 |
|
|
|
514 |
}
|
|
|
515 |
|
|
|
516 |
/**
|
|
|
517 |
* Accesseur pour la toolbar de pagination
|
|
|
518 |
* @return la toolbar de pagination
|
|
|
519 |
*/
|
|
|
520 |
|
59 |
david |
521 |
public BarrePaginationVue getToolBarVue()
|
12 |
david |
522 |
{
|
|
|
523 |
return bt ;
|
|
|
524 |
}
|
|
|
525 |
|
|
|
526 |
|
|
|
527 |
/**
|
|
|
528 |
* Recherche l'élement actuellement affiché et affiche son message de chargement
|
|
|
529 |
*/
|
|
|
530 |
public void masquerChargement()
|
|
|
531 |
{
|
|
|
532 |
ExtElement masked = Ext.get(getId()) ;
|
|
|
533 |
|
52 |
david |
534 |
|
12 |
david |
535 |
if (masked!=null) {
|
|
|
536 |
masked.mask("Chargement") ;
|
|
|
537 |
}
|
|
|
538 |
|
|
|
539 |
}
|
|
|
540 |
|
|
|
541 |
/**
|
|
|
542 |
* Recherche l'élement actuellement affiché et retire son message de chargement si l'était affiché
|
|
|
543 |
*/
|
|
|
544 |
public void demasquerChargement()
|
|
|
545 |
{
|
155 |
aurelien |
546 |
ExtElement masked = Ext.get(getId()) ;
|
|
|
547 |
|
|
|
548 |
if (masked!=null) {
|
323 |
aurelien |
549 |
masked.unmask() ;
|
155 |
aurelien |
550 |
}
|
12 |
david |
551 |
}
|
|
|
552 |
|
|
|
553 |
|
54 |
david |
554 |
|
46 |
david |
555 |
/**
|
|
|
556 |
* Méthode héritée de l'interface rafraichissable
|
|
|
557 |
* @param nouvelleDonnees les nouvelles données
|
|
|
558 |
* @param repandreRafraichissement le booleen de notification du rafraichissement
|
|
|
559 |
*/
|
|
|
560 |
|
12 |
david |
561 |
|
46 |
david |
562 |
|
|
|
563 |
public void rafraichir(Object nouvelleDonnees, boolean repandreRafraichissement) {
|
|
|
564 |
|
|
|
565 |
// si l'on a reçu une liste d'observation
|
|
|
566 |
if(nouvelleDonnees instanceof ListeObservation)
|
|
|
567 |
{
|
|
|
568 |
|
|
|
569 |
ListeObservation data = (ListeObservation) nouvelleDonnees ;
|
54 |
david |
570 |
Object[][] observationData = new Object[data.size()][7];
|
46 |
david |
571 |
int i = 0 ;
|
|
|
572 |
|
|
|
573 |
if(data.size() == 0)
|
|
|
574 |
{
|
|
|
575 |
pageEncours = 0 ;
|
|
|
576 |
}
|
|
|
577 |
|
54 |
david |
578 |
// on la parse et on récupère les informations qui nous interessent
|
46 |
david |
579 |
for (Iterator it = data.keySet().iterator(); it.hasNext();)
|
|
|
580 |
{
|
|
|
581 |
|
|
|
582 |
Observation obs=(Observation) data.get(it.next());
|
|
|
583 |
|
206 |
aurelien |
584 |
observationData[i][0] = obs.getTransmis();
|
|
|
585 |
observationData[i][1] = obs.getNomSaisi();
|
|
|
586 |
observationData[i][2] = obs.getNomRetenu();
|
|
|
587 |
|
655 |
aurelien |
588 |
observationData[i][3] = Util.formaterLieu(obs, modeleLieu);
|
206 |
aurelien |
589 |
observationData[i][4] = obs.getDate();
|
|
|
590 |
observationData[i][5] = obs.getNumeroOrdre();
|
|
|
591 |
observationData[i][6] = obs.getNumeroNomenclaturalSaisi();
|
46 |
david |
592 |
|
|
|
593 |
i++ ;
|
|
|
594 |
}
|
|
|
595 |
|
|
|
596 |
// creation du store qui les contient
|
|
|
597 |
FieldDef defEtatObservation = new StringFieldDef("etat_observation");
|
|
|
598 |
FieldDef defNomSaisiObservation = new StringFieldDef("nomSaisi_observation");
|
|
|
599 |
FieldDef defNomRetenuObservation = new StringFieldDef("nomRetenu_observation");
|
|
|
600 |
FieldDef defLieuObservation = new StringFieldDef("lieu_observation");
|
|
|
601 |
FieldDef defDateObservation = new StringFieldDef("date_observation");
|
238 |
aurelien |
602 |
FieldDef defOrdreObservation = new IntegerFieldDef("ordre_observation");
|
46 |
david |
603 |
|
54 |
david |
604 |
// Non affiches :
|
|
|
605 |
FieldDef defNumeroNomenclaturalSaisiObservation = new StringFieldDef("numeroNomenclaturalSaisi_observation");
|
|
|
606 |
|
|
|
607 |
|
46 |
david |
608 |
// on associe le store
|
|
|
609 |
|
|
|
610 |
FieldDef[] defTab = { defEtatObservation, defNomSaisiObservation, defNomRetenuObservation,
|
54 |
david |
611 |
defLieuObservation, defDateObservation, defOrdreObservation, defNumeroNomenclaturalSaisiObservation };
|
46 |
david |
612 |
|
|
|
613 |
RecordDef rd = new RecordDef(defTab);
|
|
|
614 |
|
|
|
615 |
final MemoryProxy dataProxy = new MemoryProxy(observationData);
|
|
|
616 |
final ArrayReader reader = new ArrayReader(rd);
|
|
|
617 |
|
|
|
618 |
final Store observationStore = new Store(dataProxy, reader);
|
|
|
619 |
|
|
|
620 |
|
|
|
621 |
st = observationStore ;
|
|
|
622 |
st.load() ;
|
|
|
623 |
|
|
|
624 |
|
|
|
625 |
// et on reconfigure et rafraichit la vue
|
|
|
626 |
this.reconfigure(st, this.getColumnModel());
|
|
|
627 |
|
|
|
628 |
demasquerChargement();
|
|
|
629 |
|
82 |
david |
630 |
cacheListeObservation=data;
|
|
|
631 |
|
|
|
632 |
observationMediateur.onRafraichissementListeObservations();
|
46 |
david |
633 |
|
82 |
david |
634 |
|
46 |
david |
635 |
}
|
|
|
636 |
|
|
|
637 |
|
|
|
638 |
// Si on reçoit un tableau d'entiers
|
|
|
639 |
// c'est un tableau d'un seul entier qui est le nombre d'observation correspondant aux critères
|
|
|
640 |
if(nouvelleDonnees instanceof int[])
|
|
|
641 |
{
|
|
|
642 |
int[] pages = (int[])nouvelleDonnees ;
|
|
|
643 |
|
|
|
644 |
// on calcule le nombre de pages nécessaires et on les met à jour dans le modèle
|
|
|
645 |
pageMax = calculerNbPages(pages[0]) ;
|
|
|
646 |
nbElements = pages[0] ;
|
|
|
647 |
|
52 |
david |
648 |
|
46 |
david |
649 |
// et on notifie de le mediateur du changement des valeurs
|
51 |
david |
650 |
changerPageMaxEtCourante(pageMax,pageEncours,taillePage,pages[0]) ;
|
46 |
david |
651 |
|
54 |
david |
652 |
masquerChargement();
|
82 |
david |
653 |
observationMediateur.obtenirListeObservation(this);
|
46 |
david |
654 |
}
|
|
|
655 |
|
|
|
656 |
|
655 |
aurelien |
657 |
// si l'on a reçu une Observation
|
46 |
david |
658 |
if(nouvelleDonnees instanceof Observation) {
|
79 |
david |
659 |
|
|
|
660 |
Observation obs= (Observation) nouvelleDonnees;
|
655 |
aurelien |
661 |
if (obs.getNumeroOrdre()==null) {
|
|
|
662 |
|
|
|
663 |
// Nouvelle observation
|
|
|
664 |
// On affiche la dernière page
|
|
|
665 |
pageEncours = pageMax ;
|
|
|
666 |
masquerChargement();
|
|
|
667 |
|
|
|
668 |
observationMediateur.obtenirNombreObservation();
|
52 |
david |
669 |
|
79 |
david |
670 |
}
|
|
|
671 |
else { // Modification d'une observation
|
|
|
672 |
|
82 |
david |
673 |
|
|
|
674 |
masquerChargement();
|
|
|
675 |
|
94 |
jpm |
676 |
observationMediateur.obtenirNombreObservation();
|
82 |
david |
677 |
|
79 |
david |
678 |
}
|
107 |
aurelien |
679 |
}
|
74 |
david |
680 |
|
107 |
aurelien |
681 |
// Si on a effectué une suppression
|
|
|
682 |
if(nouvelleDonnees instanceof String)
|
|
|
683 |
{
|
|
|
684 |
String str = (String)nouvelleDonnees ;
|
|
|
685 |
observationMediateur.obtenirNombreObservation() ;
|
|
|
686 |
}
|
|
|
687 |
|
361 |
aurelien |
688 |
if(!getTailleInitialisee()) {
|
|
|
689 |
if((int)Math.round(observationMediateur.getPanneauPrincipalObservation().getHeight() * 0.6) != 0) {
|
|
|
690 |
doLayout();
|
|
|
691 |
setTailleInitialisee();
|
|
|
692 |
}
|
|
|
693 |
}
|
|
|
694 |
|
46 |
david |
695 |
}
|
51 |
david |
696 |
|
|
|
697 |
|
|
|
698 |
// GESTION DE LA PAGINATION
|
46 |
david |
699 |
|
|
|
700 |
|
82 |
david |
701 |
public ListeObservation getCacheListeObservation() {
|
|
|
702 |
return cacheListeObservation;
|
|
|
703 |
}
|
|
|
704 |
|
46 |
david |
705 |
/**
|
|
|
706 |
* Calcule le nombre de pages nécessaires pour afficher un nombre d'élements donnés en fonction de la taille de page
|
|
|
707 |
* en cours
|
|
|
708 |
* @param nbElements le nombre d'élements total
|
|
|
709 |
* @return le nombre de pages
|
|
|
710 |
*/
|
|
|
711 |
public int calculerNbPages(int nbElements)
|
|
|
712 |
{
|
|
|
713 |
// A cause de la betise de java pour les conversion implicite on fait quelques conversions manuellement
|
|
|
714 |
// pour eviter qu'il arrondisse mal la division
|
|
|
715 |
// nombre de pages = (nombre d'element / taille de la page) arrondie à l'entier superieur
|
|
|
716 |
|
|
|
717 |
double nPage = (1.0*nbElements)/(1.0*taillePage) ;
|
|
|
718 |
double nPageRound = Math.ceil(nPage) ;
|
|
|
719 |
Double nPageInt = new Double(nPageRound) ;
|
|
|
720 |
|
|
|
721 |
// on convertit en entier
|
|
|
722 |
return nPageInt.intValue() ;
|
|
|
723 |
}
|
|
|
724 |
|
|
|
725 |
|
|
|
726 |
/**
|
|
|
727 |
* Recalcule la page en cours lors du changement du nombre d'élements
|
|
|
728 |
* @param nbElements le nombre d'élements total
|
|
|
729 |
* @return la nouvelle page encours
|
|
|
730 |
*/
|
|
|
731 |
public int calculerPageCourante(int nbElements)
|
|
|
732 |
{
|
|
|
733 |
// on calcule le nombre de page
|
|
|
734 |
int nouvelNbPages = calculerNbPages(nbElements) ;
|
|
|
735 |
// la nouvelle page en cours
|
|
|
736 |
double nPageCourante = (1.0*pageEncours)/(1.0*pageMax) * (1.0*nouvelNbPages) ;
|
|
|
737 |
|
|
|
738 |
// on arrondit au supérieur
|
|
|
739 |
double nPageRound = Math.ceil(nPageCourante) ;
|
|
|
740 |
Double nPageInt = new Double(nPageRound) ;
|
|
|
741 |
|
|
|
742 |
// on convertit en entier
|
|
|
743 |
return Math.abs(nPageInt.intValue()) ;
|
|
|
744 |
}
|
|
|
745 |
|
|
|
746 |
|
|
|
747 |
/**
|
|
|
748 |
* Appelle le modèle pour lui demander les données d'une page à afficher
|
|
|
749 |
* @param pageCourante le numéro de page à affciher
|
|
|
750 |
*/
|
|
|
751 |
public void changerNumeroPage(int pageCourante) {
|
|
|
752 |
|
|
|
753 |
|
|
|
754 |
|
|
|
755 |
pageEncours = pageCourante ;
|
|
|
756 |
|
54 |
david |
757 |
masquerChargement();
|
|
|
758 |
|
46 |
david |
759 |
// On lance le chargerment des observations
|
|
|
760 |
observationMediateur.obtenirNombreObservation();
|
|
|
761 |
|
|
|
762 |
getToolBarVue().changerPageCourante(pageCourante);
|
|
|
763 |
|
|
|
764 |
}
|
|
|
765 |
|
|
|
766 |
|
|
|
767 |
/**
|
|
|
768 |
* Appelle le modèle pour qu'il change la taille de page utilisée
|
|
|
769 |
* @param nouvelleTaillePage la nouvelle taille de page
|
|
|
770 |
*/
|
|
|
771 |
|
|
|
772 |
public void changerTaillePage(int nouvelleTaillePage)
|
|
|
773 |
{
|
|
|
774 |
|
|
|
775 |
taillePage = nouvelleTaillePage ;
|
|
|
776 |
pageEncours = calculerPageCourante(nbElements) ;
|
|
|
777 |
|
54 |
david |
778 |
masquerChargement();
|
|
|
779 |
|
61 |
jpm |
780 |
// On lance le chargement des observations
|
46 |
david |
781 |
observationMediateur.obtenirNombreObservation();
|
|
|
782 |
|
|
|
783 |
|
|
|
784 |
// et on met à jour la taille de page dans les barres d'outils
|
|
|
785 |
getToolBarVue().selectionnerTaillePage(nouvelleTaillePage);
|
|
|
786 |
|
|
|
787 |
|
|
|
788 |
}
|
|
|
789 |
|
|
|
790 |
|
51 |
david |
791 |
/**
|
|
|
792 |
* Met à jour les barre d'outils avec des nouvelles valeurs
|
|
|
793 |
* @param pageMax le nombre de pages
|
|
|
794 |
* @param pageEncours la page en cours
|
|
|
795 |
* @param taillePage la taille de page
|
|
|
796 |
* @param nbElement le nombre d'élements par page
|
|
|
797 |
*/
|
|
|
798 |
public void changerPageMaxEtCourante(int pageMax, int pageEncours, int taillePage, int nbElement)
|
|
|
799 |
{
|
|
|
800 |
|
|
|
801 |
int[] pages = {pageMax,pageEncours, taillePage, nbElement} ;
|
|
|
802 |
getToolBarVue().rafraichir(pages, false) ;
|
|
|
803 |
|
|
|
804 |
}
|
46 |
david |
805 |
|
61 |
jpm |
806 |
/**
|
|
|
807 |
* Renvoie la taille de page en cours d'utilisation
|
|
|
808 |
* @return la taille de page
|
|
|
809 |
*/
|
46 |
david |
810 |
public int getTaillePage() {
|
|
|
811 |
|
|
|
812 |
return taillePage;
|
|
|
813 |
}
|
61 |
jpm |
814 |
|
|
|
815 |
/**
|
|
|
816 |
* Renvoie le numéro de la page encours (attention on commence à 0)
|
|
|
817 |
* @return le numéro de la page en cours
|
|
|
818 |
*/
|
46 |
david |
819 |
public int getPageEncours() {
|
|
|
820 |
|
|
|
821 |
return pageEncours;
|
|
|
822 |
}
|
|
|
823 |
|
682 |
aurelien |
824 |
public void afficherFiltres(String[][] filtresEnCours) {
|
94 |
jpm |
825 |
|
682 |
aurelien |
826 |
String texteFiltresEnCours = "";
|
94 |
jpm |
827 |
|
682 |
aurelien |
828 |
for(int i = 0; i < filtresEnCours.length; i++) {
|
|
|
829 |
if(Util.filtreValide(filtresEnCours[i])) {
|
|
|
830 |
|
|
|
831 |
if(!texteFiltresEnCours.equals("")) {
|
|
|
832 |
texteFiltresEnCours += " - ";
|
|
|
833 |
}
|
|
|
834 |
|
|
|
835 |
texteFiltresEnCours += "<span class=\"affichage_filtre\">"+
|
|
|
836 |
transformerNomFiltre(filtresEnCours[i][0])+": "+transformerValeurFiltre(filtresEnCours[i][0], filtresEnCours[i][1])+
|
|
|
837 |
" <input value=\"X\" type=\"button\" rel=\""+filtresEnCours[i][0]+"\" id=\"bouton_raz_filtres_obs"+filtresEnCours[i][0]+"\" />"+
|
|
|
838 |
"</span>";
|
|
|
839 |
}
|
|
|
840 |
}
|
655 |
aurelien |
841 |
|
682 |
aurelien |
842 |
if(!texteFiltresEnCours.equals("")) {
|
|
|
843 |
texteFiltresEnCours = "- <span class=\"indicateur_filtres\"> Filtres - "+texteFiltresEnCours+"</span>";
|
|
|
844 |
}
|
655 |
aurelien |
845 |
|
682 |
aurelien |
846 |
this.setTitle("Observations"+texteFiltresEnCours) ;
|
655 |
aurelien |
847 |
|
682 |
aurelien |
848 |
for(int i = 0; i < filtresEnCours.length; i++) {
|
94 |
jpm |
849 |
|
682 |
aurelien |
850 |
if(Util.filtreValide(filtresEnCours[i])) {
|
|
|
851 |
if(Ext.get("bouton_raz_filtres_obs"+filtresEnCours[i][0]) != null) {
|
|
|
852 |
|
|
|
853 |
Ext.get("bouton_raz_filtres_obs"+filtresEnCours[i][0]).addListener("click", new EventCallback() {
|
|
|
854 |
|
|
|
855 |
public void execute(EventObject e) {
|
|
|
856 |
e.stopEvent();
|
|
|
857 |
observationMediateur.viderFiltre(e.getTarget().getAttribute("rel"));
|
|
|
858 |
}
|
|
|
859 |
|
|
|
860 |
});
|
|
|
861 |
}
|
|
|
862 |
}
|
94 |
jpm |
863 |
}
|
682 |
aurelien |
864 |
}
|
|
|
865 |
|
|
|
866 |
private String transformerNomFiltre(String nomFiltre) {
|
|
|
867 |
|
|
|
868 |
if(nomFiltre.equals("id_location")) {
|
|
|
869 |
nomFiltre = "departement";
|
94 |
jpm |
870 |
}
|
|
|
871 |
|
682 |
aurelien |
872 |
if(nomFiltre.equals("location")) {
|
|
|
873 |
nomFiltre = "commune";
|
250 |
aurelien |
874 |
}
|
|
|
875 |
|
682 |
aurelien |
876 |
if(nomFiltre.equals("nom_taxon")) {
|
|
|
877 |
nomFiltre = "recherche";
|
|
|
878 |
}
|
655 |
aurelien |
879 |
|
682 |
aurelien |
880 |
if(nomFiltre.equals("mots_cles")) {
|
|
|
881 |
nomFiltre = "projets";
|
655 |
aurelien |
882 |
}
|
|
|
883 |
|
682 |
aurelien |
884 |
return nomFiltre;
|
|
|
885 |
|
94 |
jpm |
886 |
}
|
682 |
aurelien |
887 |
|
|
|
888 |
private String transformerValeurFiltre(String nomFiltre, String valeurFiltre) {
|
|
|
889 |
|
|
|
890 |
String valeurFiltreTransformee = valeurFiltre;
|
|
|
891 |
|
|
|
892 |
if(nomFiltre.equals("mots_cles")) {
|
|
|
893 |
|
|
|
894 |
String[] tabMotsCles = valeurFiltre.split(";");
|
|
|
895 |
String[] tabMotsClesTexte = observationMediateur.obtenirTexteMotsCles(tabMotsCles);
|
|
|
896 |
|
|
|
897 |
if(tabMotsClesTexte.length > 1) {
|
|
|
898 |
valeurFiltreTransformee = Util.implode(",", tabMotsClesTexte);
|
|
|
899 |
} else {
|
|
|
900 |
valeurFiltreTransformee = tabMotsClesTexte[0];
|
|
|
901 |
}
|
|
|
902 |
}
|
|
|
903 |
|
|
|
904 |
if(nomFiltre.equals("mois")) {
|
|
|
905 |
valeurFiltreTransformee = Util.renvoyerMois(Integer.parseInt(valeurFiltre));
|
|
|
906 |
}
|
|
|
907 |
|
|
|
908 |
valeurFiltreTransformee = valeurFiltreTransformee.replaceAll("000null", "inconnue");
|
46 |
david |
909 |
|
682 |
aurelien |
910 |
return valeurFiltreTransformee;
|
|
|
911 |
|
|
|
912 |
}
|
|
|
913 |
|
104 |
jpm |
914 |
public void raz() {
|
|
|
915 |
|
|
|
916 |
|
|
|
917 |
// creation du store qui les contient
|
|
|
918 |
|
|
|
919 |
FieldDef defEtatObservation = new StringFieldDef("etat_observation");
|
|
|
920 |
FieldDef defNomSaisiObservation = new StringFieldDef("nomSaisi_observation");
|
|
|
921 |
FieldDef defNomRetenuObservation = new StringFieldDef("nomRetenu_observation");
|
|
|
922 |
FieldDef defLieuObservation = new StringFieldDef("lieu_observation");
|
|
|
923 |
FieldDef defDateObservation = new StringFieldDef("date_observation");
|
238 |
aurelien |
924 |
FieldDef defOrdreObservation = new IntegerFieldDef("ordre_observation");
|
104 |
jpm |
925 |
|
|
|
926 |
// Non affiches :
|
|
|
927 |
FieldDef defNumeroNomenclaturalSaisiObservation = new StringFieldDef("numeroNomenclaturalSaisi_observation");
|
|
|
928 |
|
|
|
929 |
FieldDef[] defTab = { defEtatObservation, defNomSaisiObservation, defNomRetenuObservation,
|
|
|
930 |
defLieuObservation, defDateObservation, defOrdreObservation };
|
|
|
931 |
|
|
|
932 |
RecordDef rd = new RecordDef(defTab);
|
|
|
933 |
st = new Store(rd);
|
|
|
934 |
|
|
|
935 |
// on associe le store
|
|
|
936 |
|
|
|
937 |
this.setStore(st);
|
|
|
938 |
|
|
|
939 |
}
|
133 |
aurelien |
940 |
|
|
|
941 |
public boolean verifierFormatDate(String date) {
|
|
|
942 |
|
|
|
943 |
String regex = "[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}" ;
|
|
|
944 |
if(date.matches(regex) && !date.equals("0000-00-00")) {
|
|
|
945 |
return true ;
|
|
|
946 |
}
|
|
|
947 |
else {
|
|
|
948 |
return false;
|
|
|
949 |
}
|
|
|
950 |
}
|
206 |
aurelien |
951 |
|
250 |
aurelien |
952 |
public boolean getTailleInitialisee() {
|
|
|
953 |
return tailleInitialisee ;
|
|
|
954 |
}
|
|
|
955 |
|
|
|
956 |
public void setTailleInitialisee() {
|
|
|
957 |
tailleInitialisee = true;
|
|
|
958 |
}
|
206 |
aurelien |
959 |
|
12 |
david |
960 |
}
|