Subversion Repositories eFlore/Archives.cel-v1

Rev

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

Rev 11 Rev 12
Line 8... Line 8...
8
import com.google.gwt.json.client.JSONParser;
8
import com.google.gwt.json.client.JSONParser;
9
import com.google.gwt.json.client.JSONString;
9
import com.google.gwt.json.client.JSONString;
10
import com.google.gwt.json.client.JSONValue;
10
import com.google.gwt.json.client.JSONValue;
11
import com.google.gwt.user.client.HTTPRequest;
11
import com.google.gwt.user.client.HTTPRequest;
12
import com.google.gwt.user.client.ResponseTextHandler;
12
import com.google.gwt.user.client.ResponseTextHandler;
-
 
13
import com.google.gwt.user.client.ui.TextBox;
Line 13... Line 14...
13
 
14
 
Line 14... Line 15...
14
public class Mediator {
15
public class Mediator {
15
		
16
		
16
		
17
		
17
		private String serviceBaseUrl = getServiceBaseUrlFromDictionnary();
18
		private String serviceBaseUrl = getServiceBaseUrlFromDictionnary();
-
 
19
		private String user = null;
18
		private String user = null;
20
		private InventoryItemList inventoryItemList = null;
19
		private InventoryItemList inventoryItemList = null;
21
		private LocationList locationList = null;
-
 
22
		private DateList dateList = null;
-
 
23
		private NameAssistant nameAssistant=null;
Line -... Line 24...
-
 
24
		private LocationAssistant locationAssistant=null;
-
 
25
		private InventoryItem inventoryItem=null;
-
 
26
		private EntryPanel entryPanel=null;
-
 
27
		
-
 
28
		private TextBox date = null; 
-
 
29
		private TextBox complementLocation = null; 
-
 
30
		private TextBox comment = null;
20
		private LocationList locationList = null;
31
 
Line 21... Line 32...
21
		private NameAssistant nameAssistant=null;
32
		
Line 36... Line 47...
36
		
47
		
37
		public void initUser() {
48
		public void initUser() {
Line 38... Line 49...
38
			getUserFromService();
49
			getUserFromService();
-
 
50
			
-
 
51
		}
-
 
52
		
-
 
53
		
-
 
54
		/**
-
 
55
		 * Action initialisation
Line -... Line 56...
-
 
56
		 */
-
 
57
		
-
 
58
	
-
 
59
		public void onInit() {
-
 
60
 
-
 
61
			this.onLocationSelected("all");
-
 
62
			
-
 
63
		}
-
 
64
		
-
 
65
 
-
 
66
		public void onEntryClick() {
-
 
67
			
39
			
68
			this.entryPanel.show();
40
		}
69
		}
41
	
-
 
42
		/**
70
		
Line 43... Line 71...
43
		 * Action sur selection d'un lieu : affichage de la liste des taxons correspondants
71
		/**
Line 44... Line 72...
44
		 *
72
		 * Action sur selection d'un lieu : affichage de la liste des taxons correspondants
-
 
73
		 */
45
		 */
74
		
Line -... Line 75...
-
 
75
		public void onLocationSelected(String loc) {
-
 
76
		
46
		
77
			inventoryItemList.setLocation(loc);
47
		public void onLocationSelected(String loc) {
78
			inventoryItemList.setDate("all");
48
		
79
			inventoryItemList.updateCount();
49
			inventoryItemList.setLocation(loc);
80
			
50
			inventoryItemList.updateCount();
81
			if (entryPanel!=null) {
-
 
82
			
-
 
83
				if ((loc.compareTo("000null")==0) || (loc.compareTo("all")==0)) {
51
			
84
					locationAssistant.setText("");
-
 
85
				}
-
 
86
				else {
-
 
87
					locationAssistant.setText(loc);
-
 
88
				}
-
 
89
					
-
 
90
			}
-
 
91
		
-
 
92
		}
-
 
93
 
-
 
94
		
-
 
95
		/**
-
 
96
		 * Action sur selection d'une date : affichage de la liste des taxons correspondants
-
 
97
		 */
-
 
98
		
-
 
99
		public void onDateSelected(String date) {
Line -... Line 100...
-
 
100
 
-
 
101
			inventoryItemList.setDate(date);
-
 
102
			inventoryItemList.updateCount();
-
 
103
 
-
 
104
			/*
-
 
105
			if (entryPanel!=null) {
-
 
106
			
-
 
107
				if ((loc.compareTo("000null")==0) || (loc.compareTo("all")==0)) {
-
 
108
					locationAssistant.setText("");
-
 
109
				}
52
			if ((loc.compareTo("000null")==0) || (loc.compareTo("all")==0)) {
110
				else {
-
 
111
					locationAssistant.setText(loc);
53
				locationAssistant.setText("");
112
				}
54
			}
113
					
55
			else {
114
			}
56
				locationAssistant.setText(loc);
115
			*/
Line 57... Line 116...
57
			}
116
		
Line 58... Line 117...
58
			
117
		}
59
		}
118
 
Line 60... Line 119...
60
	
119
		
-
 
120
		/**
-
 
121
		 * Action posterieure à l'affichage des observations : mise a jour affichage des localites
-
 
122
		 */
-
 
123
		
-
 
124
	
-
 
125
		public void onInventoryItemUpdate(String loc) {
-
 
126
 
-
 
127
			locationList.setLocation(loc);
-
 
128
			locationList.updateCount();
-
 
129
		
-
 
130
		}
-
 
131
	
-
 
132
		
-
 
133
		/**
-
 
134
		 * Action posterieure à l'affichage des localites : mise a jour affichage des dates
-
 
135
		 */
-
 
136
 
-
 
137
		public void onLocationUpdate(String loc) {
-
 
138
 
-
 
139
		
-
 
140
			dateList.setLocation(loc);
-
 
141
			dateList.updateCount();
-
 
142
	
-
 
143
		}
-
 
144
		
-
 
145
		
-
 
146
		/**
-
 
147
		 * Action prealable à l'ajout d'une observation : controle presence champs requis et lancement mise a jour 
-
 
148
		 * 
-
 
149
		 */
-
 
150
		
-
 
151
		public void onAddInventoryItem() {
-
 
152
		
-
 
153
			// TODO : singleton ?
-
 
154
			registerInventoryItem(new InventoryItem(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),complementLocation.getText(),comment.getText()));
-
 
155
			inventoryItemList.addelement();
-
 
156
			
-
 
157
		}
-
 
158
 
-
 
159
 
-
 
160
		
-
 
161
		public boolean inventoryItemIsValid() {
-
 
162
			// TODO : controle date
-
 
163
			
-
 
164
		    if (inventoryItem.getName().compareTo("")==0) {
-
 
165
		    	return false;
-
 
166
		    }
-
 
167
		    else {
-
 
168
		    	return true;
-
 
169
		    }
-
 
170
			
-
 
171
		}
-
 
172
 
-
 
173
		/**
Line 61... Line 174...
61
		/**
174
		 * Declaration InventoryItem
62
		 * Action sur ajout d'un taxon : affichage du lieu corresondant
175
		 * @param cel
63
		 */
176
		 */
64
		
177
 
Line 88... Line 201...
88
		
201
		
Line 89... Line 202...
89
		public void registerLocationList(LocationList locationList) {
202
		public void registerLocationList(LocationList locationList) {
90
			
203
			
-
 
204
			this.locationList=locationList;
-
 
205
		}
-
 
206
	
-
 
207
		
-
 
208
		
-
 
209
		/**
-
 
210
		 * Declaration DateList
-
 
211
		 * @param locationList
-
 
212
		 */
-
 
213
		
-
 
214
		public void registerDateList(DateList dateList) {
-
 
215
			
-
 
216
			this.dateList=dateList;
-
 
217
		}
Line 91... Line 218...
91
			this.locationList=locationList;
218
 
92
		}
219
		
93
		
220
		
94
		/**
221
		/**
Line 119... Line 246...
119
		
246
		
120
		public void registerLocationAssistant(LocationAssistant locationAssistant) {
247
		public void registerLocationAssistant(LocationAssistant locationAssistant) {
Line 121... Line 248...
121
			this.locationAssistant=locationAssistant;
248
			this.locationAssistant=locationAssistant;
-
 
249
			
-
 
250
		}
-
 
251
 
-
 
252
		
-
 
253
		
-
 
254
		/**
-
 
255
		 * Declaration date
-
 
256
		 * @param date
-
 
257
		 */
-
 
258
		
-
 
259
		public void registerDate(TextBox date) {
-
 
260
			this.date=date;
-
 
261
			
-
 
262
		}
-
 
263
	
-
 
264
		
-
 
265
		
-
 
266
		/**
-
 
267
		 * Declaration complementLocation
-
 
268
		 * @param complementLocation
-
 
269
		 */
-
 
270
		
-
 
271
		public void registerComplementLocation(TextBox complementLocation) {
-
 
272
			this.complementLocation=complementLocation;
-
 
273
			
-
 
274
		}
-
 
275
		
-
 
276
		
-
 
277
	    public void  registerEntryPanel(EntryPanel entryPanel) {
-
 
278
	    	this.entryPanel=entryPanel;
-
 
279
		}
-
 
280
 
-
 
281
		
-
 
282
		/**
-
 
283
		 * Declaration commentaire 
-
 
284
		 * @param commentaire
-
 
285
		 */
-
 
286
		
-
 
287
		public void registerComment(TextBox comment) {
-
 
288
			this.comment=comment;
-
 
289
			
-
 
290
		}
Line 122... Line 291...
122
			
291
		
123
		}
292
 
124
		
293
		
Line 189... Line 358...
189
 
358
 
190
		public LocationList getLocationList() {
359
		public LocationList getLocationList() {
191
			return locationList;
360
			return locationList;
Line -... Line 361...
-
 
361
		}
-
 
362
 
-
 
363
		public DateList getDateList() {
-
 
364
			return dateList;
-
 
365
		}
192
		}
366
 
193
 
367
		
194
		public NameAssistant getNameAssistant() {
368
		public NameAssistant getNameAssistant() {
Line 195... Line 369...
195
			return nameAssistant;
369
			return nameAssistant;
196
		}
370
		}
197
 
371
 
Line -... Line 372...
-
 
372
		public LocationAssistant getLocationAssistant() {
-
 
373
			return locationAssistant;
-
 
374
		}
-
 
375
 
-
 
376
		public InventoryItem getInventoryItem() {
-
 
377
			return inventoryItem;
-
 
378
		}
-
 
379
 
Line 198... Line 380...
198
		public LocationAssistant getLocationAssistant() {
380
		public EntryPanel getEntryPanel() {