Subversion Repositories eFlore/Applications.coel

Rev

Rev 1779 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1779 Rev 1784
Line 88... Line 88...
88
	public TextField<String> dateFondationChp;
88
	public TextField<String> dateFondationChp;
89
	public TextArea descriptionChp;
89
	public TextArea descriptionChp;
90
	public TextArea conditionAccesChp;
90
	public TextArea conditionAccesChp;
91
	public TextArea conditionUsageChp;
91
	public TextArea conditionUsageChp;
92
	public TextArea adrChp;
92
	public TextArea adrChp;
93
	public TextArea adrComplementChp;
-
 
94
	public TextField<String> cpChp;
93
	public TextField<String> cpChp;
95
	public TextField<String> villeChp;
94
	public TextField<String> villeChp;
96
	public ListStore<Valeur> magazinRegion;
-
 
97
	public ComboBox<Valeur> comboRegion;
-
 
98
	public ListStore<Valeur> magazinPays;
95
	public ListStore<Valeur> magazinPays;
99
	public ChampComboBoxRechercheTempsReelPaginable comboPays;
96
	public ChampComboBoxRechercheTempsReelPaginable comboPays;
100
	public TextField<String> latitudeChp;
97
	public TextField<String> latitudeChp;
101
	public TextField<String> longitudeChp;
98
	public TextField<String> longitudeChp;
102
	public TextField<String> telChp;
99
	public TextField<String> telChp;
Line 387... Line 384...
387
			adrChp = new TextArea();
384
			adrChp = new TextArea();
388
			adrChp.setTabIndex(tabIndex++);
385
			adrChp.setTabIndex(tabIndex++);
389
			adrChp.setFieldLabel("Adresse (Nom du batiment, rue...)");
386
			adrChp.setFieldLabel("Adresse (Nom du batiment, rue...)");
390
			fieldSetAdresse.add(adrChp, new FormData(550, 0));
387
			fieldSetAdresse.add(adrChp, new FormData(550, 0));
Line 391... Line -...
391
			
-
 
392
			adrComplementChp = new TextArea();
-
 
393
			adrComplementChp.setTabIndex(tabIndex++);
-
 
394
			adrComplementChp.setFieldLabel("Complément d'adresse (BP, étage...)");
-
 
395
			fieldSetAdresse.add(adrComplementChp, new FormData(550, 0));
-
 
396
			
388
			
397
			cpChp = new TextField<String>();
389
			cpChp = new TextField<String>();
398
			cpChp.setTabIndex(tabIndex++);
390
			cpChp.setTabIndex(tabIndex++);
399
			cpChp.setFieldLabel("Code postal");
391
			cpChp.setFieldLabel("Code postal");
Line 421... Line 413...
421
			comboPays.getCombo().setTabIndex(tabIndex++);
413
			comboPays.getCombo().setTabIndex(tabIndex++);
422
			comboPays.getCombo().setFieldLabel("Pays");
414
			comboPays.getCombo().setFieldLabel("Pays");
423
			comboPays.getCombo().setForceSelection(true);
415
			comboPays.getCombo().setForceSelection(true);
424
			comboPays.getCombo().setTemplate(getTemplatePays());
416
			comboPays.getCombo().setTemplate(getTemplatePays());
Line 425... Line -...
425
			
-
 
426
			SelectionChangedListener<ModelData> selectionChange = new SelectionChangedListener<ModelData>() {
-
 
427
				public void selectionChanged(SelectionChangedEvent se) {
-
 
428
					// Rafraichir avec le pays sélectionné
-
 
429
					comboRegion.clear();
-
 
430
					obtenirListeRegionParPays((new Valeur(se.getSelectedItem())).getAbreviation().toString());
-
 
431
				}
-
 
432
			};
-
 
433
			comboPays.getCombo().addSelectionChangedListener(selectionChange);
-
 
434
			
417
			
Line 435... Line -...
435
			droiteFdAdresse.add(comboPays, new FormData("95%"));
-
 
436
			
-
 
437
			magazinRegion = new ListStore<Valeur>();
-
 
438
			comboRegion = new ComboBox<Valeur>();
-
 
439
			comboRegion.setTabIndex(tabIndex++);
-
 
440
			comboRegion.setFieldLabel("Région");
-
 
441
			comboRegion.setEmptyText("Sélectionner une région...");
-
 
442
			comboRegion.setDisplayField("nom");
-
 
443
			comboRegion.setTypeAhead(true);
-
 
444
			comboRegion.setTriggerAction(TriggerAction.ALL);
-
 
445
			comboRegion.setStore(magazinRegion);
-
 
446
			droiteFdAdresse.add(comboRegion, new FormData("95%"));
-
 
447
 
418
			droiteFdAdresse.add(comboPays, new FormData("95%"));
448
			
419
			
449
			latitudeChp = new TextField<String>();
420
			latitudeChp = new TextField<String>();
450
			latitudeChp.setRegex(Pattern.latitude);
421
			latitudeChp.setRegex(Pattern.latitude);
451
			latitudeChp.setToolTip("Format : nombre décimal positif ou négatif de 0 à 90.");
422
			latitudeChp.setToolTip("Format : nombre décimal positif ou négatif de 0 à 90.");
Line 544... Line 515...
544
		'<div class="x-combo-list-item">{cmlv_nom} ({cmlv_abreviation})</div>', 
515
		'<div class="x-combo-list-item">{cmlv_nom} ({cmlv_abreviation})</div>', 
545
		'</tpl>' 
516
		'</tpl>' 
546
		].join(""); 
517
		].join(""); 
547
	}-*/;
518
	}-*/;
Line 548... Line -...
548
	
-
 
549
	public void obtenirListeRegionParPays(String strPays)	{
-
 
550
		mediateur.obtenirListeRegionsEtRafraichir(this, "region", strPays);
-
 
551
	}
-
 
552
	
519
	
553
	public void peuplerIdSurRetourAjout() {
520
	public void peuplerIdSurRetourAjout() {
554
		initialiserIdentification();
521
		initialiserIdentification();
555
		idStructureChp.setValue(identification.getId());
522
		idStructureChp.setValue(identification.getId());
556
		nomStructureChp.setValue(identification.getNom());
523
		nomStructureChp.setValue(identification.getNom());
Line 604... Line 571...
604
			descriptionChp.setValue(identification.getDescription());
571
			descriptionChp.setValue(identification.getDescription());
605
			conditionAccesChp.setValue(identification.getConditionAcces());
572
			conditionAccesChp.setValue(identification.getConditionAcces());
606
			conditionUsageChp.setValue(identification.getConditionUsage());
573
			conditionUsageChp.setValue(identification.getConditionUsage());
Line 607... Line 574...
607
			
574
			
608
			adrChp.setValue(identification.getAdresse());
-
 
609
			adrComplementChp.setValue(identification.getAdresseComplement());
575
			adrChp.setValue(identification.getAdresse());
610
			cpChp.setValue(identification.getCodePostal());
576
			cpChp.setValue(identification.getCodePostal());
611
			villeChp.setValue(identification.getVille());
-
 
612
			mettreAJourRegion();
-
 
-
 
577
			villeChp.setValue(identification.getVille());
613
			//(identification.getRegion());
578
 
614
			if (identification.getPays().matches("^[0-9]+$")) {
579
			if (identification.getPays().matches("^[0-9]+$")) {
615
				comboPays.chargerValeurInitiale(identification.getPays(), "cmlv_id_valeur");
580
				comboPays.chargerValeurInitiale(identification.getPays(), "cmlv_id_valeur");
616
			} else {
581
			} else {
617
				comboPays.getCombo().setRawValue(identification.getPays());
582
				comboPays.getCombo().setRawValue(identification.getPays());
Line 684... Line 649...
684
			structureCollectee.setDescription(descriptionChp.getValue());
649
			structureCollectee.setDescription(descriptionChp.getValue());
685
			structureCollectee.setConditionAcces(conditionAccesChp.getValue());
650
			structureCollectee.setConditionAcces(conditionAccesChp.getValue());
686
			structureCollectee.setConditionUsage(conditionUsageChp.getValue());
651
			structureCollectee.setConditionUsage(conditionUsageChp.getValue());
Line 687... Line 652...
687
			
652
			
688
			structureCollectee.setAdresse(adrChp.getValue());
-
 
689
			structureCollectee.setAdresseComplement(adrComplementChp.getValue());
653
			structureCollectee.setAdresse(adrChp.getValue());
690
			structureCollectee.setCodePostal(cpChp.getValue());
654
			structureCollectee.setCodePostal(cpChp.getValue());
Line 691... Line -...
691
			structureCollectee.setVille(villeChp.getValue());
-
 
692
			
-
 
693
			String strRegion = "";
-
 
694
			Valeur valeurRegion = comboRegion.getValue();
-
 
695
			if (valeurRegion == null)	{
-
 
696
				strRegion = "AUTRE##" + comboRegion.getRawValue();	
-
 
697
			} else	{
-
 
698
				strRegion = valeurRegion.getId();
-
 
699
			}
-
 
700
			
655
			structureCollectee.setVille(villeChp.getValue());
701
			structureCollectee.setRegion(strRegion);
656
			
702
			structureCollectee.setPays(null);
657
			structureCollectee.setPays(null);
703
			if (comboPays.getCombo().getValue() != null) {
658
			if (comboPays.getCombo().getValue() != null) {
704
				structureCollectee.setPays(new Valeur(comboPays.getValeur()).getId());
659
				structureCollectee.setPays(new Valeur(comboPays.getValeur()).getId());
Line 776... Line 731...
776
			if (listeValeurs.getId().equals(config.getListeId("stpu"))) {
731
			if (listeValeurs.getId().equals(config.getListeId("stpu"))) {
777
				magazinLstpu.removeAll();
732
				magazinLstpu.removeAll();
778
				magazinLstpu.add(liste);
733
				magazinLstpu.add(liste);
779
				comboLstpu.setStore(magazinLstpu);
734
				comboLstpu.setStore(magazinLstpu);
780
			}
735
			}
781
			if (listeValeurs.getId().equals(config.getListeId("region"))) {
-
 
782
				magazinRegion.removeAll();
-
 
783
				magazinRegion.add(liste);
-
 
784
				comboRegion.setStore(magazinRegion);
-
 
785
				
-
 
786
				mettreAJourRegion();
-
 
787
			}
-
 
788
		}
-
 
789
	}
-
 
790
 
-
 
791
	private void mettreAJourRegion()	{
-
 
792
		//Met à jour la combo box en sélectionnant la valeur enregistrée pour la personne
-
 
793
		if (identification.get("ce_truk_region") != null && comboRegion.getStore().getCount() > 0)	{
-
 
794
			Valeur valeurRegion = comboRegion.getStore().findModel("id_valeur", identification.get("ce_truk_region"));
-
 
795
			if (valeurRegion!=null)	{
-
 
796
				comboRegion.setValue(valeurRegion);
-
 
797
			} else if (identification.get("ce_truk_region").toString().startsWith("AUTRE##")) {
-
 
798
				comboRegion.setRawValue(identification.get("ce_truk_region").toString().replaceFirst("^AUTRE##", ""));
-
 
799
			}
-
 
800
		}
736
		}
801
	}
737
	}
Line 802... Line 738...
802
 
738
 
803
	public Collection<? extends String> verifier() {
739
	public Collection<? extends String> verifier() {