| 985 | jpm | 1 | package org.tela_botanica.client.vues.commentaire;
 | 
        
           |  |  | 2 |   | 
        
           |  |  | 3 | import java.util.ArrayList;
 | 
        
           |  |  | 4 |   | 
        
           |  |  | 5 | import org.tela_botanica.client.ComposantClass;
 | 
        
           |  |  | 6 | import org.tela_botanica.client.Mediateur;
 | 
        
           | 1329 | cyprien | 7 | import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
 | 
        
           | 989 | jpm | 8 | import org.tela_botanica.client.composants.ChampSliderPourcentage;
 | 
        
           | 1239 | cyprien | 9 | import org.tela_botanica.client.composants.InfoLogger;
 | 
        
           | 1329 | cyprien | 10 | import org.tela_botanica.client.composants.pagination.ProxyProjets;
 | 
        
           | 985 | jpm | 11 | import org.tela_botanica.client.interfaces.Rafraichissable;
 | 
        
           |  |  | 12 | import org.tela_botanica.client.modeles.Information;
 | 
        
           |  |  | 13 | import org.tela_botanica.client.modeles.MenuApplicationId;
 | 
        
           | 989 | jpm | 14 | import org.tela_botanica.client.modeles.commentaire.Commentaire;
 | 
        
           | 999 | jpm | 15 | import org.tela_botanica.client.modeles.projet.Projet;
 | 
        
           | 1367 | cyprien | 16 | import org.tela_botanica.client.synchronisation.Sequenceur;
 | 
        
           | 989 | jpm | 17 | import org.tela_botanica.client.util.Debug;
 | 
        
           | 985 | jpm | 18 | import org.tela_botanica.client.util.UtilArray;
 | 
        
           |  |  | 19 | import org.tela_botanica.client.util.UtilString;
 | 
        
           |  |  | 20 | import org.tela_botanica.client.vues.Formulaire;
 | 
        
           |  |  | 21 |   | 
        
           | 1329 | cyprien | 22 | import com.extjs.gxt.ui.client.data.ModelData;
 | 
        
           |  |  | 23 | import com.extjs.gxt.ui.client.data.ModelType;
 | 
        
           | 985 | jpm | 24 | import com.extjs.gxt.ui.client.event.Events;
 | 
        
           |  |  | 25 | import com.extjs.gxt.ui.client.widget.MessageBox;
 | 
        
           | 989 | jpm | 26 | import com.extjs.gxt.ui.client.widget.form.CheckBox;
 | 
        
           | 999 | jpm | 27 | import com.extjs.gxt.ui.client.widget.form.Field;
 | 
        
           | 989 | jpm | 28 | import com.extjs.gxt.ui.client.widget.form.TextArea;
 | 
        
           | 985 | jpm | 29 | import com.extjs.gxt.ui.client.widget.form.TextField;
 | 
        
           | 999 | jpm | 30 | import com.extjs.gxt.ui.client.widget.form.Validator;
 | 
        
           | 985 | jpm | 31 | import com.extjs.gxt.ui.client.widget.layout.FormData;
 | 
        
           |  |  | 32 | import com.extjs.gxt.ui.client.widget.layout.FormLayout;
 | 
        
           | 1613 | aurelien | 33 | import com.google.gwt.user.client.Window;
 | 
        
           | 985 | jpm | 34 |   | 
        
           |  |  | 35 |   | 
        
           |  |  | 36 | public class CommentaireForm extends Formulaire implements Rafraichissable {
 | 
        
           |  |  | 37 |   | 
        
           | 989 | jpm | 38 | 	private Commentaire commentaire;
 | 
        
           |  |  | 39 |   | 
        
           | 1329 | cyprien | 40 | 	private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
 | 
        
           | 989 | jpm | 41 | 	private TextField<String> titreChp;
 | 
        
           |  |  | 42 | 	private TextArea texteChp;
 | 
        
           |  |  | 43 | 	private ChampSliderPourcentage ponderationChp;
 | 
        
           |  |  | 44 | 	private CheckBox publicChp;
 | 
        
           | 985 | jpm | 45 |   | 
        
           |  |  | 46 | 	private static boolean formulaireValideOk = false;
 | 
        
           | 989 | jpm | 47 | 	private static boolean commentaireValideOk = false;
 | 
        
           | 1367 | cyprien | 48 |   | 
        
           |  |  | 49 | 	private Sequenceur sequenceur = new Sequenceur();
 | 
        
           | 985 | jpm | 50 |   | 
        
           | 989 | jpm | 51 | 	public CommentaireForm(Mediateur mediateurCourrant, String commentaireId) {
 | 
        
           |  |  | 52 | 		initialiserCommentaireForm(mediateurCourrant, commentaireId);
 | 
        
           | 985 | jpm | 53 | 	}
 | 
        
           |  |  | 54 |   | 
        
           | 989 | jpm | 55 | 	public CommentaireForm(Mediateur mediateurCourrant, String commentaireId, Rafraichissable vueARafraichirApresValidation) {
 | 
        
           | 985 | jpm | 56 | 		vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
 | 
        
           | 989 | jpm | 57 | 		initialiserCommentaireForm(mediateurCourrant, commentaireId);
 | 
        
           | 985 | jpm | 58 | 	}
 | 
        
           |  |  | 59 |   | 
        
           | 989 | jpm | 60 | 	private void initialiserCommentaireForm(Mediateur mediateurCourrant, String commentaireId) {
 | 
        
           | 985 | jpm | 61 | 		initialiserValidation();
 | 
        
           |  |  | 62 |   | 
        
           | 989 | jpm | 63 | 		commentaire = new Commentaire();
 | 
        
           |  |  | 64 | 		commentaire.setId(commentaireId);
 | 
        
           | 985 | jpm | 65 |   | 
        
           | 989 | jpm | 66 | 		String modeDeCreation = (UtilString.isEmpty(commentaire.getId()) ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
 | 
        
           |  |  | 67 | 		initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.COMMENTAIRE);
 | 
        
           | 985 | jpm | 68 |   | 
        
           | 989 | jpm | 69 | 		panneauFormulaire.setLayout(new FormLayout());
 | 
        
           | 1099 | jpm | 70 | 		genererTitreFormulaire();
 | 
        
           | 989 | jpm | 71 | 		creerChamps();
 | 
        
           |  |  | 72 |   | 
        
           | 985 | jpm | 73 | 		if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
 | 
        
           | 1367 | cyprien | 74 | 			mediateur.selectionnerCommentaire(this, commentaireId, null);
 | 
        
           | 985 | jpm | 75 | 		}
 | 
        
           |  |  | 76 | 	}
 | 
        
           |  |  | 77 |   | 
        
           | 1099 | jpm | 78 | 	private void genererTitreFormulaire() {
 | 
        
           | 989 | jpm | 79 | 		String titre = i18nC.commentaireTitreFormAjout();
 | 
        
           | 985 | jpm | 80 | 		if (mode.equals(Formulaire.MODE_MODIFIER)) {
 | 
        
           | 1099 | jpm | 81 | 			 titre = i18nC.commentaireTitreFormModif();
 | 
        
           |  |  | 82 | 			 if (commentaire != null) {
 | 
        
           |  |  | 83 | 				 titre += " - "+i18nC.id()+": "+commentaire.getId();
 | 
        
           |  |  | 84 | 			 }
 | 
        
           | 985 | jpm | 85 | 		}
 | 
        
           | 1680 | raphael | 86 | 		panneauFormulaire.setHeadingHtml(titre);
 | 
        
           | 985 | jpm | 87 | 	}
 | 
        
           |  |  | 88 |   | 
        
           | 989 | jpm | 89 | 	private void creerChamps() {
 | 
        
           | 1329 | cyprien | 90 |   | 
        
           |  |  | 91 | 		ModelType modelTypeProjets = new ModelType();
 | 
        
           |  |  | 92 | 		modelTypeProjets.setRoot("projets");
 | 
        
           |  |  | 93 | 		modelTypeProjets.setTotalName("nbElements");
 | 
        
           |  |  | 94 | 		modelTypeProjets.addField("cpr_nom");
 | 
        
           |  |  | 95 | 		modelTypeProjets.addField("cpr_id_projet");
 | 
        
           |  |  | 96 |   | 
        
           |  |  | 97 | 		String displayNameProjets = "cpr_nom";
 | 
        
           | 1468 | jpm | 98 | 		ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>(null);
 | 
        
           | 1329 | cyprien | 99 |   | 
        
           |  |  | 100 | 		projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
 | 
        
           |  |  | 101 | 		projetsCombo.setWidth(100, 550);
 | 
        
           |  |  | 102 | 		projetsCombo.getCombo().setTabIndex(tabIndex++);
 | 
        
           |  |  | 103 | 		projetsCombo.getCombo().setFieldLabel(i18nC.projetChamp());
 | 
        
           |  |  | 104 | 		projetsCombo.getCombo().setEmptyText(i18nC.txtListeProjetDefaut());
 | 
        
           |  |  | 105 | 		projetsCombo.getCombo().setForceSelection(true);
 | 
        
           |  |  | 106 | 		projetsCombo.getCombo().setEditable(false);
 | 
        
           |  |  | 107 | 		projetsCombo.getCombo().setAllowBlank(false);
 | 
        
           |  |  | 108 | 		projetsCombo.getCombo().setValidator(new Validator() {
 | 
        
           | 1077 | jpm | 109 | 			public String validate(Field<?> champ, String valeurAValider) {
 | 
        
           | 999 | jpm | 110 | 				String retour = null;
 | 
        
           | 1077 | jpm | 111 | 				if (UtilString.isEmpty(valeurAValider)
 | 
        
           | 1329 | cyprien | 112 | 						|| projetsCombo.getStore().findModel("cpr_nom", valeurAValider) == null) {
 | 
        
           | 1077 | jpm | 113 | 					champ.setValue(null);
 | 
        
           |  |  | 114 | 					retour = i18nC.selectionnerValeur();
 | 
        
           | 999 | jpm | 115 | 				}
 | 
        
           | 1589 | aurelien | 116 | 				if(retour == null) {
 | 
        
           |  |  | 117 | 					projetsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE_OK);
 | 
        
           |  |  | 118 | 					projetsCombo.getCombo().removeStyleName(ComposantClass.OBLIGATOIRE);
 | 
        
           |  |  | 119 | 				} else {
 | 
        
           |  |  | 120 | 					projetsCombo.getCombo().removeStyleName(ComposantClass.OBLIGATOIRE_OK);
 | 
        
           |  |  | 121 | 					projetsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
 | 
        
           |  |  | 122 | 				}
 | 
        
           | 999 | jpm | 123 | 				return retour;
 | 
        
           |  |  | 124 | 			}
 | 
        
           |  |  | 125 | 		});
 | 
        
           | 1589 | aurelien | 126 | 		projetsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
 | 
        
           | 1329 | cyprien | 127 |   | 
        
           | 999 | jpm | 128 | 		panneauFormulaire.add(projetsCombo, new FormData(450, 0));
 | 
        
           |  |  | 129 |   | 
        
           | 985 | jpm | 130 | 		titreChp = new TextField<String>();
 | 
        
           | 989 | jpm | 131 | 		titreChp.setFieldLabel(i18nC.commentaireTitre());
 | 
        
           | 1077 | jpm | 132 | 		titreChp.setAllowBlank(false);
 | 
        
           | 985 | jpm | 133 | 		titreChp.addStyleName(ComposantClass.OBLIGATOIRE);
 | 
        
           |  |  | 134 | 		titreChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
 | 
        
           | 1077 | jpm | 135 | 		titreChp.addListener(Events.Invalid, creerEcouteurChampObligatoire());
 | 
        
           | 989 | jpm | 136 | 		panneauFormulaire.add(titreChp, new FormData(450, 0));
 | 
        
           | 985 | jpm | 137 |   | 
        
           | 989 | jpm | 138 | 		texteChp = new TextArea();
 | 
        
           |  |  | 139 | 		texteChp.setFieldLabel(i18nC.commentaireTexte());
 | 
        
           |  |  | 140 | 		panneauFormulaire.add(texteChp, new FormData(450, 250));
 | 
        
           | 985 | jpm | 141 |   | 
        
           | 989 | jpm | 142 | 		ponderationChp = new ChampSliderPourcentage(i18nC.commentairePonderation());
 | 
        
           |  |  | 143 | 		panneauFormulaire.add(ponderationChp, new FormData(450, 0));
 | 
        
           |  |  | 144 |   | 
        
           |  |  | 145 | 		publicChp = new CheckBox();
 | 
        
           |  |  | 146 | 		publicChp.setFieldLabel(i18nC.donneePublic());
 | 
        
           |  |  | 147 | 		panneauFormulaire.add(publicChp, new FormData(50, 0));
 | 
        
           | 985 | jpm | 148 | 	}
 | 
        
           |  |  | 149 |   | 
        
           |  |  | 150 | 	public void rafraichir(Object nouvellesDonnees) {
 | 
        
           | 989 | jpm | 151 | 		if (nouvellesDonnees instanceof Commentaire) {
 | 
        
           | 985 | jpm | 152 | 			// Si on a reçu les details d'une publication
 | 
        
           | 989 | jpm | 153 | 			rafraichirCommentaire((Commentaire) nouvellesDonnees);
 | 
        
           | 985 | jpm | 154 | 		} else if (nouvellesDonnees instanceof Information) {
 | 
        
           |  |  | 155 | 			rafraichirInformation((Information) nouvellesDonnees);
 | 
        
           |  |  | 156 | 		} else {
 | 
        
           | 989 | jpm | 157 | 			Debug.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()));
 | 
        
           | 985 | jpm | 158 | 		}
 | 
        
           |  |  | 159 |   | 
        
           |  |  | 160 | 		if (etreValide()) {
 | 
        
           |  |  | 161 | 			initialiserValidation();
 | 
        
           |  |  | 162 | 			repandreRafraichissement();
 | 
        
           | 1239 | cyprien | 163 | 			controlerFermeture();
 | 
        
           | 985 | jpm | 164 | 		}
 | 
        
           |  |  | 165 | 	}
 | 
        
           |  |  | 166 |   | 
        
           | 989 | jpm | 167 | 	private void rafraichirCommentaire(Commentaire commentaireRecu) {
 | 
        
           |  |  | 168 | 		commentaire = commentaireRecu;
 | 
        
           | 985 | jpm | 169 | 		peuplerFormulaire();
 | 
        
           | 1100 | jpm | 170 | 		genererTitreFormulaire();
 | 
        
           | 985 | jpm | 171 | 	}
 | 
        
           |  |  | 172 |   | 
        
           | 999 | jpm | 173 | 	private String getValeurComboProjets() {
 | 
        
           |  |  | 174 | 		String valeur = "";
 | 
        
           | 1329 | cyprien | 175 | 		if (projetsCombo.getCombo().getValue() != null && projetsCombo.getCombo().isValid()) {
 | 
        
           |  |  | 176 | 			Projet projet = new Projet (projetsCombo.getValeur());
 | 
        
           |  |  | 177 | 			valeur = projet.getId();
 | 
        
           | 999 | jpm | 178 | 		}
 | 
        
           |  |  | 179 | 		return valeur;
 | 
        
           |  |  | 180 | 	}
 | 
        
           | 1468 | jpm | 181 |   | 
        
           | 999 | jpm | 182 | 	private void setValeurComboProjets() {
 | 
        
           | 1468 | jpm | 183 | 		if (mode.equals(Formulaire.MODE_MODIFIER)) {
 | 
        
           |  |  | 184 | 			if (projetsCombo.getCombo().getStore() != null
 | 
        
           |  |  | 185 | 					&& commentaire != null
 | 
        
           |  |  | 186 | 					&& commentaire.getIdProjet() != null
 | 
        
           |  |  | 187 | 					&& !UtilString.isEmpty(commentaire.getIdProjet())) {
 | 
        
           |  |  | 188 | 				projetsCombo.chargerValeurInitiale(commentaire.getIdProjet(), "cpr_id_projet");
 | 
        
           |  |  | 189 | 			} else {
 | 
        
           |  |  | 190 | 				projetsCombo.getCombo().setValue(null);
 | 
        
           | 999 | jpm | 191 | 			}
 | 
        
           | 1468 | jpm | 192 | 		} else if (mode.equals(Formulaire.MODE_AJOUTER)) {
 | 
        
           |  |  | 193 | 			if (projetsCombo.getCombo().getStore() != null) {
 | 
        
           |  |  | 194 | 				projetsCombo.chargerValeurInitiale(mediateur.getProjetId(), "cpr_id_projet");
 | 
        
           |  |  | 195 | 			} else {
 | 
        
           |  |  | 196 | 				projetsCombo.getCombo().setValue(null);
 | 
        
           |  |  | 197 | 			}
 | 
        
           | 999 | jpm | 198 | 		}
 | 
        
           |  |  | 199 | 	}
 | 
        
           |  |  | 200 |   | 
        
           | 985 | jpm | 201 | 	private void rafraichirInformation(Information info) {
 | 
        
           | 1099 | jpm | 202 | 		// Gestion des messages d'erreur
 | 
        
           |  |  | 203 | 		if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
 | 
        
           |  |  | 204 | 			Debug.log("MESSAGES:\n"+info.getMessages().toString());
 | 
        
           |  |  | 205 | 		}
 | 
        
           |  |  | 206 |   | 
        
           |  |  | 207 | 		// Gestion des actions
 | 
        
           | 989 | jpm | 208 | 		String type = info.getType();
 | 
        
           |  |  | 209 | 		if (type.equals("ajout_commentaire") || type.equals("modif_commentaire")) {
 | 
        
           |  |  | 210 | 			commentaireValideOk = true;
 | 
        
           | 985 | jpm | 211 | 		}
 | 
        
           | 1099 | jpm | 212 | 		if (info.getType().equals("ajout_commentaire")) {
 | 
        
           |  |  | 213 | 				String noteId = (String) info.getDonnee(0);
 | 
        
           |  |  | 214 | 				commentaire.setId(noteId);
 | 
        
           | 1617 | aurelien | 215 | 				this.mode = MODE_MODIFIER;
 | 
        
           | 1099 | jpm | 216 | 		}
 | 
        
           |  |  | 217 |   | 
        
           |  |  | 218 | 		// Gestion des messages
 | 
        
           |  |  | 219 | 		if (info.getType().equals("modif_commentaire")) {
 | 
        
           | 1239 | cyprien | 220 | 			InfoLogger.display("Modification d'une note", info.toString());
 | 
        
           | 1099 | jpm | 221 | 		} else if (info.getType().equals("ajout_commentaire")) {
 | 
        
           |  |  | 222 | 			if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
 | 
        
           |  |  | 223 | 				String noteId = (String) info.getDonnee(0);
 | 
        
           | 1239 | cyprien | 224 | 				InfoLogger.display("Ajout d'une note", "La note '"+noteId+"' a bien été ajoutée");
 | 
        
           | 1099 | jpm | 225 | 			} else {
 | 
        
           | 1239 | cyprien | 226 | 				InfoLogger.display("Ajout d'une note", info.toString());
 | 
        
           | 1099 | jpm | 227 | 			}
 | 
        
           |  |  | 228 | 		}
 | 
        
           | 985 | jpm | 229 | 	}
 | 
        
           |  |  | 230 |   | 
        
           |  |  | 231 | 	private Boolean etreValide() {
 | 
        
           |  |  | 232 | 		Boolean valide = false;
 | 
        
           | 989 | jpm | 233 | 		if (formulaireValideOk && commentaireValideOk) {
 | 
        
           | 985 | jpm | 234 | 			valide = true;
 | 
        
           |  |  | 235 | 		}
 | 
        
           |  |  | 236 | 		return valide;
 | 
        
           |  |  | 237 | 	}
 | 
        
           |  |  | 238 |   | 
        
           |  |  | 239 | 	private void initialiserValidation() {
 | 
        
           |  |  | 240 | 		formulaireValideOk = false;
 | 
        
           | 989 | jpm | 241 | 		commentaireValideOk = false;
 | 
        
           | 985 | jpm | 242 | 	}
 | 
        
           |  |  | 243 |   | 
        
           |  |  | 244 | 	private void repandreRafraichissement() {
 | 
        
           |  |  | 245 | 		if (vueExterneARafraichirApresValidation != null) {
 | 
        
           | 989 | jpm | 246 | 			String type = "commentaire_modifiee";
 | 
        
           | 985 | jpm | 247 | 			if (mode.equals(Formulaire.MODE_AJOUTER)) {
 | 
        
           | 989 | jpm | 248 | 				type = "commentaire_ajoutee";
 | 
        
           | 985 | jpm | 249 | 			}
 | 
        
           |  |  | 250 | 			Information info = new Information(type);
 | 
        
           | 989 | jpm | 251 | 			info.setDonnee(0, commentaire);
 | 
        
           | 985 | jpm | 252 | 			vueExterneARafraichirApresValidation.rafraichir(info);
 | 
        
           |  |  | 253 | 		}
 | 
        
           |  |  | 254 | 	}
 | 
        
           |  |  | 255 |   | 
        
           |  |  | 256 | 	public boolean soumettreFormulaire() {
 | 
        
           |  |  | 257 | 		formulaireValideOk = verifierFormulaire();
 | 
        
           |  |  | 258 | 		if (formulaireValideOk) {
 | 
        
           | 989 | jpm | 259 | 			soumettreCommentaire();
 | 
        
           | 985 | jpm | 260 | 		}
 | 
        
           |  |  | 261 | 		return formulaireValideOk;
 | 
        
           |  |  | 262 | 	}
 | 
        
           |  |  | 263 |   | 
        
           | 989 | jpm | 264 | 	private void soumettreCommentaire() {
 | 
        
           |  |  | 265 | 		Commentaire commentaireCollectee = collecterCommentaire();
 | 
        
           |  |  | 266 | 		if (commentaireCollectee != null) {
 | 
        
           | 985 | jpm | 267 | 			if (mode.equals(Formulaire.MODE_AJOUTER)) {
 | 
        
           | 989 | jpm | 268 | 				mediateur.ajouterCommentaire(this, commentaireCollectee);
 | 
        
           | 985 | jpm | 269 | 			} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
 | 
        
           | 989 | jpm | 270 | 				mediateur.modifierCommentaire(this, commentaireCollectee);
 | 
        
           | 985 | jpm | 271 | 			}
 | 
        
           | 1617 | aurelien | 272 | 		} else {
 | 
        
           |  |  | 273 | 			if(clicBoutonvalidation) {
 | 
        
           |  |  | 274 | 				fermerFormulaire();
 | 
        
           |  |  | 275 | 			}
 | 
        
           | 985 | jpm | 276 | 		}
 | 
        
           |  |  | 277 | 	}
 | 
        
           |  |  | 278 |   | 
        
           |  |  | 279 | 	public boolean verifierFormulaire() {
 | 
        
           |  |  | 280 | 		boolean valide = true;
 | 
        
           |  |  | 281 | 		ArrayList<String> messages = new ArrayList<String>();
 | 
        
           |  |  | 282 |   | 
        
           |  |  | 283 | 		String titre = titreChp.getValue();
 | 
        
           |  |  | 284 | 		if (titre == null || titre.equals("")) {
 | 
        
           | 989 | jpm | 285 | 			messages.add(i18nC.commentaireMessageTitre());
 | 
        
           | 985 | jpm | 286 | 		}
 | 
        
           |  |  | 287 |   | 
        
           | 1077 | jpm | 288 | 		if (UtilString.isEmpty(getValeurComboProjets())) {
 | 
        
           |  |  | 289 | 			String selectionDe = i18nC.articleUn()+" "+i18nC.projetSingulier();
 | 
        
           |  |  | 290 | 			String pour = i18nC.articleLa()+" "+i18nC.commentaireSingulier();
 | 
        
           |  |  | 291 | 			messages.add(i18nM.selectionObligatoire(selectionDe, pour));
 | 
        
           |  |  | 292 | 		}
 | 
        
           |  |  | 293 |   | 
        
           | 985 | jpm | 294 | 		if (messages.size() != 0) {
 | 
        
           |  |  | 295 | 			String[] tableauDeMessages = {};
 | 
        
           |  |  | 296 | 			tableauDeMessages = messages.toArray(tableauDeMessages);
 | 
        
           | 989 | jpm | 297 | 			MessageBox.alert(i18nC.erreurSaisieTitre(), UtilArray.implode(tableauDeMessages, "<br />"), null);
 | 
        
           | 985 | jpm | 298 | 			valide = false;
 | 
        
           |  |  | 299 | 		}
 | 
        
           |  |  | 300 | 		return valide;
 | 
        
           |  |  | 301 | 	}
 | 
        
           |  |  | 302 |   | 
        
           |  |  | 303 | 	private void peuplerFormulaire() {
 | 
        
           | 999 | jpm | 304 | 		setValeurComboProjets();
 | 
        
           | 989 | jpm | 305 | 		titreChp.setValue(commentaire.getTitre());
 | 
        
           |  |  | 306 | 		texteChp.setValue(commentaire.getTexte());
 | 
        
           |  |  | 307 | 		ponderationChp.peupler(commentaire.getPonderation());
 | 
        
           |  |  | 308 | 		boolean acces = (commentaire.etrePublic() ? true : false);
 | 
        
           |  |  | 309 | 		publicChp.setValue(acces);
 | 
        
           | 985 | jpm | 310 | 	}
 | 
        
           |  |  | 311 |   | 
        
           | 989 | jpm | 312 | 	private Commentaire collecterCommentaire() {
 | 
        
           |  |  | 313 | 		Commentaire commentaireCollectee = (Commentaire) commentaire.cloner(new Commentaire());
 | 
        
           | 985 | jpm | 314 |   | 
        
           | 999 | jpm | 315 | 		commentaireCollectee.setIdProjet(getValeurComboProjets());
 | 
        
           |  |  | 316 |   | 
        
           | 985 | jpm | 317 | 		String titre = titreChp.getValue();
 | 
        
           | 989 | jpm | 318 | 		commentaireCollectee.setTitre(titre);
 | 
        
           | 985 | jpm | 319 |   | 
        
           | 989 | jpm | 320 | 		String texte = texteChp.getValue();
 | 
        
           |  |  | 321 | 		commentaireCollectee.setTexte(texte);
 | 
        
           | 985 | jpm | 322 |   | 
        
           | 989 | jpm | 323 | 		String ponderation = ponderationChp.getValeur();
 | 
        
           |  |  | 324 | 		commentaireCollectee.setPonderation(ponderation);
 | 
        
           | 985 | jpm | 325 |   | 
        
           | 989 | jpm | 326 | 		String acces = (publicChp.getValue() ? "1" : "0");
 | 
        
           |  |  | 327 | 		commentaireCollectee.setPublic(acces);
 | 
        
           | 985 | jpm | 328 |   | 
        
           | 989 | jpm | 329 | 		Commentaire commentaireARetourner = null;
 | 
        
           |  |  | 330 | 		if (!commentaireCollectee.comparer(commentaire)) {
 | 
        
           |  |  | 331 | 			commentaireARetourner = commentaire = commentaireCollectee;
 | 
        
           | 985 | jpm | 332 | 		}
 | 
        
           | 989 | jpm | 333 | 		return commentaireARetourner;
 | 
        
           | 985 | jpm | 334 | 	}
 | 
        
           | 1661 | raphael | 335 | }
 |