Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 935 Rev 973
Line 12... Line 12...
12
import org.tela_botanica.client.Mediateur;
12
import org.tela_botanica.client.Mediateur;
13
import org.tela_botanica.client.RegistreId;
13
import org.tela_botanica.client.RegistreId;
14
import org.tela_botanica.client.composants.ChampMultiValeurs;
14
import org.tela_botanica.client.composants.ChampMultiValeurs;
15
import org.tela_botanica.client.composants.ChampMultiValeursImage;
15
import org.tela_botanica.client.composants.ChampMultiValeursImage;
16
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypes;
16
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypes;
-
 
17
import org.tela_botanica.client.composants.HashMapComposants;
17
import org.tela_botanica.client.configuration.Configuration;
18
import org.tela_botanica.client.configuration.Configuration;
18
import org.tela_botanica.client.images.Images;
19
import org.tela_botanica.client.images.Images;
19
import org.tela_botanica.client.interfaces.Rafraichissable;
20
import org.tela_botanica.client.interfaces.Rafraichissable;
Line 20... Line 21...
20
 
21
 
Line 34... Line 35...
34
import com.extjs.gxt.ui.client.Registry;
35
import com.extjs.gxt.ui.client.Registry;
35
import com.extjs.gxt.ui.client.Style.IconAlign;
36
import com.extjs.gxt.ui.client.Style.IconAlign;
36
import com.extjs.gxt.ui.client.Style.Scroll;
37
import com.extjs.gxt.ui.client.Style.Scroll;
37
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
38
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
Line -... Line 39...
-
 
39
 
38
 
40
import com.extjs.gxt.ui.client.binding.FieldBinding;
Line 39... Line 41...
39
import com.extjs.gxt.ui.client.binding.FormBinding;
41
import com.extjs.gxt.ui.client.binding.FormBinding;
40
 
42
 
41
import com.extjs.gxt.ui.client.event.ButtonEvent;
43
import com.extjs.gxt.ui.client.event.ButtonEvent;
Line 50... Line 52...
50
import com.extjs.gxt.ui.client.widget.MessageBox;
52
import com.extjs.gxt.ui.client.widget.MessageBox;
Line 51... Line 53...
51
 
53
 
52
import com.extjs.gxt.ui.client.widget.Info;
54
import com.extjs.gxt.ui.client.widget.Info;
53
import com.extjs.gxt.ui.client.widget.TabItem;
55
import com.extjs.gxt.ui.client.widget.TabItem;
-
 
56
import com.extjs.gxt.ui.client.widget.TabPanel;
Line 54... Line 57...
54
import com.extjs.gxt.ui.client.widget.TabPanel;
57
import com.extjs.gxt.ui.client.widget.Text;
55
 
58
 
56
import com.extjs.gxt.ui.client.widget.button.Button;
59
import com.extjs.gxt.ui.client.widget.button.Button;
57
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
60
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
Line 83... Line 86...
83
	private TabItem tiIdentite, tiAdresses, tiInfosNat;
86
	private TabItem tiIdentite, tiAdresses, tiInfosNat;
84
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
87
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
85
	private Personne personneSelectionnee, personneSauvegarde = null;
88
	private Personne personneSelectionnee, personneSauvegarde = null;
Line 86... Line 89...
86
	
89
	
87
	//hmIdentite[...] référence par une chaine de caractère tous les composants de l'onglet Identite
90
	//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>();
91
	private HashMapComposants hmIdentite = new HashMapComposants();
89
	private HashMap<String, Widget>hmAdresse = new HashMap<String, Widget>();
92
	private HashMap<String, Widget>hmAdresse = new HashMap<String, Widget>();
90
	private HashMap<String, Widget>hmInfosNat = new HashMap<String, Widget>();
93
	private HashMap<String, Widget>hmInfosNat = new HashMap<String, Widget>();
91
	private HashMap<String, Valeur> hmCbSelectionnee = new HashMap();
94
	private HashMap<String, Valeur> hmCbSelectionnee = new HashMap();
Line 300... Line 303...
300
		autresNoms.add(abreviationAutre, new TableData("200px", "15px"));
303
		autresNoms.add(abreviationAutre, new TableData("200px", "15px"));
301
		fsNoms.add(autresNoms);
304
		fsNoms.add(autresNoms);
Line 302... Line 305...
302
										
305
										
Line 303... Line -...
303
		left.add(fsNoms);
-
 
304
		
-
 
305
		formLayout = new FormLayout();
-
 
306
		formLayout.setLabelAlign(LabelAlign.LEFT);
306
		left.add(fsNoms);
307
		
307
		
308
		FieldSet fsNaissance = new FieldSet();
308
		FieldSet fsNaissanceEtDeces = new FieldSet();
Line -... Line 309...
-
 
309
		fsNaissanceEtDeces.setHeading("Naissance et Décès");
-
 
310
		fsNaissanceEtDeces.setLayout(new ColumnLayout()); 
-
 
311
		
-
 
312
		formLayout = new FormLayout();
309
		fsNaissance.setHeading("Naissance");
313
		formLayout.setLabelAlign(LabelAlign.TOP);
310
		fsNaissance.setLayout(formLayout); 
314
		LayoutContainer containerNaissance = new LayoutContainer(formLayout);
311
		
315
				
312
		DateField dfDateNaissance = new DateField();
316
		DateField dfDateNaissance = new DateField();
Line 313... Line 317...
313
		dfDateNaissance.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
317
		dfDateNaissance.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
314
		dfDateNaissance.setFieldLabel("Date");
318
		dfDateNaissance.setFieldLabel("Date de naissance");
Line 315... Line 319...
315
		dfDateNaissance.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
319
		dfDateNaissance.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
316
		
320
		
317
		fsNaissance.add(dfDateNaissance);
321
		containerNaissance.add(dfDateNaissance);
318
		hmIdentite.put("dfDateNaissance", dfDateNaissance);
322
		hmIdentite.put("dfDateNaissance", dfDateNaissance);
Line 319... Line 323...
319
		
323
		
320
		// Lieu naissance
324
		// Lieu naissance
321
		TextField<String> tfLieuNaissance = new TextField<String>();
325
		TextField<String> tfLieuNaissance = new TextField<String>();
-
 
326
		tfLieuNaissance.setFieldLabel("Lieu de naissance");
322
		tfLieuNaissance.setFieldLabel("Lieu");
327
		tfLieuNaissance.setName("naissance_lieu");
Line 323... Line 328...
323
		tfLieuNaissance.setName("naissance_lieu");
328
		
324
		
329
		containerNaissance.add(tfLieuNaissance);
-
 
330
		hmIdentite.put("tfLieuNaissance", tfLieuNaissance);
Line 325... Line -...
325
		fsNaissance.add(tfLieuNaissance);
-
 
326
		hmIdentite.put("tfLieuNaissance", tfLieuNaissance);
-
 
327
			
-
 
328
		left.add(fsNaissance);
-
 
329
		
331
		
-
 
332
		fsNaissanceEtDeces.add(containerNaissance, new ColumnData(.5));
-
 
333
		left.add(fsNaissanceEtDeces);
330
		formLayout = new FormLayout();
334
		
331
		formLayout.setLabelAlign(LabelAlign.LEFT);
335
		formLayout = new FormLayout();
-
 
336
		formLayout.setLabelAlign(LabelAlign.TOP);
332
		
337
		LayoutContainer containerDeces = new LayoutContainer(formLayout);
333
		FieldSet fsDeces = new FieldSet();
338
		
Line 334... Line 339...
334
		fsDeces.setHeading("Décès");
339
		Radio rbEstDecedee = new Radio();
335
		fsDeces.setLayout(formLayout); 
340
		rbEstDecedee.setId("ce_deces");
336
			
341
		
337
		Radio rbEstDecedee = new Radio();
342
		rbEstDecedee.setBoxLabel("oui");
338
		rbEstDecedee.setBoxLabel("oui");
343
		rbEstDecedee.setValueAttribute("1");
339
		rbEstDecedee.setValueAttribute("1");
344
		rbEstDecedee.setId("rbEstD");
340
	
345
		
341
		rbEstDecedee.addListener(Events.Change, new Listener<ComponentEvent>() {
346
		rbEstDecedee.addListener(Events.Change, new Listener<ComponentEvent>() {
Line 342... Line 347...
342
						
347
						
343
			public void handleEvent(ComponentEvent be) {
348
			public void handleEvent(ComponentEvent be) {
344
				if(((Radio) be.getComponent()).getValue().equals(true))	{
349
				if(((Radio) be.getComponent()).getValue().equals(true))	{
345
					((DateField) hmIdentite.get("dfDateDeces")).setVisible(true);
350
					hmIdentite.getDateField("dfDateDeces").setVisible(true);
346
					((TextField) hmIdentite.get("tfLieuDeces")).setVisible(true);
351
					hmIdentite.getTextField("tfLieuDeces").setVisible(true);
347
				} else	{
352
				} else	{
Line 348... Line -...
348
					DateField dfDateDeces = ((DateField) hmIdentite.get("dfDateDeces"));
-
 
349
					dfDateDeces.setValue(null);
-
 
350
					dfDateDeces.setVisible(false);
-
 
351
					
-
 
352
					TextField tfLieuDeces = ((TextField) hmIdentite.get("tfLieuDeces"));
-
 
353
					tfLieuDeces.setValue(null);
-
 
354
					tfLieuDeces.setVisible(false);
-
 
355
				}
-
 
356
			}	
-
 
357
		});
-
 
358
					
-
 
359
		hmIdentite.put("rbEstDecedee", rbEstDecedee);
-
 
360
		
-
 
361
		Radio rbNestPasDecedee = new Radio();
-
 
362
		rbNestPasDecedee.setValueAttribute("0");
-
 
363
		rbNestPasDecedee.setBoxLabel("non");
-
 
364
		rbNestPasDecedee.setValue(true);
-
 
365
		
-
 
366
	/*	Radio rbDecesInconnu = new Radio();
353
					DateField dfDateDeces = hmIdentite.getDateField("dfDateDeces");
367
		rbDecesInconnu.setBoxLabel("Ne sais pas");
354
					dfDateDeces.setValue(null);
368
		rbDecesInconnu.setValue(true);*/
355
					dfDateDeces.setVisible(false);
369
		
356
					
370
		RadioGroup rbgDeces = new RadioGroup();
357
					TextField tfLieuDeces = hmIdentite.getTextField("tfLieuDeces");
371
		rbgDeces.setFieldLabel("Est décédée");
358
					tfLieuDeces.setValue(null);
Line 372... Line 359...
372
		rbgDeces.add(rbEstDecedee);
359
					tfLieuDeces.setVisible(false);
373
		rbgDeces.add(rbNestPasDecedee);
360
				}
Line 374... Line 361...
374
		
361
			}	
375
		fsDeces.add(rbgDeces);
362
		});
376
		
363
					
377
		DateField dfDateDeces = new DateField();
364
		DateField dfDateDeces = new DateField();
Line 378... Line 365...
378
		dfDateDeces.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
365
		dfDateDeces.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
379
		dfDateDeces.setFormatValue(true);
366
		dfDateDeces.setFormatValue(true);
-
 
367
		dfDateDeces.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
380
		dfDateDeces.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
368
		dfDateDeces.setFieldLabel("Date de décès");
-
 
369
		dfDateDeces.setVisible(false);
-
 
370
 
-
 
371
		containerDeces.add(dfDateDeces);
381
		dfDateDeces.setFieldLabel("Date");
372
		hmIdentite.put("dfDateDeces", dfDateDeces);
Line -... Line 373...
-
 
373
 
-
 
374
		TextField<String> tfLieuDeces = new TextField<String>();
-
 
375
		tfLieuDeces.setFieldLabel("Lieu de décès");
-
 
376
		tfLieuDeces.setName("deces_lieu");
-
 
377
		tfLieuDeces.setVisible(false);
-
 
378
		
-
 
379
		containerDeces.add(tfLieuDeces);
-
 
380
		hmIdentite.put("tfLieuDeces", tfLieuDeces);
382
		dfDateDeces.setVisible(false);
381
		hmIdentite.put("rbEstDecedee", rbEstDecedee);
Line 383... Line 382...
383
 
382
		
384
		fsDeces.add(dfDateDeces);
383
		Radio rbNestPasDecedee = new Radio();
385
		hmIdentite.put("dfDateDeces", dfDateDeces);
384
		rbNestPasDecedee.setValueAttribute("0");
Line -... Line 385...
-
 
385
		rbNestPasDecedee.setBoxLabel("non");
Line 386... Line 386...
386
 
386
		rbNestPasDecedee.setValue(true);
387
		TextField<String> tfLieuDeces = new TextField<String>();
387
			
388
		tfLieuDeces.setFieldLabel("Lieu");
388
		RadioGroup rbgDeces = new RadioGroup();
389
		tfLieuDeces.setName("deces_lieu");
389
		rbgDeces.setFieldLabel("Est décédée");
390
		tfLieuDeces.setVisible(false);
-
 
391
		
-
 
392
		fsDeces.add(tfLieuDeces);
-
 
Line 393... Line -...
393
		hmIdentite.put("tfLieuDeces", tfLieuDeces);
-
 
394
								
-
 
395
		left.add(fsDeces);
-
 
396
			
-
 
397
		tiIdentite.add(main);
-
 
398
			
-
 
399
		FieldSet fsContactTel = new FieldSet();
-
 
400
		fsContactTel.setHeading("Contact - Téléphones");
-
 
401
		fsContactTel.setLayout(new RowLayout());
390
		rbgDeces.add(rbEstDecedee);
402
		
391
		rbgDeces.add(rbNestPasDecedee);
-
 
392
		
403
		
393
		containerDeces.add(rbgDeces);
-
 
394
		
404
		ChampMultiValeursMultiTypes telephones = new ChampMultiValeursMultiTypes("Téléphones");
395
		fsNaissanceEtDeces.add(containerDeces, new ColumnData(.5));
Line 405... Line 396...
405
		hmIdentite.put("telephones", telephones);
396
		tiIdentite.add(main);
406
		telephones.initialiserType("tel");
-
 
407
		fsContactTel.add(telephones);
397
			
408
		right.add(fsContactTel);
398
		FieldSet fsContact = new FieldSet();
Line -... Line 399...
-
 
399
		fsContact.setHeading("Contact");
-
 
400
		fsContact.setLayout(new RowLayout());
409
		hmIdentite.put("fsContactTel", fsContactTel);
401
		
410
				
402
		LayoutContainer containerTelEtEmail = new LayoutContainer(new ColumnLayout());
411
		
403
		
412
		FieldSet fsContact = new FieldSet();
404
		ChampMultiValeursMultiTypes telephones = new ChampMultiValeursMultiTypes("Téléphones", 180, 100);
413
		fsContact.setHeading("Contact - Autres");
405
		hmIdentite.put("telephones", telephones);
Line 450... Line 442...
450
		ComboBox<Valeur> cbSexe = new ComboBox<Valeur>();
442
		ComboBox<Valeur> cbSexe = new ComboBox<Valeur>();
451
		cbSexe.setStore(storeSexe);
443
		cbSexe.setStore(storeSexe);
452
		cbSexe.setFieldLabel("Sexe");
444
		cbSexe.setFieldLabel("Sexe");
453
		cbSexe.setDisplayField("nom");
445
		cbSexe.setDisplayField("nom");
454
		cbSexe.setEmptyText("Choisissez le sexe:");
446
		cbSexe.setEmptyText("Choisissez le sexe:");
455
	
447
		
-
 
448
		FormData fd = new FormData();
-
 
449
		fd.setWidth(100);
456
		lcAutreInformations1.add(cbSexe, new FormData(100, 10));			
450
		lcAutreInformations1.add(cbSexe, fd);			
457
		hmIdentite.put("cbSexe", cbSexe);
451
		hmIdentite.put("cbSexe", cbSexe);
Line 458... Line 452...
458
	
452
	
Line 459... Line 453...
459
		mediateur.obtenirListeValeurEtRafraichir(this, "sexe");			
453
		mediateur.obtenirListeValeurEtRafraichir(this, "sexe");			
Line 714... Line 708...
714
				remplirCombobox("cbSexe", liste, "hmIdentite");
708
				remplirCombobox("cbSexe", liste, "hmIdentite");
715
			} else if (listeValeurs.getId().equals(config.getListeId("tel"))) {
709
			} else if (listeValeurs.getId().equals(config.getListeId("tel"))) {
716
				remplirCombobox("cbTelephone", liste, "hmIdentite");
710
				remplirCombobox("cbTelephone", liste, "hmIdentite");
Line 717... Line 711...
717
 
711
 
718
				//Préselection du tél
712
				//Préselection du tél
719
				ComboBox<Valeur> cbTelephone = (ComboBox<Valeur>) hmIdentite.get("cbTelephone");
713
				ComboBox<Valeur> cbTelephone = hmIdentite.getComboBoxValeur("cbTelephone");
720
				cbTelephone.setValue(liste.get(1));
714
				cbTelephone.setValue(liste.get(1));
721
			} else if (listeValeurs.getId().equals(config.getListeId("pays")))	{
715
			} else if (listeValeurs.getId().equals(config.getListeId("pays")))	{
722
				remplirCombobox("cbPays", liste, "hmAdresse");
716
				remplirCombobox("cbPays", liste, "hmAdresse");
723
			} else if (listeValeurs.getId().equals(config.getListeId("region")))	{
717
			} else if (listeValeurs.getId().equals(config.getListeId("region")))	{
Line 726... Line 720...
726
			}
720
			}
727
		} else if (nouvellesDonnees instanceof ProjetListe) {
721
		} else if (nouvellesDonnees instanceof ProjetListe) {
728
			ProjetListe projets = (ProjetListe) nouvellesDonnees;
722
			ProjetListe projets = (ProjetListe) nouvellesDonnees;
729
			List<Projet> liste = projets.toList();
723
			List<Projet> liste = projets.toList();
Line 730... Line 724...
730
			
724
			
731
			ComboBox cbProjets = (ComboBox) hmIdentite.get("cbProjets");
725
			ComboBox cbProjets = hmIdentite.getComboBox("cbProjets");
732
			ListStore<Projet> storeProjets= cbProjets.getStore();
726
			ListStore<Projet> storeProjets= cbProjets.getStore();
733
			storeProjets.removeAll();
727
			storeProjets.removeAll();
734
			storeProjets.add(liste);
728
			storeProjets.add(liste);
735
			cbProjets.setStore(storeProjets);
729
			cbProjets.setStore(storeProjets);
Line 773... Line 767...
773
				Info.display("messages", info.getMessages().toString());
767
				Info.display("messages", info.getMessages().toString());
774
			}
768
			}
775
		}
769
		}
Line 776... Line 770...
776
		
770
		
777
		if (nouvellesDonnees == null) {
771
		if (nouvellesDonnees == null) {
Line 778... Line 772...
778
			ComboBox cb= (ComboBox) hmIdentite.get("cbPrefixe");
772
			ComboBox<Valeur> cb= hmIdentite.getComboBoxValeur("cbPrefixe");
779
			
773
			
Line 780... Line 774...
780
			//Met à jour le nom Complet du formulaire
774
			//Met à jour le nom Complet du formulaire
781
			String valeurRetour = "";
775
			String valeurRetour = "";
782
			
776
			
Line 783... Line 777...
783
			// Prefixe
777
			// Prefixe
784
			String prefixe = "";
778
			String prefixe = "";
785
			Valeur valPrefixe = (Valeur) ((ComboBox) hmIdentite.get("cbPrefixe")).getValue();
779
			Valeur valPrefixe = cb.getValue();
786
			
780
			
787
			if (valPrefixe != null)	{
781
			if (valPrefixe != null)	{
Line 788... Line 782...
788
				prefixe = valPrefixe.getNom();
782
				prefixe = valPrefixe.getNom();
789
			} else 	{
783
			} else 	{
Line 790... Line 784...
790
				prefixe =  (String) ((ComboBox) hmIdentite.get("cbPrefixe")).getRawValue();
784
				prefixe =  (String) cb.getRawValue();
791
			}		
785
			}		
Line 792... Line 786...
792
			
786
			
-
 
787
			// Prénom
-
 
788
			String prenom = (String) hmIdentite.getTextField("tfPrenom").getValue();
793
			// Prénom
789
			
794
			String prenom = (String) ((TextField) hmIdentite.get("tfPrenom")).getValue();
790
			// Nom
Line 795... Line 791...
795
			
791
			String nom = (String) hmIdentite.getTextField("tfNom").getValue();
796
			// Nom
792
			
797
			String nom = (String) ((TextField) hmIdentite.get("tfNom")).getValue();
793
			// Suffixe
798
			
794
			ComboBox<Valeur> cbSuffixe = hmIdentite.getComboBoxValeur("cbSuffixe");
799
			// Suffixe
795
			
Line 800... Line 796...
800
			String suffixe = "";
796
			String suffixe = "";
801
			Valeur valSuffixe = (Valeur) ((ComboBox) hmIdentite.get("cbSuffixe")).getValue();
797
			Valeur valSuffixe = cbSuffixe.getValue();
802
			
798
			
Line 803... Line 799...
803
			if (valSuffixe != null)	{
799
			if (valSuffixe != null)	{
Line 804... Line 800...
804
				suffixe = valSuffixe.getNom();
800
				suffixe = valSuffixe.getNom();
805
			} else 	{
801
			} else 	{
806
				suffixe =  (String) ((ComboBox) hmIdentite.get("cbSuffixe")).getRawValue();
802
				suffixe =  (String) cbSuffixe.getRawValue();
807
			}
803
			}
808
			
804
			
809
			// Mettre à jour la valeur
805
			// Mettre à jour la valeur
Line 810... Line 806...
810
			valeurRetour = prefixe + " " + prenom + " " + nom + " " + suffixe;
806
			valeurRetour = prefixe + " " + prenom + " " + nom + " " + suffixe;
Line 840... Line 836...
840
	
836
	
841
	private void mettreAJourPersonne(Personne personne)	{
837
	private void mettreAJourPersonne(Personne personne)	{
842
		//Mise à jour de la personne		
838
		//Mise à jour de la personne		
Line 843... Line 839...
843
		//Personne personne = (Personne) nouvellesDonnees;
839
		//Personne personne = (Personne) nouvellesDonnees;
844
		
840
		
Line 845... Line 841...
845
		ComboBox cbProjets = (ComboBox) hmIdentite.get("cbProjets");
841
		ComboBox cbProjets = hmIdentite.getComboBox("cbProjets");
846
		cbProjets.setValue(cbProjets.getStore().findModel("id_projet", personne.get("ce_projet")));
842
		cbProjets.setValue(cbProjets.getStore().findModel("id_projet", personne.get("ce_projet")));
847
		
843
		
Line 848... Line 844...
848
		//Prefixe
844
		//Prefixe
849
		String prefixe = personne.get("ce_truk_prefix");
845
		String prefixe = personne.get("ce_truk_prefix");
850
		ComboBox<Valeur> cbPrefixe = (ComboBox<Valeur>) hmIdentite.get("cbPrefixe");
846
		ComboBox<Valeur> cbPrefixe = hmIdentite.getComboBoxValeur("cbPrefixe");
851
		
847
		
852
		
848
		
853
		String prefixeCourant = personne.get("ce_truk_prefix");
849
		String prefixeCourant = personne.get("ce_truk_prefix");
Line 854... Line -...
854
		if (cbPrefixe.getStore().findModel("id_valeur", prefixeCourant) != null)	{
-
 
855
			cbPrefixe.setValue(cbPrefixe.getStore().findModel("id_valeur", prefixeCourant));
850
		if (cbPrefixe.getStore().findModel("id_valeur", prefixeCourant) != null)	{
856
		}	else	{
851
			cbPrefixe.setValue(cbPrefixe.getStore().findModel("id_valeur", prefixeCourant));
Line 857... Line 852...
857
			cbPrefixe.setRawValue(prefixeCourant);
852
		}	else	{
858
		}
853
			cbPrefixe.setRawValue(prefixeCourant);
859
		
854
		}
Line 860... Line 855...
860
		
855
		
861
		((TextField) hmIdentite.get("tfPrenom")).setValue(personne.get("prenom"));
856
		hmIdentite.getTextField("tfPrenom").setValue(personne.get("prenom"));
862
		((TextField) hmIdentite.get("tfNom")).setValue(personne.get("nom"));
857
		hmIdentite.getTextField("tfNom").setValue(personne.get("nom"));
863
		
858
		
864
		//Suffixe
859
		//Suffixe
865
		String suffixe = personne.get("ce_truk_suffixe");
860
		String suffixe = personne.get("ce_truk_suffixe");
Line 866... Line 861...
866
		ComboBox<Valeur> cbSuffixe = (ComboBox<Valeur>) hmIdentite.get("cbSuffixe");
861
		ComboBox<Valeur> cbSuffixe = hmIdentite.getComboBoxValeur("cbSuffixe");
867
		
862
		
868
		String suffixeCourant = personne.get("ce_truk_suffix");
863
		String suffixeCourant = personne.get("ce_truk_suffix");
869
		if (cbSuffixe.getStore().findModel("id_valeur", suffixeCourant) != null)	{
-
 
Line 870... Line 864...
870
			cbSuffixe.setValue(cbSuffixe.getStore().findModel("id_valeur", suffixeCourant));
864
		if (cbSuffixe.getStore().findModel("id_valeur", suffixeCourant) != null)	{
871
		}	else	{
865
			cbSuffixe.setValue(cbSuffixe.getStore().findModel("id_valeur", suffixeCourant));
Line 872... Line 866...
872
			cbSuffixe.setRawValue(suffixeCourant);
866
		}	else	{
873
		}
867
			cbSuffixe.setRawValue(suffixeCourant);
874
		
868
		}
875
		((ChampMultiValeurs) hmIdentite.get("nomAutre")).peupler(personne.getString("truk_nom_autre"));
869
		
876
		((TextField) hmIdentite.get("tfAbreviation")).setValue(personne.get("abreviation"));
870
		hmIdentite.getChampMultiValeurs("nomAutre").peupler(personne.getString("truk_nom_autre"));
877
		((ChampMultiValeurs) hmIdentite.get("abreviationAutre")).peupler(personne.getString("truk_abreviation_autre"));
-
 
878
		
871
		hmIdentite.getTextField("tfAbreviation").setValue(personne.get("abreviation"));
Line 879... Line 872...
879
		
872
		hmIdentite.getChampMultiValeurs("abreviationAutre").peupler(personne.getString("truk_abreviation_autre"));
Line 880... Line 873...
880
		(((DateField) hmIdentite.get("dfDateNaissance"))).setValue(personne.getDate("naissance_date"));
873
		
881
		((TextField) hmIdentite.get("tfLieuNaissance")).setValue(personne.get("naissance_lieu"));
874
		hmIdentite.getDateField("dfDateNaissance").setValue(personne.getDate("naissance_date"));
Line 882... Line 875...
882
		
875
		hmIdentite.getTextField("tfLieuNaissance").setValue(personne.get("naissance_lieu"));
883
		if (personne.estDecedee())	{
876
		
884
			(((DateField) hmIdentite.get("dfDateDeces"))).setValue(personne.getDate("deces_date"));
-
 
Line 885... Line 877...
885
			((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu"));
877
		if (personne.estDecedee())	{
886
			Radio rbEstDecede = (Radio) hmIdentite.get("rbEstDecedee");
878
			hmIdentite.getDateField("dfDateDeces").setValue(personne.getDate("deces_date"));
887
			rbEstDecede.setValue(true);
879
			hmIdentite.getTextField("tfLieuDeces").setValue(personne.get("deces_lieu"));
Line 888... Line 880...
888
			
880
			Radio rbEstDecede = hmIdentite.getRadio("rbEstDecedee");
889
		}
881
			rbEstDecede.setValue(true);
890
		
882
		}
891
		((ChampMultiValeurs) hmIdentite.get("telephones")).peupler(personne.getString("truk_telephone"));
883
		
892
		
884
		hmIdentite.getChampMultiValeurs("telephones").peupler(personne.getString("truk_telephone"));
Line 893... Line 885...
893
		//Courriel
885
		
Line 894... Line 886...
894
		((ChampMultiValeurs) hmIdentite.get("courriels")).peupler(personne.getCourriel());
886
		//Courriel
895
		
887
		hmIdentite.getChampMultiValeurs("courriels").peupler(personne.getCourriel());
Line 896... Line 888...
896
		//Sites web
888
		
897
		((ChampMultiValeurs) hmIdentite.get("sites")).peupler(personne.getString("truk_url"));
889
		//Sites web
898
		
890
		hmIdentite.getChampMultiValeurs("sites").peupler(personne.getString("truk_url"));
Line 1012... Line 1004...
1012
	 * 
1004
	 * 
1013
	 */
1005
	 */
1014
	public boolean enregistrer()	{
1006
	public boolean enregistrer()	{
1015
		boolean success = false;
1007
		boolean success = false;
1016
		LinkedList lstMessageErreur = new LinkedList<String>();
1008
		LinkedList lstMessageErreur = new LinkedList<String>();
1017
		
1009
	
1018
		ComboBox<Projet> cbProjets = (ComboBox<Projet>) hmIdentite.get("cbProjets");
1010
		ComboBox<Projet> cbProjets = hmIdentite.getComboBox("cbProjets");
1019
		Projet projet = cbProjets.getValue();
1011
		Projet projet = cbProjets.getValue();
1020
		if (projet == null)	{
1012
		if (projet == null)	{
1021
			lstMessageErreur.add("Le projet n'a pas été renseigné");
1013
			lstMessageErreur.add("Le projet n'a pas été renseigné");
1022
		} else {
1014
		} else {
1023
			personneSelectionnee.set("ce_projet", projet.getId());
1015
			personneSelectionnee.set("ce_projet", projet.getId());
1024
		}
1016
		}
Line 1025... Line 1017...
1025
		
1017
		
1026
		String strTfNom = ((TextField<String>) hmIdentite.get("tfNom")).getValue();
1018
		String strTfNom = (String) hmIdentite.getTextField("tfNom").getValue();
1027
		if ((strTfNom == null)||(strTfNom.trim().equals("")))	{
1019
		if ((strTfNom == null)||(strTfNom.trim().equals("")))	{
1028
			lstMessageErreur.add("Le nom n'a pas été saisi");
1020
			lstMessageErreur.add("Le nom n'a pas été saisi");
1029
		} else {
1021
		} else {
1030
			strTfNom = UtilString.ucFirst(strTfNom);
1022
			strTfNom = UtilString.ucFirst(strTfNom);
1031
			personneSelectionnee.set("nom", strTfNom);
1023
			personneSelectionnee.set("nom", strTfNom);
Line 1032... Line 1024...
1032
		}
1024
		}
1033
		
1025
		
Line 1034... Line 1026...
1034
		String strTfPrenom = ((TextField<String>) hmIdentite.get("tfPrenom")).getValue();
1026
		String strTfPrenom = (String) hmIdentite.getTextField("tfPrenom").getValue();
1035
		personneSelectionnee.set("prenom", UtilString.ucFirst(strTfPrenom));
1027
		personneSelectionnee.set("prenom", UtilString.ucFirst(strTfPrenom));
1036
		
1028
		
1037
		//Préparer les données
1029
		//Préparer les données
Line 1038... Line 1030...
1038
		ComboBox combo = (ComboBox) hmIdentite.get("cbSexe");
1030
		ComboBox<Valeur> combo = hmIdentite.getComboBoxValeur("cbSexe");
1039
		Valeur valeur;
1031
		Valeur valeur;
1040
		String strValeur = "";
1032
		String strValeur = "";
1041
		
1033
		
Line 1042... Line 1034...
1042
		valeur = (Valeur) combo.getValue();
1034
		valeur = combo.getValue();
1043
		if (valeur!=null)	{
1035
		if (valeur!=null)	{
Line 1044... Line 1036...
1044
			personneSelectionnee.set("ce_sexe", valeur.getId());
1036
			personneSelectionnee.set("ce_sexe", valeur.getId());
1045
		}
1037
		}
Line 1046... Line 1038...
1046
		
1038
		
1047
		strValeur = obtenirValeurCombo("cbPrefixe");
1039
		strValeur = obtenirValeurCombo("cbPrefixe");
Line 1048... Line 1040...
1048
		personneSelectionnee.set("ce_truk_prefix", strValeur);
1040
		personneSelectionnee.set("ce_truk_prefix", strValeur);
1049
		
1041
		
Line 1050... Line 1042...
1050
		strValeur = obtenirValeurCombo("cbSuffixe"); 
1042
		strValeur = obtenirValeurCombo("cbSuffixe"); 
Line 1051... Line 1043...
1051
		personneSelectionnee.set("ce_truk_suffix", strValeur);
1043
		personneSelectionnee.set("ce_truk_suffix", strValeur);
1052
		
1044
		
1053
		String nomAutre = ((ChampMultiValeurs) hmIdentite.get("nomAutre")).getValeurs();
1045
		String nomAutre = hmIdentite.getChampMultiValeurs("nomAutre").getValeurs();
1054
		personneSelectionnee.set("truk_nom_autre", nomAutre);
1046
		personneSelectionnee.set("truk_nom_autre", nomAutre);
1055
		
1047
		
1056
		String abreviationAutre = ((ChampMultiValeurs) hmIdentite.get("abreviationAutre")).getValeurs();
1048
		String abreviationAutre = hmIdentite.getChampMultiValeurs("abreviationAutre").getValeurs();
1057
		personneSelectionnee.set("truk_abreviation_autre", abreviationAutre);
1049
		personneSelectionnee.set("truk_abreviation_autre", abreviationAutre);
1058
		
1050
		
1059
		personneSelectionnee.set("truk_courriel", ((ChampMultiValeurs) hmIdentite.get("courriels")).getValeurs());
1051
		personneSelectionnee.set("truk_courriel", hmIdentite.getChampMultiValeurs("courriels").getValeurs());
Line 1060... Line 1052...
1060
		
1052
		
1061
		
1053
		
1062
		//Pour le nom complet, on enregistre dans la bdd la valeur du prefixe/suffixe et non l'id
1054
		//Pour le nom complet, on enregistre dans la bdd la valeur du prefixe/suffixe et non l'id
1063
		String strPrefixe = "";
1055
		String strPrefixe = "";
1064
		combo = (ComboBox) hmIdentite.get("cbPrefixe");
1056
		combo = hmIdentite.getComboBoxValeur("cbPrefixe");
1065
		valeur = (Valeur) combo.getValue();
1057
		valeur = combo.getValue();
1066
		if (valeur != null)	{
1058
		if (valeur != null)	{
1067
			strPrefixe = valeur.getNom();
1059
			strPrefixe = valeur.getNom();
Line 1068... Line 1060...
1068
		} else {
1060
		} else {
Line 1069... Line 1061...
1069
			strPrefixe = combo.getRawValue();
1061
			strPrefixe = combo.getRawValue();
1070
		}
1062
		}
1071
		
1063
		
Line 1072... Line 1064...
1072
		String strSuffixe = "";
1064
		String strSuffixe = "";
1073
		combo = (ComboBox) hmIdentite.get("cbSuffixe");
1065
		combo = hmIdentite.getComboBoxValeur("cbSuffixe");
1074
		valeur = (Valeur) combo.getValue();
1066
		valeur = combo.getValue();
1075
		if (valeur != null)	{
1067
		if (valeur != null)	{
1076
			strSuffixe = valeur.getNom() + " ";
1068
			strSuffixe = valeur.getNom() + " ";
1077
		} else {
1069
		} else {
1078
			strSuffixe = combo.getRawValue() +" ";
1070
			strSuffixe = combo.getRawValue() +" ";
1079
		}
1071
		}
Line 1097... Line 1089...
1097
		personneSelectionnee.set("ce_truk_pays", strValeur);
1089
		personneSelectionnee.set("ce_truk_pays", strValeur);
Line 1098... Line 1090...
1098
		
1090
		
1099
		strValeur = obtenirValeurCombo("cbRegion");
1091
		strValeur = obtenirValeurCombo("cbRegion");
Line 1100... Line 1092...
1100
		personneSelectionnee.set("ce_truk_region", strValeur);
1092
		personneSelectionnee.set("ce_truk_region", strValeur);
Line 1101... Line 1093...
1101
		
1093
		
1102
		personneSelectionnee.set("truk_telephone", ((ChampMultiValeursMultiTypes) hmIdentite.get("telephones")).getValeurs());
1094
		personneSelectionnee.set("truk_telephone", hmIdentite.getChampMultiValeursMultiTypes("telephones").getValeurs());
Line 1103... Line 1095...
1103
		
1095
		
Line 1104... Line 1096...
1104
		String logoUrls = ((ChampMultiValeursImage) hmIdentite.get("logos")).getValeurs();
1096
		String logoUrls = hmIdentite.getChampMultiValeursImage("logos").getValeurs();
1105
		personneSelectionnee.set("truk_logo", logoUrls);
1097
		personneSelectionnee.set("truk_logo", logoUrls);
1106
		
1098
		
Line 1107... Line 1099...
1107
		personneSelectionnee.set("truk_url", ((ChampMultiValeurs) hmIdentite.get("sites")).getValeurs());
1099
		personneSelectionnee.set("truk_url", hmIdentite.getChampMultiValeurs("sites").getValeurs());
1108
		
1100
		
Line 1109... Line 1101...
1109
		//Infos Naturalistes
1101
		//Infos Naturalistes
-
 
1102
		String recolte = ((ChampMultiValeursMultiTypes) hmInfosNat.get("recolte")).getValeurs();
-
 
1103
		personneSelectionnee.set("truk_recolte", recolte);
1110
		String recolte = ((ChampMultiValeursMultiTypes) hmInfosNat.get("recolte")).getValeurs();
1104
		
1111
		personneSelectionnee.set("truk_recolte", recolte);
1105
		String specialite = ((ChampMultiValeurs) hmInfosNat.get("specialite")).getValeurs();
1112
		
1106
		personneSelectionnee.set("ce_truk_specialite", specialite);
1113
		String specialite = ((ChampMultiValeurs) hmInfosNat.get("specialite")).getValeurs();
1107
		
1114
		personneSelectionnee.set("ce_truk_specialite", specialite);
1108
		
Line 1134... Line 1128...
1134
	
1128
	
1135
	private String obtenirValeurCombo(String strComboName)	{
1129
	private String obtenirValeurCombo(String strComboName)	{
1136
		String strValeur = "";
1130
		String strValeur = "";
Line 1137... Line 1131...
1137
		Valeur valeur;
1131
		Valeur valeur;
1138
		
1132
		
1139
		ComboBox combo = (ComboBox) hmIdentite.get(strComboName);
1133
		ComboBox<Valeur> combo = hmIdentite.getComboBoxValeur(strComboName);
1140
		if (combo == null)	{
1134
		if (combo == null)	{
1141
			combo = (ComboBox) hmAdresse.get(strComboName);
1135
			combo = (ComboBox) hmAdresse.get(strComboName);
1142
		}
1136
		}
1143
		strValeur = combo.getRawValue();
1137
		strValeur = combo.getRawValue();
1144
		valeur = (Valeur) combo.getStore().findModel(strValeur);
1138
		valeur = combo.getStore().findModel(strValeur);
1145
		if (valeur != null)	{
1139
		if (valeur != null)	{
Line 1146... Line 1140...
1146
			strValeur = valeur.getId();
1140
			strValeur = valeur.getId();
Line 1165... Line 1159...
1165
 
1159
 
1166
	public boolean verifierFormulaire() {
1160
	public boolean verifierFormulaire() {
1167
		boolean success = true;
1161
		boolean success = true;
Line 1168... Line 1162...
1168
		LinkedList<String> lstMessageErreur = new LinkedList<String>();
1162
		LinkedList<String> lstMessageErreur = new LinkedList<String>();
1169
		
1163
		
1170
		ComboBox<Projet> cbProjets = (ComboBox<Projet>) hmIdentite.get("cbProjets");
1164
		ComboBox<Projet> cbProjets = hmIdentite.getComboBox("cbProjets");
1171
		Projet projet = cbProjets.getValue();
1165
		Projet projet = cbProjets.getValue();
1172
		if (projet == null)	{
1166
		if (projet == null)	{
1173
			lstMessageErreur.add("Le projet n'a pas été renseigné");
1167
			lstMessageErreur.add("Le projet n'a pas été renseigné");
1174
		} else {
1168
		} else {
Line 1175... Line 1169...
1175
			personneSelectionnee.set("ce_projet", projet.getId());
1169
			personneSelectionnee.set("ce_projet", projet.getId());
1176
		}
1170
		}
1177
		
1171
		
1178
		String strTfNom = ((TextField<String>) hmIdentite.get("tfNom")).getValue();
1172
		String strTfNom = (String) hmIdentite.getTextField("tfNom").getValue();
1179
		if ((strTfNom == null)||(strTfNom.trim().equals("")))	{
1173
		if ((strTfNom == null)||(strTfNom.trim().equals("")))	{
1180
			lstMessageErreur.add("Le nom n'a pas été saisi");
1174
			lstMessageErreur.add("Le nom n'a pas été saisi");
1181
		} else {
1175
		} else {
Line 1182... Line 1176...
1182
			strTfNom = UtilString.ucFirst(strTfNom);
1176
			strTfNom = UtilString.ucFirst(strTfNom);
1183
			personneSelectionnee.set("nom", strTfNom);
1177
			personneSelectionnee.set("nom", strTfNom);
Line 1184... Line 1178...
1184
		}
1178
		}
1185
		
1179
		
1186
		String strTfPrenom = ((TextField<String>) hmIdentite.get("tfPrenom")).getValue();
1180
		String strTfPrenom = (String) hmIdentite.getTextField("tfPrenom").getValue();
1187
		personneSelectionnee.set("prenom", UtilString.ucFirst(strTfPrenom));
1181
		personneSelectionnee.set("prenom", UtilString.ucFirst(strTfPrenom));
Line 1188... Line 1182...
1188
		
1182
		
1189
		//Préparer les données
1183
		//Préparer les données
1190
		ComboBox combo = (ComboBox) hmIdentite.get("cbSexe");
1184
		ComboBox<Valeur> combo = hmIdentite.getComboBoxValeur("cbSexe");
1191
		Valeur valeur;
1185
		Valeur valeur;
Line 1192... Line 1186...
1192
		String strValeur = "";
1186
		String strValeur = "";
1193
		
1187
		
Line 1194... Line 1188...
1194
		valeur = (Valeur) combo.getValue();
1188
		valeur = combo.getValue();
1195
		if (valeur!=null)	{
1189
		if (valeur!=null)	{
Line 1196... Line 1190...
1196
			personneSelectionnee.set("ce_sexe", valeur.getId());
1190
			personneSelectionnee.set("ce_sexe", valeur.getId());
1197
		}
1191
		}
Line 1198... Line 1192...
1198
		
1192
		
1199
		strValeur = obtenirValeurCombo("cbPrefixe");
1193
		strValeur = obtenirValeurCombo("cbPrefixe");
Line 1200... Line 1194...
1200
		personneSelectionnee.set("ce_truk_prefix", strValeur);
1194
		personneSelectionnee.set("ce_truk_prefix", strValeur);
Line 1201... Line 1195...
1201
		
1195
		
1202
		strValeur = obtenirValeurCombo("cbSuffixe"); 
1196
		strValeur = obtenirValeurCombo("cbSuffixe"); 
1203
		personneSelectionnee.set("ce_truk_suffix", strValeur);
1197
		personneSelectionnee.set("ce_truk_suffix", strValeur);
1204
		
1198
		
1205
		String nomAutre = ((ChampMultiValeurs) hmIdentite.get("nomAutre")).getValeurs();
1199
		String nomAutre = hmIdentite.getChampMultiValeurs("nomAutre").getValeurs();
1206
		personneSelectionnee.set("truk_nom_autre", nomAutre);
1200
		personneSelectionnee.set("truk_nom_autre", nomAutre);
1207
		
1201
		
1208
		String abreviationAutre = ((ChampMultiValeurs) hmIdentite.get("abreviationAutre")).getValeurs();
1202
		String abreviationAutre = hmIdentite.getChampMultiValeurs("abreviationAutre").getValeurs();
1209
		personneSelectionnee.set("truk_abreviation_autre", abreviationAutre);
1203
		personneSelectionnee.set("truk_abreviation_autre", abreviationAutre);
Line 1210... Line 1204...
1210
		
1204
		
1211
		personneSelectionnee.set("truk_courriel", ((ChampMultiValeurs) hmIdentite.get("courriels")).getValeurs());
1205
		personneSelectionnee.set("truk_courriel", hmIdentite.getChampMultiValeurs("courriels").getValeurs());
1212
		
1206
		
1213
		
1207
		
1214
		//Pour le nom complet, on enregistre dans la bdd la valeur du prefixe/suffixe et non l'id
1208
		//Pour le nom complet, on enregistre dans la bdd la valeur du prefixe/suffixe et non l'id
1215
		String strPrefixe = "";
1209
		String strPrefixe = "";
1216
		combo = (ComboBox) hmIdentite.get("cbPrefixe");
1210
		combo = hmIdentite.getComboBoxValeur("cbPrefixe");
1217
		valeur = (Valeur) combo.getValue();
1211
		valeur = combo.getValue();
Line 1218... Line 1212...
1218
		if (valeur != null)	{
1212
		if (valeur != null)	{
Line 1219... Line 1213...
1219
			strPrefixe = valeur.getNom();
1213
			strPrefixe = valeur.getNom();
1220
		} else {
1214
		} else {
1221
			strPrefixe = combo.getRawValue();
1215
			strPrefixe = combo.getRawValue();
Line 1222... Line 1216...
1222
		}
1216
		}
1223
		
1217
		
1224
		String strSuffixe = "";
1218
		String strSuffixe = "";
1225
		combo = (ComboBox) hmIdentite.get("cbSuffixe");
1219
		combo = hmIdentite.getComboBox("cbSuffixe");
1226
		valeur = (Valeur) combo.getValue();
1220
		valeur = combo.getValue();
1227
		if (valeur != null)	{
1221
		if (valeur != null)	{
1228
			strSuffixe = valeur.getNom() + " ";
1222
			strSuffixe = valeur.getNom() + " ";
1229
		} else {
1223
		} else {
Line 1249... Line 1243...
1249
		personneSelectionnee.set("ce_truk_pays", strValeur);
1243
		personneSelectionnee.set("ce_truk_pays", strValeur);
Line 1250... Line 1244...
1250
		
1244
		
1251
		strValeur = obtenirValeurCombo("cbRegion");
1245
		strValeur = obtenirValeurCombo("cbRegion");
Line 1252... Line 1246...
1252
		personneSelectionnee.set("ce_truk_region", strValeur);
1246
		personneSelectionnee.set("ce_truk_region", strValeur);
Line 1253... Line 1247...
1253
		
1247
		
1254
		personneSelectionnee.set("truk_telephone", ((ChampMultiValeursMultiTypes) hmIdentite.get("telephones")).getValeurs());
1248
		personneSelectionnee.set("truk_telephone", hmIdentite.getChampMultiValeursMultiTypes("telephones").getValeurs());
Line 1255... Line 1249...
1255
		
1249
		
Line 1256... Line 1250...
1256
		String logoUrls = ((ChampMultiValeursImage) hmIdentite.get("logos")).getValeurs();
1250
		String logoUrls = hmIdentite.getChampMultiValeursImage("logos").getValeurs();
1257
		personneSelectionnee.set("truk_logo", logoUrls);
1251
		personneSelectionnee.set("truk_logo", logoUrls);
1258
		
1252