Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 729 Rev 730
Line 37... Line 37...
37
 
37
 
Line 38... Line 38...
38
import com.extjs.gxt.ui.client.binding.FormBinding;
38
import com.extjs.gxt.ui.client.binding.FormBinding;
39
 
39
 
40
import com.extjs.gxt.ui.client.event.ButtonEvent;
-
 
41
import com.extjs.gxt.ui.client.event.ComponentEvent;
40
import com.extjs.gxt.ui.client.event.ButtonEvent;
42
import com.extjs.gxt.ui.client.event.IconButtonEvent;
41
import com.extjs.gxt.ui.client.event.ComponentEvent;
43
import com.extjs.gxt.ui.client.event.KeyListener;
42
import com.extjs.gxt.ui.client.event.KeyListener;
44
import com.extjs.gxt.ui.client.event.Listener;
43
import com.extjs.gxt.ui.client.event.Listener;
45
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
44
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
Line 50... Line 49...
50
import com.extjs.gxt.ui.client.widget.MessageBox;
49
import com.extjs.gxt.ui.client.widget.MessageBox;
Line 51... Line 50...
51
 
50
 
52
import com.extjs.gxt.ui.client.widget.Info;
51
import com.extjs.gxt.ui.client.widget.Info;
53
import com.extjs.gxt.ui.client.widget.TabItem;
52
import com.extjs.gxt.ui.client.widget.TabItem;
54
import com.extjs.gxt.ui.client.widget.TabPanel;
-
 
Line 55... Line 53...
55
import com.extjs.gxt.ui.client.widget.Text;
53
import com.extjs.gxt.ui.client.widget.TabPanel;
56
 
54
 
57
import com.extjs.gxt.ui.client.widget.button.Button;
55
import com.extjs.gxt.ui.client.widget.button.Button;
58
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
56
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
59
import com.extjs.gxt.ui.client.widget.form.ComboBox;
57
import com.extjs.gxt.ui.client.widget.form.ComboBox;
60
import com.extjs.gxt.ui.client.widget.form.DateField;
58
import com.extjs.gxt.ui.client.widget.form.DateField;
61
import com.extjs.gxt.ui.client.widget.form.FieldSet;
-
 
62
import com.extjs.gxt.ui.client.widget.form.FormPanel;
59
import com.extjs.gxt.ui.client.widget.form.FieldSet;
63
import com.extjs.gxt.ui.client.widget.form.HiddenField;
60
import com.extjs.gxt.ui.client.widget.form.FormPanel;
64
import com.extjs.gxt.ui.client.widget.form.LabelField;
61
import com.extjs.gxt.ui.client.widget.form.LabelField;
65
import com.extjs.gxt.ui.client.widget.form.Radio;
62
import com.extjs.gxt.ui.client.widget.form.Radio;
66
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
63
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
Line 74... Line 71...
74
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
71
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
75
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
72
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
76
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
73
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
77
import com.google.gwt.core.client.GWT;
74
import com.google.gwt.core.client.GWT;
78
import com.google.gwt.i18n.client.DateTimeFormat;
75
import com.google.gwt.i18n.client.DateTimeFormat;
79
import com.google.gwt.user.client.ui.Image;
-
 
80
import com.google.gwt.user.client.ui.Widget;
76
import com.google.gwt.user.client.ui.Widget;
Line 81... Line 77...
81
 
77
 
Line 82... Line -...
82
public class PersonneForm extends FormPanel implements Rafraichissable {
-
 
83
 
78
public class PersonneForm extends FormPanel implements Rafraichissable {
84
	/*--------------------------------------------------------------------------------------
-
 
85
	 * 		VARIABLES
-
 
86
	 * -------------------------------------------------------------------------------------
-
 
87
	 */
79
 
88
	
80
	// VARIABLES
89
	private TabItem tiIdentite, tiAdresses, tiInfosNat;
81
	private TabItem tiIdentite, tiAdresses, tiInfosNat;
90
	private Mediateur mediateur = Registry.get(RegistreId.MEDIATEUR);
82
	private Mediateur mediateur = Registry.get(RegistreId.MEDIATEUR);
91
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
83
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
Line 92... Line 84...
92
	private Personne personneSelectionnee, personneSauvegarde = null;
84
	private Personne personneSelectionnee, personneSauvegarde = null;
93
	private String mode = "";
85
	private String mode = "";
94
	
86
	
95
	//hmIdentite[...] référence par une chaine de caractère tous les composants de l'onglet Identite
87
	//hmIdentite[...] référence par une chaine de caractère tous les composants de l'onglet Identite
-
 
88
	private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>();
96
	private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>();
89
	private HashMap<String, Widget>hmAdresse = new HashMap<String, Widget>();
Line 97... Line 90...
97
	private HashMap<String, Widget>hmAdresse = new HashMap<String, Widget>();
90
	private HashMap<String, Widget>hmInfosNat = new HashMap<String, Widget>();
Line 98... Line 91...
98
	private HashMap<String, Widget>hmInfosNat = new HashMap<String, Widget>();
91
	private HashMap<String, Valeur> hmCbSelectionnee = new HashMap();
99
	private FormData fd100 = new FormData("1");
92
	private FormData fd100 = new FormData("1");
100
	
-
 
101
	private Button enregistrer, enregistrerEtRevenir;
93
	
102
	
94
	private Button enregistrer, enregistrerEtRevenir;
Line 103... Line -...
103
	public static final String MODE_AJOUTER = "AJOUT";
-
 
104
	public static final String MODE_MODIFIER = "MODIF";
95
	
105
	
-
 
106
	
-
 
Line 107... Line -...
107
	private FormBinding binding = null;
-
 
108
	
-
 
109
	/*--------------------------------------------------------------------------------------
-
 
110
	 * 		CONSTRUCTEUR 
-
 
111
	 * -------------------------------------------------------------------------------------
-
 
112
	 */
-
 
113
	
-
 
114
	/**
96
	public static final String MODE_AJOUTER = "AJOUT";
115
	 * Constructeur du panneau
97
	public static final String MODE_MODIFIER = "MODIF";
116
	 * 
98
 
117
	 * Initialise le panneau et ajoute une barre d'outils à deux boutons (réinitialiser le 
99
	private FormBinding binding = null;
Line 118... Line 100...
118
	 * formulaire et annuler la saisie). 
100
	
119
	 * 
-
 
120
	 * */
101
	// CONSTRUCTEUR 
121
	public PersonneForm(String mode) {
102
	
Line 122... Line 103...
122
		this.mode = mode;
103
	public PersonneForm(String mode) {
Line 153... Line 134...
153
		layout();
134
		layout();
Line 154... Line 135...
154
		
135
		
155
		binderPersonne(personneSelectionnee);
136
		binderPersonne(personneSelectionnee);
Line 156... Line -...
156
	}
-
 
157
	
137
	}
158
	/*---------------------------------------------------------------------------------------
-
 
159
	 * 		SOUS-METHODES
-
 
160
	 * --------------------------------------------------------------------------------------
-
 
161
	 */
-
 
162
	/**
138
	
163
	 * Inialise le panneau donné
-
 
164
	 * 
-
 
165
	 * @param contentPanel le panneau à initialiser
139
	// SOUS-METHODES
166
	 * */
-
 
167
	public void initialiserPanneau()	{
140
 
168
		
141
	public void initialiserPanneau()	{
169
		setCollapsible(false);  
142
		setCollapsible(false);  
170
		if (this.mode.equals(MODE_AJOUTER))	{
143
		if (this.mode.equals(MODE_AJOUTER))	{
171
			setHeading(mediateur.i18nC.personneModeAjout());
144
			setHeading(mediateur.i18nC.personneModeAjout());
Line 220... Line 193...
220
	 * 
193
	 * 
221
	 * */
194
	 * */
Line 222... Line 195...
222
	
195
	
223
	
-
 
224
	public void creerComposantsIdentite()	{
196
	
225
		
197
	public void creerComposantsIdentite()	{
226
		// Gestion de l'affichage en colonnes : 3 Layout container : principal, gauche & droite
198
		// Gestion de l'affichage en colonnes : 3 Layout container : principal, gauche & droite
227
		LayoutContainer left = new LayoutContainer();
199
		LayoutContainer left = new LayoutContainer();
228
		left.setLayout(new FormLayout());
200
		left.setLayout(new FormLayout());
Line 317... Line 289...
317
		fsNoms.add(cbSuffixe);			
289
		fsNoms.add(cbSuffixe);			
318
		hmIdentite.put("cbSuffixe", cbSuffixe);
290
		hmIdentite.put("cbSuffixe", cbSuffixe);
Line 319... Line 291...
319
		
291
		
Line 320... Line 292...
320
		mediateur.obtenirListeValeurEtRafraichir(this, "suffixes");
292
		mediateur.obtenirListeValeurEtRafraichir(this, "suffixes");
321
 
293
 
322
		TextField<String> tfNomAutre = new TextField();
294
		TextField<String> tfNomAutre = new TextField<String>();
Line 323... Line 295...
323
		tfNomAutre.setFieldLabel("Autres noms");
295
		tfNomAutre.setFieldLabel("Autres noms");
324
		tfNomAutre.setName("truk_nom_autre");
296
		tfNomAutre.setName("truk_nom_autre");
Line 357... Line 329...
357
		
329
		
358
		fsNaissance.add(dfDateNaissance);
330
		fsNaissance.add(dfDateNaissance);
Line 359... Line 331...
359
		hmIdentite.put("dfDateNaissance", dfDateNaissance);
331
		hmIdentite.put("dfDateNaissance", dfDateNaissance);
360
		
332
		
361
		// Lieu naissance
333
		// Lieu naissance
362
		TextField<String> tfLieuNaissance = new TextField();
334
		TextField<String> tfLieuNaissance = new TextField<String>();
Line 363... Line 335...
363
		tfLieuNaissance.setFieldLabel("Lieu");
335
		tfLieuNaissance.setFieldLabel("Lieu");
364
		tfLieuNaissance.setName("naissance_lieu");
336
		tfLieuNaissance.setName("naissance_lieu");
Line 412... Line 384...
412
		dfDateDeces.setVisible(false);
384
		dfDateDeces.setVisible(false);
Line 413... Line 385...
413
 
385
 
414
		fsDeces.add(dfDateDeces);
386
		fsDeces.add(dfDateDeces);
Line 415... Line 387...
415
		hmIdentite.put("dfDateDeces", dfDateDeces);
387
		hmIdentite.put("dfDateDeces", dfDateDeces);
416
 
388
 
417
		TextField<String> tfLieuDeces = new TextField();
389
		TextField<String> tfLieuDeces = new TextField<String>();
418
		tfLieuDeces.setFieldLabel("Lieu");
390
		tfLieuDeces.setFieldLabel("Lieu");
Line 419... Line 391...
419
		tfLieuDeces.setName("deces_lieu");
391
		tfLieuDeces.setName("deces_lieu");
Line 528... Line 500...
528
			}				
500
			}				
529
		};
501
		};
Line 530... Line 502...
530
		
502
		
531
		SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
503
		SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
532
			public void selectionChanged(SelectionChangedEvent se) {
504
			public void selectionChanged(SelectionChangedEvent se) {
533
					rafraichir(null);
505
				rafraichir(null);
534
				}
506
			}
Line 535... Line 507...
535
		};
507
		};
536
						
508
						
537
		cbPrefixe.addSelectionChangedListener(selectionChange);
509
		cbPrefixe.addSelectionChangedListener(selectionChange);
Line 541... Line 513...
541
		cbSuffixe.addSelectionChangedListener(selectionChange);		
513
		cbSuffixe.addSelectionChangedListener(selectionChange);		
Line 542... Line 514...
542
			
514
			
Line 543... Line 515...
543
	}
515
	}
544
	
-
 
545
	public void creerComposantsAdresse()	{
516
	
546
		
517
	public void creerComposantsAdresse()	{
547
		// Gauche
518
		// Gauche
Line 548... Line 519...
548
		LayoutContainer left = new LayoutContainer();
519
		LayoutContainer left = new LayoutContainer();
Line 583... Line 554...
583
		right.add(cbPays, fd100);
554
		right.add(cbPays, fd100);
584
		hmAdresse.put("cbPays", cbPays);
555
		hmAdresse.put("cbPays", cbPays);
Line 585... Line 556...
585
		
556
		
586
		SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
557
		SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
587
			public void selectionChanged(SelectionChangedEvent se) {
558
			public void selectionChanged(SelectionChangedEvent se) {
588
					// Rafraichir avec le pays sélectionné
559
				// Rafraichir avec le pays sélectionné
589
					obtenirListeRegionParPays(((Valeur) se.getSelectedItem()).getAbreviation().toString());
-
 
590
					
560
				obtenirListeRegionParPays(((Valeur) se.getSelectedItem()).getAbreviation().toString());
591
				}
561
			}
Line 592... Line 562...
592
		};
562
		};
Line 687... Line 657...
687
	 * Ajouter le bouton Sauvegarder à la barre d'outils donnée
657
	 * Ajouter le bouton Sauvegarder à la barre d'outils donnée
688
	 * 
658
	 * 
689
	 * @param barreOutils la barre d'outils à modifier
659
	 * @param barreOutils la barre d'outils à modifier
690
	 * */
660
	 * */
691
	private void ajouterBoutonEnregistrer(ButtonBar barreOutils)	{
661
	private void ajouterBoutonEnregistrer(ButtonBar barreOutils)	{
692
		
-
 
693
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
662
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
694
		enregistrer = new Button("Enregistrer");
663
		enregistrer = new Button("Enregistrer");
695
		enregistrer.setIcon(Images.ICONES.scriptSave());
664
		enregistrer.setIcon(Images.ICONES.scriptSave());
696
		enregistrer.setIconAlign(IconAlign.LEFT);
665
		enregistrer.setIconAlign(IconAlign.LEFT);
697
		enregistrer.setId("main-button");
666
		enregistrer.setId("main-button");
Line 725... Line 694...
725
	
694
	
726
	public void obtenirListeRegionParPays(String strPays)	{
695
	public void obtenirListeRegionParPays(String strPays)	{
727
		mediateur.obtenirListeRegionsEtRafraichir(this, "region", strPays);
696
		mediateur.obtenirListeRegionsEtRafraichir(this, "region", strPays);
Line 728... Line -...
728
	}
-
 
729
	
-
 
730
	
-
 
731
	
697
	}
732
	/*---------------------------------------------------------------------------------------
-
 
733
	 * 		RAFRAICHISSEMENT DU PANNEAU
698
	
734
	 * --------------------------------------------------------------------------------------
699
	// RAFRAICHISSEMENT DU PANNEAU
735
	 */	
-
 
736
	public void rafraichir(Object nouvellesDonnees) {
-
 
737
		
-
 
738
		
700
 
739
		
-
 
740
		if (nouvellesDonnees instanceof ValeurListe) {
-
 
741
			
701
	public void rafraichir(Object nouvellesDonnees) {
Line 742... Line 702...
742
			
702
		if (nouvellesDonnees instanceof ValeurListe) {
743
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
703
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
744
			
704
			
745
			// Créer une liste de valeurs
705
			// Créer une liste de valeurs
746
			List<Valeur> liste = new ArrayList<Valeur>();
706
			List<Valeur> liste = new ArrayList<Valeur>();
Line 747... Line 707...
747
			for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
707
			for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
748
				liste.add(listeValeurs.get(it.next()));
-
 
749
			}
708
				liste.add(listeValeurs.get(it.next()));
750
			
-
 
751
			if (listeValeurs.getId().equals(config.getListeId("prefixe")))	{
709
			}
752
 
-
 
753
				remplirCombobox("cbPrefixe", liste, "hmIdentite");
710
			
754
								
-
 
755
			} else if (listeValeurs.getId().equals(config.getListeId("suffixes"))) {
711
			if (listeValeurs.getId().equals(config.getListeId("prefixe")))	{
756
			
-
 
757
				remplirCombobox("cbSuffixe", liste, "hmIdentite");
712
				remplirCombobox("cbPrefixe", liste, "hmIdentite");
758
								
-
 
759
			} else if (listeValeurs.getId().equals(config.getListeId("sexe"))) {
713
			} else if (listeValeurs.getId().equals(config.getListeId("suffixes"))) {
760
 
-
 
761
				remplirCombobox("cbSexe", liste, "hmIdentite");
714
				remplirCombobox("cbSuffixe", liste, "hmIdentite");
762
				
715
			} else if (listeValeurs.getId().equals(config.getListeId("sexe"))) {
763
			} else if (listeValeurs.getId().equals(config.getListeId("tel"))) {
716
				remplirCombobox("cbSexe", liste, "hmIdentite");
764
			
717
			} else if (listeValeurs.getId().equals(config.getListeId("tel"))) {
765
				remplirCombobox("cbTelephone", liste, "hmIdentite");
718
				remplirCombobox("cbTelephone", liste, "hmIdentite");
766
				
-
 
767
				//Préselection du tél
719
 
768
				ComboBox<Valeur> cbTelephone = (ComboBox<Valeur>) hmIdentite.get("cbTelephone");
-
 
769
				cbTelephone.setValue(liste.get(1));
720
				//Préselection du tél
770
			
-
 
771
			} else if (listeValeurs.getId().equals(config.getListeId("pays")))	{
721
				ComboBox<Valeur> cbTelephone = (ComboBox<Valeur>) hmIdentite.get("cbTelephone");
772
				
-
 
773
				remplirCombobox("cbPays", liste, "hmAdresse");
722
				cbTelephone.setValue(liste.get(1));
774
				
-
 
775
			} else if (listeValeurs.getId().equals(config.getListeId("region")))	{
723
			} else if (listeValeurs.getId().equals(config.getListeId("pays")))	{
776
				
724
				remplirCombobox("cbPays", liste, "hmAdresse");
777
				remplirCombobox("cbRegion", liste, "hmAdresse");
-
 
778
				
-
 
779
				((ComboBox) hmAdresse.get("cbRegion")).setVisible(true);
725
			} else if (listeValeurs.getId().equals(config.getListeId("region")))	{
780
			}
-
 
781
			
726
				remplirCombobox("cbRegion", liste, "hmAdresse");
-
 
727
				((ComboBox<Valeur>) hmAdresse.get("cbRegion")).setVisible(true);
Line 782... Line -...
782
			
-
 
783
		} else if (nouvellesDonnees instanceof ProjetListe) {
-
 
784
			
-
 
785
			ProjetListe projets = (ProjetListe) nouvellesDonnees;
-
 
786
			
728
			}
787
			List<Projet> liste = new ArrayList<Projet>();
729
		} else if (nouvellesDonnees instanceof ProjetListe) {
788
			for (Iterator<String> it = projets.keySet().iterator(); it.hasNext();) {
730
			ProjetListe projets = (ProjetListe) nouvellesDonnees;
789
				liste.add(projets.get(it.next()));
731
			List<Projet> liste = projets.toList();
790
			}
732
			
791
			ComboBox cbProjets = (ComboBox) hmIdentite.get("cbProjets");
-
 
792
			ListStore<Projet> storeProjets= cbProjets.getStore();
733
			ComboBox<Projet> cbProjets = (ComboBox<Projet>) hmIdentite.get("cbProjets");
793
			storeProjets.removeAll();
-
 
794
			storeProjets.add(liste);
734
			ListStore<Projet> storeProjets= cbProjets.getStore();
795
			cbProjets.setStore(storeProjets);
735
			storeProjets.removeAll();
796
			
-
 
797
		} else if (nouvellesDonnees instanceof Information)	{
736
			storeProjets.add(liste);
798
			
737
			cbProjets.setStore(storeProjets);
799
			Information info = (Information) nouvellesDonnees;
-
 
800
			if (info.getType().equals("ajout_personne"))	{
738
		} else if (nouvellesDonnees instanceof Information)	{
801
				
-
 
802
				GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null);
739
			Information info = (Information) nouvellesDonnees;
803
				Info.display("Enregistrement", "La personne a été ajoutée (id: " + personneSelectionnee.getId() + ")");
740
			if (info.getType().equals("ajout_personne"))	{
804
				
741
				GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null);
805
			} else if (info.getType().equals("modification_personne"))	{
742
				Info.display("Enregistrement", "La personne a été ajoutée (id: " + personneSelectionnee.getId() + ")");
806
				
743
			} else if (info.getType().equals("modification_personne"))	{
807
				Info.display("Enregistrement", "Les modifications apportées à la personne " + personneSelectionnee.getId() + " ont été correctement enregistrées.");
-
 
808
			}
744
				Info.display("Enregistrement", "Les modifications apportées à la personne " + personneSelectionnee.getId() + " ont été correctement enregistrées.");
809
			else if (info.getType().equals("maj_utilisateur"))	{
745
			}
810
				gererEtatActivationBouton();
746
			else if (info.getType().equals("maj_utilisateur"))	{
811
			} else if (info.getDonnee(0) instanceof PersonneListe)	{
747
				gererEtatActivationBouton();
812
			
748
			} else if (info.getDonnee(0) instanceof PersonneListe)	{
813
					Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values();
749
				Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values();
814
					Iterator itPersonneListe = colPersonneListe.iterator();
750
				Iterator itPersonneListe = colPersonneListe.iterator();
815
					Personne personne = (Personne) itPersonneListe.next();
751
				Personne personne = (Personne) itPersonneListe.next();
816
					
752
				
817
					personneSauvegarde = new Personne();
753
				personneSauvegarde = new Personne();
818
					personneSauvegarde = (Personne) personne.cloner(personneSauvegarde);
754
				personneSauvegarde = (Personne) personne.cloner(personneSauvegarde);
819
					
755
				
820
					binderPersonne(personne);
756
				binderPersonne(personne);
821
					//Mise à jour de la personne		
757
				//Mise à jour de la personne		
822
					//Personne personne = (Personne) nouvellesDonnees;
758
				//Personne personne = (Personne) nouvellesDonnees;
823
					
759
				
824
					ComboBox cbProjets = (ComboBox) hmIdentite.get("cbProjets");
760
				ComboBox cbProjets = (ComboBox) hmIdentite.get("cbProjets");
825
					cbProjets.setValue(cbProjets.getStore().findModel("id_projet", personne.get("ce_projet")));
761
				cbProjets.setValue(cbProjets.getStore().findModel("id_projet", personne.get("ce_projet")));
826
					
762
				
827
					//Prefixe
763
				//Prefixe
828
					String prefixe = personne.get("ce_truk_prefix");
764
				String prefixe = personne.get("ce_truk_prefix");
829
					ComboBox<Valeur> cbPrefixe = (ComboBox<Valeur>) hmIdentite.get("cbPrefixe");
765
				ComboBox<Valeur> cbPrefixe = (ComboBox<Valeur>) hmIdentite.get("cbPrefixe");
830
					
766
				
831
					
767
				
832
					String prefixeCourant = personne.get("ce_truk_prefix");
768
				String prefixeCourant = personne.get("ce_truk_prefix");
833
					if (cbPrefixe.getStore().findModel("id_valeur", prefixeCourant) != null)	{
769
				if (cbPrefixe.getStore().findModel("id_valeur", prefixeCourant) != null)	{
834
						cbPrefixe.setValue(cbPrefixe.getStore().findModel("id_valeur", prefixeCourant));
770
					cbPrefixe.setValue(cbPrefixe.getStore().findModel("id_valeur", prefixeCourant));
835
					}	else	{
771
				}	else	{
836
						cbPrefixe.setRawValue(prefixeCourant);
772
					cbPrefixe.setRawValue(prefixeCourant);
837
					}
773
				}
838
					
774
				
839
					
775
				
840
					((TextField) hmIdentite.get("tfPrenom")).setValue(personne.get("prenom"));
776
				((TextField) hmIdentite.get("tfPrenom")).setValue(personne.get("prenom"));
841
					((TextField) hmIdentite.get("tfNom")).setValue(personne.get("nom"));
777
				((TextField) hmIdentite.get("tfNom")).setValue(personne.get("nom"));
842
					
778
				
843
					//Suffixe
779
				//Suffixe
844
					String suffixe = personne.get("ce_truk_suffixe");
780
				String suffixe = personne.get("ce_truk_suffixe");
845
					ComboBox<Valeur> cbSuffixe = (ComboBox<Valeur>) hmIdentite.get("cbSuffixe");
781
				ComboBox<Valeur> cbSuffixe = (ComboBox<Valeur>) hmIdentite.get("cbSuffixe");
846
					
782
				
847
					String suffixeCourant = personne.get("ce_truk_suffix");
783
				String suffixeCourant = personne.get("ce_truk_suffix");
848
					if (cbSuffixe.getStore().findModel("id_valeur", suffixeCourant) != null)	{
784
				if (cbSuffixe.getStore().findModel("id_valeur", suffixeCourant) != null)	{
849
						cbSuffixe.setValue(cbSuffixe.getStore().findModel("id_valeur", suffixeCourant));
785
					cbSuffixe.setValue(cbSuffixe.getStore().findModel("id_valeur", suffixeCourant));
850
					}	else	{
786
				}	else	{
851
						cbSuffixe.setRawValue(suffixeCourant);
787
					cbSuffixe.setRawValue(suffixeCourant);
852
					}
788
				}
853
					
789
				
854
					((TextField) hmIdentite.get("tfNomAutre")).setValue(personne.get("truk_nom_autre"));
790
				((TextField) hmIdentite.get("tfNomAutre")).setValue(personne.get("truk_nom_autre"));
855
					((TextField) hmIdentite.get("tfAbreviation")).setValue(personne.get("abreviation"));
791
				((TextField) hmIdentite.get("tfAbreviation")).setValue(personne.get("abreviation"));
856
					((TextField) hmIdentite.get("tfAbreviationAutre")).setValue(personne.get("truk_abreviation_autre"));
792
				((TextField) hmIdentite.get("tfAbreviationAutre")).setValue(personne.get("truk_abreviation_autre"));
857
					
793
				
858
					
794
				
859
					(((DateField) hmIdentite.get("dfDateNaissance"))).setValue(personne.getDate("naissance_date"));
795
				(((DateField) hmIdentite.get("dfDateNaissance"))).setValue(personne.getDate("naissance_date"));
-
 
796
				((TextField) hmIdentite.get("tfLieuNaissance")).setValue(personne.get("naissance_lieu"));
860
					((TextField) hmIdentite.get("tfLieuNaissance")).setValue(personne.get("naissance_lieu"));
797
				
861
					
798
				(((DateField) hmIdentite.get("dfDateDeces"))).setValue(personne.getDate("deces_date"));
862
					(((DateField) hmIdentite.get("dfDateDeces"))).setValue(personne.getDate("deces_date"));
799
				((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu"));
863
					((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu"));
-
 
864
					
800
				
865
					
-
 
866
					// Telephone
-
 
867
					/*HashMap<String, String> hmTelephone = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_telephone");
-
 
868
					if (hmTelephone!=null)	{
-
 
869
						
801
				((ChampMultiValeursMultiTypes) hmIdentite.get("telephones")).peupler(personne.getString("truk_telephone"));
870
						ListStore storeTelephone = ((ComboBox) hmIdentite.get("cbTelephone")).getStore();
-
 
871
						List lstModelsTelephone = storeTelephone.getModels();
802
				
872
						Iterator<Valeur> itStore = lstModelsTelephone.iterator();
-
 
873
						HashMap<String, String> hmTel = new HashMap();
803
				//Courriel
874
						while (itStore.hasNext())	{
-
 
875
							Valeur v = itStore.next();
-
 
876
							hmTel.put(v.getAbreviation(), v.getNom());
804
				((ChampMultiValeurs) hmIdentite.get("courriels")).peupler(personne.getCourriel());
877
						}
805
				
878
						
806
				//Sites web
879
						Collection<String> colTelephone = hmTelephone.keySet();
807
				((ChampMultiValeurs) hmIdentite.get("sites")).peupler(personne.getString("truk_url"));
880
						Iterator<String> itTelephone = colTelephone.iterator();
-
 
881
					
-
 
882
						while (itTelephone.hasNext())	{
-
 
883
							String strTelephone = itTelephone.next();
-
 
884
							String strTypeTelephone = hmTelephone.get(strTelephone);
808
				
885
							String idTel = hmTel.get(strTypeTelephone);
809
				
-
 
810
				// Sexe
886
							if (idTel == null)	{
811
				String strSexe = personne.get("ce_sexe");
-
 
812
				ComboBox<Valeur> cbSexe = (ComboBox<Valeur>) hmIdentite.get("cbSexe");
887
								idTel = strTypeTelephone;
813
 
888
							}
814
				if (cbSexe.getStore().findModel("id_valeur", strSexe) != null)	{
889
							
815
					cbSexe.setValue(cbSexe.getStore().findModel("id_valeur", strSexe));
890
							ajouterTelephone(strTelephone, idTel, strTypeTelephone);
816
				}	else	{
891
						}
817
					cbSexe.setRawValue(strSexe);
892
					}*/
818
				}
893
					
819
				
-
 
820
				((TextArea) hmIdentite.get("taDescription")).setRawValue((String) personne.get("description"));
894
					((ChampMultiValeursMultiTypes) hmIdentite.get("telephones")).peupler(personne.getString("truk_telephone"));
821
				
895
					
822
				//Logo
896
					//Courriel
-
 
897
					((ChampMultiValeurs) hmIdentite.get("courriels")).peupler(personne.getCourriel());
823
				((ChampMultiValeurs) hmIdentite.get("logos")).peupler(personne.getString("truk_logo"));
898
					
824
				
899
					//Sites web
-
 
900
					((ChampMultiValeurs) hmIdentite.get("sites")).peupler(personne.getString("truk_url"));
825
				/*--------------------------------------------------
Line 901... Line -...
901
					
-
 
902
					
-
 
903
					// Sexe
826
				                      Adresse
904
					String strSexe = personne.get("ce_sexe");
-
 
905
					ComboBox<Valeur> cbSexe = (ComboBox<Valeur>) hmIdentite.get("cbSexe");
-
 
906
 
-
 
907
					if (cbSexe.getStore().findModel("id_valeur", strSexe) != null)	{
827
				 ---------------------------------------------------*/
908
						cbSexe.setValue(cbSexe.getStore().findModel("id_valeur", strSexe));
828
				
909
					}	else	{
829
				// Adresse
910
						cbSexe.setRawValue(strSexe);
830
				((TextField<String>) hmAdresse.get("tfAdresse1")).setValue((String) personne.get("adresse_01"));
911
					}
831
 
912
					
832
				// Complément
913
					((TextArea) hmIdentite.get("taDescription")).setRawValue((String) personne.get("description"));
833
				((TextField<String>) hmAdresse.get("tfAdresse2")).setValue((String) personne.get("adresse_02"));
914
					
834
				
915
					//Logo
835
				//Boite postale
916
					((ChampMultiValeurs) hmIdentite.get("logos")).peupler(personne.getString("truk_logo"));
-
 
917
					
-
 
918
					/*--------------------------------------------------
836
				((TextField<String>) hmAdresse.get("tfBoitePostale")).setValue((String) personne.get("bp"));
919
					                      Adresse
837
				
920
					 ---------------------------------------------------*/
838
				//Pays
921
					
-
 
922
					// Adresse
839
				String strPays = personne.get("pays");
923
					((TextField<String>) hmAdresse.get("tfAdresse1")).setValue((String) personne.get("adresse_01"));
840
				ComboBox<Valeur> cbPays = (ComboBox<Valeur>) hmAdresse.get("cbPays");
-
 
841
				
924
	
842
				
925
					// Complément
843
				if (cbPays.getStore().findModel("nom", strPays) != null)	{
926
					((TextField<String>) hmAdresse.get("tfAdresse2")).setValue((String) personne.get("adresse_02"));
844
					cbPays.setValue(cbPays.getStore().findModel("nom", strPays));
-
 
845
				}	else	{
927
					
846
					cbPays.setRawValue(strPays);
928
					//Boite postale
-
 
-
 
847
				}
Line 929... Line 848...
929
					((TextField<String>) hmAdresse.get("tfBoitePostale")).setValue((String) personne.get("bp"));
848
				
930
					
849
				//Région
931
					//Pays
850
				String strRegion = personne.get("region");
932
					String strPays = personne.get("pays");
-
 
933
					ComboBox<Valeur> cbPays = (ComboBox<Valeur>) hmAdresse.get("cbPays");
-
 
934
					
-
 
935
					
-
 
936
					if (cbPays.getStore().findModel("nom", strPays) != null)	{
-
 
937
						cbPays.setValue(cbPays.getStore().findModel("nom", strPays));
-
 
938
					}	else	{
-
 
939
						cbPays.setRawValue(strPays);
-
 
940
					}
-
 
941
					
-
 
942
					
-
 
943
					//Région
-
 
944
					String strRegion = personne.get("region");
-
 
945
					if ((strRegion!=null)&&(!strRegion.equals("")))	{
851
				if ((strRegion!=null)&&(!strRegion.equals("")))	{
946
						ComboBox<Valeur> cbRegion = (ComboBox<Valeur>) hmAdresse.get("cbRegion");
-
 
947
						cbRegion.setVisible(true);
852
					ComboBox<Valeur> cbRegion = (ComboBox<Valeur>) hmAdresse.get("cbRegion");
948
						
-
 
949
						if (cbRegion.getStore().findModel("nom", strRegion) != null)	{
-
 
950
							cbRegion.setValue(cbRegion.getStore().findModel("nom", strRegion));
-
 
951
						}	else	{
-
 
952
							cbRegion.setRawValue(strRegion);
-
 
953
						}
-
 
954
					}
-
 
955
					
-
 
956
					//Cp
-
 
957
					((TextField) hmAdresse.get("tfCodePostal")).setValue(personne.get("code_postal"));
-
 
958
					
-
 
959
					//Ville
-
 
960
					((TextField) hmAdresse.get("tfVille")).setValue(personne.get("ville"));
-
 
961
					
853
					cbRegion.setVisible(true);
-
 
854
					
-
 
855
					if (cbRegion.getStore().findModel("nom", strRegion) != null)	{
-
 
856
						cbRegion.setValue(cbRegion.getStore().findModel("nom", strRegion));
-
 
857
					}	else	{
-
 
858
						cbRegion.setRawValue(strRegion);
-
 
859
					}
-
 
860
				}
-
 
861
				
-
 
862
				//Cp
-
 
863
				((TextField) hmAdresse.get("tfCodePostal")).setValue(personne.get("code_postal"));
-
 
864
				
-
 
865
				//Ville
-
 
866
				((TextField) hmAdresse.get("tfVille")).setValue(personne.get("ville"));
962
					
867
				
Line 963... Line 868...
963
					gererEtatActivationBouton();
868
				gererEtatActivationBouton();
964
					
-
 
965
					nouvellesDonnees = null;
869
				
Line 966... Line 870...
966
				} else {
870
				nouvellesDonnees = null;
967
					Info.display("messages", info.getMessages().toString());
871
			} else {
Line 983... Line 887...
983
				prefixe = valPrefixe.getNom();
887
				prefixe = valPrefixe.getNom();
984
			} else 	{
888
			} else 	{
985
				prefixe =  (String) ((ComboBox) hmIdentite.get("cbPrefixe")).getRawValue();
889
				prefixe =  (String) ((ComboBox) hmIdentite.get("cbPrefixe")).getRawValue();
986
			}		
890
			}		
Line 987... Line -...
987
			
-
 
988
			
891
			
989
			// Prénom
892
			// Prénom
Line 990... Line 893...
990
			String prenom = (String) ((TextField) hmIdentite.get("tfPrenom")).getValue();
893
			String prenom = (String) ((TextField) hmIdentite.get("tfPrenom")).getValue();
991
			
894
			
Line 1020... Line 923...
1020
		if (this.mode.equals(MODE_AJOUTER))	{
923
		if (this.mode.equals(MODE_AJOUTER))	{
1021
			gererEtatActivationBouton();
924
			gererEtatActivationBouton();
1022
		}
925
		}
1023
	}
926
	}
Line 1024... Line -...
1024
 
-
 
-
 
927
 
1025
	private HashMap<String, Valeur> hmCbSelectionnee = new HashMap(); 
928
 
1026
	public void remplirCombobox(String idComboBox, List liste, String hashMapId)	{
-
 
1027
	
929
	public void remplirCombobox(String idComboBox, List liste, String hashMapId)	{
1028
		HashMap hm = null;
930
		HashMap hm = null;
1029
		if (hashMapId.equals("hmIdentite"))	{
931
		if (hashMapId.equals("hmIdentite"))	{
1030
			hm = hmIdentite;
932
			hm = hmIdentite;
1031
		} else if (hashMapId.equals("hmAdresse")){
933
		} else if (hashMapId.equals("hmAdresse")){
Line 1037... Line 939...
1037
		ListStore<Valeur> store = ((ComboBox) hm.get(idComboBox)).getStore();
939
		ListStore<Valeur> store = ((ComboBox) hm.get(idComboBox)).getStore();
Line 1038... Line 940...
1038
		
940
		
1039
		store.removeAll();
941
		store.removeAll();
1040
		store.add(liste);
942
		store.add(liste);
1041
		((ComboBox) hm.get(idComboBox)).setStore(store);
-
 
1042
		
943
		((ComboBox) hm.get(idComboBox)).setStore(store);
Line 1043... Line -...
1043
	}
-
 
1044
	
944
	}
1045
	
-
 
1046
	private void gererEtatActivationBouton()	{
945
	
1047
		
946
	private void gererEtatActivationBouton()	{
1048
		if (((Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT)).isIdentifie() == false)	{			
947
		if (((Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT)).isIdentifie() == false)	{			
1049
			enregistrer.setEnabled(false);
948
			enregistrer.setEnabled(false);
1050
			enregistrerEtRevenir.setEnabled(false);
949
			enregistrerEtRevenir.setEnabled(false);
1051
		} else	{
950
		} else	{
1052
			enregistrer.setEnabled(true);
951
			enregistrer.setEnabled(true);
1053
			enregistrerEtRevenir.setEnabled(true);
-
 
1054
		}
952
			enregistrerEtRevenir.setEnabled(true);
Line 1055... Line 953...
1055
			
953
		}
1056
	}
-
 
1057
	
954
	}
Line 1058... Line 955...
1058
	public void reinitialiser()	{
955
	
1059
	 
956
	public void reinitialiser()	{
Line 1060... Line 957...
1060
		mediateur.afficherPopinChargement();
957
		mediateur.afficherPopinChargement();
1061
		
958
		
Line 1062... Line -...
1062
		binderPersonne(personneSauvegarde);
-
 
1063
		layout();
-
 
1064
		
959
		binderPersonne(personneSauvegarde);
1065
		mediateur.masquerPopinChargement();
-
 
1066
	}
-
 
Line 1067... Line 960...
1067
	
960
		layout();
1068
	
961
		
1069
	
962
		mediateur.masquerPopinChargement();
Line 1081... Line 974...
1081
	/**
974
	/**
1082
	 * Enregistre les information de la personne en cours 
975
	 * Enregistre les information de la personne en cours 
1083
	 * 
976
	 * 
1084
	 */
977
	 */
1085
	public boolean enregistrer()	{
978
	public boolean enregistrer()	{
1086
		
-
 
1087
		boolean success = false;
979
		boolean success = false;
1088
		LinkedList lstMessageErreur = new LinkedList<String>();
980
		LinkedList lstMessageErreur = new LinkedList<String>();
Line 1089... Line 981...
1089
		
981
		
1090
		ComboBox<Projet> cbProjets = (ComboBox<Projet>) hmIdentite.get("cbProjets");
982
		ComboBox<Projet> cbProjets = (ComboBox<Projet>) hmIdentite.get("cbProjets");
Line 1195... Line 1087...
1195
		
1087
		
1196
		return success;
1088
		return success;
Line 1197... Line 1089...
1197
	}
1089
	}
1198
	
-
 
1199
	private String obtenirValeurCombo(String strComboName)	{
1090
	
1200
		
1091
	private String obtenirValeurCombo(String strComboName)	{
Line 1201... Line 1092...
1201
		String strValeur = "";
1092
		String strValeur = "";
1202
		Valeur valeur;
1093
		Valeur valeur;