Subversion Repositories eFlore/Archives.cel-v1

Rev

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

Rev 14 Rev 22
-
 
1
/**
-
 
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
 
-
 
30
 */
-
 
31
 
1
/*
32
/*
2
 * Copyright 2006 Google Inc.
33
 * EntryPanel.java  (Composite de Panel)
3
 * 
34
 * 
-
 
35
 * Cas d'utilisation :
4
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
36
 * Saisie assistee (completion nom et completion commune) de releves. 
-
 
37
 * L'identification n'est pas obligatoire
-
 
38
 *
-
 
39
 * 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
-
 
41
 * 2 : Le programme assiste la saisie de nom de plante ou de localite par interrogation du systeme distant
5
 * use this file except in compliance with the License. You may obtain a copy of
42
 * 3 : L'utilisateur choisi le type de mise (ajout ou modification)
6
 * the License at
43
 * 3 : L'utilisateur valide sa saisie
-
 
44
 * 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
7
 * 
46
 * 
8
 * http://www.apache.org/licenses/LICENSE-2.0
-
 
9
 * 
47
 * 
10
 * Unless required by applicable law or agreed to in writing, software
48
 * Affichage detail d'un observation
11
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-
 
12
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-
 
13
 * License for the specific language governing permissions and limitations under
49
 * 1 : Le programme affiche les donnees d'inventaire pour l'identifiant enregistre et pour le numero d'ordre transmis
14
 * the License.
50
 *
15
 */
51
 */
-
 
52
 
-
 
53
 
16
package org.tela_botanica.client;
54
package org.tela_botanica.client;
17
 
55
 
18
import java.util.Date;
56
import java.util.Date;
19
 
57
 
20
import com.google.gwt.json.client.JSONArray;
58
import com.google.gwt.json.client.JSONArray;
21
import com.google.gwt.json.client.JSONNull;
-
 
22
import com.google.gwt.json.client.JSONParser;
59
import com.google.gwt.json.client.JSONParser;
23
import com.google.gwt.json.client.JSONString;
60
import com.google.gwt.json.client.JSONString;
24
import com.google.gwt.json.client.JSONValue;
61
import com.google.gwt.json.client.JSONValue;
25
import com.google.gwt.user.client.HTTPRequest;
62
import com.google.gwt.user.client.HTTPRequest;
26
import com.google.gwt.user.client.History;
63
import com.google.gwt.user.client.History;
27
import com.google.gwt.user.client.ResponseTextHandler;
64
import com.google.gwt.user.client.ResponseTextHandler;
28
import com.google.gwt.user.client.Window;
-
 
29
import com.google.gwt.user.client.ui.Button;
65
import com.google.gwt.user.client.ui.Button;
30
import com.google.gwt.user.client.ui.ChangeListener;
66
import com.google.gwt.user.client.ui.ChangeListener;
31
import com.google.gwt.user.client.ui.CheckBox;
67
import com.google.gwt.user.client.ui.CheckBox;
32
import com.google.gwt.user.client.ui.ClickListener;
68
import com.google.gwt.user.client.ui.ClickListener;
33
import com.google.gwt.user.client.ui.Composite;
69
import com.google.gwt.user.client.ui.Composite;
34
import com.google.gwt.user.client.ui.Grid;
70
import com.google.gwt.user.client.ui.Grid;
35
import com.google.gwt.user.client.ui.HTML;
71
import com.google.gwt.user.client.ui.HTML;
36
import com.google.gwt.user.client.ui.HorizontalPanel;
72
import com.google.gwt.user.client.ui.HorizontalPanel;
37
import com.google.gwt.user.client.ui.KeyboardListener;
73
import com.google.gwt.user.client.ui.KeyboardListener;
38
import com.google.gwt.user.client.ui.PopupPanel;
74
import com.google.gwt.user.client.ui.PopupPanel;
39
import com.google.gwt.user.client.ui.TextBox;
75
import com.google.gwt.user.client.ui.TextBox;
40
import com.google.gwt.user.client.ui.VerticalPanel;
76
import com.google.gwt.user.client.ui.VerticalPanel;
41
import com.google.gwt.user.client.ui.Widget;
77
import com.google.gwt.user.client.ui.Widget;
42
 
-
 
43
/**
-
 
44
 * Composite permet de wrapper des Widget pour creer un nouveau Widget cf methode initWidget()
-
 
45
 */
78
 
46
 
79
 
47
public class EntryPanel extends Composite   {
80
public class EntryPanel extends Composite   {
48
	
81
	
49
  private NameAssistant nameAssistant = null;
82
  private NameAssistant nameAssistant = null;
50
  private LocationAssistant locationAssistant = null;
83
  private LocationAssistant locationAssistant = null;
51
  TextBox date = new TextBox();
84
  private TextBox date = new TextBox();
52
  TextBox complementLocation = new TextBox();
85
  private TextBox complementLocation = new TextBox();
53
  TextBox comment = new TextBox();
86
  private TextBox comment = new TextBox();
54
  Button dateSelector = new Button("...");
87
  private Button dateSelector = new Button("...");
55
  boolean visible=false;
88
  boolean visible=false;
56
  Mediator mediator=null;
89
  private Mediator mediator=null;
57
 
-
 
58
  private String serviceBaseUrl = null;
90
 
59
  
91
  
60
  private String user= null;
92
  private String user= null;
61
  private String ordre =null;
93
  private String ordre =null;
62
  
94
  
63
  final CalendarWidget calendar = new CalendarWidget();
-
 
64
  
95
  private CalendarWidget calendar = null; // Lazy instantiation
65
  private PopupPanel choicesPopup = new PopupPanel(true);
96
  private PopupPanel choicesPopup = null; // Lazy instantiation
66
 
97
 
67
  public EntryPanel(final Mediator med) {
98
  public EntryPanel(final Mediator med) {
68
	 
99
	 
69
	  
100
	  
70
   mediator=med;
101
   mediator=med;
-
 
102
   user=mediator.getUser();
71
 
-
 
72
   
-
 
73
   
103
 
74
   mediator.registerEntryPanel(this);
104
   mediator.registerEntryPanel(this);
75
   
105
   
76
   mediator.registerDate(date);
106
   mediator.registerDate(date);
77
   mediator.registerComment(comment);
107
   mediator.registerComment(comment);
78
   mediator.registerComplementLocation(complementLocation);
108
   mediator.registerComplementLocation(complementLocation);
79
   
-
 
80
   
-
 
81
   user=mediator.getUser();
-
 
82
   serviceBaseUrl = mediator.getServiceBaseUrl();
-
 
83
 
-
 
84
   
109
   
85
   
110
 
86
   VerticalPanel outer = new VerticalPanel();
111
   VerticalPanel outer = new VerticalPanel();
87
   
112
   
88
 
113
 
89
	outer.add(new HTML("<b>Saisir&nbsp;un&nbsp;relev&eacute;&nbsp;:</b>"));
-
 
90
 
114
   outer.add(new HTML("<b>Saisir&nbsp;un&nbsp;relev&eacute;&nbsp;:</b>"));
91
   
115
 
92
   
116
   
93
   Grid inner = new Grid(3,4);
117
   Grid inner = new Grid(3,4);
94
 
118
 
95
   for (int i=0; i<3;i++) {
119
   for (int i=0; i<3;i++) {
96
	inner.getCellFormatter().setWidth(i, 0, "3%");
120
	inner.getCellFormatter().setWidth(i, 0, "3%");
97
	inner.getCellFormatter().setWidth(i, 1, "47%");
121
	inner.getCellFormatter().setWidth(i, 1, "47%");
98
	inner.getCellFormatter().setWidth(i, 2, "3%");
122
	inner.getCellFormatter().setWidth(i, 2, "3%");
99
	inner.getCellFormatter().setWidth(i, 3, "47%");
123
	inner.getCellFormatter().setWidth(i, 3, "47%");
100
   }
124
   }
101
 
125
 
102
 
126
 
103
	nameAssistant = new NameAssistant(mediator);
127
	nameAssistant = new NameAssistant(mediator);
104
	locationAssistant = new LocationAssistant(mediator);
128
	locationAssistant = new LocationAssistant(mediator);
105
	
-
 
106
 
-
 
107
	
129
 
108
	
-
 
109
	// Saisie Nom
130
	
110
	
131
	// Saisie Nom
111
     HTML labelNameAssistant = new HTML("Esp&egrave;ce:&nbsp;");
132
	
112
     inner.setWidget(0,0,labelNameAssistant);
133
     inner.setHTML(0,0,"Esp&egrave;ce:&nbsp;");
113
     inner.setWidget(0,1,nameAssistant);
134
     inner.setWidget(0,1,nameAssistant);
114
    
135
    
115
     nameAssistant.setWidth("100%");
136
     nameAssistant.setWidth("100%");
116
 
137
 
117
	 // Saisie lieu
138
	 // Saisie lieu
118
	 
-
 
119
     HTML labelLocationAssistant= new HTML("Commune:&nbsp;");
139
	 
120
     inner.setWidget(1,0,labelLocationAssistant);
140
     inner.setHTML(1,0,"Commune:&nbsp;");
121
     inner.setWidget(1,1,locationAssistant);
141
     inner.setWidget(1,1,locationAssistant);
122
 
142
 
123
     locationAssistant.setWidth("100%");
143
     locationAssistant.setWidth("100%");
124
   
144
   
125
     // Saisie Date 
145
     // Saisie Date 
126
	 
-
 
127
     choicesPopup.add(calendar);
146
	 
128
     
147
     
129
     dateSelector.addClickListener(new ClickListener () {
148
     dateSelector.addClickListener(new ClickListener () {
130
    
149
    
131
       public void onClick(Widget w) {
150
       public void onClick(Widget w) {
132
    	  
151
    	  
133
    	   if (visible) {
152
    	   if (visible) {
134
    		  visible=false; 
153
    		  visible=false; 
135
    		  choicesPopup.hide();
154
    		  choicesPopup.hide();
136
    	   }
155
    	   }
137
    	   else {
156
    	   else {
138
    		visible=true; 
157
    		visible=true; 
-
 
158
    		if (calendar==null) {  // Lazy instantiation
-
 
159
    		  calendar = new CalendarWidget();
-
 
160
    		  choicesPopup = new PopupPanel(true);
-
 
161
    		  choicesPopup.add(calendar);
-
 
162
    		  calendar.addChangeListener(new ChangeListener() {
-
 
163
 
-
 
164
    			     public void onChange(Widget sender) {
-
 
165
    			    	 
-
 
166
    			       Date dateSelected=calendar.getDate();
-
 
167
    			       date.setText(dateSelected.getDate()+"/"+(dateSelected.getMonth()+1)+"/"+(dateSelected.getYear()+1900));
-
 
168
    			       visible=false; 
-
 
169
    			       choicesPopup.hide();
-
 
170
    			     }
-
 
171
    			     });
-
 
172
    		  
-
 
173
    	   	}
-
 
174
 
139
    	    choicesPopup.show();
175
    	    choicesPopup.show();
140
	        choicesPopup.setPopupPosition(dateSelector.getAbsoluteLeft(),
176
	        choicesPopup.setPopupPosition(dateSelector.getAbsoluteLeft(),
141
	        dateSelector.getAbsoluteTop()  - dateSelector.getOffsetHeight() - choicesPopup.getOffsetHeight());
177
	        dateSelector.getAbsoluteTop()  - dateSelector.getOffsetHeight() - choicesPopup.getOffsetHeight());
142
	        choicesPopup.setWidth(dateSelector.getOffsetWidth() + "px");
178
	        choicesPopup.setWidth(dateSelector.getOffsetWidth() + "px");
143
    	   }
179
    	   }
144
       }
180
       }
145
     
181
     
146
     });
182
     });
147
     
-
 
148
     calendar.addChangeListener(new ChangeListener() {
183
     
149
 
-
 
150
     public void onChange(Widget sender) {
-
 
151
    	 
-
 
152
       Date dateSelected=calendar.getDate();
-
 
153
       date.setText(dateSelected.getDate()+"/"+(dateSelected.getMonth()+1)+"/"+(dateSelected.getYear()+1900));
-
 
154
       
-
 
155
       visible=false; 
-
 
156
       choicesPopup.hide();
-
 
157
     }
-
 
158
     });
-
 
159
     
-
 
160
    HTML labelDate= new HTML("Date:&nbsp;");
184
         
161
    inner.setWidget(2,0,labelDate);
185
    inner.setHTML(2,0,"Date:&nbsp;");
162
    
186
    
163
    HorizontalPanel datePanel = new HorizontalPanel();
187
    HorizontalPanel datePanel = new HorizontalPanel();
164
    datePanel.add(date);
188
    datePanel.add(date);
165
    datePanel.add(dateSelector);
189
    datePanel.add(dateSelector);
166
    inner.setWidget(2,1,datePanel);
190
    inner.setWidget(2,1,datePanel);
-
 
191
    
167
    
192
    // Saisie date   
168
 
-
 
169
    
-
 
170
    
193
   
171
    date.addKeyboardListener( new KeyboardListener() {
194
    date.addKeyboardListener( new KeyboardListener() {
172
 
195
 
173
    		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
196
    		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
174
    			  
-
 
175
    			  
-
 
176
    			  if(arg1 == KEY_ENTER)
197
    			  if(arg1 == KEY_ENTER)
177
    			    {
198
    			    {
178
    			     mediator.onAddInventoryItem(); 
199
    			     mediator.onAddInventoryItem(); 
179
    			     date.setText("");
200
    			     date.setText("");
180
    			    }
201
    			    }
181
 
-
 
182
    		  }
202
    		  }
183
    		  
203
    		  
184
    		  public void onKeyUp(Widget arg0, char arg1, int arg2) {
-
 
185
    		  }
-
 
186
 
204
    		  public void onKeyUp(Widget arg0, char arg1, int arg2) { }
187
    		  public void onKeyPress(Widget arg0, char arg1, int arg2) {
-
 
188
    		  }
205
    		  public void onKeyPress(Widget arg0, char arg1, int arg2) { }
189
    		  
206
    		  
190
    		  }
207
    		  }
191
    );
208
    );
192
    
209
    
193
  
210
  
194
 
211
 
195
	 // Saisie Complement lieu 
-
 
196
	 
212
	 // Saisie Complement de lieu  (station)
197
    HTML labelComplementLocation= new HTML("Station:&nbsp;");
213
	 
198
    inner.setWidget(1,2,labelComplementLocation);
214
    inner.setHTML(1,2,"Station:&nbsp;");
199
    inner.setWidget(1,3,complementLocation);
215
    inner.setWidget(1,3,complementLocation);
200
 
216
 
201
    complementLocation.setWidth("100%");
217
    complementLocation.setWidth("100%");
202
 
218
 
203
    
219
    
204
    complementLocation.addKeyboardListener( new KeyboardListener() {
220
    complementLocation.addKeyboardListener( new KeyboardListener() {
205
 
221
 
206
		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
222
		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
207
			  
-
 
208
			  
-
 
209
			  if(arg1 == KEY_ENTER)
223
			  if(arg1 == KEY_ENTER)
210
			    {
224
			    {
211
			     mediator.onAddInventoryItem(); 
225
			     mediator.onAddInventoryItem(); 
212
			     complementLocation.setText("");
226
			     complementLocation.setText("");
213
			    }
227
			    }
214
 
228
 
215
		  }
229
		  }
216
		  
230
		  
217
		  public void onKeyUp(Widget arg0, char arg1, int arg2) {
-
 
218
		  }
231
		  public void onKeyUp(Widget arg0, char arg1, int arg2) { }
219
 
-
 
220
		  public void onKeyPress(Widget arg0, char arg1, int arg2) {
232
 
221
		  }
233
		  public void onKeyPress(Widget arg0, char arg1, int arg2) { }
222
		  
234
		  
223
		  }
235
		  }
224
    );
236
    );
225
 
237
 
226
    
238
    
227
	 // Saisie Commentaire
239
	 // Saisie Commentaire
228
	 
-
 
229
    HTML labelComment= new HTML("Notes:&nbsp;");
240
	 
230
    inner.setWidget(2,2,labelComment);
241
    inner.setHTML(2,2,"Notes:&nbsp;");
231
    inner.setWidget(2,3,comment);
242
    inner.setWidget(2,3,comment);
232
 
243
 
233
    comment.setWidth("100%");
244
    comment.setWidth("100%");
234
 
245
 
235
   
246
   
236
    comment.addKeyboardListener( new KeyboardListener() {
247
    comment.addKeyboardListener( new KeyboardListener() {
237
 
248
 
238
		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
249
		  public void onKeyDown(Widget arg0, char arg1, int arg2) {
239
			  
-
 
240
			  
-
 
241
			  if(arg1 == KEY_ENTER)
250
			  if(arg1 == KEY_ENTER)
242
			    {
251
			    {
243
			     mediator.onAddInventoryItem(); 
252
			     mediator.onAddInventoryItem(); 
244
			     comment.setText("");
253
			     comment.setText("");
245
			    }
254
			    }
246
 
255
 
247
		  }
256
		  }
248
		  
257
		  
249
		  public void onKeyUp(Widget arg0, char arg1, int arg2) {
-
 
250
		  }
-
 
251
 
258
		  public void onKeyUp(Widget arg0, char arg1, int arg2) { }
252
		  public void onKeyPress(Widget arg0, char arg1, int arg2) {
-
 
253
		  }
259
		  public void onKeyPress(Widget arg0, char arg1, int arg2) { }
254
		  
260
		  
255
		  }
261
		  }
256
  );
262
  );
257
 
263
 
258
   
264
   
259
    Button addButton = new Button("Ajout");
-
 
-
 
265
    Button validButton = new Button("Valider");
260
    Button updateButton = new Button("Modification");
266
    
261
 
267
 
262
    addButton.addClickListener(
268
    validButton.addClickListener(
263
    
269
    
264
    		new ClickListener() {
270
    		new ClickListener() {
265
    			
271
    			
266
    			  public void onClick(Widget w) {
272
    			  public void onClick(Widget w) {
-
 
273
    				  	if (ordre==null) {
267
    				     mediator.onAddInventoryItem(); 
274
    				     mediator.onAddInventoryItem(); 
268
    			  }
275
    				  	}
269
    		}
-
 
270
    );
-
 
271
    
-
 
272
    HorizontalPanel buttonPanel = new HorizontalPanel();
-
 
273
   
-
 
274
    
-
 
275
    updateButton.addClickListener(
-
 
276
    	    
-
 
277
    		new ClickListener() {
276
    				  	else {
278
    			
-
 
279
    			  public void onClick(Widget w) {
-
 
280
    				     mediator.onModifyInventoryItem(ordre); 
277
    				     mediator.onModifyInventoryItem(ordre); 
-
 
278
    				     ordre=null;
-
 
279
    				  	}
281
    			  }
280
    			  }
282
    		}
281
    		}
283
    );
282
    );
284
    
283
    
-
 
284
    
285
    
285
   
-
 
286
    HorizontalPanel actionPanel= new HorizontalPanel();
286
    buttonPanel.add(addButton);
287
   
287
    buttonPanel.add(updateButton);
288
    actionPanel.add(validButton);
288
    
289
    
289
 
290
 
290
	 inner.setWidth("100%");
291
	inner.setWidth("100%");
291
 
292
 
292
	 outer.add(inner);
293
	outer.add(inner);
293
	 outer.setCellWidth(inner, "100%");
294
	outer.setCellWidth(inner, "100%");
294
	 outer.setSpacing(10);
295
	outer.setSpacing(10);
295
	 
296
	 
296
	outer.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
297
	outer.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
297
    outer.add(buttonPanel);
298
    outer.add(actionPanel);
298
 
299
 
299
 
300
 
300
    // Initialisation si provenance d'un lien
301
    // Initialisation si provenance d'un lien
301
    
302
    
302
    if (History.getToken().length()>0) {
303
    if (History.getToken().length()>0) {
303
 
304
 
304
    	final String anum=History.getToken();
305
    	final String anum=History.getToken();
305
 
306
 
306
		HTTPRequest.asyncGet(serviceBaseUrl + "/Name/" + anum,
307
		HTTPRequest.asyncGet(mediator.getServiceBaseUrl() + "/Name/" + anum,
307
				new ResponseTextHandler() {
308
				new ResponseTextHandler() {
308
 
309
 
309
					public void onCompletion(String strcomplete) {
310
					public void onCompletion(String strcomplete) {
310
 
311
 
311
						JSONValue jsonValue = JSONParser.parse(strcomplete);
312
						JSONValue jsonValue = JSONParser.parse(strcomplete);
312
						JSONArray jsonArray;
313
						JSONArray jsonArray;
313
 
314
 
314
						if ((jsonArray = jsonValue.isArray()) != null) {
315
						if ((jsonArray = jsonValue.isArray()) != null) {
315
		
316
		
316
								String aname = ((JSONString) jsonArray.get(0)).stringValue();
317
								String aname = ((JSONString) jsonArray.get(0)).stringValue();
317
								
318
								
318
								// Nom  
319
								// Nom  
319
							
320
							
320
								if (aname.compareTo("null")!=0) {
321
								if (aname.compareTo("null")!=0) {
321
									nameAssistant.setText(((JSONString) jsonArray.get(0)).stringValue());
322
									nameAssistant.setText(((JSONString) jsonArray.get(0)).stringValue());
322
							
323
							
323
									// Numero nomenclatural 
324
									// Numero nomenclatural 
324
							
325
							
325
									nameAssistant.setValue(anum);
326
									nameAssistant.setValue(anum);
326
									
327
									
327
								}
328
								}
328
							
329
							
329
						}
330
						}
330
					}
331
					}
331
 
332
 
332
				});
333
				});
333
 
334
 
334
    	
335
    	
335
    }
336
    }
336
	 
337
	 
337
 
338
 
338
	 
339
	 
339
    initWidget(outer);
340
    initWidget(outer);
340
   
341
   
341
    
342
    
342
  }
343
  }
343
 
344
 
344
	/*
345
	/*
345
	 * Numero d'ordre du relevé affiché
346
	 * Numero d'ordre du relevé affiché
346
	 * 
347
	 * 
347
	 */
348
	 */
348
	
349
	
349
	public void setOrdre(String ordre) {
350
	public void setOrdre(String ordre) {
350
		this.ordre = ordre;
351
		this.ordre = ordre;
351
	}
352
	}
352
 
353
 
353
 
354
 
354
	/*
355
	/*
355
	 * Numero d'ordre du relevé affiché
356
	 * Numero d'ordre du relevé affiché
356
	 * 
357
	 * 
357
	 */
358
	 */
358
	
359
	
359
	public String getOrdre() {
360
	public String getOrdre() {
360
		return this.ordre;
361
		return this.ordre;
361
	}
362
	}
362
 
363
 
363
 
364
 
364
  
365
  
365
  /**
366
  /**
366
	 * Mise a jour de l'affichage a partir de données deja saisie
367
	 * Mise a jour de l'affichage a partir de données deja saisie
367
	 * 
368
	 * 
368
	 */
369
	 */
369
 
370
 
370
	public void update() {
371
	public void update() {
371
 
372
 
372
		HTTPRequest.asyncGet(serviceBaseUrl + "/Inventory/" + user + "/" + ordre, 
373
		HTTPRequest.asyncGet(mediator.getServiceBaseUrl() + "/Inventory/" + user + "/" + ordre, 
373
 
374
 
374
		new ResponseTextHandler() {
375
		new ResponseTextHandler() {
375
 
376
 
376
			public void onCompletion(String str) {
377
			public void onCompletion(String str) {
377
 
378
 
378
				JSONValue jsonValue = JSONParser.parse(str);
379
				JSONValue jsonValue = JSONParser.parse(str);
379
				JSONArray jsonArray;
380
				JSONArray jsonArray;
380
				
381
				
381
				
382
				
382
				if ((jsonArray = jsonValue.isArray()) != null) {
383
				if ((jsonArray = jsonValue.isArray()) != null) {
383
							// Nom saisi
384
							// Nom saisi
384
							nameAssistant.setText(((JSONString) jsonArray.get(0)).stringValue());
385
							nameAssistant.setText(((JSONString) jsonArray.get(0)).stringValue());
385
							
386
							
386
							// Numero nomenclatural
387
							// Numero nomenclatural
387
						
388
						
388
							String ann=((JSONString) jsonArray .get(3)).stringValue();
389
							String ann=((JSONString) jsonArray .get(3)).stringValue();
389
							
390
							
390
							if (ann.compareTo("0")!=0) {
391
							if (ann.compareTo("0")!=0) {
391
								nameAssistant.setValue(ann);
392
								nameAssistant.setValue(ann);
392
							}
393
							}
393
							
394
							
394
							// Commune
395
							// Commune
395
							String aloc=((JSONString) jsonArray .get(6)).stringValue();
396
							String aloc=((JSONString) jsonArray .get(6)).stringValue();
396
							
397
							
397
							if (aloc.compareTo("000null")!=0) {
398
							if (aloc.compareTo("000null")!=0) {
398
								locationAssistant.setText(aloc);
399
								locationAssistant.setText(aloc);
399
							}
400
							}
400
							else { 
401
							else { 
401
								locationAssistant.setText("");
402
								locationAssistant.setText("");
402
							}
403
							}
403
							
404
							
404
							String adate=((JSONString) jsonArray .get(8)).stringValue();
405
							String adate=((JSONString) jsonArray .get(8)).stringValue();
405
							
406
							
406
//							Date 
407
//							Date 
407
							if (adate.compareTo("0000-00-00 00:00:00")!=0) {
408
							if (adate.compareTo("0000-00-00 00:00:00")!=0) {
408
								date.setText(adate); 
409
								date.setText(adate); 
409
							}
410
							}
410
							else {
411
							else {
411
								date.setText(""); 
412
								date.setText(""); 
412
							}
413
							}
413
 
414
 
414
 
415
 
415
							String astation=((JSONString) jsonArray .get(9)).stringValue();
416
							String astation=((JSONString) jsonArray .get(9)).stringValue();
416
							
417
							
417
//							Station 
418
//							Station 
418
							if (astation.compareTo("000null")!=0) {
419
							if (astation.compareTo("000null")!=0) {
419
								complementLocation.setText(astation); 
420
								complementLocation.setText(astation); 
420
							}
421
							}
421
							else {
422
							else {
422
								complementLocation.setText(""); 
423
								complementLocation.setText(""); 
423
							}
424
							}
424
							
425
							
425
 
426
 
426
							String acomment=((JSONString) jsonArray .get(10)).stringValue();
427
							String acomment=((JSONString) jsonArray .get(10)).stringValue();
427
//							Notes
428
//							Notes
428
							if (acomment.compareTo("null")!=0) {
429
							if (acomment.compareTo("null")!=0) {
429
								comment.setText(acomment); 
430
								comment.setText(acomment); 
430
							}
431
							}
431
							else {
432
							else {
432
								comment.setText(""); 
433
								comment.setText(""); 
433
							}
434
							}
434
							
435
							
435
				}
436
				}
436
 
437
 
437
				
-
 
438
				
438
				
439
			}
439
			}
440
		});
440
		});
441
 
441
 
442
	}
442
	}
443
 
443
 
444
	public void setUser(String user) {
444
	public void setUser(String user) {
445
		this.user = user;
445
		this.user = user;
446
	}
446
	}
447
 
447
 
448
}
448
}
-
 
449
 
-
 
450
/* +--Fin du code ---------------------------------------------------------------------------------------+
-
 
451
* $Log$
-
 
452
* 
-
 
453
*/