Subversion Repositories eFlore/Applications.cel

Rev

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

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