Subversion Repositories eFlore/Applications.cel

Rev

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

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