Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1186 Rev 1239
Line 28... Line 28...
28
import org.tela_botanica.client.modeles.projet.Projet;
28
import org.tela_botanica.client.modeles.projet.Projet;
29
import org.tela_botanica.client.modeles.projet.ProjetListe;
29
import org.tela_botanica.client.modeles.projet.ProjetListe;
30
import org.tela_botanica.client.modeles.publication.Publication;
30
import org.tela_botanica.client.modeles.publication.Publication;
31
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
31
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
32
import org.tela_botanica.client.modeles.publication.PublicationListe;
32
import org.tela_botanica.client.modeles.publication.PublicationListe;
-
 
33
import org.tela_botanica.client.util.Debug;
33
import org.tela_botanica.client.util.Pattern;
34
import org.tela_botanica.client.util.Pattern;
34
import org.tela_botanica.client.util.UtilString;
35
import org.tela_botanica.client.util.UtilString;
35
import org.tela_botanica.client.vues.Formulaire;
36
import org.tela_botanica.client.vues.Formulaire;
Line 36... Line 37...
36
 
37
 
Line 52... Line 53...
52
import com.extjs.gxt.ui.client.store.ListStore;
53
import com.extjs.gxt.ui.client.store.ListStore;
53
import com.extjs.gxt.ui.client.widget.LayoutContainer;
54
import com.extjs.gxt.ui.client.widget.LayoutContainer;
54
import com.extjs.gxt.ui.client.widget.MessageBox;
55
import com.extjs.gxt.ui.client.widget.MessageBox;
Line 55... Line 56...
55
 
56
 
56
import com.extjs.gxt.ui.client.widget.ContentPanel;
57
import com.extjs.gxt.ui.client.widget.ContentPanel;
57
import com.extjs.gxt.ui.client.widget.Info;
58
import org.tela_botanica.client.composants.InfoLogger;
58
import com.extjs.gxt.ui.client.widget.TabItem;
59
import com.extjs.gxt.ui.client.widget.TabItem;
59
import com.extjs.gxt.ui.client.widget.TabPanel;
60
import com.extjs.gxt.ui.client.widget.TabPanel;
Line 60... Line 61...
60
import com.extjs.gxt.ui.client.widget.Text;
61
import com.extjs.gxt.ui.client.widget.Text;
Line 181... Line 182...
181
		
182
		
182
		//Tab 3 : Infos Naturalistes
183
		//Tab 3 : Infos Naturalistes
183
		tiInfosNat = creerOnglet(i18nC.personneInfoNat(), "tiInfosNat");
184
		tiInfosNat = creerOnglet(i18nC.personneInfoNat(), "tiInfosNat");
Line -... Line 185...
-
 
185
		formulaireOnglets.add(tiInfosNat);
184
		formulaireOnglets.add(tiInfosNat);
186
		
185
		
187
		//Tab 4 : Publications
Line 186... Line 188...
186
		tiPubli = new PersonneFormPublication(this);
188
		tiPubli = new PersonneFormPublication(this);
187
		formulaireOnglets.add(tiPubli);
189
		formulaireOnglets.add(tiPubli);
Line 669... Line 671...
669
		Button ajouterPubli = new Button("Ajouter");
671
		Button ajouterPubli = new Button("Ajouter");
670
		ajouterPubli.setIcon(Images.ICONES.vcardAjouter());
672
		ajouterPubli.setIcon(Images.ICONES.vcardAjouter());
671
		ajouterPubli.addSelectionListener(new SelectionListener<ButtonEvent>() {  
673
		ajouterPubli.addSelectionListener(new SelectionListener<ButtonEvent>() {  
672
			@Override  
674
			@Override  
673
			public void componentSelected(ButtonEvent ce) {  
675
			public void componentSelected(ButtonEvent ce) {  
674
				Window.alert("ajout publi");
676
Debug.log("|> PersonneForm.creerComposantsPubli() : A MODIFIER ! ajout publi");
675
				/*StructureAPersonne membreDuPersonnel = new StructureAPersonne("", StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
677
				/*StructureAPersonne membreDuPersonnel = new StructureAPersonne("", StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
676
				ajouterMembreAGrillePersonnel(membreDuPersonnel);*/
678
				ajouterMembreAGrillePersonnel(membreDuPersonnel);*/
677
			}  
679
			}  
678
		});
680
		});
679
		toolBar.add(ajouterPubli);
681
		toolBar.add(ajouterPubli);
Line 747... Line 749...
747
		
749
		
748
		tiPubli.add(cp);
750
		tiPubli.add(cp);
Line 749... Line 751...
749
	}
751
	}
-
 
752
 
-
 
753
	public void rafraichirPublicationsExistante(String nomPubli)	{
-
 
754
		
750
 
755
Debug.log("|> PersonneForm.rafraichirPublicationsExistante()");
751
	public void rafraichirPublicationsExistante(String nomPubli)	{
756
		
752
		nomPubli +="%";
757
		nomPubli +="%";
Line 753... Line 758...
753
		mediateur.selectionnerPublicationParNomComplet(this, null, nomPubli);
758
		mediateur.selectionnerPublicationParNomComplet(this, null, nomPubli);
Line 776... Line 781...
776
	}
781
	}
Line 777... Line 782...
777
	
782
	
Line 778... Line 783...
778
	// RAFRAICHISSEMENT DU PANNEAU
783
	// RAFRAICHISSEMENT DU PANNEAU
-
 
784
 
-
 
785
	public void rafraichir(Object nouvellesDonnees) {
-
 
786
		
779
 
787
Debug.log("|> PersonneForm.rafraichir(Object nouvellesDonnees) BEGIN");
-
 
788
 
-
 
789
		if (nouvellesDonnees instanceof PublicationAPersonneListe)	{
-
 
790
			
780
	public void rafraichir(Object nouvellesDonnees) {
791
Debug.log("|--> PersonneForm.rafraichir(Object nouvellesDonnees) : nouvellesDonnees instanceof PublicationAPersonneListe");						
781
		if (nouvellesDonnees instanceof PublicationAPersonneListe)	{
792
			
782
			Information info = new Information();
793
			Information info = new Information();
-
 
794
			info.setType("publication_liees");
-
 
795
			info.setDonnee(0, (PublicationAPersonneListe) nouvellesDonnees);
783
			info.setType("publication_liees");
796
 
-
 
797
Debug.log("|--> tiPubli.rafraichir(info)");
784
			info.setDonnee(0, (PublicationAPersonneListe) nouvellesDonnees);
798
			tiPubli.rafraichir(info);
Line -... Line 799...
-
 
799
 
-
 
800
		} else if (nouvellesDonnees instanceof ValeurListe) {
-
 
801
			
785
			tiPubli.rafraichir(info);
802
Debug.log("|--> PersonneForm.rafraichir(Object nouvellesDonnees) : nouvellesDonnees instanceof ValeurListe");				
Line 786... Line 803...
786
		} else if (nouvellesDonnees instanceof ValeurListe) {
803
			
787
			
804
			
788
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
805
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
789
			
806
			
790
			// Créer une liste de valeurs
807
			// Créer une liste de valeurs
791
			List<Valeur> liste = new ArrayList<Valeur>();
808
			List<Valeur> liste = new ArrayList<Valeur>();
-
 
809
			for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
-
 
810
				liste.add(listeValeurs.get(it.next()));
792
			for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
811
			}
-
 
812
			if (listeValeurs.getId().equals(config.getListeId("relationPersonnePublication")))	{
-
 
813
	
793
				liste.add(listeValeurs.get(it.next()));
814
Debug.log("|--> tiPubli.rafraichir(nouvellesDonnees)");
794
			}
815
				tiPubli.rafraichir(nouvellesDonnees);
795
			if (listeValeurs.getId().equals(config.getListeId("relationPersonnePublication")))	{
816
				
796
				tiPubli.rafraichir(nouvellesDonnees);
817
				
797
			} else if (listeValeurs.getId().equals(config.getListeId("prefixe")))	{
818
			} else if (listeValeurs.getId().equals(config.getListeId("prefixe")))	{
Line 827... Line 848...
827
				mettreAJourRegion();
848
				mettreAJourRegion();
828
				hmAdresse.getComboBox("cbRegion").setVisible(true);
849
				hmAdresse.getComboBox("cbRegion").setVisible(true);
Line 829... Line 850...
829
				
850
				
830
			}
851
			}
-
 
852
		} else if (nouvellesDonnees instanceof ProjetListe) {
-
 
853
			
-
 
854
			
-
 
855
Debug.log("|--> PersonneForm.rafraichir(Object nouvellesDonnees) : nouvellesDonnees instanceof ProjetListe");				
831
		} else if (nouvellesDonnees instanceof ProjetListe) {
856
			
832
			ProjetListe projets = (ProjetListe) nouvellesDonnees;
857
			ProjetListe projets = (ProjetListe) nouvellesDonnees;
Line 833... Line 858...
833
			List<Projet> liste = projets.toList();
858
			List<Projet> liste = projets.toList();
834
			
859
			
835
			ComboBox cbProjets = hmIdentite.getComboBox("cbProjets");
860
			ComboBox cbProjets = hmIdentite.getComboBox("cbProjets");
836
			ListStore<Projet> storeProjets= cbProjets.getStore();
861
			ListStore<Projet> storeProjets= cbProjets.getStore();
837
			storeProjets.removeAll();
862
			storeProjets.removeAll();
838
			storeProjets.add(liste);
863
			storeProjets.add(liste);
-
 
864
			cbProjets.setStore(storeProjets);
-
 
865
		} else if (nouvellesDonnees instanceof PublicationListe)	{
-
 
866
 
-
 
867
Debug.log("|> PersonneForm.rafraichir");
Line 839... Line 868...
839
			cbProjets.setStore(storeProjets);
868
Debug.log("|--> nouvellesDonnees instanceof PublicationListe");
-
 
869
 
-
 
870
			
-
 
871
			PublicationListe publicationListe = (PublicationListe) nouvellesDonnees;
840
		} else if (nouvellesDonnees instanceof PublicationListe)	{
872
			
-
 
873
Debug.log("|--> nouvellesDonnees ="+publicationListe.toString());
841
			
874
			
842
			PublicationListe publicationListe = (PublicationListe) nouvellesDonnees;
875
			List<Publication> liste = publicationListe.toList();
843
			List<Publication> liste = publicationListe.toList();
876
			
Line 844... Line 877...
844
			storePubli.removeAll();
877
			storePubli.removeAll();
-
 
878
			storePubli.add(liste);
-
 
879
			cbPubli.setStore(storePubli);
-
 
880
			
845
			storePubli.add(liste);
881
		} else if (nouvellesDonnees instanceof Information)	{
846
			cbPubli.setStore(storePubli);
882
			
847
			
883
Debug.log("|--> PersonneForm.rafraichir(Object nouvellesDonnees) : nouvellesDonnees instanceof Information");				
848
		} else if (nouvellesDonnees instanceof Information)	{
884
			
849
			Information info = (Information) nouvellesDonnees;
885
			Information info = (Information) nouvellesDonnees;
850
			if (info.getType().equals("ajout_personne"))	{
886
			if (info.getType().equals("ajout_personne"))	{
851
				if (info.getDonnee(0) != null) {
887
				if (info.getDonnee(0) != null) {
852
					personneSelectionnee.setId(info.getDonnee(0).toString());
888
					personneSelectionnee.setId(info.getDonnee(0).toString());
853
					GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null);
889
					GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null);
854
					Info.display("Enregistrement", "La personne a été ajoutée (id: " + personneSelectionnee.getId() + ")");
890
					InfoLogger.display("Enregistrement", "La personne a été ajoutée (id: " + personneSelectionnee.getId() + ")");
855
					repandreRafraichissement();
891
					repandreRafraichissement();
856
					if (clicBoutonvalidation)	{
892
					if (clicBoutonvalidation)	{
857
						mediateur.clicMenu(menuIdCourant);
893
						mediateur.clicMenu(menuIdCourant);
858
					}
894
					}
859
				} else {
895
				} else {
860
					Info.display("Enregistrement", info.getMessages().toString());
896
					InfoLogger.display("Enregistrement", info.getMessages().toString());
861
				}
897
				}
862
			} else if (info.getType().equals("modification_personne"))	{
898
			} else if (info.getType().equals("modification_personne"))	{
863
				Info.display("Enregistrement", "Les modifications apportées à la personne " + personneSelectionnee.getId() + " ont été correctement enregistrées.");
899
				InfoLogger.display("Enregistrement", "Les modifications apportées à la personne " + personneSelectionnee.getId() + " ont été correctement enregistrées.");
864
				repandreRafraichissement();
900
				repandreRafraichissement();
Line 881... Line 917...
881
				
917
				
Line 882... Line 918...
882
				mettreAJourPersonne(personne);
918
				mettreAJourPersonne(personne);
883
				
919
				
884
				nouvellesDonnees = null;
920
				nouvellesDonnees = null;
885
			} else {
921
			} else {
886
				Info.display("messages", info.getMessages().toString());
922
				InfoLogger.display("messages", info.getMessages().toString());
Line 887... Line 923...
887
			}
923
			}
-
 
924
		}
-
 
925
		
-
 
926
		if (nouvellesDonnees == null) {
888
		}
927
			
Line 889... Line 928...
889
		
928
Debug.log("|--> PersonneForm.rafraichir(Object nouvellesDonnees) : nouvellesDonnees == null");	
890
		if (nouvellesDonnees == null) {
929
			
Line 937... Line 976...
937
		mediateur.masquerPopinChargement();
976
		mediateur.masquerPopinChargement();
Line 938... Line 977...
938
		
977
		
939
		if (this.mode.equals(MODE_AJOUTER))	{
978
		if (this.mode.equals(MODE_AJOUTER))	{
940
			gererEtatActivationBouton();
979
			gererEtatActivationBouton();
-
 
980
		}
-
 
981
		
941
		}
982
Debug.log("|> PersonneForm.rafraichir(Object nouvellesDonnees) END");		
Line 942... Line 983...
942
	}
983
	}
-
 
984
 
-
 
985
	private void repandreRafraichissement() {
-
 
986
		
943
 
987
Debug.log("|> PersonneForm.repandreRafraichissement()");	
944
	private void repandreRafraichissement() {
988
		
945
		if (vueExterneARafraichirApresValidation != null) {
989
		if (vueExterneARafraichirApresValidation != null) {
946
			String type = "personne_modifiee";
990
			String type = "personne_modifiee";
947
			if (mode.equals(Formulaire.MODE_AJOUTER)) {
991
			if (mode.equals(Formulaire.MODE_AJOUTER)) {
Line 965... Line 1009...
965
			}
1009
			}
966
		}
1010
		}
967
	}
1011
	}
Line 968... Line 1012...
968
	
1012
	
-
 
1013
	private void mettreAJourPersonne(Personne personne)	{
-
 
1014
		
-
 
1015
Debug.log("|> BEGIN PersonneForm.mettreAJourPersonne()");	
-
 
1016
 
969
	private void mettreAJourPersonne(Personne personne)	{
1017
		
970
		//Mise à jour de la personne		
1018
		//Mise à jour de la personne		
971
		//Personne personne = (Personne) nouvellesDonnees;
1019
		//Personne personne = (Personne) nouvellesDonnees;
972
		ComboBox cbProjets = hmIdentite.getComboBox("cbProjets");
1020
		ComboBox cbProjets = hmIdentite.getComboBox("cbProjets");
Line 1085... Line 1133...
1085
		hmInfosNat.getChampMultiValeurs("specialite").peupler(personne.getString("ce_truk_specialite"));
1133
		hmInfosNat.getChampMultiValeurs("specialite").peupler(personne.getString("ce_truk_specialite"));
1086
		String tr = personne.getString("truk_recolte");
1134
		String tr = personne.getString("truk_recolte");
1087
		hmInfosNat.getChampMultiValeursMultiTypes("recolte").peupler(tr);
1135
		hmInfosNat.getChampMultiValeursMultiTypes("recolte").peupler(tr);
Line 1088... Line 1136...
1088
		
1136
		
-
 
1137
		//Onglet publi
-
 
1138
		
1089
		//Onglet publi
1139
Debug.log("|--> appel à tiPubli.mettreAJourPersonne()");	
1090
		tiPubli.mettreAJourPersonne();
1140
		tiPubli.mettreAJourPersonne();
-
 
1141
		gererEtatActivationBouton();
-
 
1142
		
1091
		gererEtatActivationBouton();
1143
Debug.log("|> BEGIN PersonneForm.mettreAJourPersonne()");	
Line 1092... Line 1144...
1092
	}
1144
	}
1093
 
1145
 
1094
	public void remplirCombobox(String idComboBox, List liste, String hashMapId)	{
1146
	public void remplirCombobox(String idComboBox, List liste, String hashMapId)	{
Line 1123... Line 1175...
1123
		mettreAJourPersonne(personneSauvegarde);
1175
		mettreAJourPersonne(personneSauvegarde);
1124
		mediateur.masquerPopinChargement();
1176
		mediateur.masquerPopinChargement();
1125
	}
1177
	}
Line 1126... Line 1178...
1126
	
1178
	
-
 
1179
	public void binderPersonne(Personne personne)	{
-
 
1180
		
-
 
1181
Debug.log("|> BEGIN PersonneForm.binderPersonne()");	
1127
	public void binderPersonne(Personne personne)	{
1182
 
Line 1128... Line 1183...
1128
		binding = new FormBinding(getFormulaire());
1183
		binding = new FormBinding(getFormulaire());
Line 1129... Line 1184...
1129
		
1184
		
1130
		personneSelectionnee = personne;
1185
		personneSelectionnee = personne;
1131
		
1186
		
Line 1132... Line 1187...
1132
		FieldBinding f = new FieldBinding((RadioGroup) hmIdentite.get("rbgDeces"), null);
1187
		FieldBinding f = new FieldBinding((RadioGroup) hmIdentite.get("rbgDeces"), null);
1133
		binding.autoBind();
1188
		binding.autoBind();
-
 
1189
		binding.removeFieldBinding(f);
-
 
1190
		
-
 
1191
		binding.bind(personneSelectionnee);
1134
		binding.removeFieldBinding(f);
1192
		layout();
Line 1135... Line 1193...
1135
		
1193
		
1136
		binding.bind(personneSelectionnee);
1194
Debug.log("|> END PersonneForm.binderPersonne()");
1137
		layout();
1195