Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 42 Rev 46
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
2
 
2
 
3
 
3
 
4
 
4
 
5
import java.util.Iterator;
5
import java.util.Iterator;
6
 
6
 
7
import org.tela_botanica.client.interfaces.Rafraichissable;
7
import org.tela_botanica.client.interfaces.Rafraichissable;
8
import org.tela_botanica.client.modeles.ListeReferentielCommune;
8
import org.tela_botanica.client.modeles.ListeReferentielCommune;
9
import org.tela_botanica.client.modeles.ListeReferentielNom;
9
import org.tela_botanica.client.modeles.ListeReferentielNom;
10
import org.tela_botanica.client.modeles.Observation;
10
import org.tela_botanica.client.modeles.Observation;
11
import org.tela_botanica.client.modeles.ReferentielCommune;
11
import org.tela_botanica.client.modeles.ReferentielCommune;
12
import org.tela_botanica.client.modeles.ReferentielNom;
12
import org.tela_botanica.client.modeles.ReferentielNom;
13
import org.tela_botanica.client.observation.ObservationMediateur;
13
import org.tela_botanica.client.observation.ObservationMediateur;
14
 
14
 
15
 
15
 
16
import com.google.gwt.user.client.Window;
16
import com.google.gwt.user.client.Window;
17
import com.gwtext.client.core.EventCallback;
17
import com.gwtext.client.core.EventCallback;
18
import com.gwtext.client.core.EventObject;
18
import com.gwtext.client.core.EventObject;
19
import com.gwtext.client.core.ListenerConfig;
19
import com.gwtext.client.core.ListenerConfig;
20
import com.gwtext.client.core.Position;
20
import com.gwtext.client.core.Position;
21
import com.gwtext.client.data.ArrayReader;
21
import com.gwtext.client.data.ArrayReader;
22
import com.gwtext.client.data.FieldDef;
22
import com.gwtext.client.data.FieldDef;
23
import com.gwtext.client.data.MemoryProxy;
23
import com.gwtext.client.data.MemoryProxy;
24
import com.gwtext.client.data.RecordDef;
24
import com.gwtext.client.data.RecordDef;
25
import com.gwtext.client.data.Store;
25
import com.gwtext.client.data.Store;
26
import com.gwtext.client.data.StringFieldDef;
26
import com.gwtext.client.data.StringFieldDef;
27
import com.gwtext.client.widgets.Button;
27
import com.gwtext.client.widgets.Button;
28
import com.gwtext.client.widgets.Panel;
28
import com.gwtext.client.widgets.Panel;
29
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
29
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
30
import com.gwtext.client.widgets.form.ComboBox;
30
import com.gwtext.client.widgets.form.ComboBox;
31
import com.gwtext.client.widgets.form.DateField;
31
import com.gwtext.client.widgets.form.DateField;
32
import com.gwtext.client.widgets.form.FormPanel;
32
import com.gwtext.client.widgets.form.FormPanel;
33
import com.gwtext.client.widgets.form.TextField;
33
import com.gwtext.client.widgets.form.TextField;
34
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
34
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
35
import com.gwtext.client.widgets.layout.ColumnLayout;
35
import com.gwtext.client.widgets.layout.ColumnLayout;
36
import com.gwtext.client.widgets.layout.ColumnLayoutData;
36
import com.gwtext.client.widgets.layout.ColumnLayoutData;
37
import com.gwtext.client.widgets.layout.FormLayout;
37
import com.gwtext.client.widgets.layout.FormLayout;
38
import com.gwtext.client.data.Record;
38
import com.gwtext.client.data.Record;
39
 
39
 
40
/**
40
/**
41
 * Panneau contenant les infos, les métadonnées et l'arbre des mots clés, il implémente l'interface rafraichissable
41
 * Panneau contenant les infos, les métadonnées et l'arbre des mots clés, il implémente l'interface rafraichissable
42
 * @author aurelien
42
 * @author aurelien
43
 *
43
 *
44
 */
44
 */
45
public class FormulaireSaisieObservationVue extends Panel implements Rafraichissable  {
45
public class FormulaireSaisieObservationVue extends Panel implements Rafraichissable  {
46
 
46
 
47
 
47
 
48
	/**
48
	/**
49
	 * Le médiateur associé à la vue
49
	 * Le médiateur associé à la vue
50
	 */
50
	 */
51
	private ObservationMediateur	observationMediateur		= null;
51
	private ObservationMediateur	observationMediateur		= null;
52
	
52
	
53
	
53
	
54
 
54
 
55
	private DateField date = null;
55
	private DateField date = null;
56
	private TextField lieudit = null;
56
	private TextField lieudit = null;
57
	private TextField station = null;
57
	private TextField station = null;
58
	private TextField milieu = null;
58
	private TextField milieu = null;
59
	private TextField comment = null;
59
	private TextField comment = null;
60
	private ComboBox  commune = null;
60
	private ComboBox  commune = null;
61
	private String departement = null;
61
	private String departement = null;
62
	private ComboBox  espece = null;
62
	private ComboBox  espece = null;
63
	private String numeroNom = null;
63
	private String numeroNom = null;
64
 
64
 
65
	private Button boutonOK = new Button("Ok");
65
	private Button boutonOK = new Button("Ok");
66
	private Button boutonAnnuler = new Button("Annuler");
66
	private Button boutonAnnuler = new Button("Annuler");
67
 
67
 
68
	private boolean selectionCommune=false;
68
	private boolean selectionCommune=false;
69
	private boolean selectionEspece=false;
69
	private boolean selectionEspece=false;
70
	
70
	
71
	
71
	
72
	private final int KEY_ALT = 18;
72
	private final int KEY_ALT = 18;
73
	private final int KEY_BACKSPACE = 8;
73
	private final int KEY_BACKSPACE = 8;
74
	private final int KEY_CTRL = 17;
74
	private final int KEY_CTRL = 17;
75
	private final int KEY_DELETE = 46;
75
	private final int KEY_DELETE = 46;
76
	private final int KEY_DOWN = 40;
76
	private final int KEY_DOWN = 40;
77
	private final int KEY_END = 35;
77
	private final int KEY_END = 35;
78
	private final int KEY_ENTER = 13;
78
	private final int KEY_ENTER = 13;
79
	private final int KEY_ESCAPE = 27;
79
	private final int KEY_ESCAPE = 27;
80
	private final int KEY_HOME = 36;
80
	private final int KEY_HOME = 36;
81
	private final int KEY_LEFT = 37;
81
	private final int KEY_LEFT = 37;
82
	private final int KEY_PAGEDOWN = 34;
82
	private final int KEY_PAGEDOWN = 34;
83
	private final int KEY_PAGEUP = 33;
83
	private final int KEY_PAGEUP = 33;
84
	private final int KEY_RIGHT = 39;
84
	private final int KEY_RIGHT = 39;
85
	private final int KEY_SHIFT = 16;
85
	private final int KEY_SHIFT = 16;
86
	private final int KEY_TAB = 9;
86
	private final int KEY_TAB = 9;
87
	private final int KEY_UP = 38;
87
	private final int KEY_UP = 38;
88
	
88
	
89
	
89
	
90
	
90
	
91
 
91
 
92
	/**
92
	/**
93
	 * Booleen d'instanciation
93
	 * Booleen d'instanciation
94
	 */
94
	 */
95
	boolean estInstancie = false ;
95
	boolean estInstancie = false ;
96
	
96
	
97
	/**
97
	/**
98
	 * Constructeur sans argument (privé car ne doit pas être utilisé)
98
	 * Constructeur sans argument (privé car ne doit pas être utilisé)
99
	 */
99
	 */
100
	private FormulaireSaisieObservationVue()
100
	private FormulaireSaisieObservationVue()
101
	{
101
	{
102
		super() ;
102
		super() ;
103
	}
103
	}
104
	
104
	
105
	/**
105
	/**
106
	 * Constructeur avec argument
106
	 * Constructeur avec argument
107
	 * @param im
107
	 * @param im
108
	 */
108
	 */
109
	public FormulaireSaisieObservationVue(ObservationMediateur obs)
109
	public FormulaireSaisieObservationVue(ObservationMediateur obs)
110
	{
110
	{
111
 
111
 
112
		
112
		
113
		// on associe le médiateur
113
		// on associe le médiateur
114
		observationMediateur = obs ;
114
		observationMediateur = obs ;
115
		
115
		
116
		this.setHeader(true);
116
		this.setHeader(true);
117
		this.setTitle("Saisie");
117
		this.setTitle("Saisie");
118
	   
118
	   
119
		
119
		
120
		this.setCollapsible(true) ;
120
		this.setCollapsible(true) ;
121
		
121
		
122
		FormPanel panneauFormulaire = new FormPanel(Position.RIGHT);
122
		FormPanel panneauFormulaire = new FormPanel(Position.RIGHT);
123
		panneauFormulaire.setBorder(false);
123
		panneauFormulaire.setBorder(false);
124
		
124
		
125
		// Panneau intermediaire qui contient deux colonnes de formulaire
125
		// Panneau intermediaire qui contient deux colonnes de formulaire
126
		
126
		
127
		Panel panneauIntermediaire = new Panel();  
127
		Panel panneauIntermediaire = new Panel();  
128
		panneauIntermediaire.setLayout(new ColumnLayout());  
128
		panneauIntermediaire.setLayout(new ColumnLayout());  
129
		panneauIntermediaire.setBorder(false);
129
		panneauIntermediaire.setBorder(false);
130
		   
130
		   
131
		//create first panel and add fields to it  
131
		//create first panel and add fields to it  
132
		Panel panneauPremierColonne = new Panel();  
132
		Panel panneauPremierColonne = new Panel();  
133
		panneauPremierColonne.setLayout(new FormLayout());  
133
		panneauPremierColonne.setLayout(new FormLayout());  
134
		panneauPremierColonne.setBorder(false);
134
		panneauPremierColonne.setBorder(false);
135
 
135
 
136
		//create second panel and add fields to it  
136
		//create second panel and add fields to it  
137
	    Panel panneauSecondeColonne = new Panel();  
137
	    Panel panneauSecondeColonne = new Panel();  
138
		panneauSecondeColonne.setLayout(new FormLayout());  
138
		panneauSecondeColonne.setLayout(new FormLayout());  
139
		panneauSecondeColonne.setBorder(false);
139
		panneauSecondeColonne.setBorder(false);
140
		
140
		
141
		this.setPaddings(5) ;
141
		this.setPaddings(5) ;
142
	
142
	
143
	/*
143
	/*
144
	    //	  creation du store
144
	    //	  creation du store
145
		FieldDef defCommune = new StringFieldDef("commune");
145
		FieldDef defCommune = new StringFieldDef("commune");
146
		FieldDef defDepartement = new StringFieldDef("departement");
146
		FieldDef defDepartement = new StringFieldDef("departement");
147
		
147
		
148
		
148
		
149
		FieldDef[] defTab = { defCommune, defDepartement};
149
		FieldDef[] defTab = { defCommune, defDepartement};
150
		
150
		
151
		RecordDef rd = new RecordDef(defTab);
151
		RecordDef rd = new RecordDef(defTab);
152
		
152
		
153
		
153
		
154
		store = new Store(rd);
154
		store = new Store(rd);
155
		
155
		
156
		//store.load();*/
156
		//store.load();*/
157
		
157
		
158
 
158
 
159
		commune=new ComboBox("Commune","commune",275 );  
159
		commune=new ComboBox("Commune","commune",275 );  
160
		
160
		
161
		
161
		
162
		final String resultTplCommune = "<div class=\"search-item-commune\">{commune}</div>";  
162
		final String resultTplCommune = "<div class=\"search-item-commune\">{commune}</div>";  
163
 
163
 
164
		
164
		
165
		commune.setTpl(resultTplCommune);
165
		commune.setTpl(resultTplCommune);
166
		commune.setMode(ComboBox.REMOTE);
166
		commune.setMode(ComboBox.REMOTE);
167
		// commune.setPageSize(10); // Ne fonctionne pas 
167
		// commune.setPageSize(10); // Ne fonctionne pas 
168
		commune.setItemSelector("div.search-item-commune");
168
		commune.setItemSelector("div.search-item-commune");
169
		commune.setTypeAhead(true);  
169
		commune.setTypeAhead(true);  
170
		commune.setLoadingText("Recherche...");  
170
		commune.setLoadingText("Recherche...");  
171
		  
171
		  
172
		commune.setHideTrigger(true);
172
		commune.setHideTrigger(true);
173
		
173
		
174
		
174
		
175
     
175
     
176
 
176
 
177
 
177
 
178
	    panneauPremierColonne.add(commune);  
178
	    panneauPremierColonne.add(commune);  
179
 
179
 
180
		
180
		
181
	    
181
	    
182
	    station = new TextField("Station", "station", 275);  
182
	    station = new TextField("Station", "station", 275);  
183
	    station.setAllowBlank(true);  
183
	    station.setAllowBlank(true);  
184
	    panneauPremierColonne.add(station);  
184
	    panneauPremierColonne.add(station);  
185
	    
185
	    
186
	    date = new DateField("Date", "date", 100);  
186
	    date = new DateField("Date", "date", 100);  
187
	    date.setAllowBlank(true);
187
	    date.setAllowBlank(true);
188
	    date.setFormat("d/m/Y") ;
188
	    date.setFormat("d/m/Y") ;
189
	    panneauPremierColonne.add(date);  
189
	    panneauPremierColonne.add(date);  
190
 
190
 
191
	 	
191
	 	
192
		espece=new ComboBox("Espèce","nom",275 );  
192
		espece=new ComboBox("Espèce","nom",275 );  
193
		
193
		
194
		
194
		
195
		final String resultTplEspece = "<div class=\"search-item-espece\">{nom}</div>";  
195
		final String resultTplEspece = "<div class=\"search-item-espece\">{nom}</div>";  
196
 
196
 
197
		
197
		
198
		espece.setTpl(resultTplEspece);
198
		espece.setTpl(resultTplEspece);
199
		espece.setMode(ComboBox.REMOTE);
199
		espece.setMode(ComboBox.REMOTE);
200
		// commune.setPageSize(10); // Ne fonctionne pas 
200
		// commune.setPageSize(10); // Ne fonctionne pas 
201
		espece.setItemSelector("div.search-item-espece");
201
		espece.setItemSelector("div.search-item-espece");
202
		espece.setTypeAhead(true);  
202
		espece.setTypeAhead(true);  
203
		espece.setLoadingText("Recherche...");  
203
		espece.setLoadingText("Recherche...");  
204
		  
204
		  
205
		espece.setHideTrigger(true);
205
		espece.setHideTrigger(true);
206
		
206
		
207
 
207
 
208
 
208
 
209
	    panneauPremierColonne.add(espece);  
209
	    panneauPremierColonne.add(espece);  
210
	    
210
	    
211
	    comment = new TextField("Notes", "comment", 275);  
211
	    comment = new TextField("Notes", "comment", 275);  
212
	    comment.setAllowBlank(true);  
212
	    comment.setAllowBlank(true);  
213
	    panneauPremierColonne.add(comment); 
213
	    panneauPremierColonne.add(comment); 
214
	    
214
	    
215
	    
215
	    
216
	    lieudit = new TextField("Lieu-dit", "lieudit", 275);  
216
	    lieudit = new TextField("Lieu-dit", "lieudit", 275);  
217
	    lieudit.setAllowBlank(true);  
217
	    lieudit.setAllowBlank(true);  
218
	    panneauSecondeColonne.add(lieudit);  
218
	    panneauSecondeColonne.add(lieudit);  
219
	       
219
	       
220
	
220
	
221
	    milieu = new TextField("Milieu", "milieu", 275);  
221
	    milieu = new TextField("Milieu", "milieu", 275);  
222
	    milieu.setAllowBlank(true);  
222
	    milieu.setAllowBlank(true);  
223
	    panneauSecondeColonne.add(milieu);  
223
	    panneauSecondeColonne.add(milieu);  
224
	   
224
	   
225
	 
225
	 
226
		
226
		
227
		panneauIntermediaire.add(panneauPremierColonne, new ColumnLayoutData(.5));
227
		panneauIntermediaire.add(panneauPremierColonne, new ColumnLayoutData(.5));
228
		panneauIntermediaire.add(panneauSecondeColonne, new ColumnLayoutData(.5));
228
		panneauIntermediaire.add(panneauSecondeColonne, new ColumnLayoutData(.5));
229
		
229
		
230
		panneauFormulaire.add(panneauIntermediaire);
230
		panneauFormulaire.add(panneauIntermediaire);
231
		
231
		
232
		
232
		
233
		panneauFormulaire.addButton(boutonOK);
233
		panneauFormulaire.addButton(boutonOK);
234
		    
234
		    
235
		  
235
		  
236
		panneauFormulaire.addButton(boutonAnnuler);
236
		panneauFormulaire.addButton(boutonAnnuler);
237
		    
237
		    
238
	
238
	
239
		this.add(panneauFormulaire) ;
239
		this.add(panneauFormulaire) ;
240
		
240
		
241
		
241
		
242
		this.setAutoHeight(true);
242
		this.setAutoHeight(true);
243
	
243
	
244
	
244
	
245
		// on ajoute les listeners
245
		// on ajoute les listeners
246
		ajouterListeners() ;
246
		ajouterListeners() ;
247
		
247
		
248
		
248
		
249
 
249
 
250
	}
250
	}
251
	
251
	
252
	private void ajouterListeners()
252
	private void ajouterListeners()
253
	{
253
	{
254
		
254
		
255
		
255
		
256
		// Listener completion communne 
256
		// Listener completion communne 
257
		
257
		
258
		   commune.addListener(new ComboBoxListenerAdapter() {  
258
		   commune.addListener(new ComboBoxListenerAdapter() {  
259
	             public void onSelect(ComboBox comboBox, Record record, int index) {  
259
	             public void onSelect(ComboBox comboBox, Record record, int index) {  
260
	                 commune.setValue(record.getAsString("commune"));
260
	                 commune.setValue(record.getAsString("commune"));
261
	                 departement=record.getAsString("departement");
261
	                 departement=record.getAsString("departement");
262
	                 selectionCommune=true;
262
	                 selectionCommune=true;
263
	             }  
263
	             }  
264
	         });  
264
	         });  
265
	         
265
	         
266
	        
266
	        
267
			ListenerConfig listenerConfigCommune=new ListenerConfig();
267
			ListenerConfig listenerConfigCommune=new ListenerConfig();
268
			listenerConfigCommune.setDelay(10);
268
			listenerConfigCommune.setDelay(10);
269
			listenerConfigCommune.setStopPropagation(false);
269
			listenerConfigCommune.setStopPropagation(false);
270
			listenerConfigCommune.setStopEvent(false);
270
			listenerConfigCommune.setStopEvent(false);
271
			
271
			
272
 
272
 
273
		
273
		
274
		    commune.addKeyPressListener(new EventCallback()	{
274
		    commune.addKeyPressListener(new EventCallback()	{
275
		    	
275
		    	
276
		    	    public void execute(EventObject e) {
276
		    	    public void execute(EventObject e) {
277
		    	    	
277
		    	    	
278
		    	    		  
278
		    	    		  
279
		    	    		  switch(e.getKey()) {
279
		    	    		  switch(e.getKey()) {
280
		    	    	      	    		  
280
		    	    	      	    		  
281
		    	    		  
281
		    	    		  
282
		    	    		  case KEY_ALT:
282
		    	    		  case KEY_ALT:
283
		    	    	      case KEY_CTRL:
283
		    	    	      case KEY_CTRL:
284
		    	    	      case KEY_DOWN:
284
		    	    	      case KEY_DOWN:
285
		    	    	      case KEY_END:
285
		    	    	      case KEY_END:
286
		    	    	      case KEY_ESCAPE:
286
		    	    	      case KEY_ESCAPE:
287
		    	    	      case KEY_HOME:
287
		    	    	      case KEY_HOME:
288
		    	    	      case KEY_LEFT:
288
		    	    	      case KEY_LEFT:
289
		    	    	      case KEY_PAGEDOWN:
289
		    	    	      case KEY_PAGEDOWN:
290
		    	    	      case KEY_PAGEUP:
290
		    	    	      case KEY_PAGEUP:
291
		    	    	      case KEY_RIGHT:
291
		    	    	      case KEY_RIGHT:
292
		    	    	      case KEY_SHIFT:
292
		    	    	      case KEY_SHIFT:
293
		    	    	      case KEY_TAB:
293
		    	    	      case KEY_TAB:
294
		    	    	      case KEY_UP:
294
		    	    	      case KEY_UP:
295
		    	    	    	
295
		    	    	    	
296
		    	    	        break;
296
		    	    	        break;
297
		    	    	      
297
		    	    	      
298
		    	    	      case KEY_ENTER:
298
		    	    	      case KEY_ENTER:
299
		    	    	    	  
299
		    	    	    	  
300
		    	    	    	 if (selectionCommune) {
300
		    	    	    	 if (selectionCommune) {
301
		    	    	    		 selectionCommune=false;
301
		    	    	    		 selectionCommune=false;
302
		    	    	    	 }
302
		    	    	    	 }
303
		    	    	    	 else {
303
		    	    	    	 else {
304
		    	    	    		// lancer mise a jour 	    	    	    		 
304
		    	    	    		// lancer mise a jour 	    	    	    		 
305
		    	    	    	 }
305
		    	    	    	 }
306
		    	    	    	
306
		    	    	    	
307
		    	    	    	
307
		    	    	    	
308
		    	    	    	  break;
308
		    	    	    	  break;
309
		    	    	       
309
		    	    	       
310
		    	    	      default:
310
		    	    	      default:
311
		    	    	    	  
311
		    	    	    	  
312
		    	    	    	  obtenirListeReferentielCommune();
312
		    	    	    	  obtenirListeReferentielCommune();
313
		    	    	    	  	    	    	        
313
		    	    	    	  	    	    	        
314
		    	    	        break;
314
		    	    	        break;
315
		    	    	    }
315
		    	    	    }
316
 
316
 
317
		    	    	 
317
		    	    	 
318
		    	    	
318
		    	    	
319
		     		}
319
		     		}
320
		    	 
320
		    	 
321
		    		},    listenerConfigCommune
321
		    		},    listenerConfigCommune
322
		    	
322
		    	
323
			);
323
			);
324
		    
324
		    
325
			// Listener completion espece 
325
			// Listener completion espece 
326
 
326
 
327
			
327
			
328
			espece.addListener(new ComboBoxListenerAdapter() {  
328
			espece.addListener(new ComboBoxListenerAdapter() {  
329
	             public void onSelect(ComboBox comboBox, Record record, int index) {  
329
	             public void onSelect(ComboBox comboBox, Record record, int index) {  
330
	            	 espece.setValue(record.getAsString("nom"));
330
	            	 espece.setValue(record.getAsString("nom"));
331
	            	 numeroNom=record.getAsString("numeroNom");
331
	            	 numeroNom=record.getAsString("numeroNom");
332
	                 selectionEspece=true;
332
	                 selectionEspece=true;
333
	             }  
333
	             }  
334
	         });  
334
	         });  
335
	         
335
	         
336
 
336
 
337
			ListenerConfig listenerConfigEspece=new ListenerConfig();
337
			ListenerConfig listenerConfigEspece=new ListenerConfig();
338
			listenerConfigEspece.setDelay(10);
338
			listenerConfigEspece.setDelay(10);
339
			listenerConfigEspece.setStopPropagation(false);
339
			listenerConfigEspece.setStopPropagation(false);
340
			listenerConfigEspece.setStopEvent(false);			
340
			listenerConfigEspece.setStopEvent(false);			
341
 
341
 
342
		
342
		
343
			espece.addKeyPressListener(new EventCallback()	{
343
			espece.addKeyPressListener(new EventCallback()	{
344
		    	
344
		    	
345
		    	    public void execute(EventObject e) {
345
		    	    public void execute(EventObject e) {
346
		    	    	
346
		    	    	
347
		    	    		  
347
		    	    		  
348
		    	    		  switch(e.getKey()) {
348
		    	    		  switch(e.getKey()) {
349
		    	    	      	    		  
349
		    	    	      	    		  
350
		    	    		  
350
		    	    		  
351
		    	    		  case KEY_ALT:
351
		    	    		  case KEY_ALT:
352
		    	    	      case KEY_CTRL:
352
		    	    	      case KEY_CTRL:
353
		    	    	      case KEY_DOWN:
353
		    	    	      case KEY_DOWN:
354
		    	    	      case KEY_END:
354
		    	    	      case KEY_END:
355
		    	    	      case KEY_ESCAPE:
355
		    	    	      case KEY_ESCAPE:
356
		    	    	      case KEY_HOME:
356
		    	    	      case KEY_HOME:
357
		    	    	      case KEY_LEFT:
357
		    	    	      case KEY_LEFT:
358
		    	    	      case KEY_PAGEDOWN:
358
		    	    	      case KEY_PAGEDOWN:
359
		    	    	      case KEY_PAGEUP:
359
		    	    	      case KEY_PAGEUP:
360
		    	    	      case KEY_RIGHT:
360
		    	    	      case KEY_RIGHT:
361
		    	    	      case KEY_SHIFT:
361
		    	    	      case KEY_SHIFT:
362
		    	    	      case KEY_TAB:
362
		    	    	      case KEY_TAB:
363
		    	    	      case KEY_UP:
363
		    	    	      case KEY_UP:
364
		    	    	    	
364
		    	    	    	
365
		    	    	        break;
365
		    	    	        break;
366
		    	    	      
366
		    	    	      
367
		    	    	      case KEY_ENTER:
367
		    	    	      case KEY_ENTER:
368
		    	    	    	  
368
		    	    	    	  
369
		    	    	    	 if (selectionEspece) {
369
		    	    	    	 if (selectionEspece) {
370
		    	    	    		 selectionEspece=false;
370
		    	    	    		 selectionEspece=false;
371
		    	    	    	 }
371
		    	    	    	 }
372
		    	    	    	 else {
372
		    	    	    	 else {
373
		    	    	    		// lancer mise a jour 	    	    	    		 
373
		    	    	    		// lancer mise a jour 	    	    	    		 
374
		    	    	    	 }
374
		    	    	    	 }
375
		    	    	    	
375
		    	    	    	
376
		    	    	    	
376
		    	    	    	
377
		    	    	    	  break;
377
		    	    	    	  break;
378
		    	    	       
378
		    	    	       
379
		    	    	      default:
379
		    	    	      default:
380
		    	    	    	  
380
		    	    	    	  
381
		    	    	    	  obtenirListeReferentielNom();
381
		    	    	    	  obtenirListeReferentielNom();
382
		    	    	    	  	    	    	        
382
		    	    	    	  	    	    	        
383
		    	    	        break;
383
		    	    	        break;
384
		    	    	    }
384
		    	    	    }
385
 
385
 
386
		    	    	 
386
		    	    	 
387
		    	    	
387
		    	    	
388
		     		}
388
		     		}
389
		    	 
389
		    	 
390
		    		},    listenerConfigEspece
390
		    		},    listenerConfigEspece
391
		    	
391
		    	
392
			);
392
			);
393
		    
393
		    
394
 
394
 
395
		  
395
		  
396
 
396
 
397
		boutonOK.addListener(new ButtonListenerAdapter() {
397
		boutonOK.addListener(new ButtonListenerAdapter() {
398
			
398
			
399
			public void onClick(Button button, EventObject e) {
399
			public void onClick(Button button, EventObject e) {
400
				
400
				
401
				ajouterObservation();
401
				ajouterObservation();
402
				
402
				
403
			}
403
			}
404
		
404
		
405
			
405
			
406
		});
406
		});
407
 
407
 
408
		// on ajoute un écouteur
408
		// on ajoute un écouteur
409
		/*validerInfo.addListener(new ButtonListenerAdapter() {
409
		/*validerInfo.addListener(new ButtonListenerAdapter() {
410
 
410
 
411
			// gestion du clic
411
			// gestion du clic
412
			
412
			
413
			public void onClick(Button button, EventObject e) {
413
			public void onClick(Button button, EventObject e) {
414
				
414
				
415
				// lors du clic sur le bouton valider on met à jour les commentaires et la date
415
				// lors du clic sur le bouton valider on met à jour les commentaires et la date
416
		//	getIMediateur().mettreAJourInfo(commentaireGeneral.getText(), dateImage.getRawValue(), noteVue.getNote()) ;
416
		//	getIMediateur().mettreAJourInfo(commentaireGeneral.getText(), dateImage.getRawValue(), noteVue.getNote()) ;
417
				
417
				
418
			}	
418
			}	
419
		});
419
		});
420
		*/
420
		*/
421
	
421
	
422
	
422
	
423
	}
423
	}
424
	
424
	
425
	/**
425
	/**
426
	 * Desactive visuellement ce panneau
426
	 * Desactive visuellement ce panneau
427
	 */
427
	 */
428
	public void desactiverPanneau()
428
	public void desactiverPanneau()
429
	{
429
	{
430
		this.setDisabled(true) ;
430
		this.setDisabled(true) ;
431
	}
431
	}
432
	
432
	
433
	/**
433
	/**
434
	 * Active visuellement ce panneau
434
	 * Active visuellement ce panneau
435
	 */
435
	 */
436
	public void activerPanneau()
436
	public void activerPanneau()
437
	{
437
	{
438
		this.setDisabled(false) ;
438
		this.setDisabled(false) ;
439
	}
439
	}
440
 
440
 
441
	public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
441
	public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
442
		
442
		
443
		// si l'on a reçu une liste de commune
443
		// si l'on a reçu une liste du referentiel commune
444
			if(nouvelleDonnees instanceof ListeReferentielCommune)
444
			if(nouvelleDonnees instanceof ListeReferentielCommune)
445
			{
445
			{
446
				
446
				
447
					ListeReferentielCommune data = (ListeReferentielCommune) nouvelleDonnees ;
447
					ListeReferentielCommune data = (ListeReferentielCommune) nouvelleDonnees ;
448
					Object[][] communeData = new Object[data.size()][2];
448
					Object[][] communeData = new Object[data.size()][2];
449
					int i = 0 ;
449
					int i = 0 ;
450
				
450
				
451
					// on la parse et on récupère les informations quiç nous interessent
451
					// on la parse et on récupère les informations quiç nous interessent
452
					for (Iterator it = data.keySet().iterator(); it.hasNext();) 
452
					for (Iterator it = data.keySet().iterator(); it.hasNext();) 
453
					{
453
					{
454
						
454
						
455
						ReferentielCommune ref=(ReferentielCommune) data.get(it.next());
455
						ReferentielCommune ref=(ReferentielCommune) data.get(it.next());
456
						
456
						
457
						communeData[i][0]= ref.getCommune();
457
						communeData[i][0]= ref.getCommune();
458
						communeData[i][1]= ref.getDepartement();
458
						communeData[i][1]= ref.getDepartement();
459
						
459
						
460
																	
460
																	
461
						i++ ;
461
						i++ ;
462
					}
462
					}
463
					
463
					
464
					   //	  creation du store
464
					   //	  creation du store
465
					FieldDef defCommune = new StringFieldDef("commune");
465
					FieldDef defCommune = new StringFieldDef("commune");
466
					FieldDef defDepartement = new StringFieldDef("departement");
466
					FieldDef defDepartement = new StringFieldDef("departement");
467
					
467
					
468
					
468
					
469
					FieldDef[] defTab = { defCommune, defDepartement};
469
					FieldDef[] defTab = { defCommune, defDepartement};
470
					
470
					
471
					RecordDef rd = new RecordDef(defTab);
471
					RecordDef rd = new RecordDef(defTab);
472
					
472
					
473
					final MemoryProxy dataProxy = new MemoryProxy(communeData);
473
					final MemoryProxy dataProxy = new MemoryProxy(communeData);
474
					final ArrayReader reader = new ArrayReader(rd);		
474
					final ArrayReader reader = new ArrayReader(rd);		
475
					
475
					
476
					Store store=new Store(dataProxy,reader);
476
					Store store=new Store(dataProxy,reader);
477
					store.load() ;
477
					store.load() ;
478
		
478
		
479
					commune.setStore(store);					
479
					commune.setStore(store);					
480
							
480
							
481
			}
481
			}
482
			
482
			
483
			//			 si l'on a reçu une liste de nom
483
			//			 si l'on a reçu une liste du referentiel nom
484
			
484
			
485
			if(nouvelleDonnees instanceof ListeReferentielNom)
485
			if(nouvelleDonnees instanceof ListeReferentielNom)
486
			{
486
			{
487
				
487
				
488
					ListeReferentielNom data = (ListeReferentielNom) nouvelleDonnees ;
488
					ListeReferentielNom data = (ListeReferentielNom) nouvelleDonnees ;
489
					Object[][] nomData = new Object[data.size()][2];
489
					Object[][] nomData = new Object[data.size()][2];
490
					int i = 0 ;
490
					int i = 0 ;
491
				
491
				
492
					// on la parse et on récupère les informations quiç nous interessent
492
					// on la parse et on récupère les informations quiç nous interessent
493
					for (Iterator it = data.keySet().iterator(); it.hasNext();) 
493
					for (Iterator it = data.keySet().iterator(); it.hasNext();) 
494
					{
494
					{
495
						
495
						
496
						ReferentielNom ref=(ReferentielNom) data.get(it.next());
496
						ReferentielNom ref=(ReferentielNom) data.get(it.next());
497
						
497
						
498
						nomData[i][0]= ref.getNom();
498
						nomData[i][0]= ref.getNom();
499
						nomData[i][1]= ref.getNumeroNom();
499
						nomData[i][1]= ref.getNumeroNom();
500
						
500
						
501
																	
501
																	
502
						i++ ;
502
						i++ ;
503
					}
503
					}
504
					
504
					
505
					   //	  creation du store
505
					   //	  creation du store
506
					FieldDef defNom = new StringFieldDef("nom");
506
					FieldDef defNom = new StringFieldDef("nom");
507
					FieldDef defNumeroNom = new StringFieldDef("numeroNom");
507
					FieldDef defNumeroNom = new StringFieldDef("numeroNom");
508
					
508
					
509
					
509
					
510
					FieldDef[] defTab = { defNom, defNumeroNom};
510
					FieldDef[] defTab = { defNom, defNumeroNom};
511
					
511
					
512
					RecordDef rd = new RecordDef(defTab);
512
					RecordDef rd = new RecordDef(defTab);
513
					
513
					
514
					final MemoryProxy dataProxy = new MemoryProxy(nomData);
514
					final MemoryProxy dataProxy = new MemoryProxy(nomData);
515
					final ArrayReader reader = new ArrayReader(rd);		
515
					final ArrayReader reader = new ArrayReader(rd);		
516
					
516
					
517
					Store store=new Store(dataProxy,reader);
517
					Store store=new Store(dataProxy,reader);
518
					store.load() ;
518
					store.load() ;
519
		
519
		
520
					espece.setStore(store);
520
					espece.setStore(store);
521
				
521
				
522
					
522
					
523
							
523
							
524
			}
524
			}
525
			
525
			
526
 
526
 
527
	}
527
	}
528
	
528
	
529
 
529
 
530
	public void obtenirListeReferentielCommune() {
530
	public void obtenirListeReferentielCommune() {
531
	 String com=commune.getText().replaceAll(" ","/");
531
	 String com=commune.getText().replaceAll(" ","/");
532
	 com=com.replaceAll("%","");
532
	 com=com.replaceAll("%","");
533
		  
533
		  
534
	 observationMediateur.obtenirListeReferentielCommune(this,com);
534
	 observationMediateur.obtenirListeReferentielCommune(this,com);
535
	 
535
	 
536
	}
536
	}
537
	
537
	
538
 
538
 
539
	public void obtenirListeReferentielNom() {
539
	public void obtenirListeReferentielNom() {
540
	 
540
	 
541
	  String esp=espece.getText().replaceAll(" ","/");
541
	  String esp=espece.getText().replaceAll(" ","/");
542
	  esp=esp.replaceAll("%","");
542
	  esp=esp.replaceAll("%","");
543
		
543
		
544
	  observationMediateur.obtenirListeReferentielNom(this,esp);
544
	  observationMediateur.obtenirListeReferentielNom(this,esp);
545
	 
545
	 
546
	}
546
	}
547
   
547
   
548
 
548
 
549
	public void ajouterObservation() {
549
	public void ajouterObservation() {
550
 
550
 
551
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getText());	
551
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),date.getText());	
552
		observationMediateur.ajouterObservation(this, obs);
552
		observationMediateur.ajouterObservation(obs);
553
	}
553
	}
554
	
554
	
555
 
555
 
556
}
556
}