Subversion Repositories eFlore/Applications.coel

Rev

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

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