| 637 | 
           jp_milcent | 
           1 | 
           package org.tela_botanica.client.vues;
  | 
        
        
            | 
            | 
           2 | 
              | 
        
        
           | 639 | 
           jp_milcent | 
           3 | 
           import java.util.Iterator;
  | 
        
        
           | 687 | 
           jp_milcent | 
           4 | 
           import java.util.List;
  | 
        
        
           | 639 | 
           jp_milcent | 
           5 | 
              | 
        
        
           | 980 | 
           jpm | 
           6 | 
           import org.tela_botanica.client.ComposantClass;
  | 
        
        
           | 637 | 
           jp_milcent | 
           7 | 
           import org.tela_botanica.client.Mediateur;
  | 
        
        
           | 687 | 
           jp_milcent | 
           8 | 
           import org.tela_botanica.client.RegistreId;
  | 
        
        
           | 980 | 
           jpm | 
           9 | 
           import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
  | 
        
        
           | 1239 | 
           cyprien | 
           10 | 
           import org.tela_botanica.client.composants.InfoLogger;
  | 
        
        
           | 907 | 
           jpm | 
           11 | 
           import org.tela_botanica.client.configuration.Configuration;
  | 
        
        
           | 637 | 
           jp_milcent | 
           12 | 
           import org.tela_botanica.client.i18n.Constantes;
  | 
        
        
           | 1076 | 
           jpm | 
           13 | 
           import org.tela_botanica.client.i18n.ErrorMessages;
  | 
        
        
           | 637 | 
           jp_milcent | 
           14 | 
           import org.tela_botanica.client.images.Images;
  | 
        
        
           | 687 | 
           jp_milcent | 
           15 | 
           import org.tela_botanica.client.interfaces.Rafraichissable;
  | 
        
        
           | 639 | 
           jp_milcent | 
           16 | 
           import org.tela_botanica.client.modeles.Valeur;
  | 
        
        
            | 
            | 
           17 | 
           import org.tela_botanica.client.modeles.ValeurListe;
  | 
        
        
           | 703 | 
           jp_milcent | 
           18 | 
           import org.tela_botanica.client.modeles.aDonneeListe;
  | 
        
        
           | 1262 | 
           cyprien | 
           19 | 
           import org.tela_botanica.client.util.Debug;
  | 
        
        
           | 637 | 
           jp_milcent | 
           20 | 
              | 
        
        
           | 687 | 
           jp_milcent | 
           21 | 
           import com.extjs.gxt.ui.client.Registry;
  | 
        
        
           | 637 | 
           jp_milcent | 
           22 | 
           import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
  | 
        
        
           | 703 | 
           jp_milcent | 
           23 | 
           import com.extjs.gxt.ui.client.Style.SortDir;
  | 
        
        
           | 639 | 
           jp_milcent | 
           24 | 
           import com.extjs.gxt.ui.client.event.BaseEvent;
  | 
        
        
           | 637 | 
           jp_milcent | 
           25 | 
           import com.extjs.gxt.ui.client.event.ButtonEvent;
  | 
        
        
           | 639 | 
           jp_milcent | 
           26 | 
           import com.extjs.gxt.ui.client.event.ComponentEvent;
  | 
        
        
            | 
            | 
           27 | 
           import com.extjs.gxt.ui.client.event.Events;
  | 
        
        
            | 
            | 
           28 | 
           import com.extjs.gxt.ui.client.event.Listener;
  | 
        
        
           | 637 | 
           jp_milcent | 
           29 | 
           import com.extjs.gxt.ui.client.event.SelectionListener;
  | 
        
        
           | 703 | 
           jp_milcent | 
           30 | 
           import com.extjs.gxt.ui.client.store.ListStore;
  | 
        
        
           | 1164 | 
           jpm | 
           31 | 
           import com.extjs.gxt.ui.client.widget.Info;
  | 
        
        
           | 637 | 
           jp_milcent | 
           32 | 
           import com.extjs.gxt.ui.client.widget.LayoutContainer;
  | 
        
        
            | 
            | 
           33 | 
           import com.extjs.gxt.ui.client.widget.TabItem;
  | 
        
        
           | 934 | 
           jpm | 
           34 | 
           import com.extjs.gxt.ui.client.widget.button.Button;
  | 
        
        
           | 637 | 
           jp_milcent | 
           35 | 
           import com.extjs.gxt.ui.client.widget.button.ButtonBar;
  | 
        
        
           | 639 | 
           jp_milcent | 
           36 | 
           import com.extjs.gxt.ui.client.widget.form.CheckBox;
  | 
        
        
            | 
            | 
           37 | 
           import com.extjs.gxt.ui.client.widget.form.CheckBoxGroup;
  | 
        
        
           | 703 | 
           jp_milcent | 
           38 | 
           import com.extjs.gxt.ui.client.widget.form.ComboBox;
  | 
        
        
           | 639 | 
           jp_milcent | 
           39 | 
           import com.extjs.gxt.ui.client.widget.form.Field;
  | 
        
        
           | 637 | 
           jp_milcent | 
           40 | 
           import com.extjs.gxt.ui.client.widget.form.FormPanel;
  | 
        
        
           | 639 | 
           jp_milcent | 
           41 | 
           import com.extjs.gxt.ui.client.widget.form.Radio;
  | 
        
        
            | 
            | 
           42 | 
           import com.extjs.gxt.ui.client.widget.form.RadioGroup;
  | 
        
        
           | 980 | 
           jpm | 
           43 | 
           import com.extjs.gxt.ui.client.widget.form.TextArea;
  | 
        
        
            | 
            | 
           44 | 
           import com.extjs.gxt.ui.client.widget.form.TextField;
  | 
        
        
           | 639 | 
           jp_milcent | 
           45 | 
           import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
  | 
        
        
           | 637 | 
           jp_milcent | 
           46 | 
           import com.extjs.gxt.ui.client.widget.layout.FitLayout;
  | 
        
        
           | 639 | 
           jp_milcent | 
           47 | 
           import com.extjs.gxt.ui.client.widget.layout.FormData;
  | 
        
        
           | 637 | 
           jp_milcent | 
           48 | 
           import com.extjs.gxt.ui.client.widget.layout.FormLayout;
  | 
        
        
           | 639 | 
           jp_milcent | 
           49 | 
           import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
  | 
        
        
           | 687 | 
           jp_milcent | 
           50 | 
           import com.google.gwt.core.client.GWT;
  | 
        
        
           | 637 | 
           jp_milcent | 
           51 | 
              | 
        
        
           | 687 | 
           jp_milcent | 
           52 | 
           public abstract class Formulaire extends LayoutContainer implements Rafraichissable {
  | 
        
        
           | 637 | 
           jp_milcent | 
           53 | 
              | 
        
        
            | 
            | 
           54 | 
           	public static final String MODE_AJOUTER = "AJOUT";
  | 
        
        
            | 
            | 
           55 | 
           	public static final String MODE_MODIFIER = "MODIF";
  | 
        
        
            | 
            | 
           56 | 
              | 
        
        
           | 934 | 
           jpm | 
           57 | 
           	public Constantes i18nC = null;
  | 
        
        
           | 1076 | 
           jpm | 
           58 | 
           	public ErrorMessages i18nM = null;
  | 
        
        
           | 934 | 
           jpm | 
           59 | 
           	public Mediateur mediateur = null;
  | 
        
        
            | 
            | 
           60 | 
           	public Configuration config = null;
  | 
        
        
           | 687 | 
           jp_milcent | 
           61 | 
              | 
        
        
           | 934 | 
           jpm | 
           62 | 
           	public String mode = null;
  | 
        
        
            | 
            | 
           63 | 
           	public int tabIndex = 100;
  | 
        
        
           | 637 | 
           jp_milcent | 
           64 | 
              | 
        
        
           | 934 | 
           jpm | 
           65 | 
           	public FormPanel panneauFormulaire = null;
  | 
        
        
            | 
            | 
           66 | 
           	public ButtonBar barreOutilsValidation = null;
  | 
        
        
           | 775 | 
           jpm | 
           67 | 
              | 
        
        
           | 934 | 
           jpm | 
           68 | 
           	public String menuIdCourant = null;
  | 
        
        
            | 
            | 
           69 | 
           	public static Boolean clicBoutonvalidation = false;
  | 
        
        
            | 
            | 
           70 | 
           	public Rafraichissable vueExterneARafraichirApresValidation = null;
  | 
        
        
           | 775 | 
           jpm | 
           71 | 
              | 
        
        
            | 
            | 
           72 | 
           	public FormPanel getFormulaire() {
  | 
        
        
            | 
            | 
           73 | 
           		return panneauFormulaire;
  | 
        
        
            | 
            | 
           74 | 
           	}
  | 
        
        
           | 639 | 
           jp_milcent | 
           75 | 
              | 
        
        
           | 648 | 
           jp_milcent | 
           76 | 
           	public void initialiserFormulaire(Mediateur mediateurCourrant, String modeDeCreation, String idMenuCourrant) {
  | 
        
        
           | 637 | 
           jp_milcent | 
           77 | 
           		// Initialisation de variables
  | 
        
        
            | 
            | 
           78 | 
           		mode = modeDeCreation;
  | 
        
        
            | 
            | 
           79 | 
           		mediateur = mediateurCourrant;
  | 
        
        
            | 
            | 
           80 | 
           		i18nC = Mediateur.i18nC;
  | 
        
        
           | 1077 | 
           jpm | 
           81 | 
           		i18nM = Mediateur.i18nM;
  | 
        
        
           | 648 | 
           jp_milcent | 
           82 | 
           		menuIdCourant = idMenuCourrant;
  | 
        
        
           | 687 | 
           jp_milcent | 
           83 | 
           		config = (Configuration) Registry.get(RegistreId.CONFIG);
  | 
        
        
           | 648 | 
           jp_milcent | 
           84 | 
              | 
        
        
           | 637 | 
           jp_milcent | 
           85 | 
           		// Iniatilisation du layoutContainer
  | 
        
        
            | 
            | 
           86 | 
           		setLayout(new FitLayout());
  | 
        
        
            | 
            | 
           87 | 
           		setBorders(false);
  | 
        
        
            | 
            | 
           88 | 
              | 
        
        
            | 
            | 
           89 | 
           		// Création du panneau du FORMULAIRE GÉNÉRAL
  | 
        
        
            | 
            | 
           90 | 
           		panneauFormulaire = new FormPanel();
  | 
        
        
            | 
            | 
           91 | 
           		panneauFormulaire.setBodyBorder(false);
  | 
        
        
            | 
            | 
           92 | 
           		panneauFormulaire.setFrame(true);
  | 
        
        
           | 775 | 
           jpm | 
           93 | 
            		panneauFormulaire.setCollapsible(false);
  | 
        
        
           | 637 | 
           jp_milcent | 
           94 | 
           		panneauFormulaire.setButtonAlign(HorizontalAlignment.CENTER);
  | 
        
        
            | 
            | 
           95 | 
           		panneauFormulaire.setLayout(new FitLayout());
  | 
        
        
           | 1284 | 
           gduche | 
           96 | 
           		panneauFormulaire.setPadding(0);
  | 
        
        
            | 
            | 
           97 | 
              | 
        
        
           | 775 | 
           jpm | 
           98 | 
           		if (modeDeCreation.equals(MODE_AJOUTER)) {
  | 
        
        
            | 
            | 
           99 | 
           			panneauFormulaire.setIcon(Images.ICONES.formAjouter());
  | 
        
        
            | 
            | 
           100 | 
           		} else if (modeDeCreation.equals(MODE_AJOUTER)) {
  | 
        
        
            | 
            | 
           101 | 
           			panneauFormulaire.setIcon(Images.ICONES.formModifier());
  | 
        
        
            | 
            | 
           102 | 
           		}
  | 
        
        
           | 639 | 
           jp_milcent | 
           103 | 
              | 
        
        
           | 775 | 
           jpm | 
           104 | 
           		barreOutilsValidation = new FormulaireBarreValidation(creerEcouteurValidation());
  | 
        
        
            | 
            | 
           105 | 
           		panneauFormulaire.setBottomComponent(barreOutilsValidation);
  | 
        
        
           | 648 | 
           jp_milcent | 
           106 | 
              | 
        
        
            | 
            | 
           107 | 
           		add(panneauFormulaire);
  | 
        
        
           | 637 | 
           jp_milcent | 
           108 | 
           	}
  | 
        
        
            | 
            | 
           109 | 
              | 
        
        
           | 934 | 
           jpm | 
           110 | 
           	public SelectionListener<ButtonEvent> creerEcouteurValidation() {
  | 
        
        
            | 
            | 
           111 | 
           		SelectionListener<ButtonEvent> ecouteur = new SelectionListener<ButtonEvent>() {
  | 
        
        
            | 
            | 
           112 | 
           			public void componentSelected(ButtonEvent ce) {
  | 
        
        
           | 1292 | 
           cyprien | 
           113 | 
              | 
        
        
           | 934 | 
           jpm | 
           114 | 
           				String code = ((Button) ce.getComponent()).getData("code");
  | 
        
        
            | 
            | 
           115 | 
           				if (code.equals(FormulaireBarreValidation.CODE_BOUTON_VALIDER)) {
  | 
        
        
           | 1164 | 
           jpm | 
           116 | 
           					if (mediateur.getUtilisateur().isIdentifie()) {
  | 
        
        
           | 1239 | 
           cyprien | 
           117 | 
           						clicBoutonvalidation = true;
  | 
        
        
           | 1164 | 
           jpm | 
           118 | 
           						soumettreFormulaire();
  | 
        
        
           | 1239 | 
           cyprien | 
           119 | 
              | 
        
        
           | 1164 | 
           jpm | 
           120 | 
           					} else {
  | 
        
        
           | 1239 | 
           cyprien | 
           121 | 
           						InfoLogger.display(i18nC.modeAnonyme(), i18nC.identificationNecessaire());
  | 
        
        
           | 1164 | 
           jpm | 
           122 | 
           					}
  | 
        
        
           | 934 | 
           jpm | 
           123 | 
           				} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_APPLIQUER)) {
  | 
        
        
           | 1164 | 
           jpm | 
           124 | 
           					if (mediateur.getUtilisateur().isIdentifie()) {
  | 
        
        
            | 
            | 
           125 | 
           						soumettreFormulaire();
  | 
        
        
            | 
            | 
           126 | 
           					} else {
  | 
        
        
           | 1239 | 
           cyprien | 
           127 | 
           						InfoLogger.display(i18nC.modeAnonyme(), i18nC.identificationNecessaire());
  | 
        
        
           | 1164 | 
           jpm | 
           128 | 
           					}
  | 
        
        
           | 934 | 
           jpm | 
           129 | 
           				} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_ANNULER)) {
  | 
        
        
           | 1613 | 
           aurelien | 
           130 | 
           					fermerFormulaire();
  | 
        
        
           | 934 | 
           jpm | 
           131 | 
           				}
  | 
        
        
            | 
            | 
           132 | 
           			}
  | 
        
        
            | 
            | 
           133 | 
           		};
  | 
        
        
            | 
            | 
           134 | 
              | 
        
        
            | 
            | 
           135 | 
           		return ecouteur;
  | 
        
        
            | 
            | 
           136 | 
           	}
  | 
        
        
           | 637 | 
           jp_milcent | 
           137 | 
              | 
        
        
           | 934 | 
           jpm | 
           138 | 
           	public abstract boolean verifierFormulaire();
  | 
        
        
           | 787 | 
           jpm | 
           139 | 
              | 
        
        
           | 934 | 
           jpm | 
           140 | 
           	public abstract boolean soumettreFormulaire();
  | 
        
        
           | 782 | 
           jpm | 
           141 | 
              | 
        
        
           | 934 | 
           jpm | 
           142 | 
           	public TabItem creerOnglet(String nom, String id) {
  | 
        
        
           | 637 | 
           jp_milcent | 
           143 | 
           		TabItem onglet = new TabItem();
  | 
        
        
            | 
            | 
           144 | 
           		onglet.setId(id);
  | 
        
        
            | 
            | 
           145 | 
           		onglet.setText(nom);
  | 
        
        
           | 687 | 
           jp_milcent | 
           146 | 
           		FormulaireOnglet.parametrer(onglet);
  | 
        
        
           | 637 | 
           jp_milcent | 
           147 | 
           		return onglet;
  | 
        
        
            | 
            | 
           148 | 
           	}
  | 
        
        
           | 639 | 
           jp_milcent | 
           149 | 
              | 
        
        
           | 1239 | 
           cyprien | 
           150 | 
           	public void controlerFermeture() {
  | 
        
        
           | 639 | 
           jp_milcent | 
           151 | 
           		if (clicBoutonvalidation) {
  | 
        
        
           | 782 | 
           jpm | 
           152 | 
           			fermerFormulaire();
  | 
        
        
           | 1239 | 
           cyprien | 
           153 | 
           		}
  | 
        
        
           | 639 | 
           jp_milcent | 
           154 | 
           	}
  | 
        
        
            | 
            | 
           155 | 
              | 
        
        
           | 934 | 
           jpm | 
           156 | 
           	public void fermerFormulaire() {
  | 
        
        
           | 782 | 
           jpm | 
           157 | 
           		clicBoutonvalidation = false;
  | 
        
        
            | 
            | 
           158 | 
           		panneauFormulaire.setEnabled(false);
  | 
        
        
           | 1613 | 
           aurelien | 
           159 | 
           		surFermetureFormulaire();
  | 
        
        
            | 
            | 
           160 | 
           		//mediateur.clicMenu(menuIdCourant);
  | 
        
        
           | 782 | 
           jpm | 
           161 | 
           	}
  | 
        
        
            | 
            | 
           162 | 
              | 
        
        
           | 1613 | 
           aurelien | 
           163 | 
           	public void surFermetureFormulaire() {
  | 
        
        
            | 
            | 
           164 | 
           		// A surcharger si jamais une action spécifique doit être entreprise
  | 
        
        
            | 
            | 
           165 | 
           	}
  | 
        
        
            | 
            | 
           166 | 
              | 
        
        
           | 639 | 
           jp_milcent | 
           167 | 
           	/** Méthode simplifiant la création de FormLayout.
  | 
        
        
            | 
            | 
           168 | 
           	 * Chacun des paramètres peut prendre la valeur null pour utiliser la valeur par défaut.
  | 
        
        
            | 
            | 
           169 | 
           	 *
  | 
        
        
            | 
            | 
           170 | 
           	 * @param labelWidth largeur des labels.
  | 
        
        
            | 
            | 
           171 | 
           	 * @param labelAlign alignement des labels
  | 
        
        
            | 
            | 
           172 | 
           	 * @return
  | 
        
        
            | 
            | 
           173 | 
           	 */
  | 
        
        
           | 912 | 
           jpm | 
           174 | 
           	public static FormLayout creerFormLayout(Integer labelWidth, LabelAlign labelAlign) {
  | 
        
        
           | 639 | 
           jp_milcent | 
           175 | 
           		FormLayout formLayout = new FormLayout();
  | 
        
        
            | 
            | 
           176 | 
           		if (labelWidth != null) {
  | 
        
        
            | 
            | 
           177 | 
           			formLayout.setLabelWidth(labelWidth);
  | 
        
        
            | 
            | 
           178 | 
           		}
  | 
        
        
            | 
            | 
           179 | 
           		if (labelAlign != null) {
  | 
        
        
            | 
            | 
           180 | 
           			formLayout.setLabelAlign(labelAlign);
  | 
        
        
            | 
            | 
           181 | 
           		}
  | 
        
        
            | 
            | 
           182 | 
           		return formLayout;
  | 
        
        
            | 
            | 
           183 | 
           	}
  | 
        
        
            | 
            | 
           184 | 
              | 
        
        
            | 
            | 
           185 | 
           	/** Méthode simplifiant la création de bouton radio oui/non
  | 
        
        
            | 
            | 
           186 | 
           	 *
  | 
        
        
            | 
            | 
           187 | 
           	 * @param listeNom nom de la liste de valeur
  | 
        
        
            | 
            | 
           188 | 
           	 * @return
  | 
        
        
            | 
            | 
           189 | 
           	 */
  | 
        
        
           | 934 | 
           jpm | 
           190 | 
           	public RadioGroup creerChoixUniqueRadioGroupe(String groupeNom, String listeNom) {
  | 
        
        
           | 639 | 
           jp_milcent | 
           191 | 
           		groupeNom += "_grp";
  | 
        
        
            | 
            | 
           192 | 
           		// NOTE : il semblerait qu'il faille aussi utiliser setName() pour éviter tout problème...
  | 
        
        
            | 
            | 
           193 | 
           		RadioGroup radioGroup = new RadioGroup(groupeNom);
  | 
        
        
            | 
            | 
           194 | 
           		radioGroup.setName(groupeNom);
  | 
        
        
            | 
            | 
           195 | 
              | 
        
        
            | 
            | 
           196 | 
           		if (listeNom.equals("ouiNon")) {
  | 
        
        
            | 
            | 
           197 | 
           			ValeurListe ouiNonListe = new ValeurListe();
  | 
        
        
            | 
            | 
           198 | 
           			ouiNonListe.ajouter(new Valeur("1", i18nC.oui(), "NULL", "NULL"));
  | 
        
        
            | 
            | 
           199 | 
           			ouiNonListe.ajouter(new Valeur("0", i18nC.non(), "NULL", "NULL"));
  | 
        
        
            | 
            | 
           200 | 
           			creerChoixUniqueBoutonRadio(radioGroup, ouiNonListe);
  | 
        
        
            | 
            | 
           201 | 
           		}
  | 
        
        
            | 
            | 
           202 | 
              | 
        
        
            | 
            | 
           203 | 
           		return radioGroup;
  | 
        
        
            | 
            | 
           204 | 
           	}
  | 
        
        
            | 
            | 
           205 | 
              | 
        
        
           | 934 | 
           jpm | 
           206 | 
           	public void creerChoixUniqueBoutonRadio(RadioGroup radioGroupe, ValeurListe listeValeurs) {
  | 
        
        
           | 639 | 
           jp_milcent | 
           207 | 
           		for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
  | 
        
        
            | 
            | 
           208 | 
           			Valeur val = listeValeurs.get(it.next());
  | 
        
        
            | 
            | 
           209 | 
              | 
        
        
            | 
            | 
           210 | 
           			Radio radioBtn = new Radio();
  | 
        
        
            | 
            | 
           211 | 
           			radioBtn.setName(radioGroupe.getName().replace("_grp", ""));
  | 
        
        
            | 
            | 
           212 | 
           			radioBtn.setId(val.getId()+"_"+radioBtn.getName());
  | 
        
        
            | 
            | 
           213 | 
           			radioBtn.setBoxLabel(val.getNom());
  | 
        
        
            | 
            | 
           214 | 
           			radioBtn.setValueAttribute(val.getId());
  | 
        
        
            | 
            | 
           215 | 
           			radioBtn.addListener(Events.Change, new Listener<ComponentEvent>() {
  | 
        
        
            | 
            | 
           216 | 
              | 
        
        
            | 
            | 
           217 | 
           				public void handleEvent(ComponentEvent be) {
  | 
        
        
            | 
            | 
           218 | 
           					//Window.alert(((Radio) be.component).getName());
  | 
        
        
            | 
            | 
           219 | 
           					afficherChampSupplementaire(((Radio) be.getComponent()));
  | 
        
        
            | 
            | 
           220 | 
           				}
  | 
        
        
            | 
            | 
           221 | 
              | 
        
        
            | 
            | 
           222 | 
           			});
  | 
        
        
            | 
            | 
           223 | 
              | 
        
        
            | 
            | 
           224 | 
           			if (! val.getDescription().equals("NULL")) {
  | 
        
        
            | 
            | 
           225 | 
           				radioBtn.setToolTip(new ToolTipConfig(val.getNom(), val.getDescription()));
  | 
        
        
            | 
            | 
           226 | 
           			}
  | 
        
        
            | 
            | 
           227 | 
           			radioGroupe.add(radioBtn);
  | 
        
        
            | 
            | 
           228 | 
           		}
  | 
        
        
            | 
            | 
           229 | 
           	}
  | 
        
        
            | 
            | 
           230 | 
              | 
        
        
           | 934 | 
           jpm | 
           231 | 
           	public void afficherChampSupplementaire(Radio radioBtn) {
  | 
        
        
           | 775 | 
           jpm | 
           232 | 
           		GWT.log("Vous devez redéfinir la méthode afficherChampSupplementaire(Radio radioBtn) dans votre classe formulaire.", null);
  | 
        
        
            | 
            | 
           233 | 
           	};
  | 
        
        
           | 639 | 
           jp_milcent | 
           234 | 
              | 
        
        
            | 
            | 
           235 | 
           	/** Méthode simplifiant la création de choix multiple sous forme de case à cocher.
  | 
        
        
            | 
            | 
           236 | 
           	 * Apelle un service retournant la liste des valeurs représentant les cases à cocher.
  | 
        
        
            | 
            | 
           237 | 
           	 * Ajoute ou pas un champ "Autre".
  | 
        
        
            | 
            | 
           238 | 
           	 *
  | 
        
        
            | 
            | 
           239 | 
           	 * @return ContentPanel le panneau contenant les cases à cocher
  | 
        
        
            | 
            | 
           240 | 
           	 */
  | 
        
        
           | 831 | 
           jpm | 
           241 | 
           	public static LayoutContainer creerChoixMultipleCp() {
  | 
        
        
           | 639 | 
           jp_milcent | 
           242 | 
           		LayoutContainer conteneur = new LayoutContainer();
  | 
        
        
            | 
            | 
           243 | 
           		conteneur.setLayout(creerFormLayout(650, LabelAlign.TOP));
  | 
        
        
            | 
            | 
           244 | 
           		return conteneur;
  | 
        
        
            | 
            | 
           245 | 
           	}
  | 
        
        
            | 
            | 
           246 | 
              | 
        
        
            | 
            | 
           247 | 
           	/** Méthode simplifiant la création de choix multiple sous forme de case à cocher.
  | 
        
        
            | 
            | 
           248 | 
           	 * Apelle un service retournant la liste des valeurs représentant les cases à cocher.
  | 
        
        
            | 
            | 
           249 | 
           	 * Ajoute ou pas un champ "Autre".
  | 
        
        
            | 
            | 
           250 | 
           	 *
  | 
        
        
            | 
            | 
           251 | 
           	 * @param cp panneau conteant le groupe de case à cocher
  | 
        
        
            | 
            | 
           252 | 
           	 * @param cacGroup le groupe de case à cocher
  | 
        
        
            | 
            | 
           253 | 
           	 * @param listeValeurs la liste de valeurs à transformer en case à cocher
  | 
        
        
            | 
            | 
           254 | 
           	 * @param boolAutreChp booléen indiquant si oui ou non le champ autre doit apparaître
  | 
        
        
            | 
            | 
           255 | 
           	 * @return
  | 
        
        
            | 
            | 
           256 | 
           	 */
  | 
        
        
           | 831 | 
           jpm | 
           257 | 
           	public static void creerChoixMultipleCac(LayoutContainer cp, final CheckBoxGroup cacGroupe, ValeurListe listeValeurs, final Field<String> autreChp) {
  | 
        
        
           | 639 | 
           jp_milcent | 
           258 | 
           		cp.addListener(Events.Hide, new Listener<BaseEvent>() {
  | 
        
        
            | 
            | 
           259 | 
           			public void handleEvent(BaseEvent be) {
  | 
        
        
            | 
            | 
           260 | 
           				cacGroupe.reset();
  | 
        
        
            | 
            | 
           261 | 
           				autreChp.setValue("");
  | 
        
        
            | 
            | 
           262 | 
           			}
  | 
        
        
            | 
            | 
           263 | 
              | 
        
        
            | 
            | 
           264 | 
           		});
  | 
        
        
            | 
            | 
           265 | 
              | 
        
        
            | 
            | 
           266 | 
           		cacGroupe.setAutoWidth(true);
  | 
        
        
            | 
            | 
           267 | 
           		cacGroupe.setStyleAttribute("padding", "3px");
  | 
        
        
            | 
            | 
           268 | 
           		cacGroupe.setData("liste_id", listeValeurs.getId());
  | 
        
        
            | 
            | 
           269 | 
           		for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
  | 
        
        
            | 
            | 
           270 | 
           			Valeur val = listeValeurs.get(it.next());
  | 
        
        
            | 
            | 
           271 | 
           			String nom =  val.get("nom");
  | 
        
        
            | 
            | 
           272 | 
           			CheckBox cac = new CheckBox();
  | 
        
        
            | 
            | 
           273 | 
           			cac.setId("val-"+val.getId());
  | 
        
        
            | 
            | 
           274 | 
           			cac.setData("id", val.getId());
  | 
        
        
            | 
            | 
           275 | 
           			cac.setBoxLabel(nom);
  | 
        
        
            | 
            | 
           276 | 
           			if (! val.getDescription().equals("NULL")) {
  | 
        
        
            | 
            | 
           277 | 
           				cac.setToolTip(new ToolTipConfig(val.getNom(), val.getDescription()));
  | 
        
        
            | 
            | 
           278 | 
           			}
  | 
        
        
            | 
            | 
           279 | 
           			cacGroupe.add(cac);
  | 
        
        
            | 
            | 
           280 | 
           		}
  | 
        
        
            | 
            | 
           281 | 
           		cp.add(cacGroupe);
  | 
        
        
            | 
            | 
           282 | 
              | 
        
        
            | 
            | 
           283 | 
           		if (autreChp != null) {
  | 
        
        
            | 
            | 
           284 | 
           			// FIXME : éviter le chevauchement du texte des cases à cocher avec le label "Autre" sur les petits écrans
  | 
        
        
            | 
            | 
           285 | 
           			LayoutContainer conteneur = new LayoutContainer();
  | 
        
        
            | 
            | 
           286 | 
           			conteneur.setLayout(creerFormLayout(50, LabelAlign.TOP));
  | 
        
        
            | 
            | 
           287 | 
           			autreChp.setFieldLabel("Autre");
  | 
        
        
            | 
            | 
           288 | 
           			autreChp.setLabelStyle("font-weight:normal;");
  | 
        
        
            | 
            | 
           289 | 
           			conteneur.add(autreChp, new FormData(500, 0));
  | 
        
        
            | 
            | 
           290 | 
              | 
        
        
            | 
            | 
           291 | 
           			cp.add(conteneur);
  | 
        
        
            | 
            | 
           292 | 
           		}
  | 
        
        
            | 
            | 
           293 | 
           		cp.layout();
  | 
        
        
            | 
            | 
           294 | 
           	}
  | 
        
        
           | 687 | 
           jp_milcent | 
           295 | 
              | 
        
        
           | 703 | 
           jp_milcent | 
           296 | 
           	@SuppressWarnings({"unchecked"})
  | 
        
        
           | 831 | 
           jpm | 
           297 | 
           	public static void rafraichirComboBox(aDonneeListe<?> listeValeurs, ComboBox combo) {
  | 
        
        
            | 
            | 
           298 | 
           		rafraichirComboBox(listeValeurs, combo, "nom");
  | 
        
        
            | 
            | 
           299 | 
           	}
  | 
        
        
            | 
            | 
           300 | 
              | 
        
        
            | 
            | 
           301 | 
           	@SuppressWarnings({"unchecked"})
  | 
        
        
            | 
            | 
           302 | 
           	public static void rafraichirComboBox(aDonneeListe<?> listeValeurs, ComboBox combo, String champATrier) {
  | 
        
        
           | 703 | 
           jp_milcent | 
           303 | 
           		List<?> liste = listeValeurs.toList();
  | 
        
        
            | 
            | 
           304 | 
           		if (liste.size() > 0) {
  | 
        
        
           | 831 | 
           jpm | 
           305 | 
           			ListStore store = combo.getStore();
  | 
        
        
           | 703 | 
           jp_milcent | 
           306 | 
           			store.removeAll();
  | 
        
        
            | 
            | 
           307 | 
           			store.add(liste);
  | 
        
        
           | 831 | 
           jpm | 
           308 | 
           			store.sort(champATrier, SortDir.ASC);
  | 
        
        
           | 703 | 
           jp_milcent | 
           309 | 
           			combo.setStore(store);
  | 
        
        
            | 
            | 
           310 | 
           		}
  | 
        
        
            | 
            | 
           311 | 
           	}
  | 
        
        
           | 980 | 
           jpm | 
           312 | 
              | 
        
        
            | 
            | 
           313 | 
           	public static Listener<BaseEvent> creerEcouteurChampObligatoire() {
  | 
        
        
            | 
            | 
           314 | 
           		return new Listener<BaseEvent>() {
  | 
        
        
            | 
            | 
           315 | 
           			public void handleEvent(BaseEvent be) {
  | 
        
        
            | 
            | 
           316 | 
           				Field<?> champ = null;
  | 
        
        
            | 
            | 
           317 | 
           				boolean etreVide = true;
  | 
        
        
            | 
            | 
           318 | 
           				if (be.getSource() instanceof TextField<?>) {
  | 
        
        
            | 
            | 
           319 | 
           					champ = (TextField<?>) be.getSource();
  | 
        
        
            | 
            | 
           320 | 
           					etreVide = (champ.getRawValue().isEmpty()) ? true : false;
  | 
        
        
            | 
            | 
           321 | 
           				} else if (be.getSource() instanceof TextArea) {
  | 
        
        
            | 
            | 
           322 | 
           					champ = (TextArea) be.getSource();
  | 
        
        
            | 
            | 
           323 | 
           					etreVide = (champ.getRawValue().isEmpty()) ? true : false;
  | 
        
        
            | 
            | 
           324 | 
           				} else if (be.getSource() instanceof ChampComboBoxListeValeurs) {
  | 
        
        
            | 
            | 
           325 | 
           					champ = (ChampComboBoxListeValeurs) be.getSource();
  | 
        
        
            | 
            | 
           326 | 
           					etreVide = (champ.getValue() == null) ? true : false;
  | 
        
        
            | 
            | 
           327 | 
           				} else if (be.getSource() instanceof ComboBox<?>) {
  | 
        
        
            | 
            | 
           328 | 
           					champ = (ComboBox<?>) be.getSource();
  | 
        
        
            | 
            | 
           329 | 
           					etreVide = (champ.getValue() == null) ? true : false;
  | 
        
        
            | 
            | 
           330 | 
           				}
  | 
        
        
            | 
            | 
           331 | 
           				champ.removeStyleName(ComposantClass.OBLIGATOIRE);
  | 
        
        
            | 
            | 
           332 | 
           				champ.removeStyleName(ComposantClass.OBLIGATOIRE_OK);
  | 
        
        
            | 
            | 
           333 | 
           				if (etreVide == false) {
  | 
        
        
            | 
            | 
           334 | 
           					champ.addStyleName(ComposantClass.OBLIGATOIRE_OK);
  | 
        
        
            | 
            | 
           335 | 
           				} else {
  | 
        
        
            | 
            | 
           336 | 
           					champ.addStyleName(ComposantClass.OBLIGATOIRE);
  | 
        
        
            | 
            | 
           337 | 
           				}
  | 
        
        
            | 
            | 
           338 | 
           			}
  | 
        
        
            | 
            | 
           339 | 
           		};
  | 
        
        
            | 
            | 
           340 | 
           	}
  | 
        
        
           | 1779 | 
           aurelien | 
           341 | 
              | 
        
        
            | 
            | 
           342 | 
           	public static ValeurListe trierListeOuiNonEnPartie(ValeurListe listeValeurs) {
  | 
        
        
            | 
            | 
           343 | 
           		ValeurListe listeValeursTriees = new ValeurListe();
  | 
        
        
            | 
            | 
           344 | 
           		Valeur valeurOui = null;
  | 
        
        
            | 
            | 
           345 | 
           		Valeur valeurNon = null;
  | 
        
        
            | 
            | 
           346 | 
           		Valeur valeurEnpartie = null;
  | 
        
        
            | 
            | 
           347 | 
           		String idValeurOui = null;
  | 
        
        
            | 
            | 
           348 | 
           		String idValeurNon = null;
  | 
        
        
            | 
            | 
           349 | 
           		String idValeurEnpartie = null;
  | 
        
        
            | 
            | 
           350 | 
           		for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
  | 
        
        
            | 
            | 
           351 | 
           			String strId = it.next();
  | 
        
        
            | 
            | 
           352 | 
           			Valeur valeurDeLaListe = listeValeurs.get(strId);
  | 
        
        
            | 
            | 
           353 | 
           			//Window.alert(strId+" "+valeurDeLaListe.getNom());
  | 
        
        
            | 
            | 
           354 | 
           			if(valeurDeLaListe.getNom().equals("Oui")) {
  | 
        
        
            | 
            | 
           355 | 
           				idValeurOui = strId;
  | 
        
        
            | 
            | 
           356 | 
           				valeurOui = valeurDeLaListe;
  | 
        
        
            | 
            | 
           357 | 
           			}
  | 
        
        
            | 
            | 
           358 | 
           			if(valeurDeLaListe.getNom().equals("Non")) {
  | 
        
        
            | 
            | 
           359 | 
           				idValeurNon = strId;
  | 
        
        
            | 
            | 
           360 | 
           				valeurNon = valeurDeLaListe;
  | 
        
        
            | 
            | 
           361 | 
           			}
  | 
        
        
            | 
            | 
           362 | 
           			if(valeurDeLaListe.getNom().equals("En partie")) {
  | 
        
        
            | 
            | 
           363 | 
           				idValeurEnpartie = strId;
  | 
        
        
            | 
            | 
           364 | 
           				valeurEnpartie = valeurDeLaListe;
  | 
        
        
            | 
            | 
           365 | 
           			}
  | 
        
        
            | 
            | 
           366 | 
           		}
  | 
        
        
            | 
            | 
           367 | 
           		listeValeursTriees.put(idValeurOui, valeurOui);
  | 
        
        
            | 
            | 
           368 | 
           		listeValeursTriees.put(idValeurNon, valeurNon);
  | 
        
        
            | 
            | 
           369 | 
           		listeValeursTriees.put(idValeurEnpartie, valeurEnpartie);
  | 
        
        
            | 
            | 
           370 | 
              | 
        
        
            | 
            | 
           371 | 
           		return listeValeursTriees;
  | 
        
        
            | 
            | 
           372 | 
           	}
  | 
        
        
           | 1661 | 
           raphael | 
           373 | 
           }
  |