Subversion Repositories eFlore/Applications.cel

Rev

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

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