Subversion Repositories eFlore/Applications.coel

Rev

Rev 1082 | Rev 1100 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1082 Rev 1099
Line 14... Line 14...
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;
Line 18... Line -...
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;
Line 62... Line 61...
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);
Line 64... Line 63...
64
		initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.COMMENTAIRE);
63
		initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.COMMENTAIRE);
65
		
64
		
66
		panneauFormulaire.setLayout(new FormLayout());
-
 
67
		String titre = genererTitreFormulaire();
-
 
68
		panneauFormulaire.setHeading(titre);
65
		panneauFormulaire.setLayout(new FormLayout());
Line 69... Line 66...
69
 
66
		genererTitreFormulaire();
70
		creerChamps();
67
		creerChamps();
71
 
68
 
72
		if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
69
		if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
Line 73... Line 70...
73
			mediateur.selectionnerCommentaire(this, commentaireId);
70
			mediateur.selectionnerCommentaire(this, commentaireId);
74
		}
71
		}
75
	}
72
	}
-
 
73
	
-
 
74
	private void genererTitreFormulaire() {
76
	
75
		String titre = i18nC.commentaireTitreFormAjout();
-
 
76
		if (mode.equals(Formulaire.MODE_MODIFIER)) {
77
	private String genererTitreFormulaire() {
77
			 titre = i18nC.commentaireTitreFormModif();
78
		String titre = i18nC.commentaireTitreFormAjout();
78
			 if (commentaire != null) {
79
		if (mode.equals(Formulaire.MODE_MODIFIER)) {
79
				 titre += " - "+i18nC.id()+": "+commentaire.getId();
Line 80... Line 80...
80
			 titre = i18nC.commentaireTitreFormModif()+" - "+i18nC.id()+": "+commentaire.getId();
80
			 }
81
		}
81
		}
82
		return titre;
82
		panneauFormulaire.setHeading(titre);
Line 172... Line 172...
172
			}
172
			}
173
		}
173
		}
174
	}
174
	}
Line 175... Line 175...
175
	
175
	
-
 
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
		
176
	private void rafraichirInformation(Information info) {
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")) {
-
 
185
			commentaireValideOk = true;
-
 
186
		}
-
 
187
		if (info.getType().equals("ajout_commentaire")) {
179
			commentaireValideOk = true;
188
			if (vueExterneARafraichirApresValidation != null) {
-
 
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());
180
			commentaire.setId((String) info.getDonnee(0));
203
			}
181
		}
204
		}
Line 182... Line 205...
182
	}
205
	}
183
 
206
 
Line 207... Line 230...
207
		}
230
		}
208
	}
231
	}
Line 209... Line 232...
209
	
232
	
210
	public boolean soumettreFormulaire() {
233
	public boolean soumettreFormulaire() {
211
		formulaireValideOk = verifierFormulaire();
-
 
212
		Debug.log("Form?"+formulaireValideOk);
234
		formulaireValideOk = verifierFormulaire();
213
		if (formulaireValideOk) {
235
		if (formulaireValideOk) {
214
			soumettreCommentaire();
236
			soumettreCommentaire();
215
		}
237
		}
216
		return formulaireValideOk;
238
		return formulaireValideOk;
Line 217... Line 239...
217
	}
239
	}
218
	
240
	
219
	private void soumettreCommentaire() {
241
	private void soumettreCommentaire() {
220
		Commentaire commentaireCollectee = collecterCommentaire();
-
 
221
		if (commentaireCollectee != null) {
242
		Commentaire commentaireCollectee = collecterCommentaire();
222
			Debug.log("Info public collectée ? ok");
243
		if (commentaireCollectee != null) {
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)) {
Line 239... Line 260...
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));
-
 
244
			Debug.log("Projet combo vide");
264
			messages.add(i18nM.selectionObligatoire(selectionDe, pour));
245
		}
-
 
Line 246... Line 265...
246
		Debug.log("Projet combo non vide : "+getValeurComboProjets());
265
		}
247
		
266
		
248
		if (messages.size() != 0) {
267
		if (messages.size() != 0) {
249
			String[] tableauDeMessages = {};
268
			String[] tableauDeMessages = {};