Subversion Repositories eFlore/Archives.cel-v1

Rev

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

Rev 25 Rev 26
1
/**
1
/**
2
 David Delon david.delon@clapas.net 2007
2
 David Delon david.delon@clapas.net 2007
3
 
-
 
4
 Ce logiciel est régi par la licence CeCILL soumise au droit français et
-
 
5
 respectant les principes de diffusion des logiciels libres. Vous pouvez
-
 
6
 utiliser, modifier et/ou redistribuer ce programme sous les conditions
-
 
7
 de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA 
-
 
8
 sur le site "http://www.cecill.info".
-
 
9
 En contrepartie de l'accessibilité au code source et des droits de copie,
-
 
10
 de modification et de redistribution accordés par cette licence, il n'est
-
 
11
 offert aux utilisateurs qu'une garantie limitée.  Pour les mêmes raisons,
-
 
12
 seule une responsabilité restreinte pèse sur l'auteur du programme,  le
-
 
13
 titulaire des droits patrimoniaux et les concédants successifs.
-
 
14
 
-
 
15
 A cet égard  l'attention de l'utilisateur est attirée sur les risques
-
 
16
 associés au chargement,  à l'utilisation,  à la modification et/ou au
-
 
17
 développement et à la reproduction du logiciel par l'utilisateur étant 
-
 
18
 donné sa spécificité de logiciel libre, qui peut le rendre complexe à 
-
 
19
 manipuler et qui le réserve donc à des développeurs et des professionnels
-
 
20
 avertis possédant  des  connaissances  informatiques approfondies.  Les
-
 
21
 utilisateurs sont donc invités à charger  et  tester  l'adéquation  du
-
 
22
 logiciel à leurs besoins dans des conditions permettant d'assurer la
-
 
23
 sécurité de leurs systèmes et ou de leurs données et, plus généralement, 
-
 
24
 à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. 
-
 
25
                                                                                                      
-
 
26
 Le fait que vous puissiez accéder à cet en-tête signifie que vous avez 
-
 
27
 pris connaissance de la licence CeCILL, et que vous en avez accepté les
-
 
28
 termes.
-
 
29
 
3
 
30
 */
4
 */
31
 
5
 
32
/*
6
/*
33
 * EntryPanel.java  (Composite de Panel)
7
 * EntryPanel.java  (Composite de Panel)
34
 * 
8
 * 
35
 * Cas d'utilisation :
9
 * Cas d'utilisation :
36
 * Saisie assistee (completion nom et completion commune) de releves. 
10
 * Saisie assistee (completion nom et completion commune) de releves. 
37
 * L'identification n'est pas obligatoire
11
 * L'identification n'est pas obligatoire
38
 *
12
 *
39
 * 1 : L'utilisateur saisit a minima un nom de plante 
13
 * 1 : L'utilisateur saisit a minima un nom de plante 
40
 * 		1: Le nom de plante provient d'une application externe : il est deduit du nuremo nomenclatural transmis en historique
14
 * 		1: Le nom de plante provient d'une application externe : il est deduit du nuremo nomenclatural transmis en historique
41
 * 2 : Le programme assiste la saisie de nom de plante ou de localite par interrogation du systeme distant
15
 * 2 : Le programme assiste la saisie de nom de plante ou de localite par interrogation du systeme distant
42
 * 3 : L'utilisateur choisi le type de mise (ajout ou modification)
16
 * 3 : L'utilisateur choisi le type de mise (ajout ou modification)
43
 * 3 : L'utilisateur valide sa saisie
17
 * 3 : L'utilisateur valide sa saisie
44
 * 4 : Le programme transmet au systeme distant la nouvelle saisie pour l'identifiant en cours
18
 * 4 : Le programme transmet au systeme distant la nouvelle saisie pour l'identifiant en cours
45
 * 5 : Le programme transmet au systeme local un evenement annoncant une nouvelle saisie
19
 * 5 : Le programme transmet au systeme local un evenement annoncant une nouvelle saisie
46
 * 
20
 * 
47
 * 
21
 * 
48
 * Affichage detail d'un observation
22
 * Affichage detail d'un observation
49
 * 1 : Le programme affiche les donnees d'inventaire pour l'identifiant enregistre et pour le numero d'ordre transmis
23
 * 1 : Le programme affiche les donnees d'inventaire pour l'identifiant enregistre et pour le numero d'ordre transmis
50
 *
24
 *
51
 */
25
 */
52
 
26
 
53
 
27
 
54
package org.tela_botanica.client;
28
package org.tela_botanica.client;
55
 
29
 
56
import java.util.Date;
30
import java.util.Date;
57
 
31
 
58
import com.google.gwt.json.client.JSONArray;
32
import com.google.gwt.json.client.JSONArray;
59
import com.google.gwt.json.client.JSONParser;
33
import com.google.gwt.json.client.JSONParser;
60
import com.google.gwt.json.client.JSONString;
34
import com.google.gwt.json.client.JSONString;
61
import com.google.gwt.json.client.JSONValue;
35
import com.google.gwt.json.client.JSONValue;
62
import com.google.gwt.user.client.HTTPRequest;
36
import com.google.gwt.user.client.HTTPRequest;
63
import com.google.gwt.user.client.History;
37
import com.google.gwt.user.client.History;
64
import com.google.gwt.user.client.ResponseTextHandler;
38
import com.google.gwt.user.client.ResponseTextHandler;
65
import com.google.gwt.user.client.ui.Button;
39
import com.google.gwt.user.client.ui.Button;
66
import com.google.gwt.user.client.ui.ChangeListener;
40
import com.google.gwt.user.client.ui.ChangeListener;
67
import com.google.gwt.user.client.ui.ClickListener;
41
import com.google.gwt.user.client.ui.ClickListener;
68
import com.google.gwt.user.client.ui.Composite;
42
import com.google.gwt.user.client.ui.Composite;
69
import com.google.gwt.user.client.ui.Grid;
43
import com.google.gwt.user.client.ui.Grid;
70
import com.google.gwt.user.client.ui.HTML;
44
import com.google.gwt.user.client.ui.HTML;
71
import com.google.gwt.user.client.ui.HorizontalPanel;
45
import com.google.gwt.user.client.ui.HorizontalPanel;
72
import com.google.gwt.user.client.ui.KeyboardListener;
46
import com.google.gwt.user.client.ui.KeyboardListener;
73
import com.google.gwt.user.client.ui.PopupPanel;
47
import com.google.gwt.user.client.ui.PopupPanel;
74
import com.google.gwt.user.client.ui.TextBox;
48
import com.google.gwt.user.client.ui.TextBox;
75
import com.google.gwt.user.client.ui.VerticalPanel;
49
import com.google.gwt.user.client.ui.VerticalPanel;
76
import com.google.gwt.user.client.ui.Widget;
50
import com.google.gwt.user.client.ui.Widget;
77
 
51
 
78
 
52
 
79
public class EntryPanel extends Composite   {
53
public class EntryPanel extends Composite   {
80
	
54
	
81
  private NameAssistant nameAssistant = null;
55
  private NameAssistant nameAssistant = null;
82
  private LocationAssistant locationAssistant = null;
56
  private LocationAssistant locationAssistant = null;
83
  private TextBox date = new TextBox();
57
  private TextBox date = new TextBox();
84
  private TextBox complementLocation = new TextBox();
58
  private TextBox complementLocation = new TextBox();
85
  private TextBox comment = new TextBox();
59
  private TextBox comment = new TextBox();
86
  private Button dateSelector = new Button("...");
60
  private Button dateSelector = new Button("...");
87
  boolean visible=false;
61
  boolean visible=false;
88
  private Mediator mediator=null;
62
  private Mediator mediator=null;
89
  
63
  
90
  
64
  
91
  private String user= null;
65
  private String user= null;
92
  private String ordre =null;
66
  private String ordre =null;
93
  
67
  
94
  private CalendarWidget calendar = null; // Lazy instantiation
68
  private CalendarWidget calendar = null; // Lazy instantiation
95
  private PopupPanel choicesPopup = null; // Lazy instantiation
69
  private PopupPanel choicesPopup = null; // Lazy instantiation
96
  
70
  
97
 
71
 
98
  public EntryPanel(final Mediator med) {
72
  public EntryPanel(final Mediator med) {
99
	 
73
	 
100
	  
74
	  
101
	  Grid inner = new Grid(3,4);
75
	  Grid inner = new Grid(3,4);
102
 
76
 
103
	  
77
	  
104
	  
78
	  
105
   mediator=med;
79
   mediator=med;
106
   user=mediator.getUser();
80
   user=mediator.getUser();
107
 
81
 
108
   mediator.registerEntryPanel(this);
82
   mediator.registerEntryPanel(this);
109
   
83
   
110
   mediator.registerDate(date);
84
   mediator.registerDate(date);
111
   mediator.registerComment(comment);
85
   mediator.registerComment(comment);
112
   mediator.registerComplementLocation(complementLocation);
86
   mediator.registerComplementLocation(complementLocation);
113
   
87
   
114
 
88
 
115
   VerticalPanel outer = new VerticalPanel();
89
   VerticalPanel outer = new VerticalPanel();
116
   
90
   
117
 
91
 
118
   outer.add(new HTML("<b>Saisir&nbsp;un&nbsp;relev&eacute;&nbsp;:</b>"));
92
   outer.add(new HTML("<b>Saisir&nbsp;un&nbsp;relev&eacute;&nbsp;:</b>"));
119
 
93
 
120
   
94
   
121
 
95
 
122
   for (int i=0; i<3;i++) {
96
   for (int i=0; i<3;i++) {
123
	inner.getCellFormatter().setWidth(i, 0, "3%");
97
	inner.getCellFormatter().setWidth(i, 0, "3%");
124
	inner.getCellFormatter().setWidth(i, 1, "47%");
98
	inner.getCellFormatter().setWidth(i, 1, "47%");
125
	inner.getCellFormatter().setWidth(i, 2, "3%");
99
	inner.getCellFormatter().setWidth(i, 2, "3%");
126
	inner.getCellFormatter().setWidth(i, 3, "47%");
100
	inner.getCellFormatter().setWidth(i, 3, "47%");
127
   }  
101
   }  
128
 
102
 
129
 
103
 
130
   
104
   
131
 
105
 
132
	nameAssistant = new NameAssistant(mediator);
106
	nameAssistant = new NameAssistant(mediator);
133
	locationAssistant = new LocationAssistant(mediator);
107
	locationAssistant = new LocationAssistant(mediator);
134
 
108
 
135
	
109
	
136
	// Saisie Nom
110
	// Saisie Nom
137
	
111
	
138
     inner.setHTML(0,0,"Esp&egrave;ce:&nbsp;");
112
     inner.setHTML(0,0,"Esp&egrave;ce:&nbsp;");
139
     inner.setWidget(0,1,nameAssistant);
113
     inner.setWidget(0,1,nameAssistant);
140
    
114
    
141
     nameAssistant.setWidth("100%");
115
     nameAssistant.setWidth("100%");
142
 
116
 
143
	 // Saisie lieu
117
	 // Saisie lieu
144
	 
118
	 
145
     inner.setHTML(1,0,"Commune:&nbsp;");
119
     inner.setHTML(1,0,"Commune:&nbsp;");
146
     inner.setWidget(1,1,locationAssistant);
120
     inner.setWidget(1,1,locationAssistant);
147
 
121
 
148
     locationAssistant.setWidth("100%");
122
     locationAssistant.setWidth("100%");
149
   
123
   
150
     // Saisie Date 
124
     // Saisie Date 
151
	 
125
	 
152
     
126
     
153
     dateSelector.addClickListener(new ClickListener () {
127
     dateSelector.addClickListener(new ClickListener () {
154
    
128
    
155
       public void onClick(Widget w) {
129
       public void onClick(Widget w) {
156
    	  
130
    	  
157
    	   if (visible) {
131
    	   if (visible) {
158
    		  visible=false; 
132
    		  visible=false; 
159
    		  choicesPopup.hide();
133
    		  choicesPopup.hide();
160
    	   }
134
    	   }
161
    	   else {
135
    	   else {
162
    		visible=true; 
136
    		visible=true; 
163
    		if (calendar==null) {  // Lazy instantiation
137
    		if (calendar==null) {  // Lazy instantiation
164
    		  calendar = new CalendarWidget();
138
    		  calendar = new CalendarWidget();
165
    		  choicesPopup = new PopupPanel(true);
139
    		  choicesPopup = new PopupPanel(true);
166
    		  choicesPopup.add(calendar);
140
    		  choicesPopup.add(calendar);
167
    		  calendar.addChangeListener(new ChangeListener() {
141
    		  calendar.addChangeListener(new ChangeListener() {
168
 
142
 
169
    			     public void onChange(Widget sender) {
143
    			     public void onChange(Widget sender) {
170
    			    	 
144
    			    	 
171
    			       Date dateSelected=calendar.getDate();
145
    			       Date dateSelected=calendar.getDate();
172
    			       date.setText(dateSelected.getDate()+"/"+(dateSelected.getMonth()+1)+"/"+(dateSelected.getYear()+1900));
146
    			       date.setText(dateSelected.getDate()+"/"+(dateSelected.getMonth()+1)+"/"+(dateSelected.getYear()+1900));
173
    			       visible=false; 
147
    			       visible=false; 
174
    			       choicesPopup.hide();
148
    			       choicesPopup.hide();
175
    			     }
149
    			     }
176
    			     });
150
    			     });
177
    		  
151
    		  
178
    	   	}
152
    	   	}
179
 
153
 
180
    	    choicesPopup.show();
154
    	    choicesPopup.show();
181
	        choicesPopup.setPopupPosition(dateSelector.getAbsoluteLeft(),
155
	        choicesPopup.setPopupPosition(dateSelector.getAbsoluteLeft(),
182
	        dateSelector.getAbsoluteTop()  - dateSelector.getOffsetHeight() - choicesPopup.getOffsetHeight());
156
	        dateSelector.getAbsoluteTop()  - dateSelector.getOffsetHeight() - choicesPopup.getOffsetHeight());
183
	        choicesPopup.setWidth(dateSelector.getOffsetWidth() + "px");
157
	        choicesPopup.setWidth(dateSelector.getOffsetWidth() + "px");
184
    	   }
158
    	   }
185
       }
159
       }
186
     
160
     
187
     });
161
     });
188
     
162
     
189
         
163
         
190
    inner.setHTML(2,0,"Date:&nbsp;");
164
    inner.setHTML(2,0,"Date:&nbsp;");
191
    
165
    
192
    HorizontalPanel datePanel = new HorizontalPanel();
166
    HorizontalPanel datePanel = new HorizontalPanel();
193
    datePanel.add(date);
167
    datePanel.add(date);
194
    datePanel.add(dateSelector);
168
    datePanel.add(dateSelector);
195
    inner.setWidget(2,1,datePanel);
169
    inner.setWidget(2,1,datePanel);
196
    
170
    
197
    // Saisie date   
171
    // Saisie date   
198
   
172
   
199
    date.addKeyboardListener( new KeyboardListener() {
173
    date.addKeyboardListener( new KeyboardListener() {
200
 
174
 
201
    		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
175
    		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
202
    			  if(arg1 == KEY_ENTER)
176
    			  if(arg1 == KEY_ENTER)
203
    			    {
177
    			    {
204
    				 if (ordre==null) {
178
    				 if (ordre==null) {
205
       				     mediator.onAddInventoryItem(); 
179
       				     mediator.onAddInventoryItem(); 
206
       				     date.setText("");
180
       				     date.setText("");
207
    				 }
181
    				 }
208
       				 else {
182
       				 else {
209
       				     mediator.onModifyInventoryItem(ordre); 
183
       				     mediator.onModifyInventoryItem(ordre); 
210
       				     ordre=null;
184
       				     ordre=null;
211
       				 }
185
       				 }
212
    			    }
186
    			    }
213
    		  }
187
    		  }
214
    		  
188
    		  
215
    		  public void onKeyUp(Widget arg0, char arg1, int arg2) { }
189
    		  public void onKeyUp(Widget arg0, char arg1, int arg2) { }
216
    		  public void onKeyPress(Widget arg0, char arg1, int arg2) { }
190
    		  public void onKeyPress(Widget arg0, char arg1, int arg2) { }
217
    		  
191
    		  
218
    		  }
192
    		  }
219
    );
193
    );
220
    
194
    
221
  
195
  
222
 
196
 
223
	 // Saisie Complement de lieu  (station)
197
	 // Saisie Complement de lieu  (station)
224
	 
198
	 
225
    inner.setHTML(1,2,"Station:&nbsp;");
199
    inner.setHTML(1,2,"Station:&nbsp;");
226
    inner.setWidget(1,3,complementLocation);
200
    inner.setWidget(1,3,complementLocation);
227
 
201
 
228
    complementLocation.setWidth("100%");
202
    complementLocation.setWidth("100%");
229
 
203
 
230
    
204
    
231
    complementLocation.addKeyboardListener( new KeyboardListener() {
205
    complementLocation.addKeyboardListener( new KeyboardListener() {
232
 
206
 
233
		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
207
		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
234
			  if(arg1 == KEY_ENTER)
208
			  if(arg1 == KEY_ENTER)
235
			    {
209
			    {
236
				  	if (ordre==null) {
210
				  	if (ordre==null) {
237
   				     mediator.onAddInventoryItem(); 
211
   				     mediator.onAddInventoryItem(); 
238
   				     complementLocation.setText("");
212
   				     complementLocation.setText("");
239
   				  	}
213
   				  	}
240
   				  	else {
214
   				  	else {
241
   				     mediator.onModifyInventoryItem(ordre); 
215
   				     mediator.onModifyInventoryItem(ordre); 
242
   				     ordre=null;
216
   				     ordre=null;
243
   				 }
217
   				 }
244
			    }
218
			    }
245
 
219
 
246
		  }
220
		  }
247
		  
221
		  
248
		  public void onKeyUp(Widget arg0, char arg1, int arg2) { }
222
		  public void onKeyUp(Widget arg0, char arg1, int arg2) { }
249
 
223
 
250
		  public void onKeyPress(Widget arg0, char arg1, int arg2) { }
224
		  public void onKeyPress(Widget arg0, char arg1, int arg2) { }
251
		  
225
		  
252
		  }
226
		  }
253
    );
227
    );
254
 
228
 
255
    
229
    
256
	 // Saisie Commentaire
230
	 // Saisie Commentaire
257
	 
231
	 
258
    inner.setHTML(2,2,"Notes:&nbsp;");
232
    inner.setHTML(2,2,"Notes:&nbsp;");
259
    inner.setWidget(2,3,comment);
233
    inner.setWidget(2,3,comment);
260
 
234
 
261
    comment.setWidth("100%");
235
    comment.setWidth("100%");
262
 
236
 
263
   
237
   
264
    comment.addKeyboardListener( new KeyboardListener() {
238
    comment.addKeyboardListener( new KeyboardListener() {
265
 
239
 
266
		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
240
		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
267
			  if(arg1 == KEY_ENTER)
241
			  if(arg1 == KEY_ENTER)
268
			    {
242
			    {
269
				  	if (ordre==null) {
243
				  	if (ordre==null) {
270
   				     mediator.onAddInventoryItem(); 
244
   				     mediator.onAddInventoryItem(); 
271
   				     comment.setText("");
245
   				     comment.setText("");
272
   				  	}
246
   				  	}
273
   				  	else {
247
   				  	else {
274
   				     mediator.onModifyInventoryItem(ordre); 
248
   				     mediator.onModifyInventoryItem(ordre); 
275
   				     ordre=null;
249
   				     ordre=null;
276
   				  	}
250
   				  	}
277
			    }
251
			    }
278
 
252
 
279
		  }
253
		  }
280
		  
254
		  
281
		  public void onKeyUp(Widget arg0, char arg1, int arg2) { }
255
		  public void onKeyUp(Widget arg0, char arg1, int arg2) { }
282
		  public void onKeyPress(Widget arg0, char arg1, int arg2) { }
256
		  public void onKeyPress(Widget arg0, char arg1, int arg2) { }
283
		  
257
		  
284
		  }
258
		  }
285
  );
259
  );
286
    
260
    
287
   
261
   
288
    Button validButton = new Button("Valider");
262
    Button validButton = new Button("Valider");
289
    
263
    
290
 
264
 
291
    validButton.addClickListener(
265
    validButton.addClickListener(
292
    
266
    
293
    		new ClickListener() {
267
    		new ClickListener() {
294
    			
268
    			
295
    			  public void onClick(Widget w) {
269
    			  public void onClick(Widget w) {
296
    				  	if (ordre==null) {
270
    				  	if (ordre==null) {
297
    				     mediator.onAddInventoryItem(); 
271
    				     mediator.onAddInventoryItem(); 
298
    				  	}
272
    				  	}
299
    				  	else {
273
    				  	else {
300
    				     mediator.onModifyInventoryItem(ordre); 
274
    				     mediator.onModifyInventoryItem(ordre); 
301
    				     ordre=null;
275
    				     ordre=null;
302
    				  	}
276
    				  	}
303
    			  }
277
    			  }
304
    		}
278
    		}
305
    );
279
    );
306
    
280
    
307
    
281
    
308
   
282
   
309
    HorizontalPanel actionPanel= new HorizontalPanel();
283
    HorizontalPanel actionPanel= new HorizontalPanel();
310
   
284
   
311
    actionPanel.add(validButton);
285
    actionPanel.add(validButton);
312
    
286
    
313
 
287
 
314
	inner.setWidth("100%");
288
	inner.setWidth("100%");
315
 
289
 
316
	outer.add(inner);
290
	outer.add(inner);
317
	outer.setCellWidth(inner, "100%");
291
	outer.setCellWidth(inner, "100%");
318
	outer.setSpacing(10);
292
	outer.setSpacing(10);
319
	 
293
	 
320
	outer.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
294
	outer.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
321
    outer.add(actionPanel);
295
    outer.add(actionPanel);
322
 
296
 
323
 
297
 
324
    // Initialisation si provenance d'un lien
298
    // Initialisation si provenance d'un lien
325
    
299
    
326
    if (History.getToken().length()>0) {
300
    if (History.getToken().length()>0) {
327
 
301
 
328
    	final String anum=History.getToken();
302
    	final String anum=History.getToken();
329
 
303
 
330
		HTTPRequest.asyncGet(mediator.getServiceBaseUrl() + "/Name/" + anum,
304
		HTTPRequest.asyncGet(mediator.getServiceBaseUrl() + "/Name/" + anum,
331
				new ResponseTextHandler() {
305
				new ResponseTextHandler() {
332
 
306
 
333
					public void onCompletion(String strcomplete) {
307
					public void onCompletion(String strcomplete) {
334
 
308
 
335
						JSONValue jsonValue = JSONParser.parse(strcomplete);
309
						JSONValue jsonValue = JSONParser.parse(strcomplete);
336
						JSONArray jsonArray;
310
						JSONArray jsonArray;
337
 
311
 
338
						if ((jsonArray = jsonValue.isArray()) != null) {
312
						if ((jsonArray = jsonValue.isArray()) != null) {
339
		
313
		
340
								String aname = ((JSONString) jsonArray.get(0)).stringValue();
314
								String aname = ((JSONString) jsonArray.get(0)).stringValue();
341
								
315
								
342
								// Nom  
316
								// Nom  
343
							
317
							
344
								if (aname.compareTo("null")!=0) {
318
								if (aname.compareTo("null")!=0) {
345
									nameAssistant.setText(((JSONString) jsonArray.get(0)).stringValue());
319
									nameAssistant.setText(((JSONString) jsonArray.get(0)).stringValue());
346
							
320
							
347
									// Numero nomenclatural 
321
									// Numero nomenclatural 
348
							
322
							
349
									nameAssistant.setValue(anum);
323
									nameAssistant.setValue(anum);
350
									
324
									
351
								}
325
								}
352
							
326
							
353
						}
327
						}
354
					}
328
					}
355
 
329
 
356
				});
330
				});
357
 
331
 
358
    	
332
    	
359
    }
333
    }
360
 
334
 
361
	 
335
	 
362
    initWidget(outer);
336
    initWidget(outer);
363
   
337
   
364
    
338
    
365
  }
339
  }
366
 
340
 
367
	/*
341
	/*
368
	 * Numero d'ordre du relevé affiché
342
	 * Numero d'ordre du relev� affich�
369
	 * 
343
	 * 
370
	 */
344
	 */
371
	
345
	
372
	public void setOrdre(String ordre) {
346
	public void setOrdre(String ordre) {
373
		this.ordre = ordre;
347
		this.ordre = ordre;
374
	}
348
	}
375
 
349
 
376
 
350
 
377
	/*
351
	/*
378
	 * Numero d'ordre du relevé affiché
352
	 * Numero d'ordre du relev� affich�
379
	 * 
353
	 * 
380
	 */
354
	 */
381
	
355
	
382
	public String getOrdre() {
356
	public String getOrdre() {
383
		return this.ordre;
357
		return this.ordre;
384
	}
358
	}
385
 
359
 
386
 
360
 
387
  
361
  
388
  /**
362
  /**
389
	 * Mise a jour de l'affichage a partir de données deja saisie
363
	 * Mise a jour de l'affichage a partir de donn�es deja saisie
390
	 * 
364
	 * 
391
	 */
365
	 */
392
 
366
 
393
	public void update() {
367
	public void update() {
394
 
368
 
395
		HTTPRequest.asyncGet(mediator.getServiceBaseUrl() + "/Inventory/" + user + "/" + ordre, 
369
		HTTPRequest.asyncGet(mediator.getServiceBaseUrl() + "/Inventory/" + user + "/" + ordre, 
396
 
370
 
397
		new ResponseTextHandler() {
371
		new ResponseTextHandler() {
398
 
372
 
399
			public void onCompletion(String str) {
373
			public void onCompletion(String str) {
400
 
374
 
401
				JSONValue jsonValue = JSONParser.parse(str);
375
				JSONValue jsonValue = JSONParser.parse(str);
402
				JSONArray jsonArray;
376
				JSONArray jsonArray;
403
				
377
				
404
				
378
				
405
				if ((jsonArray = jsonValue.isArray()) != null) {
379
				if ((jsonArray = jsonValue.isArray()) != null) {
406
							// Nom saisi
380
							// Nom saisi
407
							nameAssistant.setText(((JSONString) jsonArray.get(0)).stringValue());
381
							nameAssistant.setText(((JSONString) jsonArray.get(0)).stringValue());
408
							
382
							
409
							// Numero nomenclatural
383
							// Numero nomenclatural
410
						
384
						
411
							String ann=((JSONString) jsonArray .get(3)).stringValue();
385
							String ann=((JSONString) jsonArray .get(3)).stringValue();
412
							
386
							
413
							if (ann.compareTo("0")!=0) {
387
							if (ann.compareTo("0")!=0) {
414
								nameAssistant.setValue(ann);
388
								nameAssistant.setValue(ann);
415
								mediator.getInfoPopup().setImageUrl(ann);
389
								mediator.getInfoPopup().setImageUrl(ann);
416
							}
390
							}
417
							else {
391
							else {
418
								nameAssistant.setValue(null);
392
								nameAssistant.setValue(null);
419
							}
393
							}
420
							
394
							
421
							// Commune
395
							// Commune
422
							String aloc=((JSONString) jsonArray .get(6)).stringValue();
396
							String aloc=((JSONString) jsonArray .get(6)).stringValue();
423
							
397
							
424
							if (aloc.compareTo("000null")!=0) {
398
							if (aloc.compareTo("000null")!=0) {
425
								locationAssistant.setText(aloc);
399
								locationAssistant.setText(aloc);
426
							}
400
							}
427
							else { 
401
							else { 
428
								locationAssistant.setText("");
402
								locationAssistant.setText("");
429
							}
403
							}
430
							
404
							
431
							String adate=((JSONString) jsonArray .get(8)).stringValue();
405
							String adate=((JSONString) jsonArray .get(8)).stringValue();
432
							
406
							
433
//							Date 
407
//							Date 
434
							if (adate.compareTo("0000-00-00 00:00:00")!=0) {
408
							if (adate.compareTo("0000-00-00 00:00:00")!=0) {
435
								date.setText(adate); 
409
								date.setText(adate); 
436
							}
410
							}
437
							else {
411
							else {
438
								date.setText(""); 
412
								date.setText(""); 
439
							}
413
							}
440
 
414
 
441
 
415
 
442
							String astation=((JSONString) jsonArray .get(9)).stringValue();
416
							String astation=((JSONString) jsonArray .get(9)).stringValue();
443
							
417
							
444
//							Station 
418
//							Station 
445
							if (astation.compareTo("000null")!=0) {
419
							if (astation.compareTo("000null")!=0) {
446
								complementLocation.setText(astation); 
420
								complementLocation.setText(astation); 
447
							}
421
							}
448
							else {
422
							else {
449
								complementLocation.setText(""); 
423
								complementLocation.setText(""); 
450
							}
424
							}
451
							
425
							
452
 
426
 
453
							String acomment=((JSONString) jsonArray .get(10)).stringValue();
427
							String acomment=((JSONString) jsonArray .get(10)).stringValue();
454
//							Notes
428
//							Notes
455
							if (acomment.compareTo("null")!=0) {
429
							if (acomment.compareTo("null")!=0) {
456
								comment.setText(acomment); 
430
								comment.setText(acomment); 
457
							}
431
							}
458
							else {
432
							else {
459
								comment.setText(""); 
433
								comment.setText(""); 
460
							}
434
							}
461
							
435
							
462
				}
436
				}
463
 
437
 
464
				
438
				
465
			}
439
			}
466
		});
440
		});
467
 
441
 
468
	}
442
	}
469
 
443
 
470
	public void setUser(String user) {
444
	public void setUser(String user) {
471
		this.user = user;
445
		this.user = user;
472
	}
446
	}
473
	
447
	
474
 
448
 
475
}
449
}
476
 
450
 
477
/* +--Fin du code ---------------------------------------------------------------------------------------+
451
/* +--Fin du code ---------------------------------------------------------------------------------------+
478
* $Log$
452
* $Log$
-
 
453
* Revision 1.6  2007-06-06 13:29:30  ddelon
-
 
454
* v0.09
-
 
455
*
479
* Revision 1.5  2007-05-22 14:27:08  ddelon
456
* Revision 1.5  2007-05-22 14:27:08  ddelon
480
* reglage modification
457
* reglage modification
481
*
458
*
482
* Revision 1.4  2007-05-21 21:01:35  ddelon
459
* Revision 1.4  2007-05-21 21:01:35  ddelon
483
* Modification comportement boutons
460
* Modification comportement boutons
484
*
461
*
485
* 
462
* 
486
*/
463
*/