Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 376 Rev 386
Line 19... Line 19...
19
import org.tela_botanica.client.modeles.Personne;
19
import org.tela_botanica.client.modeles.Personne;
20
import org.tela_botanica.client.modeles.PersonneListe;
20
import org.tela_botanica.client.modeles.PersonneListe;
21
import org.tela_botanica.client.modeles.Valeur;
21
import org.tela_botanica.client.modeles.Valeur;
22
import org.tela_botanica.client.modeles.ValeurListe;
22
import org.tela_botanica.client.modeles.ValeurListe;
Line 23... Line -...
23
 
-
 
24
 
23
 
25
import com.extjs.gxt.ui.client.Registry;
24
import com.extjs.gxt.ui.client.Registry;
26
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
25
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
27
import com.extjs.gxt.ui.client.Style.Scroll;
-
 
-
 
26
import com.extjs.gxt.ui.client.Style.Scroll;
28
import com.extjs.gxt.ui.client.binding.FieldBinding;
27
 
29
import com.extjs.gxt.ui.client.binding.FormBinding;
-
 
-
 
28
import com.extjs.gxt.ui.client.binding.FormBinding;
30
import com.extjs.gxt.ui.client.binding.SimpleComboBoxFieldBinding;
29
 
31
import com.extjs.gxt.ui.client.event.ComponentEvent;
30
import com.extjs.gxt.ui.client.event.ComponentEvent;
32
import com.extjs.gxt.ui.client.event.KeyListener;
31
import com.extjs.gxt.ui.client.event.KeyListener;
33
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
32
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
34
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
33
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
35
import com.extjs.gxt.ui.client.event.SelectionListener;
34
import com.extjs.gxt.ui.client.event.SelectionListener;
36
import com.extjs.gxt.ui.client.store.ListStore;
-
 
37
import com.extjs.gxt.ui.client.widget.ContentPanel;
35
import com.extjs.gxt.ui.client.store.ListStore;
38
import com.extjs.gxt.ui.client.widget.LayoutContainer;
36
import com.extjs.gxt.ui.client.widget.LayoutContainer;
Line -... Line 37...
-
 
37
import com.extjs.gxt.ui.client.widget.MessageBox;
39
import com.extjs.gxt.ui.client.widget.MessageBox;
38
 
40
 
39
import com.extjs.gxt.ui.client.widget.Info;
41
import com.extjs.gxt.ui.client.widget.TabItem;
40
import com.extjs.gxt.ui.client.widget.TabItem;
Line 42... Line 41...
42
import com.extjs.gxt.ui.client.widget.TabPanel;
41
import com.extjs.gxt.ui.client.widget.TabPanel;
Line 49... Line 48...
49
import com.extjs.gxt.ui.client.widget.form.DateField;
48
import com.extjs.gxt.ui.client.widget.form.DateField;
50
import com.extjs.gxt.ui.client.widget.form.FieldSet;
49
import com.extjs.gxt.ui.client.widget.form.FieldSet;
51
import com.extjs.gxt.ui.client.widget.form.FormPanel;
50
import com.extjs.gxt.ui.client.widget.form.FormPanel;
52
import com.extjs.gxt.ui.client.widget.form.HiddenField;
51
import com.extjs.gxt.ui.client.widget.form.HiddenField;
53
import com.extjs.gxt.ui.client.widget.form.LabelField;
52
import com.extjs.gxt.ui.client.widget.form.LabelField;
54
import com.extjs.gxt.ui.client.widget.form.SimpleComboBox;
-
 
55
import com.extjs.gxt.ui.client.widget.form.TextArea;
53
import com.extjs.gxt.ui.client.widget.form.TextArea;
56
import com.extjs.gxt.ui.client.widget.form.TextField;
54
import com.extjs.gxt.ui.client.widget.form.TextField;
57
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
-
 
58
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
55
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
59
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
56
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
60
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
57
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
61
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
-
 
62
import com.extjs.gxt.ui.client.widget.layout.FormData;
58
import com.extjs.gxt.ui.client.widget.layout.FormData;
63
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
59
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
64
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
60
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
65
import com.extjs.gxt.ui.client.widget.layout.TableData;
-
 
66
import com.extjs.gxt.ui.client.widget.layout.TableLayout;
-
 
67
import com.extjs.gxt.ui.client.widget.toolbar.TextToolItem;
61
import com.extjs.gxt.ui.client.widget.toolbar.TextToolItem;
68
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
62
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
-
 
63
import com.google.gwt.core.client.GWT;
69
import com.google.gwt.i18n.client.DateTimeFormat;
64
import com.google.gwt.i18n.client.DateTimeFormat;
70
import com.google.gwt.user.client.Window;
-
 
71
import com.google.gwt.user.client.ui.Widget;
65
import com.google.gwt.user.client.ui.Widget;
Line 99... Line 93...
99
	 * Initialise le panneau et ajoute une barre d'outils à deux boutons (réinitialiser le 
93
	 * Initialise le panneau et ajoute une barre d'outils à deux boutons (réinitialiser le 
100
	 * formulaire et annuler la saisie). 
94
	 * formulaire et annuler la saisie). 
101
	 * 
95
	 * 
102
	 * */
96
	 * */
103
	public FormPersonneVue() {
97
	public FormPersonneVue() {
104
		initialiserComposants(null);
98
		initialiserComposants();
105
	}
99
	}
Line 106... Line -...
106
	
-
 
107
	public FormPersonneVue(Personne personne)	{
-
 
108
		
-
 
109
		initialiserComposants(personne);		
-
 
110
	}
-
 
111
	
100
	
Line 112... Line 101...
112
	public void initialiserComposants(Personne personne)	{
101
	public void initialiserComposants()	{
113
		
102
		
Line 114... Line 103...
114
		personneSelectionnee = new Personne();
103
		personneSelectionnee = new Personne();
Line 135... Line 124...
135
		creerComposantsIdentite();
124
		creerComposantsIdentite();
136
		creerComposantsAdresse();
125
		creerComposantsAdresse();
Line 137... Line 126...
137
		
126
		
Line 138... Line -...
138
		layout();
-
 
139
		
127
		layout();
Line 140... Line 128...
140
		rafraichir(personne);
128
		
Line 157... Line 145...
157
		
145
		
158
		setIconStyle("icone-form-ajouter");  
146
		setIconStyle("icone-form-ajouter");  
159
		setCollapsible(false);  
147
		setCollapsible(false);  
160
		setHeading("Ajouter une personne");
148
		setHeading("Ajouter une personne");
161
		setButtonAlign(HorizontalAlignment.CENTER);  
149
		setButtonAlign(HorizontalAlignment.CENTER);  
162
		setLayout(new FormLayout());
150
		setLayout(new FitLayout());
163
		setBodyBorder(false);
151
		setBodyBorder(false);
Line 164... Line 152...
164
		setBorders(false);
152
		setBorders(false);
Line 173... Line 161...
173
	 * 
161
	 * 
174
	 * */
162
	 * */
175
	public void initialiserOnglets()	{
163
	public void initialiserOnglets()	{
176
		//TabPanel
164
		//TabPanel
177
		TabPanel formulaireOnglets = new TabPanel();
165
		TabPanel formulaireOnglets = new TabPanel();
178
		formulaireOnglets.setBodyBorder(true);
-
 
Line 179... Line 166...
179
		
166
		
180
		
167
		
181
		//Tab 1 : identite
168
		//Tab 1 : identite
182
		tiIdentite = new TabItem("Identité");
169
		tiIdentite = new TabItem("Identité");
183
		tiIdentite.setLayout(new FormLayout());
170
		tiIdentite.setLayout(new FormLayout());
Line -... Line 171...
-
 
171
		tiIdentite.setScrollMode(Scroll.AUTO);
184
		tiIdentite.setScrollMode(Scroll.AUTO);
172
		formulaireOnglets.add(tiIdentite);
Line 185... Line 173...
185
		formulaireOnglets.add(tiIdentite);
173
		
186
		
174
		
Line 289... Line 277...
289
					mediateur.obtenirListeValeurEtRafraichir(this, "suffixes");
277
					mediateur.obtenirListeValeurEtRafraichir(this, "suffixes");
Line 290... Line 278...
290
			
278
			
291
					
279
					
-
 
280
					TextField<String> tfNomAutre = new TextField();
Line 292... Line 281...
292
					TextField<String> tfNomAutre = new TextField();
281
					tfNomAutre.setFieldLabel("Autres noms");
293
					tfNomAutre.setFieldLabel("Autres noms");
282
					tfNomAutre.setName("truk_nom_autre");
Line 294... Line 283...
294
					
283
					
Line 516... Line 505...
516
					fsContact.add(lfUrl);
505
					fsContact.add(lfUrl);
Line 517... Line 506...
517
			
506
			
518
					LayoutContainer lcUrl = new LayoutContainer(new ColumnLayout());
507
					LayoutContainer lcUrl = new LayoutContainer(new ColumnLayout());
Line -... Line 508...
-
 
508
					hmIdentite.put("lcUrl", lcUrl);
-
 
509
			
-
 
510
					HiddenField<String> hfUrl = new HiddenField<String>();
-
 
511
					hmIdentite.put("hfUrl", hfUrl);
519
					hmIdentite.put("lcUrl", lcUrl);
512
					add(hfUrl);
520
			
513
					
Line 521... Line 514...
521
						TextField tfUrl = new TextField();
514
						TextField tfUrl = new TextField();
522
						tfUrl.setValue("http://");
515
						tfUrl.setValue("http://");
Line 565... Line 558...
565
					formLayout = new FormLayout();
558
					formLayout = new FormLayout();
566
					formLayout.setLabelAlign(LabelAlign.LEFT);
559
					formLayout.setLabelAlign(LabelAlign.LEFT);
567
					fsAutresInfos.setLayout(formLayout); 
560
					fsAutresInfos.setLayout(formLayout); 
Line -... Line 561...
-
 
561
			
-
 
562
				
-
 
563
			formLayout = new FormLayout();
-
 
564
			formLayout.setLabelAlign(LabelAlign.TOP);
568
			
565
			LayoutContainer lcAutreInformations1 = new LayoutContainer(formLayout);
569
				
566
								
570
				//Civilité				
567
			//Civilité				
571
				ListStore<Valeur> storeSexe = new ListStore<Valeur>();
568
			ListStore<Valeur> storeSexe = new ListStore<Valeur>();
572
				ComboBox<Valeur> cbSexe = new ComboBox<Valeur>();
569
			ComboBox<Valeur> cbSexe = new ComboBox<Valeur>();
573
				cbSexe.setStore(storeSexe);
570
			cbSexe.setStore(storeSexe);
574
				cbSexe.setFieldLabel("Sexe");
571
			cbSexe.setFieldLabel("Sexe");
575
				cbSexe.setDisplayField("nom");
572
			cbSexe.setDisplayField("nom");
576
				cbSexe.setEmptyText("Choisissez le sexe:");
573
			cbSexe.setEmptyText("Choisissez le sexe:");
577
			
574
		
578
				fsAutresInfos.add(cbSexe, fd100);			
575
			lcAutreInformations1.add(cbSexe, fd100);			
579
				hmIdentite.put("cbSexe", cbSexe);
576
			hmIdentite.put("cbSexe", cbSexe);
Line 580... Line 577...
580
			
577
		
581
				mediateur.obtenirListeValeurEtRafraichir(this, "sexe");			
578
			mediateur.obtenirListeValeurEtRafraichir(this, "sexe");			
582
			
579
			
583
			//Description
580
			//Description
584
			TextArea taDescription = new TextArea();
581
			TextArea taDescription = new TextArea();
585
			taDescription.setEmptyText("Saisissez une description");
582
			taDescription.setEmptyText("Saisissez une description");
586
			taDescription.setFieldLabel("Description");
-
 
Line -... Line 583...
-
 
583
			taDescription.setFieldLabel("Description");
587
			taDescription.setWidth("100%");
584
			taDescription.setWidth("100%");
Line -... Line 585...
-
 
585
			taDescription.setName("description");
Line 588... Line 586...
588
			taDescription.setName("description");
586
			
-
 
587
			lcAutreInformations1.add(taDescription, fd100);
-
 
588
			hmIdentite.put("taDescription", taDescription);
-
 
589
			
-
 
590
			fsAutresInfos.add(lcAutreInformations1);
-
 
591
			
-
 
592
			// Logo
-
 
593
			LayoutContainer lcAutreInformations2 = new LayoutContainer();
-
 
594
			hmIdentite.put("lcAutreInformations2", lcAutreInformations2);
-
 
595
			
-
 
596
			LabelField lfUrlLogo = new LabelField();
-
 
597
			lfUrlLogo.setText("<b>Logo:</b>");
-
 
598
			lcAutreInformations2.add(lfUrlLogo);
-
 
599
			
-
 
600
			LayoutContainer lcUrlLogo = new LayoutContainer(new ColumnLayout());
-
 
601
			hmIdentite.put("lcUrlLogo", lcUrlLogo);
-
 
602
	
-
 
603
				TextField tfUrlLogo = new TextField();
-
 
604
				tfUrlLogo.setValue("http://");
-
 
605
				
-
 
606
				HiddenField<String> hfUrlLogo = new HiddenField<String>();
-
 
607
				hmIdentite.put("hfUrlLogo", hfUrlLogo);
-
 
608
	
-
 
609
				lcUrlLogo.add(tfUrlLogo, new ColumnData(0.8));
-
 
610
				hmIdentite.put("tfUrlLogo", tfUrlLogo);
-
 
611
	
-
 
612
				IconButton ibAjouterUrlLogo = new IconButton(ComposantClass.ICONE_AJOUTER);
-
 
613
				ibAjouterUrlLogo.addSelectionListener(new SelectionListener<ComponentEvent>() {
-
 
614
 
-
 
615
					public void componentSelected(ComponentEvent ce) {
-
 
616
						
-
 
617
						TextField<String> tfUrlLogo = (TextField) hmIdentite.get("tfUrlLogo");
-
 
618
						String strUrl = tfUrlLogo.getValue();
-
 
619
						
-
 
620
						if ((strUrl == null)||(strUrl.trim().equals("http://"))||(strUrl.trim().equals("")))	{
-
 
621
							MessageBox.alert("Erreur de saisie", "Vous devez saisir un URL", null);
-
 
622
						} else if(hmIdentite.get("url-" + strUrl) != null)	{
-
 
623
							MessageBox.alert("Erreur de saisie", "L'url est déjà présente dans la liste.", null);
-
 
624
						}	else	{
-
 
625
							tfUrlLogo.setValue("");
-
 
626
								if (!strUrl.matches("[a-z]{3,}://[a-z0-9-]+.[.a-z0-9-]+(?::[0-9]*)?"))	{
-
 
627
									MessageBox.alert("Erreur de saisie", "L'adresse n'est pas au bon format (ex: http://www.domain.com)", null);			
-
 
628
								} else if (strUrl.length()>255){
-
 
629
									MessageBox.alert("Erreur de saisie", "L'adresse ne peut dépasser 255 caractères", null);
-
 
630
								} else {
-
 
631
									ajouterUrlLogo(strUrl);
-
 
632
								}
-
 
633
							
-
 
634
						}
-
 
635
						
-
 
636
					}
-
 
637
				});
589
			fsAutresInfos.add(taDescription, fd100);
638
	
590
			
639
				lcUrlLogo.add(ibAjouterUrlLogo, new ColumnData(0.15));
591
			hmIdentite.put("taDescription", taDescription);
640
				lcAutreInformations2.add(lcUrlLogo);
592
			
641
			
593
			
642
			fsAutresInfos.add(lcAutreInformations2);
Line 594... Line 643...
594
			// Logo
643
			
Line 595... Line 644...
595
			TextArea taLogo = new TextArea();
644
			TextArea taLogo = new TextArea();
Line 809... Line 858...
809
	/*---------------------------------------------------------------------------------------
858
	/*---------------------------------------------------------------------------------------
810
	 * 		RAFRAICHISSEMENT DU PANNEAU
859
	 * 		RAFRAICHISSEMENT DU PANNEAU
811
	 * --------------------------------------------------------------------------------------
860
	 * --------------------------------------------------------------------------------------
812
	 */	
861
	 */	
813
	public void rafraichir(Object nouvellesDonnees) {
862
	public void rafraichir(Object nouvellesDonnees) {
-
 
863
		
-
 
864
		
-
 
865
		
814
		if (nouvellesDonnees instanceof ValeurListe){
866
		if (nouvellesDonnees instanceof ValeurListe){
Line 815... Line 867...
815
			
867
			
Line 854... Line 906...
854
			}
906
			}
Line 855... Line 907...
855
			
907
			
Line 856... Line -...
856
			
-
 
857
		} else if (nouvellesDonnees instanceof Information)	{
908
			
858
			
-
 
859
			
909
		} else if (nouvellesDonnees instanceof Information)	{
860
			Information info = (Information) nouvellesDonnees;
-
 
861
			
-
 
862
			if (info.getDonnee(0) instanceof PersonneListe)	{
-
 
863
			
-
 
864
				Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values();
-
 
865
				Iterator itPersonneListe = colPersonneListe.iterator();
-
 
866
				Personne personne = (Personne) itPersonneListe.next();
-
 
867
				
-
 
868
				personneSauvegarde = new Personne();
-
 
869
				personneSauvegarde = (Personne) personne.cloner(personneSauvegarde);
-
 
870
				
-
 
871
				
-
 
872
				
-
 
873
				binderPersonne(personne);
-
 
874
				//Mise à jour de la personne		
-
 
875
				//Personne personne = (Personne) nouvellesDonnees;
-
 
876
				
-
 
877
				
-
 
878
				
-
 
879
				//Prefixe
-
 
880
				String prefixe = personne.get("ce_truk_prefix");
-
 
881
				ComboBox<Valeur> cbPrefixe = (ComboBox<Valeur>) hmIdentite.get("cbPrefixe");
-
 
882
				
-
 
883
				
-
 
884
				String prefixeCourant = personne.get("ce_truk_prefix");
-
 
885
				if (cbPrefixe.getStore().findModel("id_valeur", prefixeCourant) != null)	{
-
 
886
					cbPrefixe.setValue(cbPrefixe.getStore().findModel("id_valeur", prefixeCourant));
-
 
887
				}	else	{
-
 
888
					cbPrefixe.setRawValue(prefixeCourant);
-
 
889
				}
-
 
890
				
-
 
891
				
-
 
892
				((TextField) hmIdentite.get("tfPrenom")).setValue(personne.get("prenom"));
-
 
893
				((TextField) hmIdentite.get("tfNom")).setValue(personne.get("nom"));
-
 
894
				
-
 
895
				//Suffixe
-
 
896
				String suffixe = personne.get("ce_truk_suffixe");
-
 
897
				ComboBox<Valeur> cbSuffixe = (ComboBox<Valeur>) hmIdentite.get("cbSuffixe");
-
 
898
				
-
 
899
				String suffixeCourant = personne.get("ce_truk_suffix");
-
 
900
				if (cbSuffixe.getStore().findModel("id_valeur", suffixeCourant) != null)	{
-
 
901
					cbSuffixe.setValue(cbSuffixe.getStore().findModel("id_valeur", suffixeCourant));
-
 
Line 902... Line 910...
902
				}	else	{
910
			
903
					cbSuffixe.setRawValue(suffixeCourant);
911
			Information info = (Information) nouvellesDonnees;
904
				}
-
 
Line -... Line 912...
-
 
912
			if (info.getType().equals("ajout_personne"))	{
-
 
913
				
Line 905... Line 914...
905
				
914
				personneSelectionnee.set("id_personne", info.toString());
-
 
915
				GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null);
-
 
916
				
906
				((TextField) hmIdentite.get("tfNomAutre")).setValue(personne.get("truk_nom_autre"));
917
				Info.display("Enregistrement", "Les modifications apportées à la personne " + personneSelectionnee.getId() + " ont été enregistrées");
907
				((TextField) hmIdentite.get("tfAbreviation")).setValue(personne.get("abreviation"));
918
				//Passer en mode modifier
-
 
919
				
908
				((TextField) hmIdentite.get("tfAbreviationAutre")).setValue(personne.get("truk_abreviation_autre"));
920
			} else if (info.getType().equals("suppression_personne"))	{
-
 
921
				GWT.log(info.toString(), null);
909
				
922
				Info.display("lk", info.getMessages().toString());
910
				
923
			} else if (info.getDonnee(0) instanceof PersonneListe)	{
911
				(((DateField) hmIdentite.get("dfDateNaissance"))).setValue(personne.getDate("naissance_date"));
924
			
912
				((TextField) hmIdentite.get("tfLieuNaissance")).setValue(personne.get("naissance_lieu"));
925
			
-
 
926
					Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values();
913
				
927
					Iterator itPersonneListe = colPersonneListe.iterator();
-
 
928
					Personne personne = (Personne) itPersonneListe.next();
-
 
929
					
-
 
930
					personneSauvegarde = new Personne();
Line -... Line 931...
-
 
931
					personneSauvegarde = (Personne) personne.cloner(personneSauvegarde);
914
				(((DateField) hmIdentite.get("dfDateDeces"))).setValue(personne.getDate("deces_date"));
932
					
915
				((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu"));
933
					binderPersonne(personne);
-
 
934
					//Mise à jour de la personne		
-
 
935
					//Personne personne = (Personne) nouvellesDonnees;
916
				
936
					
917
				// Telephone
937
					
918
				HashMap<String, String> hmTelephone = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_telephone");
938
					
919
				if (hmTelephone!=null)	{
939
					//Prefixe
920
					
940
					String prefixe = personne.get("ce_truk_prefix");
921
					
941
					ComboBox<Valeur> cbPrefixe = (ComboBox<Valeur>) hmIdentite.get("cbPrefixe");
Line -... Line 942...
-
 
942
					
-
 
943
					
-
 
944
					String prefixeCourant = personne.get("ce_truk_prefix");
-
 
945
					if (cbPrefixe.getStore().findModel("id_valeur", prefixeCourant) != null)	{
922
					ListStore storeTelephone = ((ComboBox) hmIdentite.get("cbTelephone")).getStore();
946
						cbPrefixe.setValue(cbPrefixe.getStore().findModel("id_valeur", prefixeCourant));
-
 
947
					}	else	{
-
 
948
						cbPrefixe.setRawValue(prefixeCourant);
923
					List lstModelsTelephone = storeTelephone.getModels();
949
					}
-
 
950
					
-
 
951
					
-
 
952
					((TextField) hmIdentite.get("tfPrenom")).setValue(personne.get("prenom"));
-
 
953
					((TextField) hmIdentite.get("tfNom")).setValue(personne.get("nom"));
-
 
954
					
-
 
955
					//Suffixe
-
 
956
					String suffixe = personne.get("ce_truk_suffixe");
-
 
957
					ComboBox<Valeur> cbSuffixe = (ComboBox<Valeur>) hmIdentite.get("cbSuffixe");
-
 
958
					
-
 
959
					String suffixeCourant = personne.get("ce_truk_suffix");
-
 
960
					if (cbSuffixe.getStore().findModel("id_valeur", suffixeCourant) != null)	{
-
 
961
						cbSuffixe.setValue(cbSuffixe.getStore().findModel("id_valeur", suffixeCourant));
-
 
962
					}	else	{
-
 
963
						cbSuffixe.setRawValue(suffixeCourant);
-
 
964
					}
-
 
965
					
924
					Iterator<Valeur> itStore = lstModelsTelephone.iterator();
966
					((TextField) hmIdentite.get("tfNomAutre")).setValue(personne.get("truk_nom_autre"));
-
 
967
					((TextField) hmIdentite.get("tfAbreviation")).setValue(personne.get("abreviation"));
-
 
968
					((TextField) hmIdentite.get("tfAbreviationAutre")).setValue(personne.get("truk_abreviation_autre"));
925
					HashMap<String, String> hmTel = new HashMap();
969
					
-
 
970
					
-
 
971
					(((DateField) hmIdentite.get("dfDateNaissance"))).setValue(personne.getDate("naissance_date"));
-
 
972
					((TextField) hmIdentite.get("tfLieuNaissance")).setValue(personne.get("naissance_lieu"));
926
					while (itStore.hasNext())	{
973
					
927
						Valeur v = itStore.next();
974
					(((DateField) hmIdentite.get("dfDateDeces"))).setValue(personne.getDate("deces_date"));
928
						hmTel.put(v.getAbreviation(), v.getNom());
975
					((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu"));
929
					}
976
					
930
					
977
					// Telephone
-
 
978
					HashMap<String, String> hmTelephone = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_telephone");
931
					
979
					if (hmTelephone!=null)	{
Line -... Line 980...
-
 
980
						
-
 
981
						
-
 
982
						ListStore storeTelephone = ((ComboBox) hmIdentite.get("cbTelephone")).getStore();
-
 
983
						List lstModelsTelephone = storeTelephone.getModels();
-
 
984
						Iterator<Valeur> itStore = lstModelsTelephone.iterator();
-
 
985
						HashMap<String, String> hmTel = new HashMap();
-
 
986
						while (itStore.hasNext())	{
-
 
987
							Valeur v = itStore.next();
-
 
988
							hmTel.put(v.getAbreviation(), v.getNom());
-
 
989
						}
-
 
990
						
-
 
991
						
932
					Collection<String> colTelephone = hmTelephone.keySet();
992
						Collection<String> colTelephone = hmTelephone.keySet();
-
 
993
						Iterator<String> itTelephone = colTelephone.iterator();
933
					Iterator<String> itTelephone = colTelephone.iterator();
994
					
934
				
-
 
935
					while (itTelephone.hasNext())	{
-
 
936
						String strTypeTelephone = itTelephone.next();
-
 
937
						String strTelephone = hmTelephone.get(strTypeTelephone);
-
 
938
						String idTel = hmTel.get(strTypeTelephone);
-
 
939
						if (idTel == null)	{
-
 
940
							idTel = strTypeTelephone;
-
 
941
						}
-
 
942
						
-
 
943
						ajouterTelephone(strTelephone, idTel, strTypeTelephone);
-
 
944
					}
-
 
945
				}
-
 
946
				
-
 
947
				//Courriel
-
 
948
				LinkedList<String> lCourriels = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_courriel");
-
 
949
				Iterator<String> itCourriels = lCourriels.iterator(); 
-
 
950
				
-
 
951
				while (itCourriels.hasNext())	{
-
 
952
					String strEmail = itCourriels.next();
-
 
953
					ajouterCourriel(strEmail);
-
 
954
				}
-
 
955
				
-
 
956
				// Sites
-
 
957
				LinkedList<String> lUrl = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_url");
-
 
958
				Iterator<String> itUrl = lUrl.iterator(); 
-
 
959
				
-
 
960
				
-
 
961
				while (itUrl.hasNext())	{
-
 
962
					String strUrl = itUrl.next();
-
 
963
					ajouterUrl(strUrl);
-
 
964
				}
-
 
965
				
-
 
966
				// Sexe
-
 
967
				String strSexe = personne.get("ce_sexe");
-
 
968
				ComboBox<Valeur> cbSexe = (ComboBox<Valeur>) hmIdentite.get("cbSexe");
-
 
969
				
-
 
970
				
-
 
971
				//FIXME : le lien avec la bdd ne peut pas se faire
-
 
972
				if (cbSexe.getStore().findModel("abreviation", strSexe) != null)	{
-
 
973
					cbSexe.setValue(cbSexe.getStore().findModel("abreviation", strSexe));
-
 
974
				}	else	{
-
 
975
					cbSexe.setRawValue(strSexe);
-
 
976
				}
-
 
977
				
-
 
978
				((TextArea) hmIdentite.get("taDescription")).setRawValue((String) personne.get("description"));
-
 
979
				
-
 
980
				// Logos
-
 
981
				TextArea taLogo = (TextArea) hmIdentite.get("taLogo");
-
 
982
				LinkedList<String> lLogo = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_logo");
-
 
983
				Iterator<String> itLogo = lLogo.iterator(); 
-
 
984
				
-
 
985
				String strValeurLogo = "";
-
 
986
				while (itLogo.hasNext())	{
-
 
987
					strValeurLogo += itLogo.next() + "\n";
-
 
988
				}
-
 
989
				
-
 
990
				if (!strValeurLogo.trim().equals(""))	{
-
 
991
					taLogo.setRawValue(strValeurLogo);
-
 
992
				}
-
 
993
				
-
 
994
				
-
 
995
				/*--------------------------------------------------
-
 
996
				                      Adresse
-
 
997
				 ---------------------------------------------------*/
-
 
998
				
-
 
999
				// Adresse
-
 
1000
				((TextField<String>) hmAdresse.get("tfAdresse1")).setValue((String) personne.get("adresse_01"));
-
 
1001
 
-
 
1002
				// Complément
-
 
1003
				((TextField<String>) hmAdresse.get("tfAdresse2")).setValue((String) personne.get("adresse_02"));
-
 
1004
				
-
 
1005
				//Boite postale
-
 
1006
				((TextField<String>) hmAdresse.get("tfBoitePostale")).setValue((String) personne.get("bp"));
-
 
1007
				
-
 
1008
				//Pays
-
 
1009
				String strPays = personne.get("pays");
-
 
1010
				ComboBox<Valeur> cbPays = (ComboBox<Valeur>) hmAdresse.get("cbPays");
-
 
1011
				
-
 
1012
				
-
 
1013
				if (cbPays.getStore().findModel("nom", strPays) != null)	{
-
 
Line -... Line 995...
-
 
995
						while (itTelephone.hasNext())	{
-
 
996
							String strTypeTelephone = itTelephone.next();
-
 
997
							String strTelephone = hmTelephone.get(strTypeTelephone);
-
 
998
							String idTel = hmTel.get(strTypeTelephone);
-
 
999
							if (idTel == null)	{
-
 
1000
								idTel = strTypeTelephone;
-
 
1001
							}
-
 
1002
							
-
 
1003
							ajouterTelephone(strTelephone, idTel, strTypeTelephone);
-
 
1004
						}
-
 
1005
					}
-
 
1006
					
-
 
1007
					//Courriel
-
 
1008
					LinkedList<String> lCourriels = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_courriel");
-
 
1009
					Iterator<String> itCourriels = lCourriels.iterator(); 
-
 
1010
					
-
 
1011
					while (itCourriels.hasNext())	{
-
 
1012
						String strEmail = itCourriels.next();
-
 
1013
						ajouterCourriel(strEmail);
-
 
1014
					}
-
 
1015
					
-
 
1016
					// Sites
-
 
1017
					LinkedList<String> lUrl = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_url");
-
 
1018
					Iterator<String> itUrl = lUrl.iterator(); 
-
 
1019
					
1014
					cbPays.setValue(cbPays.getStore().findModel("nom", strPays));
1020
					
1015
				}	else	{
1021
					while (itUrl.hasNext())	{
1016
					cbPays.setRawValue(strPays);
1022
						String strUrl = itUrl.next();
1017
				}
1023
						ajouterUrl(strUrl);
-
 
1024
					}
-
 
1025
					
-
 
1026
					// Sexe
-
 
1027
					String strSexe = personne.get("ce_sexe");
-
 
1028
					ComboBox<Valeur> cbSexe = (ComboBox<Valeur>) hmIdentite.get("cbSexe");
-
 
1029
					
-
 
1030
					
-
 
1031
					//FIXME : le lien avec la bdd ne peut pas se faire
-
 
1032
					if (cbSexe.getStore().findModel("abreviation", strSexe) != null)	{
-
 
1033
						cbSexe.setValue(cbSexe.getStore().findModel("abreviation", strSexe));
-
 
1034
					}	else	{
-
 
1035
						cbSexe.setRawValue(strSexe);
-
 
1036
					}
-
 
1037
					
-
 
1038
					((TextArea) hmIdentite.get("taDescription")).setRawValue((String) personne.get("description"));
-
 
1039
					
1018
				
1040
					// Logos
-
 
1041
					TextArea taLogo = (TextArea) hmIdentite.get("taLogo");
-
 
1042
					LinkedList<String> lLogo = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_logo");
-
 
1043
					Iterator<String> itLogo = lLogo.iterator(); 
-
 
1044
					
-
 
1045
					String strValeurLogo = "";
-
 
1046
					while (itLogo.hasNext())	{
-
 
1047
						strValeurLogo += itLogo.next() + "\n";
-
 
1048
					}
-
 
1049
					
-
 
1050
					if (!strValeurLogo.trim().equals(""))	{
-
 
1051
						taLogo.setRawValue(strValeurLogo);
-
 
1052
					}
-
 
1053
					
-
 
1054
					
-
 
1055
					/*--------------------------------------------------
-
 
1056
					                      Adresse
-
 
1057
					 ---------------------------------------------------*/
-
 
1058
					
-
 
1059
					// Adresse
-
 
1060
					((TextField<String>) hmAdresse.get("tfAdresse1")).setValue((String) personne.get("adresse_01"));
-
 
1061
	
-
 
1062
					// Complément
-
 
1063
					((TextField<String>) hmAdresse.get("tfAdresse2")).setValue((String) personne.get("adresse_02"));
-
 
1064
					
-
 
1065
					//Boite postale
-
 
1066
					((TextField<String>) hmAdresse.get("tfBoitePostale")).setValue((String) personne.get("bp"));
-
 
1067
					
-
 
1068
					//Pays
-
 
1069
					String strPays = personne.get("pays");
-
 
1070
					ComboBox<Valeur> cbPays = (ComboBox<Valeur>) hmAdresse.get("cbPays");
-
 
1071
					
-
 
1072
					
-
 
1073
					if (cbPays.getStore().findModel("nom", strPays) != null)	{
-
 
1074
						cbPays.setValue(cbPays.getStore().findModel("nom", strPays));
-
 
1075
					}	else	{
-
 
1076
						cbPays.setRawValue(strPays);
-
 
1077
					}
-
 
1078
					
-
 
1079
					
-
 
1080
					//Région
-
 
1081
					String strRegion = personne.get("region");
-
 
1082
					if ((strRegion!=null)&&(!strRegion.equals("")))	{
-
 
1083
						ComboBox<Valeur> cbRegion = (ComboBox<Valeur>) hmAdresse.get("cbRegion");
-
 
1084
						cbRegion.setVisible(true);
-
 
1085
						
-
 
1086
						if (cbRegion.getStore().findModel("nom", strRegion) != null)	{
-
 
1087
							cbRegion.setValue(cbRegion.getStore().findModel("nom", strRegion));
-
 
1088
						}	else	{
-
 
1089
							cbRegion.setRawValue(strRegion);
1019
				
1090
						}
1020
				//Région
-
 
1021
				String strRegion = personne.get("region");
-
 
1022
				if ((strRegion!=null)&&(!strRegion.equals("")))	{
-
 
1023
					ComboBox<Valeur> cbRegion = (ComboBox<Valeur>) hmAdresse.get("cbRegion");
-
 
1024
					cbRegion.setVisible(true);
-
 
1025
					
-
 
1026
					if (cbRegion.getStore().findModel("nom", strRegion) != null)	{
-
 
1027
						cbRegion.setValue(cbRegion.getStore().findModel("nom", strRegion));
-
 
1028
					}	else	{
-
 
1029
						cbRegion.setRawValue(strRegion);
1091
					}
Line 1030... Line 1092...
1030
					}
1092
					
1031
				}
1093
					//Cp
1032
				
1094
					((TextField) hmAdresse.get("tfCodePostal")).setValue(personne.get("code_postal"));
Line 1268... Line 1330...
1268
				LayoutContainer lcUrl = (LayoutContainer) hmIdentite.get("lc-" + strUrl);
1330
				LayoutContainer lcUrl = (LayoutContainer) hmIdentite.get("lc-" + strUrl);
1269
				LayoutContainer lcUrlContainer  = (LayoutContainer) hmIdentite.get("lcUrlContainer");
1331
				LayoutContainer lcUrlContainer  = (LayoutContainer) hmIdentite.get("lcUrlContainer");
Line 1270... Line 1332...
1270
				
1332
				
Line -... Line 1333...
-
 
1333
				lcUrlContainer.remove(lcUrl);
-
 
1334
				
-
 
1335
				
-
 
1336
				HiddenField<String> hfUrl = (HiddenField<String>) hmIdentite.get("hfUrl");
-
 
1337
				String strValeurUrl = hfUrl.getValue();
-
 
1338
				strValeurUrl = strValeurUrl.replace(strUrl, "");
-
 
1339
				hfUrl.setValue(strValeurUrl);
-
 
1340
				
-
 
1341
			}
-
 
1342
		});
-
 
1343
		
-
 
1344
		lcUrl.add(ibSupprimerUrl, new ColumnData(0.15));
-
 
1345
		lcUrlContainer.add(lcUrl);
-
 
1346
		
-
 
1347
		HiddenField<String> hfUrl = (HiddenField<String>) hmIdentite.get("hfUrl");
-
 
1348
		String strValeurUrl = hfUrl.getValue();
-
 
1349
		if (strValeurUrl == null)	{
-
 
1350
			strValeurUrl = "";
-
 
1351
		}
-
 
1352
		
-
 
1353
		strValeurUrl += strUrl + ";;";
-
 
1354
		hfUrl.setValue(strValeurUrl);
-
 
1355
		
-
 
1356
		layout();
-
 
1357
		
-
 
1358
		
-
 
1359
		
-
 
1360
	}
-
 
1361
	
-
 
1362
	public void ajouterUrlLogo(String strUrl)	{
-
 
1363
		
-
 
1364
		LayoutContainer lcUrlContainer  = (LayoutContainer) hmIdentite.get("lcAutreInformations2");
-
 
1365
		
-
 
1366
		LayoutContainer lcUrl = new LayoutContainer();
-
 
1367
		lcUrl.setLayout(new ColumnLayout());
-
 
1368
		hmIdentite.put("lc-" + strUrl, lcUrl);
-
 
1369
		
-
 
1370
		
-
 
1371
		Text tUrl = new Text(strUrl);
-
 
1372
		hmIdentite.put("url-"+strUrl, tUrl);
-
 
1373
		
-
 
1374
		lcUrl.add(tUrl, new ColumnData(0.8));
-
 
1375
		
-
 
1376
		IconButton ibSupprimerUrl = new IconButton(ComposantClass.ICONE_SUPPRIMER);
-
 
1377
		ibSupprimerUrl.setId(strUrl);
-
 
1378
		ibSupprimerUrl.addSelectionListener(new SelectionListener<ComponentEvent>() {
-
 
1379
 
-
 
1380
			public void componentSelected(ComponentEvent ce) {
-
 
1381
				
-
 
1382
				//Suppression url
-
 
1383
				String strUrl = ce.component.getId();
-
 
1384
				LayoutContainer lcUrl = (LayoutContainer) hmIdentite.get("lc-" + strUrl);
-
 
1385
				LayoutContainer lcUrlContainer  = (LayoutContainer) hmIdentite.get("lcAutreInformations2");
-
 
1386
				
-
 
1387
				lcUrlContainer.remove(lcUrl);
-
 
1388
				
-
 
1389
				
-
 
1390
				HiddenField<String> hfUrlLogo = (HiddenField<String>) hmIdentite.get("hfUrlLogo");
-
 
1391
				String strValeurUrl = hfUrlLogo.getValue();
-
 
1392
				strValeurUrl = strUrl.replace(strUrl, "");
-
 
1393
				
1271
				lcUrlContainer.remove(lcUrl);
1394
				hfUrlLogo.setValue(strValeurUrl);
1272
				
1395
				
Line 1273... Line 1396...
1273
			}
1396
			}
1274
		});
1397
		});
Line -... Line 1398...
-
 
1398
		
-
 
1399
		lcUrl.add(ibSupprimerUrl, new ColumnData(0.15));
-
 
1400
		lcUrlContainer.add(lcUrl);
-
 
1401
		
-
 
1402
		HiddenField<String> hfUrlLogo = (HiddenField<String>) hmIdentite.get("hfUrlLogo");
-
 
1403
		String strValeurUrl = hfUrlLogo.getValue();
-
 
1404
		if (strValeurUrl == null)	{
-
 
1405
			strValeurUrl = "";
-
 
1406
		}
-
 
1407
		
-
 
1408
		strValeurUrl += strUrl + ";;";
-
 
1409
		
1275
		
1410
		hfUrlLogo.setValue(strValeurUrl);
Line 1276... Line 1411...
1276
		lcUrl.add(ibSupprimerUrl, new ColumnData(0.15));
1411
		
Line 1338... Line 1473...
1338
		strValeur = obtenirValeurCombo("cbSuffixe"); 
1473
		strValeur = obtenirValeurCombo("cbSuffixe"); 
1339
		personneSelectionnee.set("ce_truk_suffix", strValeur);
1474
		personneSelectionnee.set("ce_truk_suffix", strValeur);
Line 1340... Line 1475...
1340
		
1475
		
Line -... Line 1476...
-
 
1476
		personneSelectionnee.set("truk_courriel", ((HiddenField<String>) hmIdentite.get("hfHiddenCourriel")).getValue());
-
 
1477
		
-
 
1478
		
1341
		personneSelectionnee.set("truk_courriel", ((HiddenField<String>) hmIdentite.get("hfHiddenCourriel")).getValue());
1479
		//Pour le nom complet, on enregistre dans la bdd la valeur du prefixe/suffixe et non l'id
-
 
1480
		String strPrefixe = "";
-
 
1481
		combo = (ComboBox) hmIdentite.get("cbPrefixe");
-
 
1482
		valeur = (Valeur) combo.getValue();
-
 
1483
		if (valeur != null)	{
-
 
1484
			strPrefixe = valeur.getNom();
-
 
1485
		} else {
-
 
1486
			strPrefixe = combo.getRawValue();
-
 
1487
		}
-
 
1488
		
-
 
1489
		String strSuffixe = "";
-
 
1490
		combo = (ComboBox) hmIdentite.get("cbSuffixe");
-
 
1491
		valeur = (Valeur) combo.getValue();
-
 
1492
		if (valeur != null)	{
-
 
1493
			strSuffixe = valeur.getNom();
-
 
1494
		} else {
-
 
1495
			strSuffixe = combo.getRawValue();
1342
		
1496
		}
1343
		strValeur = personneSelectionnee.get("truk_prefix")
1497
		strValeur = strPrefixe
1344
					+ " " + personneSelectionnee.get("prenom")
1498
					+ " " + personneSelectionnee.get("prenom")
Line 1345... Line 1499...
1345
					+ " " + personneSelectionnee.get("nom")
1499
					+ " " + personneSelectionnee.get("nom")
Line 1346... Line 1500...
1346
					+ " " + personneSelectionnee.get("truk_suffix");
1500
					+ " " + strSuffixe;
Line 1356... Line 1510...
1356
		strValeur = obtenirValeurCombo("cbRegion");
1510
		strValeur = obtenirValeurCombo("cbRegion");
1357
		personneSelectionnee.set("region", strValeur);
1511
		personneSelectionnee.set("region", strValeur);
Line 1358... Line 1512...
1358
		
1512
		
Line -... Line 1513...
-
 
1513
		personneSelectionnee.set("truk_telephone", ((HiddenField<String>) hmIdentite.get("hfTelephone")).getValue());
-
 
1514
		
-
 
1515
		String logoUrls = ((HiddenField<String>) hmIdentite.get("hfUrlLogo")).getValue();
-
 
1516
		if (logoUrls == null)	{
-
 
1517
			logoUrls = "";
Line 1359... Line 1518...
1359
		personneSelectionnee.set("truk_telephone", ((HiddenField<String>) hmIdentite.get("hfTelephone")).getValue());
1518
		}
1360
		
-
 
1361
		
-
 
1362
		System.out.println(personneSelectionnee);
-
 
1363
		
-
 
1364
		//tel
-
 
1365
		//fax
-
 
Line -... Line 1519...
-
 
1519
		personneSelectionnee.set("truk_logo", logoUrls);
-
 
1520
		
-
 
1521
		personneSelectionnee.set("truk_url", ((HiddenField) hmIdentite.get("hfUrl")).getValue());
-
 
1522
		
-
 
1523
		//if (lstMessageErreur.size() < 0)	{
-
 
1524
			mediateur.enregistrerPersonne(this, personneSelectionnee);
-
 
1525
		/*} else {
-
 
1526
			String strMessagesErreur = "";
-
 
1527
			Iterator<String> itMessagesErreur = lstMessageErreur.iterator();
-
 
1528
			while (itMessagesErreur.hasNext())	{
-
 
1529
				strMessagesErreur += " - " + itMessagesErreur.next() +" \n";
1366
		//logo
1530
			}
Line 1367... Line 1531...
1367
		//url
1531
			
Line 1368... Line 1532...
1368
		
1532
 			MessageBox.alert("Erreurs", "Les erreurs suivantes ont été commises : \n" + strMessagesErreur, null);