Subversion Repositories eFlore/Applications.coel

Rev

Rev 1329 | Rev 1369 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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