Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 708 Rev 728
Line 16... Line 16...
16
import org.tela_botanica.client.modeles.Observation;
16
import org.tela_botanica.client.modeles.Observation;
17
import org.tela_botanica.client.modeles.ReferentielCommune;
17
import org.tela_botanica.client.modeles.ReferentielCommune;
18
import org.tela_botanica.client.modeles.ReferentielNom;
18
import org.tela_botanica.client.modeles.ReferentielNom;
19
import org.tela_botanica.client.modeles.ListeReferentielPerso.TypesReferentiels;
19
import org.tela_botanica.client.modeles.ListeReferentielPerso.TypesReferentiels;
20
import org.tela_botanica.client.observation.ObservationMediateur;
20
import org.tela_botanica.client.observation.ObservationMediateur;
-
 
21
import org.tela_botanica.client.util.AutoCompletionRefComboBox;
21
import org.tela_botanica.client.util.Util;
22
import org.tela_botanica.client.util.Util;
Line 22... Line 23...
22
 
23
 
23
import com.google.gwt.core.client.GWT;
24
import com.google.gwt.core.client.GWT;
24
import com.google.gwt.core.client.JavaScriptObject;
25
import com.google.gwt.core.client.JavaScriptObject;
Line 146... Line 147...
146
	private String formatDate = null ;
147
	private String formatDate = null ;
147
	private Button boutonOK = new Button("Créer");
148
	private Button boutonOK = new Button("Créer");
148
	private Button boutonAnnuler = new Button("Réinitialiser");
149
	private Button boutonAnnuler = new Button("Réinitialiser");
Line 149... Line 150...
149
 
150
 
150
	private boolean selectionCommune=false;
-
 
151
	private boolean selectionStation=false;
-
 
152
	private boolean selectionLieuDit=false;
-
 
153
	private boolean selectionMilieu=false;
151
	private boolean selectionCommune=false;
Line 154... Line 152...
154
	private boolean selectionEspece=false;
152
	private boolean selectionEspece=false;
155
	
153
	
Line 317... Line 315...
317
		htmlCommunePanel.setBorder(false);
315
		htmlCommunePanel.setBorder(false);
318
		htmlCommunePanel.setId("x-commune-panel"); 
316
		htmlCommunePanel.setId("x-commune-panel"); 
Line 319... Line 317...
319
 
317
 
Line 320... Line 318...
320
		panneauPremierColonne.add(htmlCommunePanel);
318
		panneauPremierColonne.add(htmlCommunePanel);
321
 
-
 
-
 
319
 
322
	    station = new ComboBox("Station", "station");  
320
	    station = new AutoCompletionRefComboBox("Station", "station", observationMediateur, TypesReferentiels.REFERENTIEL_STATION) {
323
	    station.setTpl(resultTplRefPerso);
-
 
324
	    station.setMode(ComboBox.REMOTE);
-
 
325
		// commune.setPageSize(10); // Ne fonctionne pas 
321
 
326
	    station.setItemSelector("div.search-item-commune");
-
 
327
	    station.setTypeAhead(true);  
-
 
328
	    station.setLoadingText("Recherche...");  
322
			public void onModificationValeur() {
Line -... Line 323...
-
 
323
				stationModifiee = true;
-
 
324
			}
-
 
325
 
-
 
326
			public void onValidationSaisie() {
329
	    station.setHideTrigger(true);
327
				validerSaisie(Champs.STATION);
Line 330... Line 328...
330
	    station.setAllowBlank(true);
328
			}  	
331
 
329
	    };
332
	    panneauPremierColonne.add(station, new AnchorLayoutData("95%"));  
330
	    panneauPremierColonne.add(station, new AnchorLayoutData("95%"));  
Line 465... Line 463...
465
		espece.setHideTrigger(true);
463
		espece.setHideTrigger(true);
466
		//espece.setTabIndex(6);
464
		//espece.setTabIndex(6);
Line 467... Line 465...
467
 
465
 
Line 468... Line 466...
468
	    panneauPremierColonne.add(espece, new AnchorLayoutData("95%"));   
466
	    panneauPremierColonne.add(espece, new AnchorLayoutData("95%"));   
469
	    
-
 
-
 
467
	    
470
	    lieudit = new ComboBox("Lieu-dit", "lieudit");  
468
	    lieudit = new AutoCompletionRefComboBox("Lieu-dit", "lieudit",observationMediateur,TypesReferentiels.REFERENTIEL_LIEU_DIT) {
471
	    lieudit.setTpl(resultTplRefPerso);
-
 
472
	    lieudit.setMode(ComboBox.REMOTE);
469
 
-
 
470
			public void onModificationValeur() {
-
 
471
				lieuDitModifie = true;			
473
	    lieudit.setItemSelector("div.search-item-commune");
472
			}
474
	    lieudit.setTypeAhead(true);  
473
 
-
 
474
			public void onValidationSaisie() {
475
	    lieudit.setLoadingText("Recherche...");  
475
				validerSaisie(Champs.LIEUDIT);
476
	    lieudit.setHideTrigger(true);
476
			}
477
	    lieudit.setAllowBlank(true);
477
	    };
-
 
478
	    panneauSecondeColonne.add(lieudit,  new AnchorLayoutData("95%"));  
478
	    panneauSecondeColonne.add(lieudit,  new AnchorLayoutData("95%"));  
479
	       	    
479
	       
480
	    milieu = new AutoCompletionRefComboBox("Milieu","milieu",observationMediateur,TypesReferentiels.REFERENTIEL_MILIEU) {
480
	
-
 
481
	    milieu = new ComboBox("Milieu", "milieu");   
-
 
482
	    milieu.setTpl(resultTplRefPerso);
-
 
483
	    milieu.setMode(ComboBox.REMOTE);
481
 
-
 
482
			public void onModificationValeur() {
-
 
483
				milieuModifie = true;
484
	    milieu.setItemSelector("div.search-item-commune");
484
			}
485
	    milieu.setTypeAhead(true);  
485
 
-
 
486
			public void onValidationSaisie() {
-
 
487
				validerSaisie(Champs.MILIEU);
486
	    milieu.setLoadingText("Recherche...");  
488
			}
487
	    milieu.setHideTrigger(true);
489
	    	
Line 488... Line 490...
488
	    milieu.setAllowBlank(true);
490
	    };
489
	    panneauSecondeColonne.add(milieu,  new AnchorLayoutData("95%"));
491
	    panneauSecondeColonne.add(milieu,  new AnchorLayoutData("95%"));
490
	    
492
	    
Line 695... Line 697...
695
		    
697
		    
696
		    ListenerConfig listenerConfigAutocompletion=new ListenerConfig();
698
		    ListenerConfig listenerConfigAutocompletion=new ListenerConfig();
697
		    listenerConfigAutocompletion.setDelay(200);
699
		    listenerConfigAutocompletion.setDelay(200);
698
		    listenerConfigAutocompletion.setStopPropagation(false);
700
		    listenerConfigAutocompletion.setStopPropagation(false);
699
		    listenerConfigAutocompletion.setStopEvent(false);
-
 
700
		    
-
 
701
		    station.addListener(new ComboBoxListenerAdapter() {  
-
 
702
	             public void onSelect(ComboBox comboBox, Record record, int index) {  
-
 
703
	            	 station.setValue(record.getAsString("element_referentiel"));
-
 
704
	                 selectionStation=true;
-
 
705
	                 station.collapse();
-
 
706
	             }  
-
 
707
	             
-
 
708
	             public void onExpand(ComboBox comboBox) {
-
 
709
	            	 comboBox.focus();
-
 
710
	             }
-
 
711
	         });  
-
 
712
		    
-
 
Line 713... Line -...
713
		    station.addKeyPressListener(new EventCallback() {
-
 
714
 
-
 
715
				public void execute(EventObject e) {
-
 
716
					// TODO Auto-generated method stub
-
 
717
					switch(e.getKey()) {
-
 
718
	  	    	      
-
 
719
						case KEY_ALT:
-
 
720
		    	        case KEY_CTRL:
-
 
721
		    	        case KEY_DOWN:
-
 
722
		    	        case KEY_END:
-
 
723
		    	        case KEY_ESCAPE:
-
 
724
		    	        case KEY_HOME:
-
 
725
		    	        case KEY_LEFT:
-
 
726
		    	        case KEY_PAGEDOWN:
-
 
727
		    	        case KEY_PAGEUP:
-
 
728
		    	        case KEY_RIGHT:
-
 
729
		    	        case KEY_SHIFT:
-
 
730
		    	        case KEY_TAB:
-
 
731
		    	        case KEY_UP:
-
 
732
		    	      break;
-
 
733
		    	      
-
 
734
	  	    	      case KEY_ENTER:	
-
 
735
	  	    	    	if (selectionStation) {
-
 
736
	  	    	    		stationModifiee= true;
-
 
737
	  	    	    		selectionStation=false;
-
 
738
	   	    	    	}
-
 
739
	   	    	    	else {
-
 
740
	  	    	    		validerSaisie(Champs.STATION); 	
-
 
741
	  	    	    	}
-
 
742
	  	    	    break;
-
 
743
	  	    	       
-
 
744
	  	    	      default:
-
 
745
	  	    	    	  obtenirReferentielStation();
-
 
746
	  	    	    	  stationModifiee = true;
-
 
747
					}
-
 
748
				}
-
 
749
		    },listenerConfigAutocompletion);
-
 
750
		    
701
		    listenerConfigAutocompletion.setStopEvent(false);
751
		    
702
 
752
			
703
		    			
753
			// Listener completion espece 
704
			// Listener completion espece 
754
			espece.addListener(new ComboBoxListenerAdapter() {  
705
			espece.addListener(new ComboBoxListenerAdapter() {  
755
	             public void onSelect(ComboBox comboBox, Record record, int index) {  
706
	             public void onSelect(ComboBox comboBox, Record record, int index) {  
Line 818... Line 769...
818
		    	 
769
		    	 
Line 819... Line 770...
819
		    		},    listenerConfigEspece
770
		    		},    listenerConfigEspece
Line 820... Line -...
820
		    	
-
 
821
			);
-
 
822
			
-
 
823
			// Listener completion lieudit 
-
 
824
			lieudit.addListener(new ComboBoxListenerAdapter() {  
-
 
825
	             public void onSelect(ComboBox comboBox, Record record, int index) {  
-
 
826
	            	 lieudit.setValue(record.getAsString("element_referentiel"));
-
 
827
	                 selectionLieuDit=true;
-
 
828
	                 lieudit.collapse();
-
 
829
	             }  
-
 
830
	         });  
-
 
831
		    
-
 
832
			lieudit.addKeyPressListener(new EventCallback() {
-
 
833
 
-
 
834
				public void execute(EventObject e) {
-
 
835
					// TODO Auto-generated method stub
-
 
836
					switch(e.getKey()) {
-
 
837
	  	    	      
-
 
838
					case KEY_ALT:
-
 
839
	  	    	      case KEY_CTRL:
-
 
840
	  	    	      case KEY_DOWN:
-
 
841
	  	    	      case KEY_END:
-
 
842
	  	    	      case KEY_ESCAPE:
-
 
843
	  	    	      case KEY_HOME:
-
 
844
	  	    	      case KEY_LEFT:
-
 
845
	  	    	      case KEY_PAGEDOWN:
-
 
846
	  	    	      case KEY_PAGEUP:
-
 
847
	  	    	      case KEY_RIGHT:
-
 
848
	  	    	      case KEY_SHIFT:
-
 
849
	  	    	      case KEY_TAB:
-
 
850
	  	    	      case KEY_UP:
-
 
851
  	    	    	
-
 
852
  	    	        break;
-
 
853
					
-
 
854
	  	    	    case KEY_ENTER:	
-
 
855
	  	    	    	if (selectionLieuDit) {
-
 
856
	  	    	    		lieuDitModifie= true;
-
 
857
	  	    	    		selectionLieuDit=false;
-
 
858
	   	    	    	}
-
 
859
	   	    	    	else {
-
 
860
	  	    	    		validerSaisie(Champs.LIEUDIT); 	
-
 
861
	  	    	    	}
-
 
862
	  	    	    break;
-
 
863
	  	    	       
-
 
864
	  	    	      default:
-
 
865
	  					lieuDitModifie = true;
-
 
866
	  	    	      	obtenirReferentielLieuDit();
-
 
867
					}
-
 
868
				}
-
 
869
		    },listenerConfigAutocompletion);
-
 
870
			
-
 
871
			// Listener completion lieudit 
-
 
872
			milieu.addListener(new ComboBoxListenerAdapter() {  
-
 
873
	             public void onSelect(ComboBox comboBox, Record record, int index) {  
-
 
874
	            	 milieu.setValue(record.getAsString("element_referentiel"));
-
 
875
	                 selectionMilieu=true;
-
 
876
	                 milieu.collapse();
-
 
877
	             }  
-
 
878
	         }); 
-
 
879
			
-
 
880
			milieu.addKeyPressListener(new EventCallback() {
-
 
881
 
-
 
882
				public void execute(EventObject e) {
-
 
883
					// TODO Auto-generated method stub
-
 
884
					switch(e.getKey()) {
-
 
885
					
-
 
886
						case KEY_ALT:
-
 
887
	  	    	      case KEY_CTRL:
-
 
888
	  	    	      case KEY_DOWN:
-
 
889
	  	    	      case KEY_END:
-
 
890
	  	    	      case KEY_ESCAPE:
-
 
891
	  	    	      case KEY_HOME:
-
 
892
	  	    	      case KEY_LEFT:
-
 
893
	  	    	      case KEY_PAGEDOWN:
-
 
894
	  	    	      case KEY_PAGEUP:
-
 
895
	  	    	      case KEY_RIGHT:
-
 
896
	  	    	      case KEY_SHIFT:
-
 
897
	  	    	      case KEY_TAB:
-
 
898
	  	    	      case KEY_UP:
-
 
899
	  	    	    	
-
 
900
	  	    	        break;
-
 
901
	  	    	      
-
 
902
		  	    	    case KEY_ENTER:	
-
 
903
		  	    	    	if (selectionMilieu) {
-
 
904
		  	    	    		milieuModifie= true;
-
 
905
		  	    	    		selectionMilieu=false;
-
 
906
		   	    	    	}
-
 
907
		   	    	    	else {
-
 
908
		  	    	    		validerSaisie(Champs.MILIEU); 	
-
 
909
		  	    	    	}
-
 
910
		  	    	    break;
-
 
911
	  	    	       
-
 
912
	  	    	      default:
-
 
913
	  					milieuModifie = true;
-
 
914
	  	    	      	obtenirListeReferentielMilieu();
-
 
915
					}
-
 
916
				}
771
		    	
Line 917... Line 772...
917
		    },listenerConfigAutocompletion);
772
			);
918
			
773
			
919
			comment.addKeyPressListener(new EventCallback() {
774
			comment.addKeyPressListener(new EventCallback() {
Line 1186... Line 1041...
1186
	
1041
	
Line 1187... Line 1042...
1187
				espece.setStore(store);
1042
				espece.setStore(store);
Line 1188... Line -...
1188
				
-
 
1189
			}
-
 
1190
			
-
 
1191
			if(nouvelleDonnees instanceof ListeReferentielPerso)
-
 
1192
			{
-
 
1193
				
-
 
1194
				ListeReferentielPerso referentielPerso = (ListeReferentielPerso)nouvelleDonnees;
-
 
1195
				
-
 
1196
				int i = 0;
-
 
1197
				Object[][] refData = new Object[referentielPerso.size()][1];
-
 
1198
				
-
 
1199
				// on la parse et on récupère les informations quiç nous interessent
-
 
1200
				for (Iterator it = referentielPerso.keySet().iterator(); it.hasNext();) 
-
 
1201
				{
-
 
1202
					String ref= referentielPerso.get(it.next());
-
 
1203
					refData[i][0]= ref;
-
 
1204
					
-
 
1205
					i++;
-
 
1206
				}
-
 
1207
				
-
 
1208
				
-
 
1209
				//creation du store
-
 
1210
				FieldDef defStation = new StringFieldDef("element_referentiel");
-
 
1211
				FieldDef[] defTab = {defStation};
-
 
1212
				
-
 
1213
				RecordDef rd = new RecordDef(defTab);
-
 
1214
				
-
 
1215
				final MemoryProxy dataProxy = new MemoryProxy(refData);
-
 
1216
				final ArrayReader reader = new ArrayReader(rd);		
-
 
1217
								
-
 
1218
				Store store=new Store(dataProxy,reader);	
-
 
1219
				
-
 
1220
				switch (referentielPerso.getTypeReferentiel()) {
-
 
1221
								
-
 
1222
					case REFERENTIEL_STATION:				
-
 
1223
						station.setStore(store);
-
 
1224
						store.load();
-
 
1225
						
-
 
1226
					break;
-
 
1227
					
-
 
1228
					case REFERENTIEL_LIEU_DIT:					
-
 
1229
						lieudit.setStore(store);
-
 
1230
						store.load();
-
 
1231
					break;
-
 
1232
					
-
 
1233
					case REFERENTIEL_MILIEU:			
-
 
1234
						milieu.setStore(store);
-
 
1235
						store.load();
-
 
1236
					break;
-
 
1237
	
-
 
1238
					default:
-
 
1239
					break;
-
 
1240
				}
1043
				
Line 1241... Line 1044...
1241
			}
1044
			}
1242
			
1045
			
1243
			// On recoit une observation dont on veut afficher le detail 
1046
			// On recoit une observation dont on veut afficher le detail