Subversion Repositories eFlore/Applications.coel

Rev

Rev 1327 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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