Subversion Repositories eFlore/Applications.cel

Rev

Rev 7 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7 Rev 12
Line 1... Line 1...
1
/**
1
/**
2
 David Delon david.delon@clapas.net 2007
2
 David Delon david.delon@clapas.net 2007
Line 3... Line 3...
3
 
3
 
Line -... Line 4...
-
 
4
 */
4
 */
5
 
5
 
6
 
6
/*
7
/*
7
 * ListeObservationsVue.java  (Composite de Panel)
8
 * ListeObservationsVue.java  (Composite de Panel)
8
 *
9
 *
Line 26... Line 27...
26
 *
27
 *
27
 * 
28
 * 
28
 *  Suppression d'une liste d'element 
29
 *  Suppression d'une liste d'element 
29
 */
30
 */
Line -... Line 31...
-
 
31
 
30
 
32
 
31
/* Actions declenchees :
33
/* Actions declenchees :
32
 * 
34
 * 
33
 * onInventoryItemSelected(numero d'ordre de la ligne selectionne) : selection d'une ligne
35
 * onInventoryItemSelected(numero d'ordre de la ligne selectionne) : selection d'une ligne
34
 * onInventoryItemUnselected(numero d'ordre de la ligne selectionne) : deselection d'une ligne
36
 * onInventoryItemUnselected(numero d'ordre de la ligne selectionne) : deselection d'une ligne
35
 * onInventoryUpdated(localite) : action suite a la modification, suppression, creation d'un element d'inventaire
37
 * onInventoryUpdated(localite) : action suite a la modification, suppression, creation d'un element d'inventaire
36
 * 
38
 * 
Line 37... Line -...
37
 */
-
 
Line -... Line 39...
-
 
39
 */
-
 
40
 
38
 
41
 
Line 39... Line 42...
39
package org.tela_botanica.client.observation;
42
package org.tela_botanica.client.observation;
40
 
43
 
41
import org.tela_botanica.client.modeles.Observation;
44
import org.tela_botanica.client.modeles.Observation;
42
 
45
 
43
import com.google.gwt.user.client.ui.Button;
-
 
44
import com.google.gwt.user.client.ui.ClickListener;
-
 
45
import com.google.gwt.user.client.ui.Composite;
46
import com.google.gwt.user.client.HTTPRequest;
-
 
47
import com.google.gwt.user.client.ResponseTextHandler;
46
import com.google.gwt.user.client.ui.DockPanel;
48
import com.google.gwt.user.client.ui.Composite;
47
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
49
import com.google.gwt.user.client.ui.DockPanel;
-
 
50
import com.google.gwt.user.client.ui.HorizontalPanel;
-
 
51
import com.google.gwt.user.client.ui.Button;
-
 
52
import com.google.gwt.user.client.ui.Label;
Line -... Line 53...
-
 
53
import com.google.gwt.user.client.ui.Widget;
48
import com.google.gwt.user.client.ui.HasVerticalAlignment;
54
import com.google.gwt.user.client.ui.ClickListener;
-
 
55
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
Line 49... Line 56...
49
import com.google.gwt.user.client.ui.HorizontalPanel;
56
import com.google.gwt.user.client.ui.HasVerticalAlignment;
Line 50... Line 57...
50
import com.google.gwt.user.client.ui.Label;
57
 
Line -... Line 58...
-
 
58
 
51
import com.google.gwt.user.client.ui.Widget;
59
public class ListeObservationsVue extends Composite
-
 
60
		 {
Line 52... Line 61...
52
 
61
 
53
public class ListeObservationsVue extends Composite {
62
	// Debut Barre de navigation
54
 
63
 
55
	// Debut Barre de navigation
64
	private class NavBar extends Composite implements ClickListener {
56
 
65
 
-
 
66
		
Line 57... Line 67...
57
	private class NavBar extends Composite implements ClickListener {
67
		public final DockPanel bar = new DockPanel();
58
 
68
		
59
		public final DockPanel bar = new DockPanel();
69
 
60
 
70
		public final Button gotoFirst = new Button("<<", this);
61
		public final Button gotoFirst = new Button("<<", this);
71
		public final Button gotoNext = new Button(">", this);
Line 62... Line 72...
62
		public final Button gotoNext = new Button(">", this);
72
		public final Button gotoPrev = new Button("<", this);
63
		public final Button gotoPrev = new Button("<", this);
73
		public final Button gotoEnd = new Button(">>", this);
64
		public final Button gotoEnd = new Button(">>", this);
74
		public final Label status = new Label();
65
		public final Label status = new Label();
75
		
66
 
-
 
67
		public NavBar() {
76
 
68
 
-
 
-
 
77
		public NavBar() {
Line 69... Line 78...
69
			initWidget(bar);
78
			
70
 
79
			initWidget(bar);
71
			status.setWordWrap(false);
80
			
72
 
81
			status.setWordWrap(false);
73
			HorizontalPanel buttons = new HorizontalPanel();
82
 
74
 
83
			HorizontalPanel buttons = new HorizontalPanel();
Line -... Line 84...
-
 
84
			
75
			buttons.add(status);
85
			buttons.add(status);
-
 
86
			buttons.setCellHorizontalAlignment(status, HasHorizontalAlignment.ALIGN_RIGHT);
Line 76... Line 87...
76
			buttons.setCellHorizontalAlignment(status,
87
			buttons.setCellVerticalAlignment(status, HasVerticalAlignment.ALIGN_MIDDLE);
77
					HasHorizontalAlignment.ALIGN_RIGHT);
88
 
78
			buttons.setCellVerticalAlignment(status,
89
 
79
					HasVerticalAlignment.ALIGN_MIDDLE);
90
			buttons.add(gotoFirst);
Line 115... Line 126...
115
	}
126
	}
Line 116... Line 127...
116
 
127
 
Line 117... Line 128...
117
	// Fin Barre de navigation
128
	// Fin Barre de navigation
118
 
129
 
119
	// Conteneur (header et table sont dans panel)
130
	// Conteneur (header et table sont dans panel)
120
	// private ContentPanel panel =null;
131
//	private ContentPanel panel =null;
121
	// private Table table = null;
132
//	private Table table = null;
122
 
133
	
123
	// Services
134
	// Services 
124
	private String serviceBaseUrl = null;
135
	private String serviceBaseUrl = null;
Line 125... Line 136...
125
	private String user;
136
	private String user;
126
	private ObservationMediateur observationMediateur = null;
137
	private ObservationMediateur observationMediateur = null;
127
 
138
 
128
	// Navigation
139
	// Navigation
129
	private int startIndex = 0;
140
	private int startIndex = 0;
Line 130... Line 141...
130
	private int count = 0;
141
	private int count = 0;
131
	private static final int VISIBLE_TAXON_COUNT = 15;
142
	private static final int VISIBLE_TAXON_COUNT = 15;
132
	private NavBar navBar = null;
143
	private NavBar navBar=null;
133
 
144
 
134
	// Filtre par defaut :
145
	// Filtre par defaut :
135
 
146
	
136
	private String identifiantLocalite = "all";
147
	private String identifiantLocalite = "all";
137
	private String localite = "all";
148
	private String localite = "all";
138
	private String annee = "all";
149
	private String annee = "all";
139
	private String mois = "all";
150
	private String mois = "all";
-
 
151
	private String jour = "all";
-
 
152
	private String rechercheLibre = "all";
Line 140... Line -...
140
	private String jour = "all";
-
 
Line -... Line 153...
-
 
153
	private String lieudit = "all";
-
 
154
	private String ordre= null;
-
 
155
	
141
	private String rechercheLibre = "all";
156
	
Line 142... Line 157...
142
	private String lieudit = "all";
157
 
143
	private String ordre = null;
-
 
144
 
-
 
145
	public ListeObservationsVue(ObservationMediateur observationMediateur) {
-
 
146
 
-
 
147
		// Traitement contexte utilisateur et service
-
 
Line -... Line 158...
-
 
158
 
-
 
159
	public ListeObservationsVue(ObservationMediateur observationMediateur) {
-
 
160
		
-
 
161
		
-
 
162
		// Traitement contexte utilisateur et service
-
 
163
 
-
 
164
		this.observationMediateur=observationMediateur;
148
 
165
 
149
		this.observationMediateur = observationMediateur;
166
	    
150
 
-
 
151
		// panel= new ContentPanel(Style.HEADER);
-
 
152
		// panel.setLayout(new FillLayout());
-
 
153
 
-
 
154
		// Barre navigation integree au header
-
 
155
 
-
 
Line -... Line 167...
-
 
167
	//    panel= new ContentPanel(Style.HEADER);
-
 
168
	  //  panel.setLayout(new FillLayout());
-
 
169
	    
-
 
170
	    
-
 
171
	    // Barre navigation integree au header 
-
 
172
	    
-
 
173
		navBar = new NavBar();
-
 
174
	//	panel.getHeader().addWidget(navBar);
156
		navBar = new NavBar();
175
 
157
		// panel.getHeader().addWidget(navBar);
176
		
158
 
177
		//  Contenu :
159
		// Contenu :
-
 
160
 
-
 
161
		// Colonnes :
-
 
162
 
-
 
163
		// TableColumn[] columns = new TableColumn[6];
-
 
164
 
-
 
165
		// TODO : renderer date, alignement etc
-
 
166
		/*
-
 
167
		 * columns[0] = new TableColumn("etat","Aransmis", 50);
-
 
168
		 * 
-
 
169
		 * columns[1] = new TableColumn("nom","Nom saisi", 250);
-
 
170
		 * 
-
 
171
		 * columns[2] = new TableColumn("nomr","Nom retenu", 250);
-
 
172
		 * 
-
 
173
		 * columns[3] = new TableColumn("lieu","Lieu", 350);
-
 
174
		 * 
-
 
175
		 * columns[4] = new TableColumn("date","Date", 75);
-
 
176
		 * 
-
 
177
		 * columns[5] = new TableColumn("ordre","Ordre", 50);
-
 
178
		 * 
-
 
179
		 * 
-
 
180
		 * TableColumnModel cm = new TableColumnModel(columns);
-
 
181
		 *  // Table :
-
 
182
		 * 
-
 
183
		 * table = new Table(Style.MULTI | Style.HORIZONTAL, cm);
-
 
184
		 * table.setBorders(false);
-
 
185
		 * 
-
 
186
		 * 
-
 
187
		 * panel.add(table);
-
 
188
		 * 
-
 
189
		 * 
-
 
190
		 *  // Selection d'une ligne table.addListener(Events.RowClick, new
-
 
191
		 * Listener() {
-
 
192
		 * 
-
 
193
		 * public void handleEvent(BaseEvent be) { TableItem item=(TableItem)
-
 
194
		 * be.item; if (item!=null) { if (ordre==null) { // Affichage de la
-
 
195
		 * ligne selectionne ordre= (String) item.getValue(5); //
-
 
Line -... Line 178...
-
 
178
		
-
 
179
		
-
 
180
		//  Colonnes :
-
 
181
		
-
 
182
//		TableColumn[] columns = new TableColumn[6]; 
-
 
183
		
-
 
184
		// TODO : renderer date, alignement etc
-
 
185
	/*	
-
 
186
		columns[0] = new TableColumn("etat","Transmis", 50);  
-
 
187
 
-
 
188
		columns[1] = new TableColumn("nom","Nom saisi", 250);  
-
 
189
		
-
 
190
		columns[2] = new TableColumn("nomr","Nom retenu", 250);  
-
 
191
 
-
 
192
		columns[3] = new TableColumn("lieu","Lieu", 350);  
-
 
193
 
-
 
194
		columns[4] = new TableColumn("date","Date", 75);  
-
 
195
 
-
 
196
		columns[5] = new TableColumn("ordre","Ordre", 50);  
-
 
197
		
-
 
198
	
-
 
199
		TableColumnModel cm = new TableColumnModel(columns);  
-
 
200
		
-
 
201
		// Table : 
-
 
202
		
-
 
203
		table = new Table(Style.MULTI | Style.HORIZONTAL, cm);  
-
 
204
		table.setBorders(false);  
-
 
205
		
-
 
206
		
-
 
207
		panel.add(table);
-
 
208
		
-
 
209
		
-
 
210
 
-
 
211
		// Selection d'une ligne 
-
 
212
		table.addListener(Events.RowClick, new Listener() {
-
 
213
 
-
 
214
		      public void handleEvent(BaseEvent be) {
-
 
215
		        TableItem item=(TableItem) be.item;
-
 
216
		        if (item!=null) {
-
 
217
		        	if (ordre==null) { // Affichage de la ligne selectionne
-
 
218
		        		ordre= (String) item.getValue(5);
-
 
219
	//	        		observationMediateur.onInventoryItemSelected(ordre);
-
 
220
		        	}
-
 
221
		        	else { 
-
 
222
		        		// Si une ligne etait deja selectionne 
-
 
223
		        		if (ordre.compareTo((String) item.getValue(5))==0) { // C'est la meme, on la deselectionne
-
 
224
		        			ordre=null;
-
 
225
		        			table.deselect(be.rowIndex);
-
 
226
		//        			observationMediateur.onInventoryItemUnselected();
-
 
227
		        		}
-
 
228
		        		else {
196
		 * observationMediateur.onInventoryItemSelected(ordre); } else { // Si
229
			        		ordre= (String) item.getValue(5); // C'est une autre, on la selectionne
Line 197... Line -...
197
		 * une ligne etait deja selectionne if (ordre.compareTo((String)
-
 
Line -... Line 230...
-
 
230
//		        			observationMediateur.onInventoryItemSelected(ordre);
-
 
231
		        		}
-
 
232
		        		
198
		 * item.getValue(5))==0) { // C'est la meme, on la deselectionne
233
		        	}
199
		 * ordre=null; table.deselect(be.rowIndex); //
234
		        }
200
		 * observationMediateur.onInventoryItemUnselected(); } else { ordre=
-
 
201
		 * (String) item.getValue(5); // C'est une autre, on la selectionne //
235
		      }
202
		 * observationMediateur.onInventoryItemSelected(ordre); }
236
		});
Line 203... Line 237...
203
		 *  } } } });
237
		*/
204
		 */
238
	
205
 
-
 
206
		// initWidget(panel);
-
 
207
 
-
 
208
	}
-
 
209
 
-
 
210
	/**
239
	// initWidget(panel);
211
	 * Suppression d'un ensemble d'element de la liste d'inventaire, on garde
-
 
212
	 * ici car s'applique a plusieurs elements
-
 
213
	 * 
-
 
214
	 */
-
 
215
 
-
 
216
	public void deleteElement() {
-
 
217
		/*
-
 
218
		 * setStatusDisabled(); TableItem[] selection=table.getSelection();
-
 
219
		 * 
240
 
220
		 * StringBuffer ids=new StringBuffer(); for (int i = 0; i <
-
 
221
		 * selection.length; i++) { ids.append((String)(((TableItem)
-
 
222
		 * selection[i]).getValue(5))); if (i<(selection.length-1))
-
 
223
		 * ids.append(","); }
-
 
Line -... Line 241...
-
 
241
 
-
 
242
	}
-
 
243
	
-
 
244
	
-
 
245
	/**
-
 
246
	 * Suppression d'un ensemble d'element de la liste d'inventaire, on garde ici car s'applique a plusieurs elements
-
 
247
	 * 
-
 
248
	 */
-
 
249
 
-
 
250
	public void deleteElement() {
-
 
251
/*
-
 
252
		setStatusDisabled();
-
 
253
		TableItem[] selection=table.getSelection();
-
 
254
 
-
 
255
		StringBuffer ids=new StringBuffer();
-
 
256
		for (int i = 0; i < selection.length; i++) {
-
 
257
			ids.append((String)(((TableItem) selection[i]).getValue(5)));
-
 
258
			if (i<(selection.length-1)) ids.append(",");
-
 
259
		} 
-
 
260
		
-
 
261
		if (ids.length()>0) {
-
 
262
			
-
 
263
			HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + user
-
 
264
							+ "/" + ids.toString(), "action=DELETE",
-
 
265
							
-
 
266
							new ResponseTextHandler() {
224
		 * 
267
								public void onCompletion(String str) {
225
		 * if (ids.length()>0) {
268
	//										observationMediateur.onInventoryUpdated(identifiantLocalite,"all","all");
226
		 * 
-
 
227
		 * HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + user + "/" +
269
		//									observationMediateur.getEntryView().clear();
Line -... Line 270...
-
 
270
								}
228
		 * ids.toString(), "action=DELETE",
271
							});
229
		 * 
272
		}
230
		 * new ResponseTextHandler() { public void onCompletion(String str) { //
273
	
-
 
274
		setStatusEnabled();
-
 
275
*/
Line 231... Line -...
231
		 * observationMediateur.onInventoryUpdated(identifiantLocalite,"all","all"); //
-
 
232
		 * observationMediateur.getEntryView().clear(); } }); }
-
 
233
		 * 
-
 
234
		 * setStatusEnabled();
276
	}
235
		 */
277
	
236
	}
278
	
237
 
279
	
238
	/**
280
	
-
 
281
	/**
239
	 * Transmission de releve a Tela, on garde ici car s'applique a plusieurs
282
	 * Transmission de releve a Tela, on garde ici car s'applique a plusieurs elements
240
	 * elements
283
	 */
241
	 */
284
 
242
 
285
	
243
	public void transmitElement() {
286
	public void transmitElement() {
-
 
287
	
244
 
288
		setStatusDisabled();
245
		setStatusDisabled();
289
		
246
 
290
/*		TableItem[] selection=table.getSelection();
247
		/*
-
 
248
		 * TableItem[] selection=table.getSelection();
291
 
249
		 * 
292
		StringBuffer ids=new StringBuffer();
250
		 * StringBuffer ids=new StringBuffer(); for (int i = 0; i <
293
		for (int i = 0; i < selection.length; i++) {
-
 
294
			ids.append((String)(((TableItem) selection[i]).getValue(5)));
Line -... Line 295...
-
 
295
			if (i<(selection.length-1)) ids.append(",");
-
 
296
		} 
-
 
297
	
-
 
298
		if (ids.length()>0) {
251
		 * selection.length; i++) { ids.append((String)(((TableItem)
299
		
252
		 * selection[i]).getValue(5))); if (i<(selection.length-1))
300
			HTTPRequest.asyncPost(serviceBaseUrl + "/InventoryTransmit/" + user
253
		 * ids.append(","); }
-
 
254
		 * 
301
							+ "/" + ids.toString(), "transmission=1",
255
		 * if (ids.length()>0) {
302
							
256
		 * 
303
							new ResponseTextHandler() {
257
		 * HTTPRequest.asyncPost(serviceBaseUrl + "/InventoryTransmit/" + user +
304
								public void onCompletion(String str) {
258
		 * "/" + ids.toString(), "transmission=1",
305
											getListeObservation(); // Pour affichage logo 
259
		 * 
306
								}
Line 260... Line 307...
260
		 * new ResponseTextHandler() { public void onCompletion(String str) {
307
							});
261
		 * getListeObservation(); // Pour affichage logo } }); }
308
		}
262
		 * 
-
 
263
		 * setStatusEnabled();
-
 
264
		 * 
-
 
265
		 */
-
 
Line -... Line 309...
-
 
309
	
266
	}
310
		setStatusEnabled();
267
 
311
 
268
	/**
312
		*/
269
	 * Recherche nombre d'enregistrement pour l'utilisateur et la localite en
313
	}
270
	 * cours
314
	
271
	 * 
315
	
272
	 */
316
	/**
273
 
317
	 * Recherche nombre d'enregistrement pour l'utilisateur et la localite en cours
Line 274... Line 318...
274
	public void initialiser() {
318
	 * 
Line 275... Line 319...
275
 
319
	 */
276
		setStatusDisabled();
320
	
277
 
-
 
278
		// observationMediateur.addListener(ObservationMediateur.NOMBRE_OBSERVATION,this);
-
 
279
		observationMediateur.getNombreObservation(identifiantLocalite,
-
 
280
				localite, annee, mois, jour, lieudit, rechercheLibre); // Retour
321
	public void initialiser() {
281
																		// dans
322
		
282
																		// handlevent()
323
		setStatusDisabled();
283
																		// NOMBRE_OBSERVATION
324
 
Line 284... Line 325...
284
 
325
	//	observationMediateur.addListener(ObservationMediateur.NOMBRE_OBSERVATION,this);
285
	}
-
 
286
 
326
	//	observationMediateur.getNombreObservation(identifiantLocalite,localite,annee, mois, jour ,lieudit,rechercheLibre); // Retour dans handlevent() NOMBRE_OBSERVATION
287
	/**
327
 
288
	 * Mise a jour de l'affichage, a partir des donnaes d'inventaire deja
328
		
289
	 * saisies. La valeur de this.startIndex permet de determiner quelles
329
	}
290
	 * donnaes seront affichees
330
	
291
	 * 
331
	/**
292
	 */
332
	 * Mise a jour de l'affichage, a partir des donnaes d'inventaire deja
293
 
333
	 * saisies. La valeur de this.startIndex permet de determiner quelles
294
	public void getListeObservation() {
334
	 * donnaes seront affichees
295
 
335
	 * 
-
 
336
	 */
-
 
337
 
-
 
338
	public void getListeObservation() {
-
 
339
 
-
 
340
	//	observationMediateur.addListener(ObservationMediateur.LISTE_OBSERVATION,this);
-
 
341
	//	observationMediateur.getListeObservation(identifiantLocalite,localite,annee, mois, jour ,lieudit,rechercheLibre, startIndex, VISIBLE_TAXON_COUNT); // Retour dans handlevent() LISTE_OBSERVATION
Line 296... Line 342...
296
		// observationMediateur.addListener(ObservationMediateur.LISTE_OBSERVATION,this);
342
		
-
 
343
	}
Line 297... Line 344...
297
		observationMediateur.getListeObservation(identifiantLocalite, localite,
344
	
-
 
345
	public void afficherListeObservation() {
Line 298... Line 346...
298
				annee, mois, jour, lieudit, rechercheLibre, startIndex,
346
 
Line 299... Line -...
299
				VISIBLE_TAXON_COUNT); // Retour dans handlevent()
-
 
300
										// LISTE_OBSERVATION
-
 
301
 
-
 
302
	}
-
 
303
 
-
 
304
	public void afficherListeObservation() {
-
 
305
 
-
 
306
		Observation[] listeObservation = observationMediateur.getObservation()
-
 
307
				.getListeObservation();
-
 
308
 
-
 
309
		for (int i = 0; i < listeObservation.length; i++) {
-
 
310
 
-
 
311
			Object[] values = new Object[6];
347
//		Observation[] listeObservation =observationMediateur.getObservation().getListeObservation();
312
			values[0] = "0";
348
		/*
313
			values[2] = "2";
349
		for (int i=0;i<listeObservation.length;i++) {
-
 
350
		
314
			values[3] = "3";
351
			Object[] values = new Object[6];
315
			values[4] = "4";
352
			values[0]="0";
316
			values[5] = "5";
353
			values[2]="2";
317
			values[1] = listeObservation[i].getNomSaisi();
354
			values[3]="3";
318
 
355
			values[4]="4";
319
			// table.add(new TableItem(values));
356
			values[5]="5";
320
 
357
			values[1]=listeObservation[i].getNomSaisi();
321
		}
358
			*/
322
 
359
    	//	table.add(new TableItem(values));
323
		// Ligne d'information
360
			
324
 
361
		}
325
		// Toutes date par defaut
362
		
326
		/*
363
//      Ligne d'information 
327
		 * 
364
 
328
		 * HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user +
365
		// Toutes date par defaut
-
 
366
/*		
329
		 * "/" + identifiantLocalite + "/" + URL.encodeComponent(localite) +"/" +
367
 
330
		 * annee + "/" + mois + "/" + jour + "/" +
368
		HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + identifiantLocalite + "/" + URL.encodeComponent(localite) +"/" + annee  + "/"  + mois  + "/"  + jour   + "/" + URL.encodeComponent(rechercheLibre) + "/" + URL.encodeComponent(lieudit) + "/"
331
		 * URL.encodeComponent(rechercheLibre) + "/" +
369
				+ startIndex + "/" + VISIBLE_TAXON_COUNT,
332
		 * URL.encodeComponent(lieudit) + "/" + startIndex + "/" +
370
 
-
 
371
		new ResponseTextHandler() {
333
		 * VISIBLE_TAXON_COUNT,
372
 
-
 
373
			public void onCompletion(String str) {
334
		 * 
374
 
335
		 * new ResponseTextHandler() {
375
				JSONValue jsonValue = JSONParser.parse(str);
336
		 * 
376
				JSONArray jsonArray;
337
		 * public void onCompletion(String str) {
377
				JSONArray jsonArrayNested;
-
 
378
				
-
 
379
				int i=0;
338
		 * 
380
 
339
		 * JSONValue jsonValue = JSONParser.parse(str); JSONArray jsonArray;
381
				if ((jsonArray = jsonValue.isArray()) != null) {
340
		 * JSONArray jsonArrayNested;
382
					
341
		 * 
-
 
-
 
383
					StringBuffer lieu=null;
342
		 * int i=0;
384
 
343
		 * 
385
					int arraySize = jsonArray.size();
344
		 * if ((jsonArray = jsonValue.isArray()) != null) {
386
					
345
		 * 
387
					for (i = 0; i < arraySize; ++i) {
346
		 * StringBuffer lieu=null;
388
						if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
347
		 * 
389
							
-
 
390
 
-
 
391
							Object[] values = new Object[6];
-
 
392
							
348
		 * int arraySize = jsonArray.size();
393
													
-
 
394
							// Statut Observation transmise ?
-
 
395
							
-
 
396
							String atransmit=((JSONString) jsonArrayNested .get(13)).stringValue();
-
 
397
							
349
		 * 
398
							if (atransmit.compareTo("1")==0) {
350
		 * for (i = 0; i < arraySize; ++i) { if ((jsonArrayNested =
399
								values[0] = new Image("tela.gif");
351
		 * jsonArray.get(i).isArray()) != null) {
400
							}
-
 
401
							else {
352
		 * 
402
								values[0] = new HTML("&nbsp;");
-
 
403
							}
-
 
404
							
353
		 * 
405
						
354
		 * Object[] values = new Object[6];
406
							// Nom saisi
-
 
407
							
-
 
408
							values[1] = new HTML("<b>"+Util.toCelString(((JSONString) jsonArrayNested .get(0)).toString())+"</b>");
355
		 * 
409
							
356
		 *  // Statut Observation transmise ?
410
							
357
		 * 
411
 
358
		 * String atransmit=((JSONString) jsonArrayNested
412
							// Nom retenu
-
 
413
							String aname=Util.toCelString(((JSONString) jsonArrayNested .get(2)).toString());
359
		 * .get(13)).stringValue();
414
							
-
 
415
							if (aname.compareTo("null")==0) {
-
 
416
								values[2] = new HTML("&nbsp;");
360
		 * 
417
							}
-
 
418
							else {
-
 
419
								values[2] = new HTML(aname);
361
		 * if (atransmit.compareTo("1")==0) { values[0] = new Image("tela.gif"); }
420
							}
362
		 * else { values[0] = new HTML("&nbsp;"); }
421
							/*
363
		 * 
422
							 
364
		 *  // Nom saisi
423
							 /*
-
 
424
							// Num nomenclatural
365
		 * 
425
							String ann=((JSONString) jsonArrayNested .get(3)).stringValue();
-
 
426
							
366
		 * values[1] = new HTML("<b>"+Util.toCelString(((JSONString)
427
							if (ann.compareTo("0")!=0) {
367
		 * jsonArrayNested .get(0)).toString())+"</b>");
428
								observationText.append(""+ann+"-");
368
		 * 
429
							}
-
 
430
							else {
369
		 * 
431
								observationText.append("0-");
370
		 *  // Nom retenu String aname=Util.toCelString(((JSONString)
432
							}
Line 450... Line -...
450
		 * String aordre=((JSONString) jsonArrayNested.get(7)).stringValue();
-
 
Line 451... Line 570...
451
		 *  // Numero d'ordre (cache)
570
									table.deselect(i);
452
		 * 
571
								}
453
		 * values[5] = aordre;
572
							}
454
		 * 
573
							
Line 503... Line 622...
503
		// Il y a forcemment un disabled avant d'arriver ici
622
		// Il y a forcemment un disabled avant d'arriver ici
Line 504... Line 623...
504
 
623
 
Line 505... Line 624...
505
		if (count > 0) {
624
		if (count > 0) {
506
 
625
 
507
			if (startIndex >= VISIBLE_TAXON_COUNT) { // Au dela de la
626
			if (startIndex >= VISIBLE_TAXON_COUNT) { // Au dela de la
508
				// premiere page
627
														// premiere page
509
				navBar.gotoPrev.setEnabled(true);
628
				navBar.gotoPrev.setEnabled(true);
510
				navBar.gotoFirst.setEnabled(true);
629
				navBar.gotoFirst.setEnabled(true);
511
				if (startIndex < (count - VISIBLE_TAXON_COUNT)) { // Pas la
630
				if (startIndex < (count - VISIBLE_TAXON_COUNT)) { // Pas la
512
					// derniere
631
																	// derniere
513
					// page
632
																	// page
514
					navBar.gotoNext.setEnabled(true);
633
					navBar.gotoNext.setEnabled(true);
515
					navBar.gotoEnd.setEnabled(true);
634
					navBar.gotoEnd.setEnabled(true);
516
					navBar.status.setText((startIndex + 1) + " - "
-
 
517
							+ (startIndex + VISIBLE_TAXON_COUNT) + " sur "
635
					navBar.status.setText((startIndex + 1) + " - "
518
							+ count);
636
							+ (startIndex + VISIBLE_TAXON_COUNT) + " sur " + count );
519
				} else { // Derniere page
-
 
520
					navBar.status.setText((startIndex + 1) + " - " + count
637
				} else { // Derniere page
521
							+ " sur " + count);
638
					navBar.status.setText((startIndex + 1) + " - " + count + " sur " + count );
522
				}
639
				}
523
			} else { // Premiere page
640
			} else { // Premiere page
524
				if (count > VISIBLE_TAXON_COUNT) { // Des pages derrieres
641
				if (count > VISIBLE_TAXON_COUNT) { // Des pages derrieres
525
					navBar.gotoNext.setEnabled(true);
642
					navBar.gotoNext.setEnabled(true);
526
					navBar.gotoEnd.setEnabled(true);
643
					navBar.gotoEnd.setEnabled(true);
527
					navBar.status.setText((startIndex + 1) + " - "
-
 
528
							+ (startIndex + VISIBLE_TAXON_COUNT) + " sur "
644
					navBar.status.setText((startIndex + 1) + " - "
529
							+ count);
645
							+ (startIndex + VISIBLE_TAXON_COUNT) + " sur " + count);
530
				} else {
-
 
531
					navBar.status.setText((startIndex + 1) + " - " + count
646
				} else {
532
							+ " sur " + count);
647
					navBar.status.setText((startIndex + 1) + " - " + count + " sur " + count);
533
				}
648
				}
Line 534... Line 649...
534
			}
649
			}
Line 541... Line 656...
541
 
656
 
542
	/*
657
	/*
543
	 * Positionnement index de parcours (this.startIndex) pour affichage de la
658
	 * Positionnement index de parcours (this.startIndex) pour affichage de la
544
	 * derniere page
659
	 * derniere page
-
 
660
	 * 
545
	 * 
661
	 * @param
546
	 * @param @return void
662
	 * @return void
Line 547... Line 663...
547
	 */
663
	 */
Line 548... Line 664...
548
 
664
 
Line 558... Line 674...
558
 
674
 
559
	/*
675
	/*
560
	 * Recherche en cours
676
	 * Recherche en cours
561
	 * 
677
	 * 
562
	 */
678
	 */
563
 
679
	
564
	public void setRechercheLibre(String search) {
680
	public void setRechercheLibre(String search) {
565
		this.rechercheLibre = search;
681
		this.rechercheLibre = search;
Line -... Line 682...
-
 
682
	}
-
 
683
 
566
	}
684
 
567
 
685
	
568
	/*
686
	/*
569
	 * Departement en cours
687
	 * Departement en cours 
570
	 * 
688
	 * 
571
	 */
689
	 */
572
 
690
	
573
	public void setIdLocation(String id_location) {
691
	public void setIdLocation(String id_location) {
Line -... Line 692...
-
 
692
		this.identifiantLocalite = id_location;
-
 
693
	}
574
		this.identifiantLocalite = id_location;
694
 
575
	}
695
 
576
 
696
	
577
	/*
697
	/*
578
	 * Localite en cours
698
	 * Localite en cours 
579
	 * 
699
	 * 
580
	 */
700
	 */
581
 
701
	
Line -... Line 702...
-
 
702
	public void setLocalite(String location) {
-
 
703
		this.localite = location;
582
	public void setLocalite(String location) {
704
	}
583
		this.localite = location;
705
 
584
	}
706
 
585
 
707
	
Line 586... Line 708...
586
	/*
708
	/*
587
	 * Lieudit en cours
709
	 * Lieudit en cours 
588
	 * 
710
	 * 
Line -... Line 711...
-
 
711
	 */
-
 
712
 
589
	 */
713
	public void setLieudit(String lieudit) {
590
 
714
		this.lieudit = lieudit;
591
	public void setLieudit(String lieudit) {
715
	}
592
		this.lieudit = lieudit;
716
 
-
 
717
	
Line 593... Line 718...
593
	}
718
	
594
 
719
	/*
595
	/*
720
	 * Date en cours 
Line -... Line 721...
-
 
721
	 * 
596
	 * Date en cours
722
	 */
597
	 * 
723
	
598
	 */
724
 
Line 599... Line 725...
599
 
725
	public void setAnnee(String year) {
600
	public void setAnnee(String year) {
726
		this.annee = year;
601
		this.annee = year;
727
	}
Line -... Line 728...
-
 
728
 
602
	}
729
 
603
 
730
	public void setMois(String month) {
604
	public void setMois(String month) {
731
		this.mois = month;
605
		this.mois = month;
732
	}
-
 
733
 
Line -... Line 734...
-
 
734
	public void setJour(String day) {
606
	}
735
		this.jour = day;
607
 
736
	}
608
	public void setJour(String day) {
737
 
Line 609... Line -...
609
		this.jour = day;
-
 
Line -... Line 738...
-
 
738
	
-
 
739
	/*
-
 
740
	 * Utilisateur en cours 
-
 
741
	 * 
610
	}
742
	 */
Line 611... Line 743...
611
 
743
	
612
	/*
744
 
-
 
745
	
613
	 * Utilisateur en cours
746
	public void setUser(String user) {
614
	 * 
747
		this.user = user;
615
	 */
748
	}
-
 
749
 
-
 
750
 
-
 
751
	public void displayFilter() {
616
 
752
		
617
	public void setUser(String user) {
753
		
618
		this.user = user;
754
	
619
	}
755
	// Mise a jour boutton export feuille de calcul
-
 
756
 
-
 
757
		/*
620
 
758
	observationMediateur.getActionView().getExportButton().setHTML("<a href=\""+observationMediateur.getServiceBaseUrl()+"/InventoryExport/" 
621
	public void displayFilter() {
759
			+  user + "/"
622
 
760
			+ URL.encodeComponent(identifiantLocalite) + "/"
623
		// Mise a jour boutton export feuille de calcul
761
			+ URL.encodeComponent(localite) + "/"
-
 
762
			+ URL.encodeComponent(lieudit)+ "/"
624
 
763
			+ annee + "/"
625
		/*
764
			+ mois  + "/"
626
		 * observationMediateur.getActionView().getExportButton().setHTML("<a
765
			+ jour 
627
		 * href=\""+observationMediateur.getServiceBaseUrl()+"/InventoryExport/" +
-
 
628
		 * user + "/" + URL.encodeComponent(identifiantLocalite) + "/" +
-
 
629
		 * URL.encodeComponent(localite) + "/" + URL.encodeComponent(lieudit)+
-
 
630
		 * "/" + annee + "/" + mois + "/" + jour + "\">"+"Export&nbsp;tableur</a>");
766
			+ "\">"+"Export&nbsp;tableur</a>");
631
		 * 
-
 
632
		 */
-
 
633
		// Mise a jour ligne de selection
-
 
634
 
-
 
635
		String dep;
767
 
636
		if (identifiantLocalite.compareTo("all") == 0) {
-
 
637
			dep = "Tous d&eacute;partements";
-
 
638
		} else {
-
 
639
			if (identifiantLocalite.compareTo("000null") == 0) {
768
	*/
640
				dep = "D&eacute;partements non renseign&eacute;es ";
-
 
641
			} else {
769
	// Mise a jour ligne de selection 
-
 
770
	
642
				dep = "Département " + identifiantLocalite;
771
	
643
			}
772
	
644
		}
773
	String dep;
-
 
774
	if (identifiantLocalite.compareTo("all")==0) {
645
 
775
		dep="Tous d&eacute;partements";
646
		String com;
776
	}
-
 
777
	else {
647
		if (localite.compareTo("all") == 0) {
778
		if (identifiantLocalite.compareTo("000null")==0) {
648
			com = ", toutes communes";
779
			dep="D&eacute;partements non renseign&eacute;es ";
649
		} else {
780
		}
650
			if (localite.compareTo("000null") == 0) {
-
 
651
				com = ", communes non renseign&eacute;es";
-
 
652
			} else {
-
 
653
				com = ", commune de " + localite;
781
		else {
654
			}
-
 
655
		}
782
		dep="Département "+identifiantLocalite;
656
 
-
 
657
		String lieu;
-
 
658
 
-
 
659
		if (lieudit.compareTo("all") == 0) {
783
		}
660
			lieu = ", tous lieux dits";
784
	}
-
 
785
	
Line -... Line 786...
-
 
786
	
-
 
787
	
-
 
788
	String com;
-
 
789
	if (localite.compareTo("all")==0) {
-
 
790
		com=", toutes communes";
-
 
791
	}
-
 
792
	else {
-
 
793
		if (localite.compareTo("000null")==0) {
-
 
794
			com=", communes non renseign&eacute;es";
-
 
795
		}
-
 
796
		else {
661
		} else {
797
		com=", commune de "+localite;
-
 
798
		}
-
 
799
	}
-
 
800
 
-
 
801
	
-
 
802
	
-
 
803
	String lieu;
-
 
804
	
-
 
805
	if (lieudit.compareTo("all")==0) {
-
 
806
		lieu=", tous lieux dits";
-
 
807
	}
-
 
808
	else {
-
 
809
		if (lieudit.compareTo("000null")==0) {
-
 
810
			lieu=", lieu-dit non renseign&eacute;es";
-
 
811
		}
-
 
812
		else {
-
 
813
			lieu=", lieu-dit "+ lieudit;
-
 
814
		}
-
 
815
	}
-
 
816
	
-
 
817
	String dat;
-
 
818
	
-
 
819
	if ((annee.compareTo("all")==0) && (mois.compareTo("all")==0) && (jour.compareTo("all")==0)) {
-
 
820
		dat=", toutes periodes";
-
 
821
	}
-
 
822
	
-
 
823
	else {
-
 
824
	
-
 
825
    	String yea="";
-
 
826
       	String da="";
-
 
827
       	String mont="";
-
 
828
       	
-
 
829
    	if (annee.compareTo("all")==0) {
-
 
830
    		yea=", toutes ann&eacute;es";
-
 
831
    	}
-
 
832
    	else {
-
 
833
    		if (annee.compareTo("0")==0) {
-
 
834
    			yea=", periode non renseign&eacute;e";
-
 
835
    		}
-
 
836
    		else {
-
 
837
    			yea=", "+ annee;
-
 
838
    
-
 
839
            	if (mois.compareTo("all")==0) {
-
 
840
            		mont=", tous mois";
-
 
841
            	}
-
 
842
            	else {
-
 
843
            			mont="/"+ mois;
Line 662... Line -...
662
			if (lieudit.compareTo("000null") == 0) {
-
 
663
				lieu = ", lieu-dit non renseign&eacute;es";
-
 
-
 
844
            	}
664
			} else {
845
            
Line 665... Line -...
665
				lieu = ", lieu-dit " + lieudit;
-
 
666
			}
-
 
667
		}
-
 
668
 
-
 
669
		String dat;
-
 
670
 
-
 
671
		if ((annee.compareTo("all") == 0) && (mois.compareTo("all") == 0)
-
 
Line 672... Line -...
672
				&& (jour.compareTo("all") == 0)) {
-
 
673
			dat = ", toutes periodes";
-
 
674
		}
846
            
675
 
-
 
676
		else {
847
            	if (jour.compareTo("all")==0) {
Line 677... Line -...
677
 
-
 
678
			String yea = "";
-
 
679
			String da = "";
-
 
680
			String mont = "";
-
 
681
 
-
 
682
			if (annee.compareTo("all") == 0) {
-
 
683
				yea = ", toutes ann&eacute;es";
-
 
Line 684... Line -...
684
			} else {
-
 
Line -... Line 848...
-
 
848
            		da=", tous jours";
-
 
849
            	}
-
 
850
            	else {
-
 
851
            			da="/"+ jour;
-
 
852
            	}
-
 
853
    		}
-
 
854
    	}
-
 
855
            	
-
 
856
        dat=yea + mont + da;
-
 
857
    	
-
 
858
	}
-
 
859
 
-
 
860
	
-
 
861
	//panel.getHeader().setText(dep + com + lieu + dat);
-
 
862
 
-
 
863
 
685
				if (annee.compareTo("0") == 0) {
864
	
686
					yea = ", periode non renseign&eacute;e";
-
 
687
				} else {
-
 
688
					yea = ", " + annee;
-
 
689
 
865
}
-
 
866
 
Line 690... Line -...
690
					if (mois.compareTo("all") == 0) {
-
 
691
						mont = ", tous mois";
-
 
692
					} else {
-
 
693
						mont = "/" + mois;
-
 
694
					}
-
 
695
 
-
 
696
					if (jour.compareTo("all") == 0) {
-
 
697
						da = ", tous jours";
-
 
698
					} else {
-
 
699
						da = "/" + jour;
-
 
700
					}
-
 
701
				}
-
 
702
			}
-
 
Line 703... Line 867...
703
 
867
 
Line 704... Line -...
704
			dat = yea + mont + da;
-
 
705
 
-
 
706
		}
-
 
707
 
-
 
708
		// panel.getHeader().setText(dep + com + lieu + dat);
-
 
709
 
-
 
710
	}
-
 
711
 
-
 
712
	// / EVENEMENTS
-
 
713
 
-
 
714
	/**
-
 
715
	 * Evenements
-
 
716
	 * 
-
 
717
	 */
-
 
718
	/*
-
 
719
	 * public void handleEvent(BaseEvent be) { switch (be.type) { case
-
 
720
	 * ObservationMediateur.NOMBRE_OBSERVATION: gotoEnd();
-
 
721
	 * getListeObservation(); break; case
-
 
722
	 * ObservationMediateur.LISTE_OBSERVATION: afficherListeObservation();
-
 
723
	 * break; } }
-
 
724
	 */
-
 
725
 
-
 
726
}
-
 
727
 
-
 
728
/*
-
 
729
 * +--Fin du code
868
 
-
 
869
	/// EVENEMENTS 
-
 
870
	
-
 
871
/**
-
 
872
 * Evenements
-
 
873
 * 
-
 
874
 */	
-
 
875
	/*
-
 
876
	public void handleEvent(BaseEvent be) {
-
 
877
		switch (be.type) {
-
 
878
			case ObservationMediateur.NOMBRE_OBSERVATION:
-
 
879
				gotoEnd();
-
 
880
				getListeObservation();	
-
 
881
				break;
-
 
882
			case ObservationMediateur.LISTE_OBSERVATION:
-
 
883
				afficherListeObservation();
-
 
884
				break;
-
 
885
		}
-
 
886
	}
-
 
887
*/
-
 
888
 
-
 
889
 
-
 
890
}
-
 
891
 
-
 
892
/* +--Fin du code ---------------------------------------------------------------------------------------+
-
 
893
* $Log$
-
 
894
* Revision 1.4  2008-11-13 11:27:05  ddelon
-
 
895
* Reecriture gwt-ext
-
 
896
*
-
 
897
* Revision 1.3  2008-06-17 14:16:16  aperonnet
-
 
898
* *** empty log message ***
730
 * ---------------------------------------------------------------------------------------+
899
*