Subversion Repositories eFlore/Applications.cel

Rev

Rev 7 | Show entire file | Regard 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 -... Line 39...
-
 
39
 */
37
 */
40
 
Line 38... Line 41...
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;
-
 
53
import com.google.gwt.user.client.ui.Widget;
Line 48... Line 54...
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
Line -... Line 60...
-
 
60
		 {
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
 
Line -... Line 66...
-
 
66
		
57
	private class NavBar extends Composite implements ClickListener {
67
		public final DockPanel bar = new DockPanel();
Line 58... Line 68...
58
 
68
		
Line 59... Line 69...
59
		public final DockPanel bar = new DockPanel();
69
 
Line 60... Line 70...
60
 
70
		public final Button gotoFirst = new Button("<<", this);
Line 61... Line 71...
61
		public final Button gotoFirst = new Button("<<", this);
71
		public final Button gotoNext = new Button(">", this);
62
		public final Button gotoNext = new Button(">", this);
72
		public final Button gotoPrev = new Button("<", this);
63
		public final Button gotoPrev = new Button("<", this);
-
 
64
		public final Button gotoEnd = new Button(">>", this);
73
		public final Button gotoEnd = new Button(">>", this);
65
		public final Label status = new Label();
-
 
-
 
74
		public final Label status = new Label();
Line 66... Line 75...
66
 
75
		
67
		public NavBar() {
76
 
68
 
77
		public NavBar() {
69
			initWidget(bar);
78
			
Line 70... Line 79...
70
 
79
			initWidget(bar);
Line -... Line 80...
-
 
80
			
71
			status.setWordWrap(false);
81
			status.setWordWrap(false);
Line -... Line 82...
-
 
82
 
72
 
83
			HorizontalPanel buttons = new HorizontalPanel();
73
			HorizontalPanel buttons = new HorizontalPanel();
84
			
74
 
85
			buttons.add(status);
75
			buttons.add(status);
86
			buttons.setCellHorizontalAlignment(status, HasHorizontalAlignment.ALIGN_RIGHT);
76
			buttons.setCellHorizontalAlignment(status,
87
			buttons.setCellVerticalAlignment(status, HasVerticalAlignment.ALIGN_MIDDLE);
Line 140... Line 151...
140
	private String jour = "all";
151
	private String jour = "all";
141
	private String rechercheLibre = "all";
152
	private String rechercheLibre = "all";
142
	private String lieudit = "all";
153
	private String lieudit = "all";
143
	private String ordre = null;
154
	private String ordre= null;
Line -... Line 155...
-
 
155
	
-
 
156
	
-
 
157
 
144
 
158
 
Line -... Line 159...
-
 
159
	public ListeObservationsVue(ObservationMediateur observationMediateur) {
145
	public ListeObservationsVue(ObservationMediateur observationMediateur) {
160
		
Line 146... Line 161...
146
 
161
		
Line -... Line 162...
-
 
162
		// Traitement contexte utilisateur et service
147
		// Traitement contexte utilisateur et service
163
 
148
 
164
		this.observationMediateur=observationMediateur;
Line -... Line 165...
-
 
165
 
149
		this.observationMediateur = observationMediateur;
166
	    
Line 150... Line 167...
150
 
167
	//    panel= new ContentPanel(Style.HEADER);
151
		// panel= new ContentPanel(Style.HEADER);
168
	  //  panel.setLayout(new FillLayout());
Line -... Line 169...
-
 
169
	    
152
		// panel.setLayout(new FillLayout());
170
	    
Line -... Line 171...
-
 
171
	    // Barre navigation integree au header 
153
 
172
	    
Line 154... Line 173...
154
		// Barre navigation integree au header
173
		navBar = new NavBar();
Line 155... Line 174...
155
 
174
	//	panel.getHeader().addWidget(navBar);
156
		navBar = new NavBar();
175
 
157
		// panel.getHeader().addWidget(navBar);
176
		
158
 
177
		//  Contenu :
159
		// Contenu :
178
		
160
 
179
		
161
		// Colonnes :
180
		//  Colonnes :
162
 
181
		
163
		// TableColumn[] columns = new TableColumn[6];
182
//		TableColumn[] columns = new TableColumn[6]; 
164
 
183
		
165
		// TODO : renderer date, alignement etc
184
		// TODO : renderer date, alignement etc
166
		/*
185
	/*	
167
		 * columns[0] = new TableColumn("etat","Aransmis", 50);
186
		columns[0] = new TableColumn("etat","Transmis", 50);  
168
		 * 
187
 
169
		 * columns[1] = new TableColumn("nom","Nom saisi", 250);
188
		columns[1] = new TableColumn("nom","Nom saisi", 250);  
170
		 * 
189
		
-
 
190
		columns[2] = new TableColumn("nomr","Nom retenu", 250);  
171
		 * columns[2] = new TableColumn("nomr","Nom retenu", 250);
191
 
172
		 * 
192
		columns[3] = new TableColumn("lieu","Lieu", 350);  
173
		 * columns[3] = new TableColumn("lieu","Lieu", 350);
193
 
174
		 * 
194
		columns[4] = new TableColumn("date","Date", 75);  
175
		 * columns[4] = new TableColumn("date","Date", 75);
195
 
176
		 * 
196
		columns[5] = new TableColumn("ordre","Ordre", 50);  
177
		 * columns[5] = new TableColumn("ordre","Ordre", 50);
197
		
178
		 * 
198
	
-
 
199
		TableColumnModel cm = new TableColumnModel(columns);  
179
		 * 
200
		
180
		 * TableColumnModel cm = new TableColumnModel(columns);
201
		// Table : 
181
		 *  // Table :
202
		
182
		 * 
203
		table = new Table(Style.MULTI | Style.HORIZONTAL, cm);  
183
		 * table = new Table(Style.MULTI | Style.HORIZONTAL, cm);
204
		table.setBorders(false);  
-
 
205
		
-
 
206
		
184
		 * table.setBorders(false);
207
		panel.add(table);
185
		 * 
208
		
186
		 * 
209
		
-
 
210
 
-
 
211
		// Selection d'une ligne 
187
		 * panel.add(table);
212
		table.addListener(Events.RowClick, new Listener() {
188
		 * 
213
 
-
 
214
		      public void handleEvent(BaseEvent be) {
189
		 * 
215
		        TableItem item=(TableItem) be.item;
190
		 *  // Selection d'une ligne table.addListener(Events.RowClick, new
216
		        if (item!=null) {
-
 
217
		        	if (ordre==null) { // Affichage de la ligne selectionne
-
 
218
		        		ordre= (String) item.getValue(5);
191
		 * Listener() {
219
	//	        		observationMediateur.onInventoryItemSelected(ordre);
192
		 * 
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
193
		 * public void handleEvent(BaseEvent be) { TableItem item=(TableItem)
224
		        			ordre=null;
-
 
225
		        			table.deselect(be.rowIndex);
-
 
226
		//        			observationMediateur.onInventoryItemUnselected();
194
		 * be.item; if (item!=null) { if (ordre==null) { // Affichage de la
227
		        		}
Line 195... Line 228...
195
		 * ligne selectionne ordre= (String) item.getValue(5); //
228
		        		else {
Line -... Line 229...
-
 
229
			        		ordre= (String) item.getValue(5); // C'est une autre, on la selectionne
196
		 * observationMediateur.onInventoryItemSelected(ordre); } else { // Si
230
//		        			observationMediateur.onInventoryItemSelected(ordre);
Line -... Line 231...
-
 
231
		        		}
197
		 * une ligne etait deja selectionne if (ordre.compareTo((String)
232
		        		
198
		 * item.getValue(5))==0) { // C'est la meme, on la deselectionne
233
		        	}
199
		 * ordre=null; table.deselect(be.rowIndex); //
-
 
200
		 * observationMediateur.onInventoryItemUnselected(); } else { ordre=
234
		        }
201
		 * (String) item.getValue(5); // C'est une autre, on la selectionne //
235
		      }
Line 202... Line 236...
202
		 * observationMediateur.onInventoryItemSelected(ordre); }
236
		});
203
		 *  } } } });
237
		*/
-
 
238
	
204
		 */
239
	// initWidget(panel);
205
 
240
 
206
		// initWidget(panel);
241
 
207
 
242
	}
208
	}
243
	
209
 
244
	
210
	/**
245
	/**
-
 
246
	 * Suppression d'un ensemble d'element de la liste d'inventaire, on garde ici car s'applique a plusieurs elements
211
	 * Suppression d'un ensemble d'element de la liste d'inventaire, on garde
247
	 * 
212
	 * ici car s'applique a plusieurs elements
248
	 */
213
	 * 
249
 
214
	 */
250
	public void deleteElement() {
215
 
251
/*
-
 
252
		setStatusDisabled();
216
	public void deleteElement() {
253
		TableItem[] selection=table.getSelection();
217
		/*
254
 
218
		 * setStatusDisabled(); TableItem[] selection=table.getSelection();
255
		StringBuffer ids=new StringBuffer();
-
 
256
		for (int i = 0; i < selection.length; i++) {
-
 
257
			ids.append((String)(((TableItem) selection[i]).getValue(5)));
219
		 * 
258
			if (i<(selection.length-1)) ids.append(",");
-
 
259
		} 
220
		 * StringBuffer ids=new StringBuffer(); for (int i = 0; i <
260
		
221
		 * selection.length; i++) { ids.append((String)(((TableItem)
261
		if (ids.length()>0) {
222
		 * selection[i]).getValue(5))); if (i<(selection.length-1))
262
			
Line -... Line 263...
-
 
263
			HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + user
-
 
264
							+ "/" + ids.toString(), "action=DELETE",
-
 
265
							
223
		 * ids.append(","); }
266
							new ResponseTextHandler() {
224
		 * 
267
								public void onCompletion(String str) {
225
		 * if (ids.length()>0) {
-
 
226
		 * 
268
	//										observationMediateur.onInventoryUpdated(identifiantLocalite,"all","all");
Line -... Line 269...
-
 
269
		//									observationMediateur.getEntryView().clear();
227
		 * HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + user + "/" +
270
								}
Line 228... Line 271...
228
		 * ids.toString(), "action=DELETE",
271
							});
Line 229... Line -...
229
		 * 
-
 
230
		 * new ResponseTextHandler() { public void onCompletion(String str) { //
272
		}
231
		 * observationMediateur.onInventoryUpdated(identifiantLocalite,"all","all"); //
273
	
232
		 * observationMediateur.getEntryView().clear(); } }); }
274
		setStatusEnabled();
233
		 * 
275
*/
234
		 * setStatusEnabled();
276
	}
235
		 */
277
	
236
	}
278
	
-
 
279
	
237
 
280
	
238
	/**
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
 
-
 
285
	
242
 
286
	public void transmitElement() {
243
	public void transmitElement() {
287
	
-
 
288
		setStatusDisabled();
-
 
289
		
244
 
290
/*		TableItem[] selection=table.getSelection();
-
 
291
 
245
		setStatusDisabled();
292
		StringBuffer ids=new StringBuffer();
246
 
293
		for (int i = 0; i < selection.length; i++) {
247
		/*
294
			ids.append((String)(((TableItem) selection[i]).getValue(5)));
248
		 * TableItem[] selection=table.getSelection();
295
			if (i<(selection.length-1)) ids.append(",");
Line -... Line 296...
-
 
296
		} 
249
		 * 
297
	
250
		 * StringBuffer ids=new StringBuffer(); for (int i = 0; i <
298
		if (ids.length()>0) {
251
		 * selection.length; i++) { ids.append((String)(((TableItem)
-
 
252
		 * selection[i]).getValue(5))); if (i<(selection.length-1))
299
		
253
		 * ids.append(","); }
300
			HTTPRequest.asyncPost(serviceBaseUrl + "/InventoryTransmit/" + user
Line 254... Line 301...
254
		 * 
301
							+ "/" + ids.toString(), "transmission=1",
Line 255... Line 302...
255
		 * if (ids.length()>0) {
302
							
Line 256... Line 303...
256
		 * 
303
							new ResponseTextHandler() {
257
		 * HTTPRequest.asyncPost(serviceBaseUrl + "/InventoryTransmit/" + user +
304
								public void onCompletion(String str) {
258
		 * "/" + ids.toString(), "transmission=1",
-
 
259
		 * 
-
 
260
		 * new ResponseTextHandler() { public void onCompletion(String str) {
-
 
261
		 * getListeObservation(); // Pour affichage logo } }); }
-
 
-
 
305
											getListeObservation(); // Pour affichage logo 
Line 262... Line 306...
262
		 * 
306
								}
Line 263... Line 307...
263
		 * setStatusEnabled();
307
							});
264
		 * 
308
		}
Line 292... Line 336...
292
	 */
336
	 */
Line 293... Line 337...
293
 
337
 
Line 294... Line 338...
294
	public void getListeObservation() {
338
	public void getListeObservation() {
295
 
339
 
296
		// observationMediateur.addListener(ObservationMediateur.LISTE_OBSERVATION,this);
-
 
297
		observationMediateur.getListeObservation(identifiantLocalite, localite,
-
 
298
				annee, mois, jour, lieudit, rechercheLibre, startIndex,
-
 
Line 299... Line 340...
299
				VISIBLE_TAXON_COUNT); // Retour dans handlevent()
340
	//	observationMediateur.addListener(ObservationMediateur.LISTE_OBSERVATION,this);
Line 300... Line 341...
300
										// LISTE_OBSERVATION
341
	//	observationMediateur.getListeObservation(identifiantLocalite,localite,annee, mois, jour ,lieudit,rechercheLibre, startIndex, VISIBLE_TAXON_COUNT); // Retour dans handlevent() LISTE_OBSERVATION
Line 301... Line 342...
301
 
342
		
302
	}
-
 
303
 
343
	}
304
	public void afficherListeObservation() {
344
	
Line 305... Line 345...
305
 
345
	public void afficherListeObservation() {
306
		Observation[] listeObservation = observationMediateur.getObservation()
346
 
307
				.getListeObservation();
347
//		Observation[] listeObservation =observationMediateur.getObservation().getListeObservation();
308
 
348
		/*
309
		for (int i = 0; i < listeObservation.length; i++) {
349
		for (int i=0;i<listeObservation.length;i++) {
310
 
350
		
311
			Object[] values = new Object[6];
351
			Object[] values = new Object[6];
312
			values[0] = "0";
352
			values[0]="0";
313
			values[2] = "2";
353
			values[2]="2";
Line 314... Line 354...
314
			values[3] = "3";
354
			values[3]="3";
Line 315... Line 355...
315
			values[4] = "4";
355
			values[4]="4";
Line 316... Line 356...
316
			values[5] = "5";
356
			values[5]="5";
317
			values[1] = listeObservation[i].getNomSaisi();
357
			values[1]=listeObservation[i].getNomSaisi();
318
 
358
			*/
319
			// table.add(new TableItem(values));
-
 
320
 
-
 
321
		}
359
    	//	table.add(new TableItem(values));
322
 
-
 
323
		// Ligne d'information
-
 
324
 
360
			
325
		// Toutes date par defaut
361
		}
326
		/*
362
		
327
		 * 
363
//      Ligne d'information 
328
		 * HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user +
364
 
329
		 * "/" + identifiantLocalite + "/" + URL.encodeComponent(localite) +"/" +
365
		// Toutes date par defaut
330
		 * annee + "/" + mois + "/" + jour + "/" +
366
/*		
-
 
367
 
331
		 * URL.encodeComponent(rechercheLibre) + "/" +
368
		HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + identifiantLocalite + "/" + URL.encodeComponent(localite) +"/" + annee  + "/"  + mois  + "/"  + jour   + "/" + URL.encodeComponent(rechercheLibre) + "/" + URL.encodeComponent(lieudit) + "/"
332
		 * URL.encodeComponent(lieudit) + "/" + startIndex + "/" +
369
				+ startIndex + "/" + VISIBLE_TAXON_COUNT,
333
		 * VISIBLE_TAXON_COUNT,
370
 
334
		 * 
371
		new ResponseTextHandler() {
335
		 * new ResponseTextHandler() {
372
 
336
		 * 
373
			public void onCompletion(String str) {
337
		 * public void onCompletion(String str) {
374
 
338
		 * 
375
				JSONValue jsonValue = JSONParser.parse(str);
339
		 * JSONValue jsonValue = JSONParser.parse(str); JSONArray jsonArray;
376
				JSONArray jsonArray;
340
		 * JSONArray jsonArrayNested;
377
				JSONArray jsonArrayNested;
341
		 * 
378
				
342
		 * int i=0;
379
				int i=0;
343
		 * 
380
 
344
		 * if ((jsonArray = jsonValue.isArray()) != null) {
381
				if ((jsonArray = jsonValue.isArray()) != null) {
345
		 * 
382
					
-
 
383
					StringBuffer lieu=null;
346
		 * StringBuffer lieu=null;
384
 
347
		 * 
385
					int arraySize = jsonArray.size();
348
		 * int arraySize = jsonArray.size();
386
					
349
		 * 
387
					for (i = 0; i < arraySize; ++i) {
350
		 * for (i = 0; i < arraySize; ++i) { if ((jsonArrayNested =
-
 
351
		 * jsonArray.get(i).isArray()) != null) {
388
						if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
352
		 * 
389
							
353
		 * 
390
 
354
		 * Object[] values = new Object[6];
391
							Object[] values = new Object[6];
355
		 * 
392
							
356
		 *  // Statut Observation transmise ?
-
 
357
		 * 
393
													
358
		 * String atransmit=((JSONString) jsonArrayNested
-
 
359
		 * .get(13)).stringValue();
394
							// Statut Observation transmise ?
360
		 * 
395
							
361
		 * if (atransmit.compareTo("1")==0) { values[0] = new Image("tela.gif"); }
-
 
362
		 * else { values[0] = new HTML("&nbsp;"); }
-
 
363
		 * 
396
							String atransmit=((JSONString) jsonArrayNested .get(13)).stringValue();
364
		 *  // Nom saisi
-
 
365
		 * 
-
 
366
		 * values[1] = new HTML("<b>"+Util.toCelString(((JSONString)
-
 
367
		 * jsonArrayNested .get(0)).toString())+"</b>");
397
							
368
		 * 
398
							if (atransmit.compareTo("1")==0) {
369
		 * 
399
								values[0] = new Image("tela.gif");
370
		 *  // Nom retenu String aname=Util.toCelString(((JSONString)
-
 
-
 
400
							}
-
 
401
							else {
371
		 * jsonArrayNested .get(2)).toString());
402
								values[0] = new HTML("&nbsp;");
372
		 * 
403
							}
373
		 * if (aname.compareTo("null")==0) { values[2] = new HTML("&nbsp;"); }
-
 
374
		 * else { values[2] = new HTML(aname); } /*
404
							
375
		 *  /* // Num nomenclatural String ann=((JSONString) jsonArrayNested
405
						
376
		 * .get(3)).stringValue();
406
							// Nom saisi
377
		 * 
407
							
378
		 * if (ann.compareTo("0")!=0) { observationText.append(""+ann+"-"); }
-
 
379
		 * else { observationText.append("0-"); }
-
 
380
		 * 
408
							values[1] = new HTML("<b>"+Util.toCelString(((JSONString) jsonArrayNested .get(0)).toString())+"</b>");
381
		 *  // Num Taxonomique
-
 
382
		 * 
-
 
383
		 * String ant=((JSONString) jsonArrayNested .get(4)).stringValue();
409
							
384
		 * 
-
 
385
		 * if (ant.compareTo("0")!=0) { observationText.append(ant+", "); } else {
410
							
386
		 * observationText.append("0, "); }
411
 
387
		 *  // Famille
412
							// Nom retenu
388
		 * 
-
 
-
 
413
							String aname=Util.toCelString(((JSONString) jsonArrayNested .get(2)).toString());
389
		 * 
414
							
390
		 * String afamily=Util.toCelString(((JSONString) jsonArrayNested
415
							if (aname.compareTo("null")==0) {
391
		 * .get(5)).toString());
-
 
392
		 * 
416
								values[2] = new HTML("&nbsp;");
393
		 * if (afamily.compareTo("null")==0) { // } else {
-
 
394
		 * observationText.append(afamily+", "); }
417
							}
395
		 */
418
							else {
396
		/*
-
 
397
		 *  // Localisation - Lieu
-
 
398
		 * 
419
								values[2] = new HTML(aname);
399
		 * lieu=new StringBuffer();
420
							}
400
		 * 
-
 
401
		 * String aloc=Util.toCelString(((JSONString) jsonArrayNested
-
 
402
		 * .get(6)).toString());
-
 
403
		 * 
-
 
404
		 * if (aloc.compareTo("000null")==0) { if (lieu.length()==0) {
-
 
405
		 * lieu.append("Commune absente"); } else { lieu.append("commune
-
 
406
		 * absente"); } } else { if (lieu.length()==0) { lieu.append("Commune de
-
 
407
		 * "+aloc); } else { lieu.append("commune de "+aloc); }
-
 
408
		 *  }
421
							/*
409
		 * 
-
 
410
		 * 
-
 
411
		 * String alieudit=Util.toCelString(((JSONString) jsonArrayNested
422
							 
412
		 * .get(9)).toString());
423
							 /*
413
		 *  // Localisation - Lieu dit
424
							// Num nomenclatural
414
		 * 
-
 
415
		 * if (alieudit.compareTo("000null")!=0) { lieu.append(", "+alieudit); }
425
							String ann=((JSONString) jsonArrayNested .get(3)).stringValue();
416
		 * 
426
							
417
		 *  // Station -
427
							if (ann.compareTo("0")!=0) {
418
		 * 
428
								observationText.append(""+ann+"-");
419
		 * String astation=Util.toCelString(((JSONString) jsonArrayNested
-
 
420
		 * .get(10)).toString());
-
 
421
		 * 
429
							}
422
		 * 
430
							else {
423
		 * if (astation.compareTo("000null")!=0) { lieu.append(", "+astation); }
-
 
424
		 * 
-
 
425
		 *  // Milieu
431
								observationText.append("0-");
426
		 * 
-
 
427
		 * String amilieu=Util.toCelString(((JSONString) jsonArrayNested
-
 
428
		 * .get(11)).toString());
432
							}
429
		 * 
433
							
430
		 * 
434
							
431
		 * if (amilieu.compareTo("000null")!=0) { lieu.append(", "+amilieu); }
-
 
432
		 * 
435
							// Num Taxonomique
433
		 * String acomment=Util.toCelString(((JSONString) jsonArrayNested
436
							
434
		 * .get(12)).toString()); // Commentaire
-
 
435
		 * 
-
 
436
		 * if (acomment.compareTo("null")!=0) { lieu.append(", "+acomment); }
-
 
437
		 * 
437
							String ant=((JSONString) jsonArrayNested .get(4)).stringValue();
438
		 * 
-
 
439
		 * if (lieu.toString().compareTo("")==0) { values[3] = new
438
							
440
		 * HTML("&nbsp;"); } else { values[3] = new HTML(lieu.toString()); }
439
							if (ant.compareTo("0")!=0) {
441
		 * 
440
								observationText.append(ant+", ");
442
		 * 
-
 
443
		 * String adate=((JSONString) jsonArrayNested .get(8)).stringValue();
-
 
444
		 *  // Date if (adate.compareTo("0000-00-00 00:00:00")!=0) {
-
 
445
		 * values[4]=new HTML("<b>"+adate+"</b>"); } else { values[4] = new
-
 
446
		 * HTML("&nbsp;"); }
-
 
447
		 * 
-
 
448
		 * 
441
							}
449
		 * 
-
 
450
		 * String aordre=((JSONString) jsonArrayNested.get(7)).stringValue();
-
 
451
		 *  // Numero d'ordre (cache)
-
 
452
		 * 
-
 
453
		 * values[5] = aordre;
-
 
454
		 * 
-
 
455
		 * 
442
							else {
456
		 * 
-
 
457
		 * 
443
								observationText.append("0, ");
458
		 * if (i>=table.getItemCount()) { TableItem item = new
444
							}
459
		 * TableItem(values); table.add(item); } else { TableItem
-
 
460
		 * item=table.getItem(i); item.setValue(0,values[0]);
-
 
461
		 * item.setValue(1,values[1]); item.setValue(2,values[2]);
-
 
462
		 * item.setValue(3,values[3]); item.setValue(4,values[4]);
445
							
463
		 * item.setValue(5,values[5]); }
446
							// Famille
464
		 *  // Spagetti if (ordre!=null) { if (aordre.compareTo(ordre)==0) {
-
 
465
		 * table.select(i); } else { table.deselect(i); } }
447
							
466
		 *  }
448
							
-
 
449
							String afamily=Util.toCelString(((JSONString) jsonArrayNested .get(5)).toString());
-
 
450
							
-
 
451
							if (afamily.compareTo("null")==0) {
-
 
452
								//
-
 
453
							}
-
 
454
							else {
-
 
455
								observationText.append(afamily+", ");
-
 
456
							}
-
 
457
							*/
-
 
458
		/*
-
 
459
		
-
 
460
//							Localisation - Lieu
-
 
461
 
-
 
462
							lieu=new StringBuffer();
-
 
463
 
-
 
464
							String aloc=Util.toCelString(((JSONString) jsonArrayNested .get(6)).toString());
-
 
465
								
-
 
466
								if (aloc.compareTo("000null")==0) {
-
 
467
									if (lieu.length()==0) {
-
 
468
										lieu.append("Commune absente");
-
 
469
									}
-
 
470
									else {
-
 
471
										lieu.append("commune absente");
-
 
472
									}
-
 
473
								}
-
 
474
								else {
-
 
475
									if (lieu.length()==0) {
-
 
476
										lieu.append("Commune de "+aloc);
-
 
477
									}
-
 
478
									else {
-
 
479
										lieu.append("commune de "+aloc);
-
 
480
									}
-
 
481
										
-
 
482
								}
-
 
483
							
-
 
484
								
-
 
485
								String alieudit=Util.toCelString(((JSONString) jsonArrayNested .get(9)).toString());
-
 
486
							
-
 
487
//								Localisation - Lieu dit
-
 
488
								
-
 
489
								if (alieudit.compareTo("000null")!=0) {
-
 
490
									lieu.append(", "+alieudit);
-
 
491
								}
-
 
492
								
-
 
493
								
-
 
494
//								Station -
-
 
495
								
-
 
496
								String astation=Util.toCelString(((JSONString) jsonArrayNested .get(10)).toString());
-
 
497
 
-
 
498
								
-
 
499
								if (astation.compareTo("000null")!=0) {
-
 
500
									lieu.append(", "+astation);
-
 
501
								}
-
 
502
 
-
 
503
								
-
 
504
//								Milieu
-
 
505
								
-
 
506
								String amilieu=Util.toCelString(((JSONString) jsonArrayNested .get(11)).toString());
-
 
507
 
-
 
508
								
-
 
509
								if (amilieu.compareTo("000null")!=0) {
-
 
510
									lieu.append(", "+amilieu);
-
 
511
								}								
-
 
512
							
-
 
513
								String acomment=Util.toCelString(((JSONString) jsonArrayNested .get(12)).toString());
-
 
514
//								Commentaire
-
 
515
								
-
 
516
								if (acomment.compareTo("null")!=0) {
-
 
517
									lieu.append(", "+acomment);
-
 
518
								}
-
 
519
 
-
 
520
								
-
 
521
								if (lieu.toString().compareTo("")==0) {
-
 
522
									values[3] = new HTML("&nbsp;");
-
 
523
								}
-
 
524
								else {
-
 
525
									values[3] = new HTML(lieu.toString());
-
 
526
								}
-
 
527
 
-
 
528
								
-
 
529
								String adate=((JSONString) jsonArrayNested .get(8)).stringValue();
-
 
530
								
-
 
531
//								Date 
-
 
532
								if (adate.compareTo("0000-00-00 00:00:00")!=0) {
-
 
533
									values[4]=new HTML("<b>"+adate+"</b>"); 
-
 
534
								}
-
 
535
								else { 
-
 
536
									values[4] = new HTML("&nbsp;");
-
 
537
								}
-
 
538
									
-
 
539
 
-
 
540
							
-
 
541
							String aordre=((JSONString) jsonArrayNested.get(7)).stringValue();
-
 
542
						
-
 
543
							// Numero d'ordre (cache)
-
 
544
							
-
 
545
							values[5] = aordre;
-
 
546
							
-
 
547
							
-
 
548
						
-
 
549
							
-
 
550
					    	if (i>=table.getItemCount()) {
-
 
551
					    		TableItem item = new TableItem(values);
-
 
552
					    		table.add(item);
-
 
553
							}
-
 
554
							else {
-
 
555
								TableItem item=table.getItem(i);
-
 
556
								item.setValue(0,values[0]);
-
 
557
								item.setValue(1,values[1]);
-
 
558
								item.setValue(2,values[2]);
-
 
559
								item.setValue(3,values[3]);
-
 
560
								item.setValue(4,values[4]);
-
 
561
								item.setValue(5,values[5]);
-
 
562
							}
-
 
563
					    	
-
 
564
					    	// Spagetti
-
 
565
							if (ordre!=null) {
Line 467... Line 566...
467
		 *  } }
566
								if (aordre.compareTo(ordre)==0) {
-
 
567
									table.select(i);
-
 
568
								}
-
 
569
								else {
-
 
570
									table.deselect(i);
-
 
571
								}
-
 
572
							}
-
 
573
							
-
 
574
						}
-
 
575
 
-
 
576
					}
-
 
577
				}
-
 
578
 
-
 
579
				// Suppression fin ancien affichage
-
 
580
				if (i<table.getItemCount()) {
-
 
581
					 for (int j = table.getItemCount() -1 ; j >= i; j--) {
-
 
582
						 TableItem item=table.getItem(j);
-
 
583
						 table.remove(item);
-
 
584
					 }
-
 
585
				}
-
 
586
				
Line 468... Line 587...
468
		 *  // Suppression fin ancien affichage if (i<table.getItemCount()) {
587
				setStatusEnabled();
469
		 * for (int j = table.getItemCount() -1 ; j >= i; j--) { TableItem
588
				
470
		 * item=table.getItem(j); table.remove(item); } }
589
				
471
		 * 
590
			}
Line 512... Line 631...
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) + " - "
635
					navBar.status.setText((startIndex + 1) + " - "
517
							+ (startIndex + VISIBLE_TAXON_COUNT) + " sur "
636
							+ (startIndex + VISIBLE_TAXON_COUNT) + " sur " + count );
518
							+ count);
-
 
519
				} else { // Derniere page
637
				} else { // Derniere page
520
					navBar.status.setText((startIndex + 1) + " - " + count
638
					navBar.status.setText((startIndex + 1) + " - " + count + " sur " + count );
521
							+ " 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) + " - "
644
					navBar.status.setText((startIndex + 1) + " - "
528
							+ (startIndex + VISIBLE_TAXON_COUNT) + " sur "
645
							+ (startIndex + VISIBLE_TAXON_COUNT) + " sur " + count);
529
							+ count);
-
 
530
				} else {
646
				} else {
531
					navBar.status.setText((startIndex + 1) + " - " + count
647
					navBar.status.setText((startIndex + 1) + " - " + count + " sur " + count);
532
							+ " sur " + count);
-
 
533
				}
648
				}
534
			}
649
			}
535
		}
650
		}
Line 536... Line 651...
536
 
651
 
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 563... Line 679...
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 
Line 570... Line 688...
570
	 * 
688
	 * 
571
	 */
689
	 */
572
 
690
	
Line -... Line 691...
-
 
691
	public void setIdLocation(String id_location) {
-
 
692
		this.identifiantLocalite = id_location;
573
	public void setIdLocation(String id_location) {
693
	}
574
		this.identifiantLocalite = id_location;
694
 
575
	}
695
 
576
 
696
	
Line 577... Line 697...
577
	/*
697
	/*
578
	 * Localite en cours
698
	 * Localite en cours 
579
	 * 
699
	 * 
Line -... Line 700...
-
 
700
	 */
-
 
701
	
580
	 */
702
	public void setLocalite(String location) {
581
 
703
		this.localite = location;
582
	public void setLocalite(String location) {
704
	}
583
		this.localite = location;
705
 
Line 584... Line 706...
584
	}
706
 
585
 
707
	
586
	/*
708
	/*
Line -... Line 709...
-
 
709
	 * Lieudit en cours 
-
 
710
	 * 
587
	 * Lieudit en cours
711
	 */
588
	 * 
712
 
589
	 */
713
	public void setLieudit(String lieudit) {
590
 
714
		this.lieudit = lieudit;
Line -... Line 715...
-
 
715
	}
591
	public void setLieudit(String lieudit) {
716
 
592
		this.lieudit = lieudit;
717
	
593
	}
718
	
Line -... Line 719...
-
 
719
	/*
594
 
720
	 * Date en cours 
595
	/*
721
	 * 
596
	 * Date en cours
722
	 */
Line 597... Line 723...
597
	 * 
723
	
598
	 */
724
 
599
 
725
	public void setAnnee(String year) {
Line -... Line 726...
-
 
726
		this.annee = year;
600
	public void setAnnee(String year) {
727
	}
601
		this.annee = year;
728
 
602
	}
729
 
603
 
730
	public void setMois(String month) {
Line -... Line 731...
-
 
731
		this.mois = month;
-
 
732
	}
604
	public void setMois(String month) {
733
 
605
		this.mois = month;
734
	public void setJour(String day) {
606
	}
735
		this.jour = day;
Line -... Line 736...
-
 
736
	}
607
 
737
 
Line -... Line 738...
-
 
738
	
-
 
739
	/*
608
	public void setJour(String day) {
740
	 * Utilisateur en cours 
Line 609... Line 741...
609
		this.jour = day;
741
	 * 
610
	}
742
	 */
-
 
743
	
611
 
744
 
612
	/*
745
	
613
	 * Utilisateur en cours
746
	public void setUser(String user) {
-
 
747
		this.user = user;
-
 
748
	}
-
 
749
 
614
	 * 
750
 
615
	 */
751
	public void displayFilter() {
616
 
752
		
617
	public void setUser(String user) {
753
		
Line -... Line 754...
-
 
754
	
-
 
755
	// Mise a jour boutton export feuille de calcul
618
		this.user = user;
756
 
619
	}
757
		/*
620
 
758
	observationMediateur.getActionView().getExportButton().setHTML("<a href=\""+observationMediateur.getServiceBaseUrl()+"/InventoryExport/" 
-
 
759
			+  user + "/"
621
	public void displayFilter() {
760
			+ URL.encodeComponent(identifiantLocalite) + "/"
622
 
761
			+ URL.encodeComponent(localite) + "/"
623
		// Mise a jour boutton export feuille de calcul
762
			+ URL.encodeComponent(lieudit)+ "/"
-
 
763
			+ annee + "/"
624
 
764
			+ mois  + "/"
625
		/*
765
			+ jour 
626
		 * observationMediateur.getActionView().getExportButton().setHTML("<a
766
			+ "\">"+"Export&nbsp;tableur</a>");
627
		 * href=\""+observationMediateur.getServiceBaseUrl()+"/InventoryExport/" +
767
 
Line -... Line 768...
-
 
768
	*/
-
 
769
	// Mise a jour ligne de selection 
628
		 * user + "/" + URL.encodeComponent(identifiantLocalite) + "/" +
770
	
629
		 * URL.encodeComponent(localite) + "/" + URL.encodeComponent(lieudit)+
771
	
630
		 * "/" + annee + "/" + mois + "/" + jour + "\">"+"Export&nbsp;tableur</a>");
772
	
-
 
773
	String dep;
631
		 * 
774
	if (identifiantLocalite.compareTo("all")==0) {
632
		 */
775
		dep="Tous d&eacute;partements";
633
		// Mise a jour ligne de selection
776
	}
-
 
777
	else {
634
 
778
		if (identifiantLocalite.compareTo("000null")==0) {
635
		String dep;
779
			dep="D&eacute;partements non renseign&eacute;es ";
636
		if (identifiantLocalite.compareTo("all") == 0) {
780
		}
637
			dep = "Tous d&eacute;partements";
781
		else {
Line -... Line 782...
-
 
782
		dep="Département "+identifiantLocalite;
-
 
783
		}
638
		} else {
784
	}
Line 639... Line 785...
639
			if (identifiantLocalite.compareTo("000null") == 0) {
785
	
640
				dep = "D&eacute;partements non renseign&eacute;es ";
786
	
-
 
787
	
641
			} else {
788
	String com;
642
				dep = "Département " + identifiantLocalite;
789
	if (localite.compareTo("all")==0) {
643
			}
790
		com=", toutes communes";
-
 
791
	}
644
		}
792
	else {
645
 
793
		if (localite.compareTo("000null")==0) {
646
		String com;
794
			com=", communes non renseign&eacute;es";
647
		if (localite.compareTo("all") == 0) {
795
		}
Line 648... Line 796...
648
			com = ", toutes communes";
796
		else {
Line 649... Line 797...
649
		} else {
797
		com=", commune de "+localite;
650
			if (localite.compareTo("000null") == 0) {
-
 
651
				com = ", communes non renseign&eacute;es";
798
		}
652
			} else {
799
	}
Line 653... Line 800...
653
				com = ", commune de " + localite;
800
 
Line 679... Line 826...
679
			String da = "";
826
       	String da="";
680
			String mont = "";
827
       	String mont="";
Line 681... Line 828...
681
 
828
       	
682
			if (annee.compareTo("all") == 0) {
829
    	if (annee.compareTo("all")==0) {
-
 
830
    		yea=", toutes ann&eacute;es";
683
				yea = ", toutes ann&eacute;es";
831
    	}
684
			} else {
832
    	else {
685
				if (annee.compareTo("0") == 0) {
833
    		if (annee.compareTo("0")==0) {
-
 
834
    			yea=", periode non renseign&eacute;e";
686
					yea = ", periode non renseign&eacute;e";
835
    		}
687
				} else {
836
    		else {
Line 688... Line 837...
688
					yea = ", " + annee;
837
    			yea=", "+ annee;
689
 
838
    
-
 
839
            	if (mois.compareTo("all")==0) {
690
					if (mois.compareTo("all") == 0) {
840
            		mont=", tous mois";
691
						mont = ", tous mois";
841
            	}
692
					} else {
842
            	else {
Line -... Line 843...
-
 
843
            			mont="/"+ mois;
693
						mont = "/" + mois;
844
            	}
694
					}
845
            
-
 
846
            
695
 
847
            	if (jour.compareTo("all")==0) {
696
					if (jour.compareTo("all") == 0) {
848
            		da=", tous jours";
697
						da = ", tous jours";
849
            	}
698
					} else {
850
            	else {
699
						da = "/" + jour;
851
            			da="/"+ jour;
Line 700... Line 852...
700
					}
852
            	}
Line 701... Line 853...
701
				}
853
    		}
Line -... Line 854...
-
 
854
    	}
702
			}
855
            	
Line -... Line 856...
-
 
856
        dat=yea + mont + da;
-
 
857
    	
703
 
858
	}
Line -... Line 859...
-
 
859
 
-
 
860
	
704
			dat = yea + mont + da;
861
	//panel.getHeader().setText(dep + com + lieu + dat);
Line 705... Line 862...
705
 
862
 
706
		}
863
 
707
 
864
	
708
		// panel.getHeader().setText(dep + com + lieu + dat);
865
}
709
 
866
 
710
	}
867
 
-
 
868
 
711
 
869
	/// EVENEMENTS 
-
 
870
	
712
	// / EVENEMENTS
871
/**
-
 
872
 * Evenements
713
 
873
 * 
-
 
874
 */	
714
	/**
875
	/*
-
 
876
	public void handleEvent(BaseEvent be) {
-
 
877
		switch (be.type) {
715
	 * Evenements
878
			case ObservationMediateur.NOMBRE_OBSERVATION:
Line -... Line 879...
-
 
879
				gotoEnd();
716
	 * 
880
				getListeObservation();	
Line 717... Line -...
717
	 */
-
 
718
	/*
-
 
719
	 * public void handleEvent(BaseEvent be) { switch (be.type) { case
881
				break;
-
 
882
			case ObservationMediateur.LISTE_OBSERVATION:
720
	 * ObservationMediateur.NOMBRE_OBSERVATION: gotoEnd();
883
				afficherListeObservation();
721
	 * getListeObservation(); break; case
-
 
722
	 * ObservationMediateur.LISTE_OBSERVATION: afficherListeObservation();
-
 
723
	 * break; } }
884
				break;
724
	 */
885
		}
725
 
886
	}
-
 
887
*/
726
}
888
 
727
 
889
 
-
 
890
}
728
/*
891
 
729
 * +--Fin du code
892
/* +--Fin du code ---------------------------------------------------------------------------------------+
-
 
893
* $Log$
730
 * ---------------------------------------------------------------------------------------+
894
* Revision 1.4  2008-11-13 11:27:05  ddelon
731
 * $Log: not supported by cvs2svn $ Revision 1.1 2008-09-19 10:27:18
895
* Reecriture gwt-ext
-
 
896
*
732
 * aperonnet Carnet en ligne, utilisant gwt 1.5 et la nouvelle version de
897
* Revision 1.3  2008-06-17 14:16:16  aperonnet
733
 * gwt-ext (plus de bugs au demarrage dans firefox, plus rapide et annotations
898
* *** empty log message ***
-
 
899
*
734
 * java)
900
* Revision 1.2  2008-06-09 16:29:01  ddelon
735
 * 
901
* import branche observation
-
 
902
*
736
 * Revision 1.3 2008-06-17 14:16:16 aperonnet *** empty log message ***
903
* Revision 1.1  2008-06-09 14:19:37  ddelon
737
 * 
904
* Initialisation observation
-
 
905
*
738
 * Revision 1.2 2008-06-09 16:29:01 ddelon import branche observation
906
* Revision 1.3  2008-04-28 13:10:43  ddelon
739
 * 
907
* Integration MyGwt
-
 
908
*
740
 * Revision 1.1 2008-06-09 14:19:37 ddelon Initialisation observation
909
* Revision 1.2  2008-01-30 08:55:40  ddelon
741
 * 
910
* fin mise en place mygwt
742
 * Revision 1.3 2008-04-28 13:10:43 ddelon Integration MyGwt
911
*