Subversion Repositories eFlore/Applications.cel

Rev

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

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