Subversion Repositories eFlore/Applications.cel

Rev

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

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