Subversion Repositories eFlore/Applications.coel

Rev

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

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