Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 128 Rev 132
Line 9... Line 9...
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
 
-
 
15
import com.google.gwt.user.client.Window;
14
import com.gwtext.client.core.EventCallback;
16
import com.gwtext.client.core.EventCallback;
15
import com.gwtext.client.core.EventObject;
17
import com.gwtext.client.core.EventObject;
16
import com.gwtext.client.core.ListenerConfig;
18
import com.gwtext.client.core.ListenerConfig;
17
import com.gwtext.client.core.Position;
19
import com.gwtext.client.core.Position;
18
import com.gwtext.client.data.ArrayReader;
20
import com.gwtext.client.data.ArrayReader;
Line 20... Line 22...
20
import com.gwtext.client.data.MemoryProxy;
22
import com.gwtext.client.data.MemoryProxy;
21
import com.gwtext.client.data.RecordDef;
23
import com.gwtext.client.data.RecordDef;
22
import com.gwtext.client.data.SimpleStore;
24
import com.gwtext.client.data.SimpleStore;
23
import com.gwtext.client.data.Store;
25
import com.gwtext.client.data.Store;
24
import com.gwtext.client.data.StringFieldDef;
26
import com.gwtext.client.data.StringFieldDef;
-
 
27
import com.gwtext.client.widgets.BoxComponent;
25
import com.gwtext.client.widgets.Button;
28
import com.gwtext.client.widgets.Button;
-
 
29
import com.gwtext.client.widgets.Component;
-
 
30
import com.gwtext.client.widgets.Container;
26
import com.gwtext.client.widgets.Panel;
31
import com.gwtext.client.widgets.Panel;
27
import com.gwtext.client.widgets.Toolbar;
32
import com.gwtext.client.widgets.Toolbar;
-
 
33
import com.gwtext.client.widgets.event.BoxComponentListener;
-
 
34
import com.gwtext.client.widgets.event.BoxComponentListenerAdapter;
28
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
35
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-
 
36
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
29
import com.gwtext.client.widgets.form.ComboBox;
37
import com.gwtext.client.widgets.form.ComboBox;
30
import com.gwtext.client.widgets.form.DateField;
38
import com.gwtext.client.widgets.form.DateField;
31
import com.gwtext.client.widgets.form.FormPanel;
39
import com.gwtext.client.widgets.form.FormPanel;
32
import com.gwtext.client.widgets.form.TextArea;
40
import com.gwtext.client.widgets.form.TextArea;
33
import com.gwtext.client.widgets.form.TextField;
41
import com.gwtext.client.widgets.form.TextField;
Line 169... Line 177...
169
		commune.setItemSelector("div.search-item-commune");
177
		commune.setItemSelector("div.search-item-commune");
170
		commune.setTypeAhead(true);  
178
		commune.setTypeAhead(true);  
171
		commune.setLoadingText("Recherche...");  
179
		commune.setLoadingText("Recherche...");  
Line 172... Line 180...
172
		  
180
		  
-
 
181
		commune.setHideTrigger(true);
Line 173... Line -...
173
		commune.setHideTrigger(true);
-
 
174
		
-
 
175
		
-
 
176
     
-
 
177
 
182
		commune.setTabIndex(1);
Line 178... Line -...
178
 
-
 
179
	    panneauPremierColonne.add(commune);  
-
 
180
 
183
		
181
		
184
	    panneauPremierColonne.add(commune);  
-
 
185
 
182
	    
186
	    station = new TextField("Station", "station", tailleChamps);  
Line 183... Line 187...
183
	    station = new TextField("Station", "station", tailleChamps);  
187
	    station.setAllowBlank(true);
184
	    station.setAllowBlank(true);  
188
	    station.setTabIndex(3);
185
	    panneauPremierColonne.add(station);  
189
	    panneauPremierColonne.add(station);  
186
	    
190
	    
-
 
191
	    date = new DateField("Date", "date", 100);  
187
	    date = new DateField("Date", "date", 100);  
192
	    date.setAllowBlank(true);
Line 188... Line 193...
188
	    date.setAllowBlank(true);
193
	    formatDate = "d/m/Y";
Line 203... Line 208...
203
		espece.setItemSelector("div.search-item-espece");
208
		espece.setItemSelector("div.search-item-espece");
204
		espece.setTypeAhead(true);  
209
		espece.setTypeAhead(true);  
205
		espece.setLoadingText("Recherche...");  
210
		espece.setLoadingText("Recherche...");  
Line 206... Line 211...
206
		  
211
		  
207
		espece.setHideTrigger(true);
-
 
208
		
-
 
-
 
212
		espece.setHideTrigger(true);
Line 209... Line 213...
209
 
213
		espece.setTabIndex(6);
Line 210... Line 214...
210
 
214
 
211
	    panneauPremierColonne.add(espece);   
215
	    panneauPremierColonne.add(espece);   
-
 
216
	    
212
	    
217
	    lieudit = new TextField("Lieu-dit", "lieudit", tailleChamps);  
Line 213... Line 218...
213
	    lieudit = new TextField("Lieu-dit", "lieudit", tailleChamps);  
218
	    lieudit.setAllowBlank(true);
214
	    lieudit.setAllowBlank(true);  
219
	    lieudit.setTabIndex(2);
-
 
220
	    panneauSecondeColonne.add(lieudit);  
215
	    panneauSecondeColonne.add(lieudit);  
221
	       
Line 216... Line 222...
216
	       
222
	
217
	
223
	    milieu = new TextField("Milieu", "milieu", tailleChamps);  
218
	    milieu = new TextField("Milieu", "milieu", tailleChamps);  
224
	    milieu.setAllowBlank(true);
219
	    milieu.setAllowBlank(true);  
225
	    milieu.setTabIndex(4);
-
 
226
	    panneauSecondeColonne.add(milieu);
220
	    panneauSecondeColonne.add(milieu);
227
	    
Line 221... Line 228...
221
	    
228
	    comment = new TextArea("Notes", "comment");  
222
	    comment = new TextArea("Notes", "comment");  
229
	    comment.setAllowBlank(true);
Line 245... Line 252...
245
		bt = new Toolbar() ;
252
		bt = new Toolbar() ;
246
		bt.addSpacer() ;
253
		bt.addSpacer() ;
247
		bt.addText("Mode de saisie ") ;
254
		bt.addText("Mode de saisie ") ;
248
		bt.addField(selecteurMode) ;
255
		bt.addField(selecteurMode) ;
Line 249... Line -...
249
		
-
 
250
		
-
 
-
 
256
		
-
 
257
		boutonOK.setTabIndex(8);
Line 251... Line 258...
251
		
258
		boutonAnnuler.setTabIndex(9);
Line 252... Line 259...
252
		
259
		
Line 273... Line 280...
273
	
280
	
274
	
281
	
Line 275... Line -...
275
		// on ajoute les listeners
-
 
276
		ajouterListeners() ;
-
 
277
		
282
		// on ajoute les listeners
Line 278... Line 283...
278
		
283
		ajouterListeners() ;
279
 
284
		
280
	}
285
	}
Line 295... Line 300...
295
			ListenerConfig listenerConfigCommune=new ListenerConfig();
300
			ListenerConfig listenerConfigCommune=new ListenerConfig();
296
			listenerConfigCommune.setDelay(10);
301
			listenerConfigCommune.setDelay(10);
297
			listenerConfigCommune.setStopPropagation(false);
302
			listenerConfigCommune.setStopPropagation(false);
298
			listenerConfigCommune.setStopEvent(false);
303
			listenerConfigCommune.setStopEvent(false);
Line 299... Line -...
299
			
-
 
300
 
-
 
301
		
304
			
Line 302... Line 305...
302
		    commune.addKeyPressListener(new EventCallback()	{
305
		    commune.addKeyPressListener(new EventCallback()	{
Line 303... Line 306...
303
		    	
306
		    	
Line -... Line 307...
-
 
307
	    	    public void execute(EventObject e) {
-
 
308
	    	    	
-
 
309
	    	    		  
-
 
310
	    	    		switch(e.getKey()) {
-
 
311
	    	    	      
-
 
312
    	    				case KEY_ALT:
-
 
313
	    	    	        case KEY_CTRL:
-
 
314
	    	    	        case KEY_DOWN:
-
 
315
	    	    	        case KEY_END:
-
 
316
	    	    	        case KEY_ESCAPE:
-
 
317
	    	    	        case KEY_HOME:
-
 
318
	    	    	        case KEY_LEFT:
-
 
319
	    	    	        case KEY_PAGEDOWN:
-
 
320
	    	    	        case KEY_PAGEUP:
-
 
321
	    	    	        case KEY_RIGHT:
-
 
322
	    	    	        case KEY_SHIFT:
304
	    	    public void execute(EventObject e) {
323
	    	    	        case KEY_TAB:
Line 305... Line 324...
305
	    	    	
324
	    	    	        case KEY_UP:
306
	    	    		  
325
	    	    	    	
307
	    	    		switch(e.getKey()) {
326
	    	    	        break;
Line 508... Line 527...
508
				
527
				
Line 509... Line 528...
509
				
528
				
-
 
529
			}
-
 
530
			
-
 
531
		});
-
 
532
		
-
 
533
		this.addListener(new ContainerListenerAdapter() {
-
 
534
			public void onAfterLayout(Container self) {
-
 
535
				
-
 
536
				ajusterTailleChamps();
-
 
537
				commune.focus();
-
 
538
			}
-
 
539
		});	
-
 
540
		
-
 
541
		this.addListener(new BoxComponentListenerAdapter() {
-
 
542
				public void onResize(BoxComponent component, int adjWidth, int adjHeight, int rawWidth, int rawHeight)  {
-
 
543
				
510
			}
544
				ajusterTailleChamps();
Line 511... Line 545...
511
			
545
			}
512
		});
546
		});
513
	}
547
	}
Line 580... Line 614...
580
					final ArrayReader reader = new ArrayReader(rd);		
614
					final ArrayReader reader = new ArrayReader(rd);		
Line 581... Line 615...
581
					
615
					
582
					Store store=new Store(dataProxy,reader);
616
					Store store=new Store(dataProxy,reader);
Line 583... Line 617...
583
					store.load() ;
617
					store.load() ;
584
		
-
 
585
					commune.setStore(store);					
618
		
Line 586... Line 619...
586
							
619
					commune.setStore(store);
Line 587... Line 620...
587
			}
620
			}
Line 774... Line 807...
774
				numeroNom = "" ;
807
				numeroNom = "" ;
775
				numeroOrdre = "";
808
				numeroOrdre = "";
776
				break;
809
				break;
Line 777... Line 810...
777
				
810
				
-
 
811
			case TOUT:
778
			case TOUT:
812
				commune.reset();
779
				date.reset() ;
813
				date.reset() ;
780
				lieudit.reset() ;
814
				lieudit.reset() ;
781
				station.reset() ;
815
				station.reset() ;
782
				milieu.reset() ;
816
				milieu.reset() ;
Line 812... Line 846...
812
			boutonAnnuler.setText("Réinitialiser") ;
846
			boutonAnnuler.setText("Réinitialiser") ;
813
			modification = false ;
847
			modification = false ;
814
			selecteurMode.removeClass("x-selec-modif") ;
848
			selecteurMode.removeClass("x-selec-modif") ;
815
			selecteurMode.setCls("x-selec-crea") ;
849
			selecteurMode.setCls("x-selec-crea") ;
Line 816... Line 850...
816
			
850
			
817
		}
-
 
818
		
851
		}	
Line 819... Line -...
819
	}
-
 
820
	
852
	}
821
	
853
	
822
	/**
854
	/**
823
	 * renvoie vrai si on est en mode modification, faux si on est en mode création
855
	 * renvoie vrai si on est en mode modification, faux si on est en mode création
824
	 * @return
856
	 * @return
Line 828... Line 860...
828
		return modification ;
860
		return modification ;
829
	}
861
	}
Line 830... Line 862...
830
	
862
	
Line 831... Line 863...
831
	public boolean verifierFormatDate(String date) {
863
	public boolean verifierFormatDate(String date) {
832
		
864
		
833
		String regex = "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" ;
865
		String regex = "[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}" ;
834
		if(date.matches(regex) && !date.equals("0000-00-00")) {
866
		if(date.matches(regex) && !date.equals("0000-00-00")) {
835
			return true ;
867
			return true ;
836
		}
868
		}
837
		else {
869
		else {
838
			return false;
870
			return false;
-
 
871
		}
-
 
872
	}
-
 
873
	
-
 
874
	private void ajusterTailleChamps() {
-
 
875
		
-
 
876
		int tailleChamps = (this.getInnerWidth()/100)*40;
-
 
877
		
-
 
878
		this.tailleChamps = tailleChamps ;
-
 
879
		
-
 
880
		commune.setWidth(tailleChamps);
-
 
881
		station.setWidth(tailleChamps);
-
 
882
		espece.setWidth(tailleChamps);
-
 
883
		lieudit.setWidth(tailleChamps);
-
 
884
		milieu.setWidth(tailleChamps);
-
 
885
		comment.setWidth(tailleChamps);
Line 839... Line 886...
839
		}
886