Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 129 Rev 133
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
2
 
2
 
3
 
3
 
4
import java.util.Iterator;
4
import java.util.Iterator;
5
 
5
 
6
import org.tela_botanica.client.modeles.ListeObservation;
6
import org.tela_botanica.client.modeles.ListeObservation;
7
import org.tela_botanica.client.modeles.Observation;
7
import org.tela_botanica.client.modeles.Observation;
8
import org.tela_botanica.client.observation.ObservationMediateur;
8
import org.tela_botanica.client.observation.ObservationMediateur;
9
import org.tela_botanica.client.interfaces.ListePaginable;
9
import org.tela_botanica.client.interfaces.ListePaginable;
10
import org.tela_botanica.client.interfaces.Rafraichissable;
10
import org.tela_botanica.client.interfaces.Rafraichissable;
11
import org.tela_botanica.client.interfaces.VueListable;
11
import org.tela_botanica.client.interfaces.VueListable;
-
 
12
 
-
 
13
import com.google.gwt.user.client.Event;
-
 
14
import com.google.gwt.user.client.Window;
12
import com.gwtext.client.core.EventCallback;
15
import com.gwtext.client.core.EventCallback;
13
import com.gwtext.client.core.EventObject;
16
import com.gwtext.client.core.EventObject;
14
import com.gwtext.client.core.Ext;
17
import com.gwtext.client.core.Ext;
15
import com.gwtext.client.core.ExtElement;
18
import com.gwtext.client.core.ExtElement;
16
import com.gwtext.client.core.Function;
19
import com.gwtext.client.core.Function;
17
import com.gwtext.client.data.ArrayReader;
20
import com.gwtext.client.data.ArrayReader;
18
import com.gwtext.client.data.FieldDef;
21
import com.gwtext.client.data.FieldDef;
19
import com.gwtext.client.data.MemoryProxy;
22
import com.gwtext.client.data.MemoryProxy;
20
import com.gwtext.client.data.Record;
23
import com.gwtext.client.data.Record;
21
import com.gwtext.client.data.RecordDef;
24
import com.gwtext.client.data.RecordDef;
22
import com.gwtext.client.data.Store;
25
import com.gwtext.client.data.Store;
23
import com.gwtext.client.data.StringFieldDef;
26
import com.gwtext.client.data.StringFieldDef;
24
import com.gwtext.client.widgets.Button;
27
import com.gwtext.client.widgets.Button;
25
import com.gwtext.client.widgets.Component;
28
import com.gwtext.client.widgets.Component;
26
import com.gwtext.client.widgets.Tool;
29
import com.gwtext.client.widgets.Tool;
27
import com.gwtext.client.widgets.Toolbar;
30
import com.gwtext.client.widgets.Toolbar;
28
import com.gwtext.client.widgets.ToolbarButton;
31
import com.gwtext.client.widgets.ToolbarButton;
29
import com.gwtext.client.widgets.ToolbarTextItem;
32
import com.gwtext.client.widgets.ToolbarTextItem;
30
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
33
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
31
import com.gwtext.client.widgets.event.PanelListenerAdapter;
34
import com.gwtext.client.widgets.event.PanelListenerAdapter;
32
import com.gwtext.client.widgets.grid.CellMetadata;
35
import com.gwtext.client.widgets.grid.CellMetadata;
33
import com.gwtext.client.widgets.grid.ColumnConfig;
36
import com.gwtext.client.widgets.grid.ColumnConfig;
34
import com.gwtext.client.widgets.grid.ColumnModel;
37
import com.gwtext.client.widgets.grid.ColumnModel;
35
import com.gwtext.client.widgets.grid.GridPanel;
38
import com.gwtext.client.widgets.grid.GridPanel;
36
import com.gwtext.client.widgets.grid.Renderer;
39
import com.gwtext.client.widgets.grid.Renderer;
-
 
40
import com.gwtext.client.widgets.grid.event.GridListener;
-
 
41
import com.gwtext.client.widgets.grid.event.GridListenerAdapter;
37
import com.gwtext.client.widgets.grid.event.GridRowListenerAdapter;
42
import com.gwtext.client.widgets.grid.event.GridRowListenerAdapter;
38
 
43
 
39
/**
44
/**
40
 * Liste d'observation composée de ligne d'observation
45
 * Liste d'observation composée de ligne d'observation
41
 * l'interface rafraichissable et l'interface vueListable
46
 * l'interface rafraichissable et l'interface vueListable
42
 * 
47
 * 
43
 * @author David Delon 2008
48
 * @author David Delon 2008
44
 */
49
 */
45
public class ListeObservationVue extends GridPanel implements Rafraichissable,
50
public class ListeObservationVue extends GridPanel implements Rafraichissable,
46
		VueListable, ListePaginable {
51
		VueListable, ListePaginable {
47
 
52
 
48
	/**
53
	/**
49
	 * Le médiateur associé à la vue
54
	 * Le médiateur associé à la vue
50
	 */
55
	 */
51
	private ObservationMediateur	observationMediateur		= null;
56
	private ObservationMediateur	observationMediateur		= null;
52
 
57
 
53
 
58
 
54
	/**
59
	/**
55
	 * Config de colonne
60
	 * Config de colonne
56
	 */
61
	 */
57
	private ColumnConfig	etatObservation;
62
	private ColumnConfig	etatObservation;
58
	/**
63
	/**
59
	 * Config de colonne
64
	 * Config de colonne
60
	 */
65
	 */
61
	private ColumnConfig	nomSaisiObservation;
66
	private ColumnConfig	nomSaisiObservation;
62
	/**
67
	/**
63
	 * Config de colonne
68
	 * Config de colonne
64
	 */
69
	 */
65
	private ColumnConfig	nomRetenuObservation;
70
	private ColumnConfig	nomRetenuObservation;
66
	/**
71
	/**
67
	 * Config de colonne
72
	 * Config de colonne
68
	 */
73
	 */
69
	private ColumnConfig	lieuObservation;
74
	private ColumnConfig	lieuObservation;
70
	/**
75
	/**
71
	 * Config de colonne
76
	 * Config de colonne
72
	 */
77
	 */
73
	private ColumnConfig	dateObservation;
78
	private ColumnConfig	dateObservation;
74
	/**
79
	/**
75
	 * Config de colonne
80
	 * Config de colonne
76
	 */
81
	 */
77
	private ColumnConfig	ordreObservation;
82
	private ColumnConfig	ordreObservation;
78
	/**
83
	/**
79
	 * Modele de colonnes
84
	 * Modele de colonnes
80
	 */
85
	 */
81
	private ColumnModel		modeleColonnes;
86
	private ColumnModel		modeleColonnes;
82
 
87
 
83
	
88
	
84
	/**
89
	/**
85
	 * Store qui contient les données à afficher
90
	 * Store qui contient les données à afficher
86
	 */
91
	 */
87
	private Store			st				= null;
92
	private Store			st				= null;
88
	
93
	
89
	
94
	
90
	/**
95
	/**
91
	 * Barre de pagination
96
	 * Barre de pagination
92
	 */
97
	 */
93
	private BarrePaginationVue bt = null ;
98
	private BarrePaginationVue bt = null ;
94
 
99
 
95
	/**
100
	/**
96
	 * Numéro de page en cours
101
	 * Numéro de page en cours
97
	 */
102
	 */
98
	private int pageEncours = 0 ;
103
	private int pageEncours = 0 ;
99
	/**
104
	/**
100
	 * Nombre de pages totales
105
	 * Nombre de pages totales
101
	 */
106
	 */
102
	private int pageMax = 1 ;
107
	private int pageMax = 1 ;
103
	/**
108
	/**
104
	 * Taille de page (par défaut 20)
109
	 * Taille de page (par défaut 20)
105
	 */
110
	 */
106
	private int taillePage = 20 ;
111
	private int taillePage = 20 ;
107
	/**
112
	/**
108
	 * Nombre d'éléments total correspondant à la requete
113
	 * Nombre d'éléments total correspondant à la requete
109
	 */
114
	 */
110
	private int nbElements = 0 ;
115
	private int nbElements = 0 ;
111
	
116
	
112
	private ListeObservation cacheListeObservation = null;
117
	private ListeObservation cacheListeObservation = null;
113
	
118
	
114
	private Tool exporterObservations = null ;
119
	private Tool exporterObservations = null ;
-
 
120
	
-
 
121
	private final int KEY_ENTER = 13;
115
	
122
	
116
	/**
123
	/**
117
	 * Constructeur sans arguments (privé car ne doit pas être utilisé)
124
	 * Constructeur sans arguments (privé car ne doit pas être utilisé)
118
	 */
125
	 */
119
	@SuppressWarnings("unused")
126
	@SuppressWarnings("unused")
120
	private ListeObservationVue()
127
	private ListeObservationVue()
121
	{
128
	{
122
		super() ;
129
		super() ;
123
	}
130
	}
124
	
131
	
125
	/**
132
	/**
126
	 * Constructeur avec argument
133
	 * Constructeur avec argument
127
	 * @param im le médiateur à associer
134
	 * @param im le médiateur à associer
128
	 */
135
	 */
129
	public ListeObservationVue(ObservationMediateur obs) {		
136
	public ListeObservationVue(ObservationMediateur obs) {		
130
		
137
		
131
		this.observationMediateur = obs;
138
		this.observationMediateur = obs;
132
		
139
		
133
		setHeader(true);
140
		setHeader(true);
134
		
141
		
135
        
142
        
136
		// on place la barre de pagination
143
		// on place la barre de pagination
137
		bt = new BarrePaginationVue(this);		
144
		bt = new BarrePaginationVue(this);		
138
		bt.setLabelElement("Observations");
145
		bt.setLabelElement("Observations");
139
		bt.setTaillePageParDefaut(20);
146
		bt.setTaillePageParDefaut(20);
140
		bt.setIntervallesPages(new String[] {"400","200",  "100" , "50" , "20", "10"}) ;
147
		bt.setIntervallesPages(new String[] {"400","200",  "100" , "50" , "20", "10"}) ;
141
		this.setTopToolbar(bt) ;
148
		this.setTopToolbar(bt) ;
142
		
149
		
143
		Toolbar barreActions = new Toolbar();
150
		Toolbar barreActions = new Toolbar();
144
		ToolbarButton transmettre = new ToolbarButton("Transmettre");
151
		ToolbarButton transmettre = new ToolbarButton("Transmettre");
145
		transmettre.addListener(new ButtonListenerAdapter() {
152
		transmettre.addListener(new ButtonListenerAdapter() {
146
			public void onClick(Button b, EventObject e) {
153
			public void onClick(Button b, EventObject e) {
147
				observationMediateur.transmettreObservations();
154
				observationMediateur.transmettreObservations();
148
			}
155
			}
149
		});
156
		});
150
		ToolbarButton supprimer = new ToolbarButton("Supprimer");
157
		ToolbarButton supprimer = new ToolbarButton("Supprimer");
151
		supprimer.addListener(new ButtonListenerAdapter() {
158
		supprimer.addListener(new ButtonListenerAdapter() {
152
			public void onClick(Button b, EventObject e) {
159
			public void onClick(Button b, EventObject e) {
153
				observationMediateur.supprimerObservations();
160
				observationMediateur.supprimerObservations();
154
			}
161
			}
155
		});
162
		});
156
		
163
		
157
 
164
 
158
		ToolbarTextItem exporter = new ToolbarTextItem("<a href=\"#\" id=\"lienExport\"> Exporter </a>");
165
		ToolbarTextItem exporter = new ToolbarTextItem("<a href=\"#\" id=\"lienExport\"> Exporter </a>");
159
		
166
		
160
		barreActions.addButton(transmettre);
167
		barreActions.addButton(transmettre);
161
		barreActions.addSpacer();
168
		barreActions.addSpacer();
162
		barreActions.addButton(supprimer);
169
		barreActions.addButton(supprimer);
163
		barreActions.addSpacer();
170
		barreActions.addSpacer();
164
		barreActions.addItem(exporter);
171
		barreActions.addItem(exporter);
165
		
172
		
166
		
173
		
167
		this.setBottomToolbar(barreActions);
174
		this.setBottomToolbar(barreActions);
168
		
175
		
169
		this.setCollapsible(true);
176
		this.setCollapsible(true);
170
		this.setTitleCollapse(true);
177
		this.setTitleCollapse(true);
171
		
178
		
172
		/*exporterObservations = new Tool(Tool.PIN, new Function() {
179
		/*exporterObservations = new Tool(Tool.PIN, new Function() {
173
 
180
 
174
			public void execute() {
181
			public void execute() {
175
				observationMediateur.exporterObservations() ;				
182
				observationMediateur.exporterObservations() ;				
176
			}
183
			}
177
			
184
			
178
		}, "Exporter des observations") ;
185
		}, "Exporter des observations") ;
179
		
186
		
180
		this.addTool(exporterObservations) ;
187
		this.addTool(exporterObservations) ;
181
		*/
188
		*/
182
		this.setTitle("Observations") ;
189
		this.setTitle("Observations") ;
183
 
190
 
184
		// on construit le modèle de colonnes
191
		// on construit le modèle de colonnes
185
 
192
 
186
		// Le store suivant est ensuite remplacé par le store contenant les données obtenus depuis le serveur (cf rafraichir) 
193
		// Le store suivant est ensuite remplacé par le store contenant les données obtenus depuis le serveur (cf rafraichir) 
187
				
194
				
188
		Renderer colRend = new Renderer() {
195
		Renderer colRend = new Renderer() {
189
 
196
 
190
			public String render(Object value, CellMetadata cellMetadata,
197
			public String render(Object value, CellMetadata cellMetadata,
191
					Record record, int rowIndex, int colNum, Store store) {
198
					Record record, int rowIndex, int colNum, Store store) {
192
				
199
				
193
				if(value == null || value.equals("null") || value.equals("000null") || value.equals("0000-00-00 00:00:00")) {
200
				if(value == null || value.equals("null") || value.equals("000null") || value.equals("0000-00-00 00:00:00")) {
194
				
201
				
195
					return "" ;
202
					return "" ;
196
				}	
203
				}	
197
				else
204
				else
198
				{
205
				{
199
					
206
					
200
				}
207
				}
201
				
208
				
202
				return value.toString() ;
209
				return value.toString() ;
203
			}
210
			}
204
			
211
			
205
		} ;
212
		} ;
-
 
213
		
-
 
214
		Renderer dateRend = new Renderer() {
-
 
215
 
-
 
216
			public String render(Object value, CellMetadata cellMetadata,
-
 
217
					Record record, int rowIndex, int colNum, Store store) {
-
 
218
				
-
 
219
				if(value == null || value.equals("null") || value.equals("000null") || value.equals("0000-00-00 00:00:00")) {
-
 
220
				
-
 
221
					return "" ;
-
 
222
				}	
-
 
223
				else
-
 
224
				{
-
 
225
					String dateEntiere = value.toString() ;
-
 
226
					String[] dateEtHeure = dateEntiere.split(" ", 2);
-
 
227
					if(verifierFormatDate(dateEtHeure[0])) {
-
 
228
						String[] dateFormateeTab = dateEtHeure[0].split("-",3);
-
 
229
						return dateFormateeTab[2]+"/"+dateFormateeTab[1]+"/"+dateFormateeTab[0] ;
-
 
230
					}
-
 
231
				}
-
 
232
				
-
 
233
				return value.toString() ;
-
 
234
			}
-
 
235
			
-
 
236
		} ;
206
		
237
		
207
		etatObservation = new ColumnConfig("Transmis", "etat_observation", 20, true, new Renderer() {
238
		etatObservation = new ColumnConfig("Transmis", "etat_observation", 20, true, new Renderer() {
208
 
239
 
209
			public String render(Object value, CellMetadata cellMetadata,
240
			public String render(Object value, CellMetadata cellMetadata,
210
					Record record, int rowIndex, int colNum, Store store) {
241
					Record record, int rowIndex, int colNum, Store store) {
211
				if(value.equals("1"))
242
				if(value.equals("1"))
212
				{
243
				{
213
					return "<img src=\"tela.png\"/></img>" ;
244
					return "<img src=\"tela.png\"/></img>" ;
214
				}
245
				}
215
				else
246
				else
216
				{
247
				{
217
					return "" ;
248
					return "" ;
218
				}
249
				}
219
			}
250
			}
220
			
251
			
221
		});		
252
		});		
222
		nomSaisiObservation = new ColumnConfig("Nom saisi", "nomSaisi_observation", 200, true, colRend);
253
		nomSaisiObservation = new ColumnConfig("Nom saisi", "nomSaisi_observation", 200, true, colRend);
223
		nomRetenuObservation = new ColumnConfig("Nom retenu", "nomRetenu_observation", 200, true, colRend);
254
		nomRetenuObservation = new ColumnConfig("Nom retenu", "nomRetenu_observation", 200, true, colRend);
224
		lieuObservation = new ColumnConfig("Lieu", "lieu_observation", 200, true, colRend);
255
		lieuObservation = new ColumnConfig("Lieu", "lieu_observation", 200, true, colRend);
225
		dateObservation = new ColumnConfig("Date", "date_observation", 120, true, colRend);
256
		dateObservation = new ColumnConfig("Date", "date_observation", 120, true, dateRend);
226
		ordreObservation = new ColumnConfig("Ordre", "ordre_observation", 50, true, colRend);
257
		ordreObservation = new ColumnConfig("Ordre", "ordre_observation", 50, true, colRend);
227
			
258
			
228
	
259
	
229
		// on associe le modèle de colonnes
260
		// on associe le modèle de colonnes
230
		
261
		
231
		ColumnConfig[] cm = {etatObservation, nomSaisiObservation, nomRetenuObservation, lieuObservation, dateObservation, ordreObservation};
262
		ColumnConfig[] cm = {etatObservation, nomSaisiObservation, nomRetenuObservation, lieuObservation, dateObservation, ordreObservation};
232
		
263
		
233
		modeleColonnes = new ColumnModel(cm);
264
		modeleColonnes = new ColumnModel(cm);
234
		
265
		
235
		this.setColumnModel(modeleColonnes);
266
		this.setColumnModel(modeleColonnes);
236
		
267
		
237
		this.setAutoScroll(true);
268
		this.setAutoScroll(true);
238
		this.setEnableColumnResize(true);
269
		this.setEnableColumnResize(true);
239
		
270
		
240
		//temp dd viewport desactive ajout de ces 2 lignes
271
		//temp dd viewport desactive ajout de ces 2 lignes
241
	//	this.setAutoWidth(true);
272
	//	this.setAutoWidth(true);
242
		// temp
273
		// temp
243
		
274
		
244
		// creation du store
275
		// creation du store
245
 
276
 
246
		FieldDef defEtatObservation = new StringFieldDef("etat_observation");
277
		FieldDef defEtatObservation = new StringFieldDef("etat_observation");
247
		FieldDef defNomSaisiObservation = new StringFieldDef("nomSaisi_observation");
278
		FieldDef defNomSaisiObservation = new StringFieldDef("nomSaisi_observation");
248
		FieldDef defNomRetenuObservation = new StringFieldDef("nomRetenu_observation");
279
		FieldDef defNomRetenuObservation = new StringFieldDef("nomRetenu_observation");
249
		FieldDef defLieuObservation = new StringFieldDef("lieu_observation");
280
		FieldDef defLieuObservation = new StringFieldDef("lieu_observation");
250
		FieldDef defDateObservation = new StringFieldDef("date_observation");
281
		FieldDef defDateObservation = new StringFieldDef("date_observation");
251
		FieldDef defOrdreObservation = new StringFieldDef("ordre_observation");
282
		FieldDef defOrdreObservation = new StringFieldDef("ordre_observation");
252
		
283
		
253
		
284
		
254
		FieldDef[] defTab = { defEtatObservation, defNomSaisiObservation, defNomRetenuObservation,
285
		FieldDef[] defTab = { defEtatObservation, defNomSaisiObservation, defNomRetenuObservation,
255
				defLieuObservation, defDateObservation, defOrdreObservation };
286
				defLieuObservation, defDateObservation, defOrdreObservation };
256
		
287
		
257
		RecordDef rd = new RecordDef(defTab);
288
		RecordDef rd = new RecordDef(defTab);
258
		st = new Store(rd);
289
		st = new Store(rd);
259
		
290
		
260
		// on associe le store
291
		// on associe le store
261
		
292
		
262
		this.setStore(st);
293
		this.setStore(st);
263
		this.getView().setAutoFill(true);
294
		this.getView().setAutoFill(true);
264
		this.getView().setForceFit(true) ;
295
		this.getView().setForceFit(true) ;
265
		
296
		
266
		// on crée un masque de chargement qui s'affichera lors des mises à jour
297
		// on crée un masque de chargement qui s'affichera lors des mises à jour
267
		this.setLoadMask("Chargement");
298
		this.setLoadMask("Chargement");
268
	
299
	
269
		// on ajoute les listeners
300
		// on ajoute les listeners
270
		ajouterListeners();
301
		ajouterListeners();
271
		
302
		
272
		
303
		
273
	}
304
	}
274
 
305
 
275
 
306
 
276
	/**
307
	/**
277
	 * Ajoute les listeners pour la gestion des évènements
308
	 * Ajoute les listeners pour la gestion des évènements
278
	 */
309
	 */
279
	private void ajouterListeners() {
310
	private void ajouterListeners() {
280
		
311
		
281
		this.addGridRowListener(new GridRowListenerAdapter() {
312
		this.addGridRowListener(new GridRowListenerAdapter() {
282
			
313
			
283
			// gestion du clic sur une ligne
314
			// gestion du clic sur une ligne
284
			public void onRowClick(GridPanel grid, int rowIndex,
315
			public void onRowClick(GridPanel grid, int rowIndex,
285
					EventObject e) {
316
					EventObject e) {
286
				// on notifie le médiateur et on lui passe le nuémro de ligne
317
				// on notifie le médiateur et on lui passe le nuémro de ligne
287
				Record rd = getSelectionModel().getSelected();
318
				Record rd = getSelectionModel().getSelected();
288
				String ordreObservation = rd.getAsString("ordre_observation") ;
319
				String ordreObservation = rd.getAsString("ordre_observation") ;
289
				observationMediateur.onClicListeObservation(rowIndex,ordreObservation);
320
				observationMediateur.onClicListeObservation(rowIndex,ordreObservation);
290
				
321
				
291
			}
322
			}
292
 
323
 
293
			// gestion du clic droit
324
			// gestion du clic droit
294
			public void onRowContextMenu(GridPanel grid, int rowIndex,
325
			public void onRowContextMenu(GridPanel grid, int rowIndex,
295
					EventObject e) {
326
					EventObject e) {
296
				// on stoppe l'évenement pour empecher le navigateur d'afficher son propre menu
327
				// on stoppe l'évenement pour empecher le navigateur d'afficher son propre menu
297
				e.stopEvent() ;
328
				e.stopEvent() ;
298
				// on notifie le médiateur en lui passant l'évenement
329
				// on notifie le médiateur en lui passant l'évenement
299
				observationMediateur.montrerContextMenu(e);
330
				observationMediateur.montrerContextMenu(e);
300
			}
331
			}
301
 
332
 
302
			// gestion du double clic
333
			// gestion du double clic
303
			public void onRowDblClick(GridPanel grid, int rowIndex,
334
			public void onRowDblClick(GridPanel grid, int rowIndex,
304
					EventObject e) {
335
					EventObject e) {
305
				// on notifie le médiateur en lui passant le numéro de ligne
336
				// on notifie le médiateur en lui passant le numéro de ligne
306
				observationMediateur.doubleClicListeObservation(rowIndex);
337
				observationMediateur.doubleClicListeObservation(rowIndex);
307
			}
338
			}
308
			
339
			
309
		});
340
		});
-
 
341
		
-
 
342
		this.addGridListener(new GridListenerAdapter() {
-
 
343
			public void onKeyPress(EventObject e) {
-
 
344
				if(e.getKey() == KEY_ENTER) {
-
 
345
					Record rd = getSelectionModel().getSelected();
-
 
346
					int rowIndex = st.indexOf(rd);
-
 
347
					String ordreObservation = rd.getAsString("ordre_observation") ;
-
 
348
					observationMediateur.onClicListeObservation(rowIndex, ordreObservation);
-
 
349
				}
-
 
350
			}
-
 
351
		});
310
		
352
		
311
		this.addListener(new PanelListenerAdapter() {
353
		this.addListener(new PanelListenerAdapter() {
312
			public void onRender(Component c) {
354
			public void onRender(Component c) {
313
				
355
				
314
				ExtElement lienExport = Ext.get("lienExport") ;
356
				ExtElement lienExport = Ext.get("lienExport") ;
315
				lienExport.addListener("click", new EventCallback() {
357
				lienExport.addListener("click", new EventCallback() {
316
 
358
 
317
					public void execute(EventObject e) {
359
					public void execute(EventObject e) {
318
						
360
						
319
						observationMediateur.exporterObservations();
361
						observationMediateur.exporterObservations();
320
					}
362
					}
321
					
363
					
322
				});
364
				});
323
			}
365
			}
324
		});
366
		});
325
	}
367
	}
326
 
368
 
327
	/**
369
	/**
328
	 * Méthode héritée de l'interface VueListable
370
	 * Méthode héritée de l'interface VueListable
329
	 * Sélectionne les observations  dans la liste suivant les identifiants donnés en paramètres
371
	 * Sélectionne les observations  dans la liste suivant les identifiants donnés en paramètres
330
	 */
372
	 */
331
	
373
	
332
	public String[] getIdSelectionnees() {
374
	public String[] getIdSelectionnees() {
333
		
375
		
334
		Record[] selection = this.getSelectionModel().getSelections();
376
		Record[] selection = this.getSelectionModel().getSelections();
335
		int taille = selection.length;
377
		int taille = selection.length;
336
		String id_selection[] = new String[taille];
378
		String id_selection[] = new String[taille];
337
 
379
 
338
		for (int i = 0; i < selection.length; i++) {
380
		for (int i = 0; i < selection.length; i++) {
339
 
381
 
340
			id_selection[i] = selection[i].getAsString("ordre_observation");
382
			id_selection[i] = selection[i].getAsString("ordre_observation");
341
		}
383
		}
342
 
384
 
343
		return id_selection;
385
		return id_selection;
344
	}
386
	}
345
	
387
	
346
 
388
 
347
	
389
	
348
	/**
390
	/**
349
	 * Sélectionne des enregistrements donné 
391
	 * Sélectionne des enregistrements donné 
350
	 * @param sel un tableau d'enregistrement à selectionner
392
	 * @param sel un tableau d'enregistrement à selectionner
351
	 */
393
	 */
352
	public void selectionnerEnregistrements(Record[] sel) {
394
	public void selectionnerEnregistrements(Record[] sel) {
353
 
395
 
354
			getSelectionModel().clearSelections();
396
			getSelectionModel().clearSelections();
355
			getSelectionModel().selectRecords(sel);
397
			getSelectionModel().selectRecords(sel);
356
		
398
		
357
	}
399
	}
358
	
400
	
359
	/**
401
	/**
360
	 * Accesseur pour la toolbar de pagination
402
	 * Accesseur pour la toolbar de pagination
361
	 * @return la toolbar de pagination
403
	 * @return la toolbar de pagination
362
	 */
404
	 */
363
	
405
	
364
	public BarrePaginationVue getToolBarVue()
406
	public BarrePaginationVue getToolBarVue()
365
	{
407
	{
366
		return bt ;
408
		return bt ;
367
	}
409
	}
368
 
410
 
369
 
411
 
370
	/**
412
	/**
371
	 * Recherche l'élement actuellement affiché et affiche son message de chargement
413
	 * Recherche l'élement actuellement affiché et affiche son message de chargement
372
	 */
414
	 */
373
	public void masquerChargement()
415
	public void masquerChargement()
374
	{
416
	{
375
			ExtElement masked = Ext.get(getId()) ;
417
			ExtElement masked = Ext.get(getId()) ;
376
 
418
 
377
 
419
 
378
			if (masked!=null) {
420
			if (masked!=null) {
379
				masked.mask("Chargement") ;
421
				masked.mask("Chargement") ;
380
			}
422
			}
381
 
423
 
382
	}
424
	}
383
	
425
	
384
	/**
426
	/**
385
	 * Recherche l'élement actuellement affiché et retire son message de chargement si l'était affiché
427
	 * Recherche l'élement actuellement affiché et retire son message de chargement si l'était affiché
386
	 */
428
	 */
387
	public void demasquerChargement()
429
	public void demasquerChargement()
388
	{
430
	{
389
			ExtElement masked = Ext.get(getId()) ;
431
			ExtElement masked = Ext.get(getId()) ;
390
			
432
			
391
 
433
 
392
			if (masked!=null) {
434
			if (masked!=null) {
393
				
435
				
394
				if(masked.isMasked())
436
				if(masked.isMasked())
395
				{
437
				{
396
					masked.unmask() ;
438
					masked.unmask() ;
397
				}
439
				}
398
			}
440
			}
399
	}
441
	}
400
	
442
	
401
 
443
 
402
 
444
 
403
	/**
445
	/**
404
	 * Méthode héritée de l'interface rafraichissable
446
	 * Méthode héritée de l'interface rafraichissable
405
	 * @param nouvelleDonnees les nouvelles données
447
	 * @param nouvelleDonnees les nouvelles données
406
	 * @param repandreRafraichissement le booleen de notification du rafraichissement
448
	 * @param repandreRafraichissement le booleen de notification du rafraichissement
407
	 */
449
	 */
408
	
450
	
409
 
451
 
410
 
452
 
411
	public void rafraichir(Object nouvelleDonnees, boolean repandreRafraichissement) {
453
	public void rafraichir(Object nouvelleDonnees, boolean repandreRafraichissement) {
412
	
454
	
413
	
455
	
414
	
456
	
415
		
457
		
416
//		 si l'on a reçu une liste d'observation
458
//		 si l'on a reçu une liste d'observation
417
		if(nouvelleDonnees instanceof ListeObservation)
459
		if(nouvelleDonnees instanceof ListeObservation)
418
		{
460
		{
419
			
461
			
420
				ListeObservation data = (ListeObservation) nouvelleDonnees ;
462
				ListeObservation data = (ListeObservation) nouvelleDonnees ;
421
				Object[][] observationData = new Object[data.size()][7];
463
				Object[][] observationData = new Object[data.size()][7];
422
				int i = 0 ;
464
				int i = 0 ;
423
				
465
				
424
				if(data.size() == 0)
466
				if(data.size() == 0)
425
				{
467
				{
426
					pageEncours = 0 ;
468
					pageEncours = 0 ;
427
				}
469
				}
428
				
470
				
429
				// on la parse et on récupère les informations qui nous interessent
471
				// on la parse et on récupère les informations qui nous interessent
430
				for (Iterator it = data.keySet().iterator(); it.hasNext();) 
472
				for (Iterator it = data.keySet().iterator(); it.hasNext();) 
431
				{
473
				{
432
					
474
					
433
					Observation obs=(Observation) data.get(it.next());
475
					Observation obs=(Observation) data.get(it.next());
434
					
476
					
435
					observationData[i][0]= obs.getTransmis();
477
					observationData[i][0]= obs.getTransmis();
436
					observationData[i][1]= obs.getNomSaisi();
478
					observationData[i][1]= obs.getNomSaisi();
437
					observationData[i][2]= obs.getNomRetenu();
479
					observationData[i][2]= obs.getNomRetenu();
438
					observationData[i][3]= obs.getLieudit();
480
					observationData[i][3]= obs.getLieudit();
439
					observationData[i][4]= obs.getDate();
481
					observationData[i][4]= obs.getDate();
440
					observationData[i][5]= obs.getNumeroOrdre();		
482
					observationData[i][5]= obs.getNumeroOrdre();		
441
					observationData[i][6]= obs.getNumeroNomenclaturalSaisi();
483
					observationData[i][6]= obs.getNumeroNomenclaturalSaisi();
442
									
484
									
443
				
485
				
444
					i++ ;
486
					i++ ;
445
				}
487
				}
446
		
488
		
447
				// creation du store qui les contient
489
				// creation du store qui les contient
448
				
490
				
449
				FieldDef defEtatObservation = new StringFieldDef("etat_observation");
491
				FieldDef defEtatObservation = new StringFieldDef("etat_observation");
450
				FieldDef defNomSaisiObservation = new StringFieldDef("nomSaisi_observation");
492
				FieldDef defNomSaisiObservation = new StringFieldDef("nomSaisi_observation");
451
				FieldDef defNomRetenuObservation = new StringFieldDef("nomRetenu_observation");
493
				FieldDef defNomRetenuObservation = new StringFieldDef("nomRetenu_observation");
452
				FieldDef defLieuObservation = new StringFieldDef("lieu_observation");
494
				FieldDef defLieuObservation = new StringFieldDef("lieu_observation");
453
				FieldDef defDateObservation = new StringFieldDef("date_observation");
495
				FieldDef defDateObservation = new StringFieldDef("date_observation");
454
				FieldDef defOrdreObservation = new StringFieldDef("ordre_observation");
496
				FieldDef defOrdreObservation = new StringFieldDef("ordre_observation");
455
				
497
				
456
				// Non affiches :
498
				// Non affiches :
457
				FieldDef defNumeroNomenclaturalSaisiObservation = new StringFieldDef("numeroNomenclaturalSaisi_observation");
499
				FieldDef defNumeroNomenclaturalSaisiObservation = new StringFieldDef("numeroNomenclaturalSaisi_observation");
458
				
500
				
459
				
501
				
460
				// on associe le store
502
				// on associe le store
461
 
503
 
462
				FieldDef[] defTab = { defEtatObservation, defNomSaisiObservation, defNomRetenuObservation,
504
				FieldDef[] defTab = { defEtatObservation, defNomSaisiObservation, defNomRetenuObservation,
463
						defLieuObservation, defDateObservation, defOrdreObservation, defNumeroNomenclaturalSaisiObservation };
505
						defLieuObservation, defDateObservation, defOrdreObservation, defNumeroNomenclaturalSaisiObservation };
464
				
506
				
465
				RecordDef rd = new RecordDef(defTab);
507
				RecordDef rd = new RecordDef(defTab);
466
				
508
				
467
				final MemoryProxy dataProxy = new MemoryProxy(observationData);
509
				final MemoryProxy dataProxy = new MemoryProxy(observationData);
468
				final ArrayReader reader = new ArrayReader(rd);
510
				final ArrayReader reader = new ArrayReader(rd);
469
		
511
		
470
				final Store observationStore = new Store(dataProxy, reader);
512
				final Store observationStore = new Store(dataProxy, reader);
471
				
513
				
472
				
514
				
473
				st = observationStore ;
515
				st = observationStore ;
474
				st.load() ;
516
				st.load() ;
475
				
517
				
476
				
518
				
477
				// et on reconfigure et rafraichit la vue
519
				// et on reconfigure et rafraichit la vue
478
				this.reconfigure(st, this.getColumnModel());
520
				this.reconfigure(st, this.getColumnModel());
479
				
521
				
480
				demasquerChargement();
522
				demasquerChargement();
481
				
523
				
482
			    cacheListeObservation=data;
524
			    cacheListeObservation=data;
483
			    
525
			    
484
				observationMediateur.onRafraichissementListeObservations();
526
				observationMediateur.onRafraichissementListeObservations();
485
				
527
				
486
				
528
				
487
		}
529
		}
488
		
530
		
489
		
531
		
490
		// Si on reçoit un tableau d'entiers
532
		// Si on reçoit un tableau d'entiers
491
		// c'est un tableau d'un seul entier qui est le nombre d'observation correspondant aux critères
533
		// c'est un tableau d'un seul entier qui est le nombre d'observation correspondant aux critères
492
		if(nouvelleDonnees instanceof int[])
534
		if(nouvelleDonnees instanceof int[])
493
		{
535
		{
494
			int[] pages = (int[])nouvelleDonnees ;
536
			int[] pages = (int[])nouvelleDonnees ;
495
			
537
			
496
			// on calcule le nombre de pages nécessaires et on les met à jour dans le modèle
538
			// on calcule le nombre de pages nécessaires et on les met à jour dans le modèle
497
			pageMax  = calculerNbPages(pages[0]) ;
539
			pageMax  = calculerNbPages(pages[0]) ;
498
			nbElements = pages[0] ;
540
			nbElements = pages[0] ;
499
			
541
			
500
			
542
			
501
			// et on notifie de le mediateur du changement des valeurs
543
			// et on notifie de le mediateur du changement des valeurs
502
			changerPageMaxEtCourante(pageMax,pageEncours,taillePage,pages[0]) ;
544
			changerPageMaxEtCourante(pageMax,pageEncours,taillePage,pages[0]) ;
503
			
545
			
504
			masquerChargement();
546
			masquerChargement();
505
			observationMediateur.obtenirListeObservation(this);
547
			observationMediateur.obtenirListeObservation(this);
506
		}
548
		}
507
		
549
		
508
		
550
		
509
//		 si l'on a reçu une Observation 
551
//		 si l'on a reçu une Observation 
510
		
552
		
511
		if(nouvelleDonnees instanceof Observation) {
553
		if(nouvelleDonnees instanceof Observation) {
512
		
554
		
513
			Observation obs= (Observation) nouvelleDonnees;
555
			Observation obs= (Observation) nouvelleDonnees;
514
			if (obs.getNumeroOrdre()==null) { // Nouvelle observation
556
			if (obs.getNumeroOrdre()==null) { // Nouvelle observation
515
			// On affiche la dernière page
557
			// On affiche la dernière page
516
			
558
			
517
			pageEncours = pageMax ;
559
			pageEncours = pageMax ;
518
			masquerChargement();
560
			masquerChargement();
519
 
561
 
520
			observationMediateur.obtenirNombreObservation();
562
			observationMediateur.obtenirNombreObservation();
521
			
563
			
522
			}
564
			}
523
			else { // Modification d'une observation
565
			else { // Modification d'une observation
524
				
566
				
525
				
567
				
526
				masquerChargement();
568
				masquerChargement();
527
 
569
 
528
				observationMediateur.obtenirNombreObservation();		
570
				observationMediateur.obtenirNombreObservation();		
529
				
571
				
530
			}
572
			}
531
		}
573
		}
532
		
574
		
533
		// Si on a effectué une suppression
575
		// Si on a effectué une suppression
534
		if(nouvelleDonnees instanceof String)
576
		if(nouvelleDonnees instanceof String)
535
		{
577
		{
536
			String str = (String)nouvelleDonnees ;
578
			String str = (String)nouvelleDonnees ;
537
			observationMediateur.obtenirNombreObservation() ;
579
			observationMediateur.obtenirNombreObservation() ;
538
		}
580
		}
539
		
581
		
540
	}
582
	}
541
	
583
	
542
	
584
	
543
	// GESTION DE LA PAGINATION
585
	// GESTION DE LA PAGINATION
544
 
586
 
545
	
587
	
546
	public ListeObservation getCacheListeObservation() {
588
	public ListeObservation getCacheListeObservation() {
547
		return cacheListeObservation;
589
		return cacheListeObservation;
548
	}
590
	}
549
 
591
 
550
	/**
592
	/**
551
	 * Calcule le nombre de pages nécessaires pour afficher un nombre d'élements donnés en fonction de la taille de page
593
	 * Calcule le nombre de pages nécessaires pour afficher un nombre d'élements donnés en fonction de la taille de page
552
	 * en cours
594
	 * en cours
553
	 * @param nbElements le nombre d'élements total
595
	 * @param nbElements le nombre d'élements total
554
	 * @return le nombre de pages 
596
	 * @return le nombre de pages 
555
	 */
597
	 */
556
	public int calculerNbPages(int nbElements)
598
	public int calculerNbPages(int nbElements)
557
	{
599
	{
558
		// A cause de la betise de java pour les conversion implicite on fait quelques conversions manuellement
600
		// A cause de la betise de java pour les conversion implicite on fait quelques conversions manuellement
559
		// pour eviter qu'il arrondisse mal la division
601
		// pour eviter qu'il arrondisse mal la division
560
		// nombre de pages = (nombre d'element / taille de la page) arrondie à l'entier superieur
602
		// nombre de pages = (nombre d'element / taille de la page) arrondie à l'entier superieur
561
		
603
		
562
		double nPage = (1.0*nbElements)/(1.0*taillePage) ; 
604
		double nPage = (1.0*nbElements)/(1.0*taillePage) ; 
563
		double nPageRound = Math.ceil(nPage) ;
605
		double nPageRound = Math.ceil(nPage) ;
564
		Double nPageInt = new Double(nPageRound) ;
606
		Double nPageInt = new Double(nPageRound) ;
565
		
607
		
566
		// on convertit en entier
608
		// on convertit en entier
567
		return nPageInt.intValue() ; 
609
		return nPageInt.intValue() ; 
568
	}
610
	}
569
 
611
 
570
	
612
	
571
	/**
613
	/**
572
	 * Recalcule la page en cours lors du changement du nombre d'élements
614
	 * Recalcule la page en cours lors du changement du nombre d'élements
573
	 * @param nbElements le nombre d'élements total
615
	 * @param nbElements le nombre d'élements total
574
	 * @return la nouvelle page encours
616
	 * @return la nouvelle page encours
575
	 */
617
	 */
576
	public int calculerPageCourante(int nbElements)
618
	public int calculerPageCourante(int nbElements)
577
	{
619
	{
578
		// on calcule le nombre de page
620
		// on calcule le nombre de page
579
		int nouvelNbPages = calculerNbPages(nbElements) ;
621
		int nouvelNbPages = calculerNbPages(nbElements) ;
580
		// la nouvelle page en cours
622
		// la nouvelle page en cours
581
		double nPageCourante = (1.0*pageEncours)/(1.0*pageMax) * (1.0*nouvelNbPages) ;
623
		double nPageCourante = (1.0*pageEncours)/(1.0*pageMax) * (1.0*nouvelNbPages) ;
582
		
624
		
583
		// on arrondit au supérieur
625
		// on arrondit au supérieur
584
		double nPageRound = Math.ceil(nPageCourante) ;
626
		double nPageRound = Math.ceil(nPageCourante) ;
585
		Double nPageInt = new Double(nPageRound) ;
627
		Double nPageInt = new Double(nPageRound) ;
586
		
628
		
587
		// on convertit en entier
629
		// on convertit en entier
588
		return Math.abs(nPageInt.intValue()) ; 
630
		return Math.abs(nPageInt.intValue()) ; 
589
	}
631
	}
590
	
632
	
591
 
633
 
592
	/**
634
	/**
593
	 * Appelle le modèle pour lui demander les données d'une page à afficher
635
	 * Appelle le modèle pour lui demander les données d'une page à afficher
594
	 * @param pageCourante le numéro de page à affciher
636
	 * @param pageCourante le numéro de page à affciher
595
	 */
637
	 */
596
	public void changerNumeroPage(int pageCourante) {
638
	public void changerNumeroPage(int pageCourante) {
597
		
639
		
598
		
640
		
599
		
641
		
600
		pageEncours = pageCourante ;
642
		pageEncours = pageCourante ;
601
		
643
		
602
		masquerChargement();
644
		masquerChargement();
603
 
645
 
604
		// On lance le chargerment des observations
646
		// On lance le chargerment des observations
605
		observationMediateur.obtenirNombreObservation();
647
		observationMediateur.obtenirNombreObservation();
606
		
648
		
607
		getToolBarVue().changerPageCourante(pageCourante);
649
		getToolBarVue().changerPageCourante(pageCourante);
608
		
650
		
609
	}
651
	}
610
	
652
	
611
	
653
	
612
	/**
654
	/**
613
	 * Appelle le modèle pour qu'il change la taille de page utilisée
655
	 * Appelle le modèle pour qu'il change la taille de page utilisée
614
	 * @param nouvelleTaillePage la nouvelle taille de page
656
	 * @param nouvelleTaillePage la nouvelle taille de page
615
	 */
657
	 */
616
	
658
	
617
	public void changerTaillePage(int nouvelleTaillePage)
659
	public void changerTaillePage(int nouvelleTaillePage)
618
	{
660
	{
619
	
661
	
620
		taillePage = nouvelleTaillePage ;
662
		taillePage = nouvelleTaillePage ;
621
		pageEncours = calculerPageCourante(nbElements) ;
663
		pageEncours = calculerPageCourante(nbElements) ;
622
 
664
 
623
		masquerChargement();
665
		masquerChargement();
624
 
666
 
625
		// 	On lance le chargement des observations
667
		// 	On lance le chargement des observations
626
		observationMediateur.obtenirNombreObservation();
668
		observationMediateur.obtenirNombreObservation();
627
		
669
		
628
		
670
		
629
		// et on met à jour la taille de page dans les barres d'outils
671
		// et on met à jour la taille de page dans les barres d'outils
630
		getToolBarVue().selectionnerTaillePage(nouvelleTaillePage);
672
		getToolBarVue().selectionnerTaillePage(nouvelleTaillePage);
631
		
673
		
632
		
674
		
633
	}
675
	}
634
 
676
 
635
	
677
	
636
	/**
678
	/**
637
	 * Met à jour les barre d'outils avec des nouvelles valeurs
679
	 * Met à jour les barre d'outils avec des nouvelles valeurs
638
	 * @param pageMax le nombre de pages
680
	 * @param pageMax le nombre de pages
639
	 * @param pageEncours la page en cours
681
	 * @param pageEncours la page en cours
640
	 * @param taillePage la taille de page
682
	 * @param taillePage la taille de page
641
	 * @param nbElement le nombre d'élements par page
683
	 * @param nbElement le nombre d'élements par page
642
	 */
684
	 */
643
	public void changerPageMaxEtCourante(int pageMax, int pageEncours, int taillePage, int nbElement) 
685
	public void changerPageMaxEtCourante(int pageMax, int pageEncours, int taillePage, int nbElement) 
644
	{
686
	{
645
				
687
				
646
		int[] pages = {pageMax,pageEncours, taillePage, nbElement} ;
688
		int[] pages = {pageMax,pageEncours, taillePage, nbElement} ;
647
		getToolBarVue().rafraichir(pages, false) ;
689
		getToolBarVue().rafraichir(pages, false) ;
648
		
690
		
649
	}
691
	}
650
	
692
	
651
	/**
693
	/**
652
	 * Renvoie la taille de page en cours d'utilisation
694
	 * Renvoie la taille de page en cours d'utilisation
653
	 * @return la taille de page
695
	 * @return la taille de page
654
	 */
696
	 */
655
	public int getTaillePage() {
697
	public int getTaillePage() {
656
		
698
		
657
		return taillePage;
699
		return taillePage;
658
	}
700
	}
659
	
701
	
660
	/**
702
	/**
661
	 * Renvoie le numéro de la page encours (attention on commence à 0)
703
	 * Renvoie le numéro de la page encours (attention on commence à 0)
662
	 * @return le numéro de la page en cours
704
	 * @return le numéro de la page en cours
663
	 */
705
	 */
664
	public int getPageEncours() {
706
	public int getPageEncours() {
665
		
707
		
666
		return pageEncours;
708
		return pageEncours;
667
	}
709
	}
668
	
710
	
669
	public void afficherFiltres(String nLieu, String nDate)
711
	public void afficherFiltres(String nLieu, String nDate)
670
	{
712
	{
671
		
713
		
672
		String titre = "Observations " ;
714
		String titre = "Observations " ;
673
		
715
		
674
		if(!nLieu.equals(""))
716
		if(!nLieu.equals(""))
675
		{
717
		{
676
			titre += "  -  Lieu : "+nLieu ;
718
			titre += "  -  Lieu : "+nLieu ;
677
			
719
			
678
		}
720
		}
679
			
721
			
680
		if(!nDate .equals(""))
722
		if(!nDate .equals(""))
681
		{
723
		{
682
			titre += "  -  Date : "+nDate ;
724
			titre += "  -  Date : "+nDate ;
683
		}
725
		}
684
		
726
		
685
		this.setTitle(titre) ;
727
		this.setTitle(titre) ;
686
	}
728
	}
687
 
729
 
688
	public void raz() {
730
	public void raz() {
689
		
731
		
690
		
732
		
691
		// creation du store qui les contient
733
		// creation du store qui les contient
692
		
734
		
693
		FieldDef defEtatObservation = new StringFieldDef("etat_observation");
735
		FieldDef defEtatObservation = new StringFieldDef("etat_observation");
694
		FieldDef defNomSaisiObservation = new StringFieldDef("nomSaisi_observation");
736
		FieldDef defNomSaisiObservation = new StringFieldDef("nomSaisi_observation");
695
		FieldDef defNomRetenuObservation = new StringFieldDef("nomRetenu_observation");
737
		FieldDef defNomRetenuObservation = new StringFieldDef("nomRetenu_observation");
696
		FieldDef defLieuObservation = new StringFieldDef("lieu_observation");
738
		FieldDef defLieuObservation = new StringFieldDef("lieu_observation");
697
		FieldDef defDateObservation = new StringFieldDef("date_observation");
739
		FieldDef defDateObservation = new StringFieldDef("date_observation");
698
		FieldDef defOrdreObservation = new StringFieldDef("ordre_observation");
740
		FieldDef defOrdreObservation = new StringFieldDef("ordre_observation");
699
		
741
		
700
		// Non affiches :
742
		// Non affiches :
701
		FieldDef defNumeroNomenclaturalSaisiObservation = new StringFieldDef("numeroNomenclaturalSaisi_observation");
743
		FieldDef defNumeroNomenclaturalSaisiObservation = new StringFieldDef("numeroNomenclaturalSaisi_observation");
702
		
744
		
703
		FieldDef[] defTab = { defEtatObservation, defNomSaisiObservation, defNomRetenuObservation,
745
		FieldDef[] defTab = { defEtatObservation, defNomSaisiObservation, defNomRetenuObservation,
704
				defLieuObservation, defDateObservation, defOrdreObservation };
746
				defLieuObservation, defDateObservation, defOrdreObservation };
705
		
747
		
706
		RecordDef rd = new RecordDef(defTab);
748
		RecordDef rd = new RecordDef(defTab);
707
		st = new Store(rd);
749
		st = new Store(rd);
708
		
750
		
709
		// on associe le store
751
		// on associe le store
710
		
752
		
711
		this.setStore(st);
753
		this.setStore(st);
712
		
754
		
713
	}
755
	}
-
 
756
	
-
 
757
	public boolean verifierFormatDate(String date) {
-
 
758
		
-
 
759
		String regex = "[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}" ;
-
 
760
		if(date.matches(regex) && !date.equals("0000-00-00")) {
-
 
761
			return true ;
-
 
762
		}
-
 
763
		else {
-
 
764
			return false;
-
 
765
		}
-
 
766
	}
714
 
767
 
715
}
768
}