Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 28 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28 Rev 29
Line 31... Line 31...
31
package org.tela_botanica.client;
31
package org.tela_botanica.client;
Line 32... Line 32...
32
 
32
 
Line 33... Line 33...
33
import java.util.Date;
33
import java.util.Date;
-
 
34
 
-
 
35
import net.mygwt.ui.client.Style;
-
 
36
import net.mygwt.ui.client.event.BaseEvent;
34
 
37
import net.mygwt.ui.client.event.SelectionListener;
35
import net.mygwt.ui.client.Style;
38
import net.mygwt.ui.client.widget.Button;
36
import net.mygwt.ui.client.widget.ContentPanel;
39
import net.mygwt.ui.client.widget.ContentPanel;
37
import net.mygwt.ui.client.widget.WidgetContainer;
40
import net.mygwt.ui.client.widget.WidgetContainer;
Line 43... Line 46...
43
import com.google.gwt.json.client.JSONString;
46
import com.google.gwt.json.client.JSONString;
44
import com.google.gwt.json.client.JSONValue;
47
import com.google.gwt.json.client.JSONValue;
45
import com.google.gwt.user.client.HTTPRequest;
48
import com.google.gwt.user.client.HTTPRequest;
46
import com.google.gwt.user.client.History;
49
import com.google.gwt.user.client.History;
47
import com.google.gwt.user.client.ResponseTextHandler;
50
import com.google.gwt.user.client.ResponseTextHandler;
48
import com.google.gwt.user.client.ui.Button;
-
 
49
import com.google.gwt.user.client.ui.ChangeListener;
51
import com.google.gwt.user.client.ui.ChangeListener;
50
import com.google.gwt.user.client.ui.ClickListener;
-
 
51
import com.google.gwt.user.client.ui.Grid;
52
import com.google.gwt.user.client.ui.Grid;
-
 
53
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
-
 
54
import com.google.gwt.user.client.ui.HasVerticalAlignment;
52
import com.google.gwt.user.client.ui.HorizontalPanel;
55
import com.google.gwt.user.client.ui.HorizontalPanel;
53
import com.google.gwt.user.client.ui.KeyboardListener;
56
import com.google.gwt.user.client.ui.KeyboardListener;
54
import com.google.gwt.user.client.ui.Label;
57
import com.google.gwt.user.client.ui.Label;
55
import com.google.gwt.user.client.ui.PopupPanel;
58
import com.google.gwt.user.client.ui.PopupPanel;
56
import com.google.gwt.user.client.ui.TextBox;
59
import com.google.gwt.user.client.ui.TextBox;
Line 65... Line 68...
65
  private Label infoOrdre=new Label("Nouvelle observation");
68
  private Label infoOrdre=new Label("Nouvelle observation");
66
  private NameAssistant nameAssistant = null;
69
  private NameAssistant nameAssistant = null;
67
  private LocationAssistant locationAssistant = null;
70
  private LocationAssistant locationAssistant = null;
68
  private TextBox date = new TextBox();
71
  private TextBox date = new TextBox();
69
  private TextBox lieudit = new TextBox();
72
  private TextBox lieudit = new TextBox();
70
  private TextBox milieu = new TextBox();
73
  private TextBox station = new TextBox();
71
  private TextBox comment = new TextBox();
74
  private TextBox comment = new TextBox();
72
  private Button dateSelector = new Button("...");
75
  private Button dateSelector = new Button("...");
73
  private Button validButton = new Button("Ajouter");
-
 
Line 74... Line 76...
74
 
76
 
75
  boolean visible=false;
77
  boolean visible=false;
Line 107... Line 109...
107
   
109
   
Line 108... Line 110...
108
   // Declaration des elements du dialogue de saisie aupres du mediator
110
   // Declaration des elements du dialogue de saisie aupres du mediator
109
   
111
   
110
   mediator.registerDate(date);
112
   mediator.registerDate(date);
111
   mediator.registerComment(comment);
113
   mediator.registerComment(comment);
Line 112... Line 114...
112
   mediator.registerMilieu(milieu);
114
   mediator.registerStation(station);
113
   mediator.registerLieudit(lieudit);
115
   mediator.registerLieudit(lieudit);
114
   
116
   
Line 125... Line 127...
125
 
127
 
Line 126... Line 128...
126
	
128
	
127
 
129
 
Line 128... Line 130...
128
	 // Saisie Commune
130
	 // Saisie Commune
Line 129... Line 131...
129
	 
131
	 
Line 130... Line 132...
130
     observation.setHTML(2,0,"Commune: ");
132
     observation.setHTML(0,0,"Commune: ");
131
     observation.setWidget(2,1,locationAssistant);
133
     observation.setWidget(0,1,locationAssistant);
Line 132... Line 134...
132
     
134
     
Line 159... Line 161...
159
 		  }
161
 		  }
160
     );
162
     );
Line 161... Line 163...
161
 
163
 
Line 162... Line 164...
162
 
164
 
163
     
165
     
Line 164... Line 166...
164
	 // Saisie (milieu)
166
	 // Saisie (station)
Line 165... Line 167...
165
	 
167
	 
Line 166... Line 168...
166
     observation.setHTML(3,0,"Milieu: ");
168
     observation.setHTML(1,0,"Station: ");
Line 167... Line 169...
167
     observation.setWidget(3,1,milieu);
169
     observation.setWidget(1,1,station);
168
 
170
 
169
     milieu.setWidth("100%");
171
     station.setWidth("100%");
170
 
172
 
171
     
173
     
Line 172... Line 174...
172
     // Validation par entree sur cette zone de texte
174
     // Validation par entree sur cette zone de texte
Line 173... Line 175...
173
     
175
     
Line 191... Line 193...
191
     
193
     
192
     // Selecteur de Date 
194
     // Selecteur de Date 
Line 193... Line 195...
193
     // Releve 
195
     // Releve 
-
 
196
 
-
 
197
     
-
 
198
     dateSelector.addSelectionListener(
Line 194... Line -...
194
 
-
 
195
     
-
 
196
     dateSelector.addClickListener(new ClickListener () {
199
    	 
197
    
200
    	 new SelectionListener() {
198
       public void onClick(Widget w) {
201
				public void widgetSelected(BaseEvent be) { 
199
    	  
202
    
200
    	   if (visible) {
203
    	   if (visible) {
Line 230... Line 233...
230
     });
233
     });
Line 231... Line 234...
231
 
234
 
Line 232... Line 235...
232
     
235
     
233
 	// Saisie Espece 
236
 	// Saisie Espece 
Line 234... Line 237...
234
 	
237
 	
Line 235... Line 238...
235
   observation.setHTML(0,0,"Espèce: ");
238
   observation.setHTML(2,0,"Espèce: ");
Line 236... Line 239...
236
   observation.setWidget(0,1,nameAssistant);
239
   observation.setWidget(2,1,nameAssistant);
237
  
240
  
238
   nameAssistant.setWidth("100%");
241
   nameAssistant.setWidth("100%");
239
 
242
 
Line 240... Line 243...
240
   observation.setHTML(0,2,"Date: ");
243
   observation.setHTML(1,2,"Date: ");
241
    
244
    
Line 266... Line 269...
266
  
269
  
Line 267... Line 270...
267
 
270
 
268
    
271
    
Line 269... Line 272...
269
	 // Saisie Commentaire
272
	 // Saisie Commentaire
Line 270... Line 273...
270
	 
273
	 
Line 291... Line 294...
291
		  
294
		  
292
		  }
295
		  }
Line 293... Line -...
293
  );
-
 
294
    
-
 
295
 
-
 
296
    // Validation par click sur bouton valider 
-
 
297
 
-
 
298
    
-
 
299
    validButton.addClickListener(
-
 
300
    
-
 
301
    		new ClickListener() {
-
 
302
    			
-
 
303
    			  public void onClick(Widget w) {
-
 
304
    				  // Numero ordre vide : ajout d'une observation
-
 
305
    				  	if (ordre==null) {
-
 
306
    				     mediator.onAddInventoryItem(); 
-
 
307
    				  	}
-
 
308
    				  	else {
-
 
309
    				     mediator.onModifyInventoryItem(ordre); 
-
 
310
    				     ordre=null;
-
 
311
    				  	}
-
 
312
    			  }
-
 
313
    		}
-
 
314
    );
-
 
315
    
296
  );
Line 316... Line 297...
316
    
297
    
Line 332... Line 313...
332
    outer.setWidth("100%");
313
    outer.setWidth("100%");
Line 333... Line 314...
333
 
314
 
Line -... Line 315...
-
 
315
           
-
 
316
    panel.add(outer);
-
 
317
    
-
 
318
    HorizontalPanel inner=new HorizontalPanel();
-
 
319
    
-
 
320
    Button newButton=new Button("#",
-
 
321
   
-
 
322
    // Init
-
 
323
    	new SelectionListener() {
-
 
324
				public void widgetSelected(BaseEvent be) {  
-
 
325
					
-
 
326
					nameAssistant.setText("");
-
 
327
					nameAssistant.setValue(null);
-
 
328
					locationAssistant.setText("");
-
 
329
					locationAssistant.setValue(null); // Null ?
-
 
330
					date.setText(""); 
-
 
331
					lieudit.setText(""); 
-
 
332
					station.setText(""); 
-
 
333
					comment.setText(""); 
-
 
334
					ordre=null;
-
 
335
					infoOrdre.setText("Nouvelle observation");
-
 
336
 
-
 
337
	    		}
-
 
338
	     	}
-
 
339
    );
-
 
340
    
-
 
341
    inner.add(infoOrdre);
-
 
342
    inner.add(newButton);
-
 
343
 
-
 
344
	inner.setCellHorizontalAlignment(infoOrdre, HasHorizontalAlignment.ALIGN_RIGHT);
334
           
345
	inner.setCellVerticalAlignment(infoOrdre, HasVerticalAlignment.ALIGN_MIDDLE);
Line 335... Line 346...
335
    panel.add(outer);
346
    
336
    
347
    inner.setWidth("100%");
337
    panel.getHeader().addWidget(infoOrdre);
348
    panel.getHeader().addWidget(inner);
Line 414... Line 425...
414
			     infoOrdre.setText("Nouvelle observation");
425
			     infoOrdre.setText("Nouvelle observation");
415
			}
426
			}
416
			else {
427
			else {
417
			  // Modification  d'une observation
428
			  // Modification  d'une observation
418
			     mediator.onModifyInventoryItem(ordre); 
429
			     mediator.onModifyInventoryItem(ordre); 
419
  				infoOrdre.setText(ordre);
430
			 	 infoOrdre.setText("Modification de l'observation n°: "+ordre);
420
			}
431
			}
421
    }
432
    }
Line 465... Line 476...
465
							}
476
							}
466
							else { 
477
							else { 
467
								locationAssistant.setText("");
478
								locationAssistant.setText("");
468
							}
479
							}
Line -... Line 480...
-
 
480
							
-
 
481
//							 Departement
-
 
482
							String adep=Util.toCelString(((JSONString) jsonArray .get(7)).toString());
-
 
483
							
-
 
484
							if (adep.compareTo("000null")!=0) {
-
 
485
								locationAssistant.setValue(adep);
-
 
486
							}
-
 
487
							else { 
-
 
488
								locationAssistant.setValue(null);
-
 
489
							}
469
							
490
							
Line 470... Line 491...
470
							String adate=((JSONString) jsonArray .get(8)).stringValue();
491
							String adate=((JSONString) jsonArray .get(9)).stringValue();
471
							
492
							
472
//							Date 
493
//							Date 
473
							if (adate.compareTo("0000-00-00 00:00:00")!=0) {
494
							if (adate.compareTo("0000-00-00 00:00:00")!=0) {
474
								date.setText(adate); 
495
								date.setText(adate); 
475
							}
496
							}
476
							else {
497
							else {
Line -... Line 498...
-
 
498
								date.setText(""); 
-
 
499
							}
-
 
500
 
-
 
501
 
-
 
502
							String alieudit=Util.toCelString(((JSONString) jsonArray .get(10)).toString());
-
 
503
							
-
 
504
//							Lieudit 
-
 
505
							if (alieudit.compareTo("000null")!=0) {
-
 
506
								lieudit.setText(alieudit); 
-
 
507
							}
477
								date.setText(""); 
508
							else {
Line 478... Line 509...
478
							}
509
								lieudit.setText(""); 
479
 
510
							}
480
 
511
							
481
							String astation=Util.toCelString(((JSONString) jsonArray .get(9)).toString());
512
							String astation=Util.toCelString(((JSONString) jsonArray .get(11)).toString());
482
							
513
							
483
//							Station 
514
//							Station 
484
							if (astation.compareTo("000null")!=0) {
515
							if (astation.compareTo("000null")!=0) {
Line 485... Line 516...
485
								milieu.setText(astation); 
516
								station.setText(astation); 
486
							}
517
							}
487
							else {
518
							else {
488
								milieu.setText(""); 
519
								station.setText(""); 
489
							}
520
							}
490
							
521
							
Line 513... Line 544...
513
 
544
 
Line 514... Line 545...
514
}
545
}
515
 
546
 
-
 
547
/* +--Fin du code ---------------------------------------------------------------------------------------+
-
 
548
* $Log$
-
 
549
* Revision 1.1  2008-01-02 21:26:04  ddelon
516
/* +--Fin du code ---------------------------------------------------------------------------------------+
550
* mise en place mygwt
517
* $Log$
551
*
518
* Revision 1.8  2007-12-22 14:48:53  ddelon
552
* Revision 1.8  2007-12-22 14:48:53  ddelon
519
* Documentation et refactorisation
553
* Documentation et refactorisation
520
*
554
*