Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 883 Rev 884
Line 85... Line 85...
85
 
85
 
86
	// VARIABLES
86
	// VARIABLES
87
	private TabItem tiIdentite, tiAdresses, tiInfosNat;
87
	private TabItem tiIdentite, tiAdresses, tiInfosNat;
88
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
88
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
89
	private Personne personneSelectionnee, personneSauvegarde = null;
-
 
Line 90... Line 89...
90
	protected String mode = "";
89
	private Personne personneSelectionnee, personneSauvegarde = null;
91
	
90
	
92
	//hmIdentite[...] référence par une chaine de caractère tous les composants de l'onglet Identite
91
	//hmIdentite[...] référence par une chaine de caractère tous les composants de l'onglet Identite
93
	private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>();
92
	private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>();
94
	private HashMap<String, Widget>hmAdresse = new HashMap<String, Widget>();
93
	private HashMap<String, Widget>hmAdresse = new HashMap<String, Widget>();
95
	private HashMap<String, Widget>hmInfosNat = new HashMap<String, Widget>();
94
	private HashMap<String, Widget>hmInfosNat = new HashMap<String, Widget>();
Line 96... Line 95...
96
	private HashMap<String, Valeur> hmCbSelectionnee = new HashMap();
95
	private HashMap<String, Valeur> hmCbSelectionnee = new HashMap();
Line 97... Line -...
97
	private FormData fd100 = new FormData("95%");
-
 
98
	
-
 
99
	private Button enregistrer, enregistrerEtRevenir;
96
	private FormData fd100 = new FormData("95%");
100
	
97
	
101
	public static final String MODE_AJOUTER = "AJOUT";
-
 
102
	public static final String MODE_MODIFIER = "MODIF";
98
	private Button enregistrer, enregistrerEtRevenir;
Line 103... Line 99...
103
	private Personne personne = null;
99
	
104
	private String personneId = null;
100
	private Personne personne = null;
105
	
101
	private String personneId = null;
106
	private FormBinding binding = null;
102
	private FormBinding binding = null;
Line 107... Line 103...
107
	
103
	
108
	// CONSTRUCTEUR 
104
	// CONSTRUCTEUR 
109
	public PersonneForm(Mediateur mediateurCourrant, String mode, String personneId) {
-
 
110
		initialiserPersonneForm(mediateurCourrant, personneId);
105
	public PersonneForm(Mediateur mediateurCourrant, String mode, String personneId) {
111
	}
106
		initialiserPersonneForm(mediateurCourrant, personneId);
Line 112... Line 107...
112
	
107
	}
113
	public PersonneForm(Mediateur mediateurCourrant, String personneId, Rafraichissable vueARafraichirApresValidation) {
108
	
114
		vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
109
	public PersonneForm(Mediateur mediateurCourrant, String personneId, Rafraichissable vueARafraichirApresValidation) {
115
		personneId = (personneId == null ? "" : personneId);
110
		vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
Line 116... Line 111...
116
		initialiserPersonneForm(mediateurCourrant, personneId);
111
		initialiserPersonneForm(mediateurCourrant, personneId);
117
	}
112
	}
Line 118... Line 113...
118
	
113
	
119
	private void initialiserPersonneForm(Mediateur mediateurCourrant, String personneIdCourrant) {
114
	private void initialiserPersonneForm(Mediateur mediateurCourrant, String personneIdCourrant) {
Line 742... Line 737...
742
			storeProjets.add(liste);
737
			storeProjets.add(liste);
743
			cbProjets.setStore(storeProjets);
738
			cbProjets.setStore(storeProjets);
744
		} else if (nouvellesDonnees instanceof Information)	{
739
		} else if (nouvellesDonnees instanceof Information)	{
745
			Information info = (Information) nouvellesDonnees;
740
			Information info = (Information) nouvellesDonnees;
746
			if (info.getType().equals("ajout_personne"))	{
741
			if (info.getType().equals("ajout_personne"))	{
-
 
742
				if (info.getDonnee(0) != null) {
-
 
743
					personneSelectionnee.setId(info.getDonnee(0).toString());
747
				GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null);
744
					GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null);
748
				Info.display("Enregistrement", "La personne a été ajoutée (id: " + personneSelectionnee.getId() + ")");
745
					Info.display("Enregistrement", "La personne a été ajoutée (id: " + personneSelectionnee.getId() + ")");
749
				
-
 
-
 
746
					repandreRafraichissement();
750
				if (clicBoutonvalidation)	{
747
					if (clicBoutonvalidation)	{
751
					mediateur.clicMenu(menuIdCourant);
748
						mediateur.clicMenu(menuIdCourant);
-
 
749
					}
-
 
750
				} else {
-
 
751
					Info.display("Enregistrement", info.getMessages().toString());
752
				}
752
				}
753
			} else if (info.getType().equals("modification_personne"))	{
753
			} else if (info.getType().equals("modification_personne"))	{
754
				Info.display("Enregistrement", "Les modifications apportées à la personne " + personneSelectionnee.getId() + " ont été correctement enregistrées.");
754
				Info.display("Enregistrement", "Les modifications apportées à la personne " + personneSelectionnee.getId() + " ont été correctement enregistrées.");
755
				
-
 
-
 
755
				repandreRafraichissement();
756
				if (clicBoutonvalidation)	{
756
				if (clicBoutonvalidation)	{
757
					mediateur.clicMenu(menuIdCourant);
757
					mediateur.clicMenu(menuIdCourant);
758
				}
758
				}
759
			}
-
 
760
			else if (info.getType().equals("maj_utilisateur"))	{
759
			} else if (info.getType().equals("maj_utilisateur"))	{
761
				gererEtatActivationBouton();
760
				gererEtatActivationBouton();
762
			} else if (info.getDonnee(0) instanceof PersonneListe)	{
761
			} else if (info.getDonnee(0) instanceof PersonneListe)	{
Line 763... Line 762...
763
				
762
				
764
				Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values();
763
				Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values();
Line 828... Line 827...
828
		if (this.mode.equals(MODE_AJOUTER))	{
827
		if (this.mode.equals(MODE_AJOUTER))	{
829
			gererEtatActivationBouton();
828
			gererEtatActivationBouton();
830
		}
829
		}
831
	}
830
	}
Line -... Line 831...
-
 
831
 
-
 
832
	private void repandreRafraichissement() {
-
 
833
		if (vueExterneARafraichirApresValidation != null) {
-
 
834
			String type = "personne_modifiee";
-
 
835
			if (mode.equals(Formulaire.MODE_AJOUTER)) {
-
 
836
				type = "personne_ajoutee";
-
 
837
			}
-
 
838
			Information info = new Information(type);
-
 
839
			info.setDonnee(0, personneSelectionnee);
-
 
840
			vueExterneARafraichirApresValidation.rafraichir(info);
-
 
841
		}
-
 
842
	}
832
 
843
	
833
	private void mettreAJourPersonne(Personne personne)	{
-
 
834
		
-
 
835
 
844
	private void mettreAJourPersonne(Personne personne)	{
836
		//Mise à jour de la personne		
845
		//Mise à jour de la personne		
Line 837... Line 846...
837
		//Personne personne = (Personne) nouvellesDonnees;
846
		//Personne personne = (Personne) nouvellesDonnees;
838
		
847
		
Line 955... Line 964...
955
		
964
		
956
		((ChampMultiValeurs) hmInfosNat.get("specialite")).peupler(personne.getString("ce_truk_specialite"));
965
		((ChampMultiValeurs) hmInfosNat.get("specialite")).peupler(personne.getString("ce_truk_specialite"));
Line 957... Line 966...
957
		((ChampMultiValeursMultiTypes) hmInfosNat.get("recolte")).peupler(personne.getString("truk_recolte"));
966
		((ChampMultiValeursMultiTypes) hmInfosNat.get("recolte")).peupler(personne.getString("truk_recolte"));
958
		 
-
 
959
		gererEtatActivationBouton();
967
		 
Line 960... Line 968...
960
		
968
		gererEtatActivationBouton();
961
	}
969
	}
962
 
970
 
Line 991... Line 999...
991
		mediateur.afficherPopinChargement();
999
		mediateur.afficherPopinChargement();
Line 992... Line 1000...
992
		
1000
		
Line 993... Line 1001...
993
		mettreAJourPersonne(personneSauvegarde);
1001
		mettreAJourPersonne(personneSauvegarde);
994
		
-
 
995
		mediateur.masquerPopinChargement();
1002
		
Line 996... Line 1003...
996
		
1003
		mediateur.masquerPopinChargement();
997
	}
1004
	}
Line 1182... Line 1189...
1182
		}
1189
		}
1183
		return true;
1190
		return true;
1184
	}
1191
	}
Line 1185... Line 1192...
1185
 
1192
 
1186
	protected boolean verifierFormulaire() {
-
 
1187
		
1193
	protected boolean verifierFormulaire() {
1188
		boolean success = false;
1194
		boolean success = true;
Line 1189... Line 1195...
1189
		LinkedList lstMessageErreur = new LinkedList<String>();
1195
		LinkedList<String> lstMessageErreur = new LinkedList<String>();
1190
		
1196
		
1191
		ComboBox<Projet> cbProjets = (ComboBox<Projet>) hmIdentite.get("cbProjets");
1197
		ComboBox<Projet> cbProjets = (ComboBox<Projet>) hmIdentite.get("cbProjets");
1192
		Projet projet = cbProjets.getValue();
1198
		Projet projet = cbProjets.getValue();
Line 1285... Line 1291...
1285
		
1291
		
1286
		String specialite = ((ChampMultiValeurs) hmInfosNat.get("specialite")).getValeurs();
1292
		String specialite = ((ChampMultiValeurs) hmInfosNat.get("specialite")).getValeurs();
Line 1287... Line 1293...
1287
		personneSelectionnee.set("ce_truk_specialite", specialite);
1293
		personneSelectionnee.set("ce_truk_specialite", specialite);
1288
		
-
 
1289
		
-
 
1290
		if (lstMessageErreur.size() == 0)	{
1294
		
1291
			success = true;
1295
		
1292
		} else {
1296
		if (lstMessageErreur.size() != 0)	{
1293
			String strMessagesErreur = "<span><br />";
1297
			String strMessagesErreur = "<span><br />";
1294
			Iterator<String> itMessagesErreur = lstMessageErreur.iterator();
1298
			Iterator<String> itMessagesErreur = lstMessageErreur.iterator();