Subversion Repositories eFlore/Archives.cel-v1

Rev

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

Rev 25 Rev 26
Line 10... Line 10...
10
import com.google.gwt.json.client.JSONParser;
10
import com.google.gwt.json.client.JSONParser;
11
import com.google.gwt.json.client.JSONString;
11
import com.google.gwt.json.client.JSONString;
12
import com.google.gwt.json.client.JSONValue;
12
import com.google.gwt.json.client.JSONValue;
13
import com.google.gwt.user.client.HTTPRequest;
13
import com.google.gwt.user.client.HTTPRequest;
14
import com.google.gwt.user.client.ResponseTextHandler;
14
import com.google.gwt.user.client.ResponseTextHandler;
-
 
15
import com.google.gwt.user.client.Window;
15
import com.google.gwt.user.client.ui.TextBox;
16
import com.google.gwt.user.client.ui.TextBox;
Line 16... Line 17...
16
 
17
 
Line 17... Line 18...
17
public class Mediator {
18
public class Mediator implements AutoCompleteAsyncTextBoxListener {
18
		
19
		
19
		
20
		
Line 42... Line 43...
42
		private Cel cel = null;
43
		private Cel cel = null;
Line 43... Line 44...
43
 
44
 
Line 44... Line -...
44
		
-
 
45
		Mediator() {
45
		
Line 46... Line 46...
46
			
46
		Mediator() {
47
			
47
			
48
		}
48
		}
49
	
49
	
Line 50... Line 50...
50
		/**
50
		/**
51
		 * Recuperation information utilisateur
51
		 * Recuperation information utilisateur
52
		 *
-
 
53
		 */
52
		 *
Line 54... Line 53...
54
		
53
		 */
55
		public void initUser() {
54
		
Line 72... Line 71...
72
			this.onLocationSelected("all");
71
			this.onLocationSelected("all");
Line 73... Line 72...
73
			
72
			
Line -... Line 73...
-
 
73
		}
-
 
74
		
-
 
75
		
-
 
76
 
-
 
77
		/**
-
 
78
		 * Action lancee par la completion d'un nom dans l'assistant de saisie
-
 
79
		 * Recherche d'information compl�mentaires ....
-
 
80
		 * 
-
 
81
		 * @return void
-
 
82
		 */
-
 
83
		  
-
 
84
		public void onComplete(ResponseTextHandler sender, String str, String value) {
-
 
85
			
-
 
86
			if (sender instanceof NameAssistant) {
-
 
87
				onNameCompleted(value);
-
 
88
			}
-
 
89
 
-
 
90
		}	
-
 
91
		 
-
 
92
		
-
 
93
 
-
 
94
		/**
-
 
95
		 * Action lancee par la selection d'un nom dans l'assistant de saisie. Lance
-
 
96
		 * la recherche d'informations compl�mentaires (famille, numero
-
 
97
		 * nomenclaturaux etc) et met a jour l'inventaire (addelement())
-
 
98
		 * 
-
 
99
		 * @return void
-
 
100
		 */
-
 
101
		public void onValidate(SourcesAutoCompleteAsyncTextBoxEvents sender,
-
 
102
				  String str, String value) {
-
 
103
		
-
 
104
		  	if (getEntryPanel().getOrdre()==null) {
-
 
105
				     onAddInventoryItem(); 
-
 
106
			  	}
-
 
107
			else {
-
 
108
			     onModifyInventoryItem(getEntryPanel().getOrdre()); 
-
 
109
			     getEntryPanel().setOrdre(null);
-
 
110
			 }
-
 
111
 
-
 
112
		}
-
 
113
		
74
		}
114
 
75
		
115
	
76
		
116
		
Line 102... Line 142...
102
			
142
			
Line 103... Line 143...
103
		}
143
		}
-
 
144
 
-
 
145
		
-
 
146
		/**
-
 
147
		 * Action sur deselection d'une observation : affichage du detail
-
 
148
		 */
-
 
149
		
-
 
150
		public void onInventoryItemUnselected(String ordre) {
-
 
151
		
-
 
152
			entryPanel.setOrdre(null);
-
 
153
			
-
 
154
		}
-
 
155
 
-
 
156
 
104
 
157
 
105
		
158
		
Line 106... Line 159...
106
		/**
159
		/**
Line 125... Line 178...
125
		 */
178
		 */
Line 126... Line 179...
126
		
179
		
Line 127... Line 180...
127
		public void onLocationSelected(String loc) {
180
		public void onLocationSelected(String loc) {
128
		
-
 
129
			inventoryItemList.setLocation(loc);
-
 
130
//			inventoryItemList.setDate("all");
181
		
Line 131... Line 182...
131
//			inventoryItemList.setStation("all");
182
			inventoryItemList.setLocation(loc);
Line 132... Line 183...
132
			inventoryItemList.updateCount();
183
			inventoryItemList.updateCount();
133
			
-
 
134
	//		nameAssistant.setValue(null);
184
			
-
 
185
			inventoryItemList.displayFilter();
135
 
186
 
136
			dateList.setLocation(loc);
-
 
137
//			dateList.setDate("all");
187
			dateList.setLocation(loc);
Line 138... Line 188...
138
			dateList.updateCount();
188
			dateList.updateCount();
-
 
189
			
-
 
190
			stationList.setLocation(loc);
Line 139... Line 191...
139
			stationList.setLocation(loc);
191
			stationList.updateCount();
140
//			stationList.setStation("all");
192
			
141
			stationList.updateCount();
193
		}
142
			
194
			
Line 188... Line 240...
188
		
240
		
Line 189... Line 241...
189
		public void onStationSelected(String station) {
241
		public void onStationSelected(String station) {
190
 
242
 
-
 
243
			inventoryItemList.setStation(station);
-
 
244
			inventoryItemList.updateCount();
-
 
245
			
191
			inventoryItemList.setStation(station);
246
			inventoryItemList.displayFilter();
Line 192... Line 247...
192
			inventoryItemList.updateCount();
247
 
Line 204... Line 259...
204
		
259
		
Line 205... Line 260...
205
		public void onDateSelected(String date) {
260
		public void onDateSelected(String date) {
206
 
261
 
-
 
262
			inventoryItemList.setDate(date);
-
 
263
			inventoryItemList.updateCount();
-
 
264
			
207
			inventoryItemList.setDate(date);
265
			inventoryItemList.displayFilter();
Line 208... Line 266...
208
			inventoryItemList.updateCount();
266
 
Line 209... Line 267...
209
	//		nameAssistant.setValue(null);
267
	//		nameAssistant.setValue(null);
210
 
268
 
211
 
269
 
212
		}
270
		}
Line 213... Line 271...
213
 
271
 
-
 
272
		/**
-
 
273
		 * Action suivant la completion d'un nom
-
 
274
		 * 
214
		/**
275
		 */
215
		 * Action suivant la complétion d'un nom
276
 
Line 216... Line 277...
216
		 * 
277
		public void  onNameCompleted(String value) {
217
		 */
278
			if (infoPopup==null) {
218
 
279
				infoPopup = new InfoPopup(this);
219
		public void  onNameCompleted(String value) {
280
			}
Line 220... Line 281...
220
			infoPopup.setImageUrl(value);
281
			infoPopup.setImageUrl(value);
Line 234... Line 295...
234
			
295
			
Line 235... Line 296...
235
		}
296
		}
236
 
297
 
237
		
298
		
238
		/**
299
		/**
Line 239... Line 300...
239
		 * Action prealable à la modification d'une observation : controle presence champs requis et lancement mise a jour 
300
		 * Action prealable a la modification d'une observation : controle presence champs requis et lancement mise a jour 
Line 427... Line 488...
427
		
488
		
428
		
489
		
429
		
490
		
430
 
491
 
431
		/**
492
		/**
Line 432... Line 493...
432
		 * Recherche distante et asynchrone de l'utilisateur connecté, en retour lancement methode initialisation
493
		 * Recherche distante et asynchrone de l'utilisateur connecte, en retour lancement methode initialisation
Line 442... Line 503...
442
 
503
 
443
						public void onCompletion(String str) {
504
						public void onCompletion(String str) {
444
							JSONValue jsonValue = JSONParser.parse(str);
505
							JSONValue jsonValue = JSONParser.parse(str);
445
							JSONArray jsonArray;
506
							JSONArray jsonArray;
446
							if ((jsonArray = jsonValue.isArray()) != null) {
507
							if ((jsonArray = jsonValue.isArray()) != null) {
447
									user = ((JSONString) jsonArray.get(0)).stringValue();
508
									user = ((JSONString) jsonArray.get(0)).stringValue(); // Identifiant utilisateur ou identifiant de session si non connecte
448
									connected = ((JSONBoolean) jsonArray.get(1)).booleanValue();
509
									connected = ((JSONBoolean) jsonArray.get(1)).booleanValue();  // Drapeau leve si utilisateur identifie
449
							}
510
							}
450
							cel.initAsync();
511
							cel.initAsync();
451
						}
512
						}
Line 478... Line 539...
478
		}
539
		}
Line 479... Line 540...
479
 
540
 
480
 
541
 
481
		/**
542
		/**
482
		 *  Accesseur Utilisateur
543
		 *  Accesseur Utilisateur
Line 483... Line 544...
483
		 * @return utilisateur connecté ou identifiant de session
544
		 * @return utilisateur connecte ou identifiant de session
484
		 */
545
		 */
485
		
546
		
Line 528... Line 589...
528
		public LeftPanel getLeftPanel() {
589
		public LeftPanel getLeftPanel() {
529
			return leftPanel;
590
			return leftPanel;
530
		}
591
		}
Line 531... Line 592...
531
 
592
 
-
 
593
		public InfoPopup getInfoPopup() {
-
 
594
			if (infoPopup==null) {
-
 
595
				infoPopup = new InfoPopup(this);
532
		public InfoPopup getInfoPopup() {
596
			}
533
			return infoPopup;
597
			return infoPopup;
Line 534... Line 598...
534
		}
598
		}