Subversion Repositories eFlore/Applications.coel

Rev

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

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