Subversion Repositories eFlore/Applications.cel

Rev

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

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