Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 981 Rev 1035
Line 80... Line 80...
80
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
80
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
81
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
81
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
82
import com.google.gwt.core.client.GWT;
82
import com.google.gwt.core.client.GWT;
83
import com.google.gwt.i18n.client.DateTimeFormat;
83
import com.google.gwt.i18n.client.DateTimeFormat;
84
import com.google.gwt.i18n.client.NumberFormat;
84
import com.google.gwt.i18n.client.NumberFormat;
-
 
85
import com.google.gwt.user.client.Window;
Line 85... Line 86...
85
 
86
 
Line 86... Line 87...
86
public class StructureForm extends Formulaire implements Rafraichissable {
87
public class StructureForm extends Formulaire implements Rafraichissable {
Line 112... Line 113...
112
	private TextField<String> nomStructureChp = null;
113
	private TextField<String> nomStructureChp = null;
113
	private DateField dateFondationChp = null;
114
	private DateField dateFondationChp = null;
114
	private TextArea adrChp = null;
115
	private TextArea adrChp = null;
115
	private TextField<String> cpChp = null;
116
	private TextField<String> cpChp = null;
116
	private TextField<String> villeChp = null;
117
	private TextField<String> villeChp = null;
117
	private TextField<String> regionChp = null;
118
	private ComboBox<Valeur> comboRegion = null;
118
	private TextField<String> telChp = null;
119
	private TextField<String> telChp = null;
119
	private TextField<String> faxChp = null;
120
	private TextField<String> faxChp = null;
120
	private TextField<String> emailChp = null;
121
	private TextField<String> emailChp = null;
121
	private TextField<String> urlChp = null;
122
	private TextField<String> urlChp = null;
122
	private ListStore<Valeur> magazinPays = null;
123
	private ListStore<Valeur> magazinPays = null;
-
 
124
	private ListStore<Valeur> magazinRegion = null;
123
	private ComboBox<Valeur> comboPays = null;
125
	private ComboBox<Valeur> comboPays = null;
Line 124... Line 126...
124
 
126
 
125
	// Onglet PERSONNEL
127
	// Onglet PERSONNEL
126
	private StructureAPersonneListe personnel = null;
128
	private StructureAPersonneListe personnel = null;
Line 646... Line 648...
646
			structureCollectee.setDateFondation(dateFondationChp.getValue());
648
			structureCollectee.setDateFondation(dateFondationChp.getValue());
Line 647... Line 649...
647
			
649
			
648
			structureCollectee.setAdresse(adrChp.getValue());
650
			structureCollectee.setAdresse(adrChp.getValue());
649
			structureCollectee.setCodePostal(cpChp.getValue());
651
			structureCollectee.setCodePostal(cpChp.getValue());
-
 
652
			structureCollectee.setVille(villeChp.getValue());
-
 
653
			
-
 
654
			String strRegion = "";
-
 
655
			Valeur valeurRegion = comboRegion.getValue();
-
 
656
			if (valeurRegion == null)	{
-
 
657
				strRegion = "AUTRE##" + comboRegion.getRawValue();	
-
 
658
			} else	{
-
 
659
				strRegion = valeurRegion.getId();
-
 
660
			}
650
			structureCollectee.setVille(villeChp.getValue());
661
			
651
			structureCollectee.setRegion(regionChp.getValue());
662
			structureCollectee.setRegion(strRegion);
652
			structureCollectee.setPays(null);
663
			structureCollectee.setPays(null);
653
			if (comboPays.getValue() != null) {
664
			if (comboPays.getValue() != null) {
654
				structureCollectee.setPays(comboPays.getValue().getId());
665
				structureCollectee.setPays(comboPays.getValue().getId());
655
			} else if (comboPays.getRawValue() != "") {
666
			} else if (comboPays.getRawValue() != "") {
Line 716... Line 727...
716
			dateFondationChp.setValue(identification.getDateFondation());
727
			dateFondationChp.setValue(identification.getDateFondation());
Line 717... Line 728...
717
			
728
			
718
			adrChp.setValue(identification.getAdresse());
729
			adrChp.setValue(identification.getAdresse());
719
			cpChp.setValue(identification.getCodePostal());
730
			cpChp.setValue(identification.getCodePostal());
-
 
731
			villeChp.setValue(identification.getVille());
720
			villeChp.setValue(identification.getVille());
732
			mettreAJourRegion();
721
			regionChp.setValue(identification.getRegion());
733
			//(identification.getRegion());
722
			if (identification.getPays().matches("^[0-9]+$")) {
734
			if (identification.getPays().matches("^[0-9]+$")) {
723
				comboPays.setValue(comboPays.getStore().findModel("id_valeur", identification.getPays()));
735
				comboPays.setValue(comboPays.getStore().findModel("id_valeur", identification.getPays()));
724
			} else {
736
			} else {
725
				comboPays.setRawValue(identification.getPays());
737
				comboPays.setRawValue(identification.getPays());
Line 1638... Line 1650...
1638
		gaucheFdAdresse.add(cpChp, new FormData("95%"));
1650
		gaucheFdAdresse.add(cpChp, new FormData("95%"));
Line 1639... Line 1651...
1639
		
1651
		
1640
		villeChp = new TextField<String>();
1652
		villeChp = new TextField<String>();
1641
		villeChp.setTabIndex(tabIndex++);
1653
		villeChp.setTabIndex(tabIndex++);
1642
		villeChp.setFieldLabel("Ville");
1654
		villeChp.setFieldLabel("Ville");
Line 1643... Line -...
1643
		droiteFdAdresse.add(villeChp, new FormData("95%"));
-
 
1644
		
-
 
1645
		regionChp = new TextField<String>();
-
 
1646
		regionChp.setTabIndex(tabIndex++);
-
 
1647
		regionChp.setFieldLabel("Région");
-
 
1648
		gaucheFdAdresse.add(regionChp, new FormData("95%"));
1655
		gaucheFdAdresse.add(villeChp, new FormData("95%"));
1649
		
1656
		
1650
		magazinPays = new ListStore<Valeur>();
1657
		magazinPays = new ListStore<Valeur>(); 
1651
		comboPays = new ComboBox<Valeur>();
1658
		comboPays = new ComboBox<Valeur>();
1652
		comboPays.setTabIndex(tabIndex++);
1659
		comboPays.setTabIndex(tabIndex++);
1653
		comboPays.setFieldLabel("Pays");
1660
		comboPays.setFieldLabel("Pays");
1654
		comboPays.setEmptyText("Sélectioner un pays...");
1661
		comboPays.setEmptyText("Sélectionner un pays...");
1655
		comboPays.setEditable(true);
1662
		comboPays.setEditable(true);
1656
		comboPays.setLabelSeparator("");
1663
		comboPays.setLabelSeparator("");
1657
		comboPays.setDisplayField("nom");
1664
		comboPays.setDisplayField("nom");
1658
		comboPays.setTemplate(getTemplatePays());
1665
		comboPays.setTemplate(getTemplatePays());
1659
		comboPays.setTypeAhead(true);
1666
		comboPays.setTypeAhead(true);
-
 
1667
		comboPays.setTriggerAction(TriggerAction.ALL);
-
 
1668
		comboPays.setStore(magazinPays);
-
 
1669
		
-
 
1670
		SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
-
 
1671
			public void selectionChanged(SelectionChangedEvent se) {
-
 
1672
				// Rafraichir avec le pays sélectionné
-
 
1673
				obtenirListeRegionParPays(((Valeur) se.getSelectedItem()).getAbreviation().toString());
-
 
1674
			}
-
 
1675
		};
-
 
1676
		
-
 
1677
		comboPays.addSelectionChangedListener(selectionChange);
1660
		comboPays.setTriggerAction(TriggerAction.ALL);
1678
		
1661
		comboPays.setStore(magazinPays);
1679
		
Line -... Line 1680...
-
 
1680
		droiteFdAdresse.add(comboPays, new FormData("95%"));
-
 
1681
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
-
 
1682
		
-
 
1683
		magazinRegion = new ListStore<Valeur>();
-
 
1684
		comboRegion = new ComboBox<Valeur>();
-
 
1685
		comboRegion.setTabIndex(tabIndex++);
-
 
1686
		comboRegion.setFieldLabel("Région");
-
 
1687
		comboRegion.setEmptyText("Sélectionner une région...");
-
 
1688
		comboRegion.setDisplayField("nom");
-
 
1689
		comboRegion.setTypeAhead(true);
-
 
1690
		comboRegion.setTriggerAction(TriggerAction.ALL);
-
 
1691
		comboRegion.setStore(magazinRegion);
-
 
1692
		
1662
		droiteFdAdresse.add(comboPays, new FormData("95%"));
1693
		droiteFdAdresse.add(comboRegion, new FormData("95%"));
1663
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
1694
		
1664
		
1695
		
Line 1665... Line 1696...
1665
		principalFdAdresse.add(gaucheFdAdresse, new ColumnData(.5));
1696
		principalFdAdresse.add(gaucheFdAdresse, new ColumnData(.5));
Line 1714... Line 1745...
1714
		identificationOnglet.add(fieldSetTelMail);
1745
		identificationOnglet.add(fieldSetTelMail);
Line 1715... Line 1746...
1715
		
1746
		
1716
		return identificationOnglet;
1747
		return identificationOnglet;
Line -... Line 1748...
-
 
1748
	}
-
 
1749
	
-
 
1750
	public void obtenirListeRegionParPays(String strPays)	{
-
 
1751
		mediateur.obtenirListeRegionsEtRafraichir(this, "region", strPays);
-
 
1752
	}
-
 
1753
	
-
 
1754
	private void mettreAJourRegion()	{
-
 
1755
		//Met à jour la combo box en sélectionnant la valeur enregistrée pour la personne
-
 
1756
		if (identification.get("ce_truk_region") != null && comboRegion.getStore().getCount() > 0)	{
-
 
1757
			Valeur valeurRegion = comboRegion.getStore().findModel("id_valeur", identification.get("ce_truk_region"));
-
 
1758
			if (valeurRegion!=null)	{
-
 
1759
				comboRegion.setValue(valeurRegion);
-
 
1760
			} else if (identification.get("ce_truk_region").toString().startsWith("AUTRE##")) {
-
 
1761
				comboRegion.setRawValue(identification.get("ce_truk_region").toString().replaceFirst("^AUTRE##", ""));
-
 
1762
			}
-
 
1763
		}
1717
	}
1764
	}
1718
	
1765
	
1719
	private native String getTemplatePays() /*-{ 
1766
	private native String getTemplatePays() /*-{ 
1720
		return  [ 
1767
		return  [ 
1721
		'<tpl for=".">', 
1768
		'<tpl for=".">', 
Line 1961... Line 2008...
1961
			if (listeValeurs.getId().equals(config.getListeId("pays"))) {
2008
			if (listeValeurs.getId().equals(config.getListeId("pays"))) {
1962
				magazinPays.removeAll();
2009
				magazinPays.removeAll();
1963
				magazinPays.add(liste);
2010
				magazinPays.add(liste);
1964
				comboPays.setStore(magazinPays);
2011
				comboPays.setStore(magazinPays);
1965
			}
2012
			}
-
 
2013
			
-
 
2014
			if (listeValeurs.getId().equals(config.getListeId("region"))) {
-
 
2015
				magazinRegion.removeAll();
-
 
2016
				magazinRegion.add(liste);
-
 
2017
				comboRegion.setStore(magazinRegion);
-
 
2018
				
-
 
2019
				mettreAJourRegion();
-
 
2020
			}
-
 
2021
			
-
 
2022
			
1966
			if (listeValeurs.getId().equals(config.getListeId("localStockage"))) {
2023
			if (listeValeurs.getId().equals(config.getListeId("localStockage"))) {
1967
				localStockageAutreChp = new TextField<String>();
2024
				localStockageAutreChp = new TextField<String>();
1968
				creerChoixMultipleCac(localStockageTrukCp, localStockageTrukCacGrpChp, listeValeurs, localStockageAutreChp);
2025
				creerChoixMultipleCac(localStockageTrukCp, localStockageTrukCacGrpChp, listeValeurs, localStockageAutreChp);
1969
			}
2026
			}
1970
			if (listeValeurs.getId().equals(config.getListeId("meubleStockage"))) {
2027
			if (listeValeurs.getId().equals(config.getListeId("meubleStockage"))) {