Subversion Repositories eFlore/Applications.coel

Rev

Rev 907 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
877 aurelien 1
package org.tela_botanica.client.vues;
2
 
3
import java.util.ArrayList;
4
import java.util.Iterator;
5
import java.util.List;
6
 
7
import org.tela_botanica.client.Mediateur;
907 jpm 8
import org.tela_botanica.client.configuration.Configuration;
878 aurelien 9
import org.tela_botanica.client.i18n.Constantes;
877 aurelien 10
import org.tela_botanica.client.images.Images;
11
import org.tela_botanica.client.interfaces.Rafraichissable;
12
import org.tela_botanica.client.modeles.Information;
13
import org.tela_botanica.client.modeles.MenuApplicationId;
14
import org.tela_botanica.client.modeles.Personne;
15
import org.tela_botanica.client.modeles.PersonneListe;
16
import org.tela_botanica.client.modeles.Projet;
17
import org.tela_botanica.client.modeles.Structure;
18
import org.tela_botanica.client.modeles.StructureListe;
878 aurelien 19
import org.tela_botanica.client.modeles.Valeur;
20
import org.tela_botanica.client.modeles.ValeurListe;
877 aurelien 21
import org.tela_botanica.client.util.Pattern;
22
import org.tela_botanica.client.util.UtilArray;
23
 
878 aurelien 24
import com.extjs.gxt.ui.client.Style.SortDir;
877 aurelien 25
import com.extjs.gxt.ui.client.event.ButtonEvent;
26
import com.extjs.gxt.ui.client.event.SelectionListener;
27
import com.extjs.gxt.ui.client.store.ListStore;
28
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
29
import com.extjs.gxt.ui.client.widget.LayoutContainer;
30
import com.extjs.gxt.ui.client.widget.MessageBox;
31
import com.extjs.gxt.ui.client.widget.button.Button;
32
import com.extjs.gxt.ui.client.widget.form.CheckBox;
33
import com.extjs.gxt.ui.client.widget.form.ComboBox;
886 aurelien 34
import com.extjs.gxt.ui.client.widget.form.Field;
877 aurelien 35
import com.extjs.gxt.ui.client.widget.form.FieldSet;
36
import com.extjs.gxt.ui.client.widget.form.TextArea;
37
import com.extjs.gxt.ui.client.widget.form.TextField;
38
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
39
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
40
import com.extjs.gxt.ui.client.widget.layout.FormData;
41
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
42
import com.google.gwt.core.client.GWT;
878 aurelien 43
import com.google.gwt.user.client.Window;
877 aurelien 44
 
45
 
46
public class ProjetForm extends Formulaire implements Rafraichissable {
47
 
48
	private Projet projet;
878 aurelien 49
 
50
	private String listeValeurIndexationDureeId = "dureesIndexation";
51
	private int listeValeurIndexationDureeInt = 1072;
52
	private String listeValeurIndexationFrequenceId = "frequencesIndexation";
53
	private int listeValeurIndexationFrequenceInt = 1073;
887 aurelien 54
	private String listeLanguesId = "langues";
55
	private int listeLanguesInt = 1071;
878 aurelien 56
 
57
	private ListStore<Valeur> listeIndexationDuree = null;
58
	private ListStore<Valeur> listeIndexationFrequence = null;
887 aurelien 59
	private ListStore<Valeur> listeLangue = null;
878 aurelien 60
 
887 aurelien 61
	private ValeurListe valeurListeIndexationDuree = null;
62
	private ValeurListe valeurListeIndexationFrequence = null;
63
	private ValeurListe valeurListeLangue = null;
64
 
908 aurelien 65
	private boolean listeIndexationDureeChargee = false;
66
	private boolean listeIndexationFrequenceChargee = false;
67
	private boolean listeLangueChargee = false;
68
 
69
 
877 aurelien 70
	private FieldSet generalitesFieldset = null;
71
	private TextField<String> nomChp = null;
72
	private TextField<String> abreviationChp = null;
886 aurelien 73
	private TextArea descriptionChp = null;
877 aurelien 74
	private TextArea resumeChp = null;
75
	private TextField<String> urlChp = null;
76
 
77
	private FieldSet complementFieldset = null;
78
	private TextField<String> motsClesChp = null;
79
	private TextField<String> citationChp = null;
80
	private TextField<String> licenceChp = null;
887 aurelien 81
	private ComboBox<Valeur> langueChp = null;
877 aurelien 82
	private CheckBox markPublicChp = null;
83
 
84
	private FieldSet indexationFieldset = null;
85
	private TextField<String> indexationHeureChp = null;
878 aurelien 86
	private ComboBox<Valeur> indexationDureeChp = null;
87
	private ComboBox<Valeur> indexationFrequenceChp = null;
877 aurelien 88
 
89
	private boolean formulaireValideOk = false;
90
	private boolean projetValideOk = false;
91
 
92
	private Rafraichissable vueExterneARafraichirApresValidation = null;
93
 
94
 
95
	public ProjetForm(Mediateur mediateurCourrant, String projetId) {
96
		initialiserProjetForm(mediateurCourrant, projetId);
97
	}
98
 
99
	public ProjetForm(Mediateur mediateurCourrant, String projetId, Rafraichissable vueARafraichirApresValidation) {
100
		vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
101
		initialiserProjetForm(mediateurCourrant, projetId);
102
	}
103
 
878 aurelien 104
	private void initialiserProjetForm(Mediateur mediateurCourant, String projetId) {
877 aurelien 105
		projet = new Projet();
106
		projet.setId(projetId);
107
 
108
		String modeDeCreation = (projet.getId().isEmpty() ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
878 aurelien 109
		initialiserFormulaire(mediateurCourant, modeDeCreation, MenuApplicationId.PROJET);
877 aurelien 110
 
111
		panneauFormulaire.setLayout(new FlowLayout());
112
		String titre = genererTitreFormulaire();
113
		panneauFormulaire.setHeading(titre);
114
 
115
		creerZoneGeneralites();
116
		panneauFormulaire.add(generalitesFieldset);
117
 
118
		creerZoneComplement();
119
		panneauFormulaire.add(complementFieldset);
120
 
121
		creerZoneIndexation();
122
		panneauFormulaire.add(indexationFieldset);
123
 
886 aurelien 124
		creerTabIndex();
125
 
877 aurelien 126
		if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
878 aurelien 127
			mediateurCourant.selectionnerProjet(this, projetId);
877 aurelien 128
		}
908 aurelien 129
 
878 aurelien 130
		mediateurCourant.obtenirListeValeurEtRafraichir(this, listeValeurIndexationDureeId);
131
		mediateurCourant.obtenirListeValeurEtRafraichir(this, listeValeurIndexationFrequenceId);
887 aurelien 132
		mediateurCourant.obtenirListeValeurEtRafraichir(this, listeLanguesId);
877 aurelien 133
	}
134
 
135
	private String genererTitreFormulaire() {
887 aurelien 136
		String titre = "Ajout d'un projet";
877 aurelien 137
		if (mode.equals(Formulaire.MODE_MODIFIER)) {
878 aurelien 138
			 titre = "Modification d'un projet - "+i18nC.id()+": "+projet.getId();
877 aurelien 139
		}
140
		return titre;
141
	}
142
 
143
	private void creerZoneGeneralites() {
144
		FormLayout layout = new FormLayout();
145
		layout.setLabelWidth(100);
146
 
147
		// Fieldset Infos Générales
148
		generalitesFieldset = new FieldSet();
149
		generalitesFieldset.setHeading("Informations générales");
150
		generalitesFieldset.setCollapsible(true);
151
		generalitesFieldset.setLayout(layout);
152
 
153
		nomChp = new TextField<String>();
154
		nomChp.setName("cpu");
155
		nomChp.setFieldLabel("Nom");
156
		generalitesFieldset.add(nomChp, new FormData(450, 0));
157
 
158
		abreviationChp = new TextField<String>();
159
		abreviationChp.setFieldLabel("Abréviation");
160
		generalitesFieldset.add(abreviationChp, new FormData(450, 0));
161
 
886 aurelien 162
		descriptionChp = new TextArea();
877 aurelien 163
		descriptionChp.setFieldLabel("Description");
164
		generalitesFieldset.add(descriptionChp, new FormData(450, 0));
165
 
166
		resumeChp = new TextArea();
167
		resumeChp.setFieldLabel("Résumé");
168
		generalitesFieldset.add(resumeChp, new FormData(450, 0));
169
 
170
		urlChp = new TextField<String>();
171
		urlChp.setFieldLabel("URL du projet");
172
		generalitesFieldset.add(urlChp, new FormData(450, 0));
173
	}
174
 
175
	private void creerZoneComplement() {
176
		FormLayout layout = new FormLayout();
177
		layout.setLabelWidth(100);
178
 
179
		// Fieldset Edition
180
		complementFieldset = new FieldSet();
181
		complementFieldset.setHeading("Informations complémentaires");
182
		complementFieldset.setCollapsible(true);
183
		complementFieldset.setLayout(layout);
184
 
185
		motsClesChp = new TextField<String>();
186
		motsClesChp.setFieldLabel("Mots Clés");
187
 
188
		complementFieldset.add(motsClesChp);
189
 
190
		citationChp = new TextField<String>();
191
		citationChp.setFieldLabel("Citation");
192
 
193
		complementFieldset.add(citationChp);
194
 
195
		licenceChp = new TextField<String>();
196
		licenceChp.setFieldLabel("Licence");
197
 
198
		complementFieldset.add(licenceChp);
199
 
887 aurelien 200
		listeLangue = new ListStore<Valeur>();
201
		langueChp = new ComboBox<Valeur>();
202
		langueChp.setStore(listeLangue);
203
		langueChp.setDisplayField("nom");
204
		langueChp.setEditable(true);
205
		langueChp.setForceSelection(true);
206
		langueChp.setTypeAhead(true);
207
		langueChp.setFieldLabel("Langue");
208
 
209
		complementFieldset.add(langueChp);
210
 
877 aurelien 211
		markPublicChp = new CheckBox();
212
		markPublicChp.setFieldLabel("Public");
213
 
214
		complementFieldset.add(markPublicChp);
215
	}
216
 
217
	private void creerZoneIndexation() {
218
		FormLayout layout = new FormLayout();
219
		layout.setLabelWidth(100);
220
 
221
		// Fieldset Edition
222
		indexationFieldset = new FieldSet();
223
		indexationFieldset.setHeading("Indexation");
224
		indexationFieldset.setCollapsible(true);
225
		indexationFieldset.setLayout(layout);
226
 
227
		indexationHeureChp = new TextField<String>();
878 aurelien 228
		indexationHeureChp.setFieldLabel(i18nC.projetIndexationHeure());
877 aurelien 229
 
230
		indexationFieldset.add(indexationHeureChp, new FormData(80, 0));
231
 
878 aurelien 232
		// liste 1073
233
		listeIndexationFrequence = new ListStore<Valeur>();
234
		indexationFrequenceChp = new ComboBox<Valeur>();
235
		indexationFrequenceChp.setStore(listeIndexationFrequence);
236
		indexationFrequenceChp.setDisplayField("nom");
887 aurelien 237
		indexationFrequenceChp.setEditable(true);
238
		indexationFrequenceChp.setForceSelection(true);
239
		indexationFrequenceChp.setTypeAhead(true);
878 aurelien 240
		indexationFrequenceChp.setFieldLabel(i18nC.projetIndexationFrequence());
241
 
242
		indexationFieldset.add(indexationFrequenceChp, new FormData(120, 0));
243
 
877 aurelien 244
		// liste 1072
878 aurelien 245
		listeIndexationDuree = new ListStore<Valeur>();
246
		indexationDureeChp = new ComboBox<Valeur>();
247
		indexationDureeChp.setStore(listeIndexationDuree);
248
		indexationDureeChp.setDisplayField("nom");
887 aurelien 249
		indexationDureeChp.setEditable(true);
250
		indexationDureeChp.setForceSelection(true);
251
		indexationDureeChp.setTypeAhead(true);
878 aurelien 252
		indexationDureeChp.setFieldLabel(i18nC.projetIndexationDuree());
877 aurelien 253
 
254
		indexationFieldset.add(indexationDureeChp, new FormData(80, 0));
255
 
256
	}
886 aurelien 257
 
258
	private void creerTabIndex() {
259
 
887 aurelien 260
		nomChp.setTabIndex(1);
261
		abreviationChp.setTabIndex(2);
262
		descriptionChp.setTabIndex(3);
263
		resumeChp.setTabIndex(4);
264
		urlChp.setTabIndex(5);
886 aurelien 265
 
266
		motsClesChp.setTabIndex(6);
267
		citationChp.setTabIndex(7);
268
		licenceChp.setTabIndex(8);
887 aurelien 269
		langueChp.setTabIndex(9);
270
		markPublicChp.setTabIndex(10);
886 aurelien 271
 
887 aurelien 272
		indexationHeureChp.setTabIndex(11);
273
		indexationFrequenceChp.setTabIndex(12);
274
		indexationDureeChp.setTabIndex(13);
886 aurelien 275
 
276
		nomChp.focus();
277
	}
877 aurelien 278
 
279
	public void rafraichir(Object nouvellesDonnees) {
280
		if (nouvellesDonnees instanceof Projet) {
281
			// Si on a reçu les details d'une projet
282
			rafraichirProjet((Projet) nouvellesDonnees);
878 aurelien 283
			GWT.log("Un projet est arrivé : "+((Projet) nouvellesDonnees).getNom(), null);
877 aurelien 284
		}
285
 
878 aurelien 286
		if(nouvellesDonnees instanceof ValeurListe) {
287
			ValeurListe nValeurListe = (ValeurListe)nouvellesDonnees;
288
 
289
			if(nValeurListe.getId() == listeValeurIndexationDureeInt) {
887 aurelien 290
 
291
				valeurListeIndexationDuree = nValeurListe;
292
 
878 aurelien 293
				for(Iterator<String> it  = nValeurListe.keySet().iterator(); it.hasNext();) {
294
					listeIndexationDuree.add(nValeurListe.get(it.next()));
295
					listeIndexationDuree.sort("id_valeur", SortDir.ASC);
296
				}
887 aurelien 297
 
908 aurelien 298
				listeIndexationDureeChargee = true;
299
 
887 aurelien 300
				if(mode.equals(MODE_MODIFIER)) {
902 aurelien 301
					if(valeurListeIndexationDuree.get(projet.getIndexationDuree()) != null) {
908 aurelien 302
						indexationDureeChp.setValue(valeurListeIndexationDuree.get(projet.getIndexationDuree()));
303
						indexationDureeChp.validate();
902 aurelien 304
					}
887 aurelien 305
				}
306
 
307
				indexationDureeChp.expand();
878 aurelien 308
 
309
			}
310
 
311
			if(nValeurListe.getId() == listeValeurIndexationFrequenceInt) {
887 aurelien 312
 
313
				valeurListeIndexationFrequence = nValeurListe;
314
 
878 aurelien 315
				for(Iterator<String> it  = nValeurListe.keySet().iterator(); it.hasNext();) {
316
					listeIndexationFrequence.add(nValeurListe.get(it.next()));
317
					listeIndexationFrequence.sort("id_valeur", SortDir.ASC);
318
				}
887 aurelien 319
 
908 aurelien 320
				listeIndexationFrequenceChargee = true;
321
 
887 aurelien 322
				if(mode.equals(MODE_MODIFIER)) {
902 aurelien 323
					if(valeurListeIndexationFrequence.get(projet.getIndexationFreq()) != null) {
908 aurelien 324
						indexationFrequenceChp.setValue(valeurListeIndexationFrequence.get(projet.getIndexationFreq()));
325
						indexationFrequenceChp.validate();
902 aurelien 326
					}
887 aurelien 327
				}
328
 
329
				indexationFrequenceChp.expand();
878 aurelien 330
			}
887 aurelien 331
 
332
			if(nValeurListe.getId() == listeLanguesInt) {
333
 
334
				valeurListeLangue = nValeurListe;
335
 
336
				for(Iterator<String> it  = nValeurListe.keySet().iterator(); it.hasNext();) {
337
					listeLangue.add(nValeurListe.get(it.next()));
338
					listeLangue.sort("id_valeur", SortDir.ASC);
339
				}
340
 
908 aurelien 341
				listeLangueChargee = true;
342
 
887 aurelien 343
				if(mode.equals(MODE_MODIFIER)) {
902 aurelien 344
					if(valeurListeLangue.get(projet.getLangue()) != null) {
908 aurelien 345
						langueChp.setValue(valeurListeLangue.get(projet.getLangue()));
346
						langueChp.validate();
902 aurelien 347
					}
887 aurelien 348
				}
349
			}
350
 
351
			GWT.log("une liste de valeurs est arrivée "+nValeurListe.getId(), null);
878 aurelien 352
		}
353
 
877 aurelien 354
		if (etreValide()) {
355
			initialiserValidation();
356
			repandreRafraichissement();
357
			controlerFermetureApresRafraichissement();
358
		}
359
	}
360
 
361
	private void rafraichirProjet(Projet proj) {
362
		projet = proj;
363
		peuplerFormulaire();
364
	}
365
 
366
	private Boolean etreValide() {
367
		Boolean valide = false;
368
		GWT.log("formulaire"+formulaireValideOk+" - Projet :"+projetValideOk, null);
369
		if (formulaireValideOk && projetValideOk) {
370
			valide = true;
371
		}
372
		return valide;
373
	}
374
 
375
	private void initialiserValidation() {
376
		formulaireValideOk = false;
377
		projetValideOk = false;
378
	}
379
 
380
	private void repandreRafraichissement() {
381
		if (vueExterneARafraichirApresValidation != null) {
878 aurelien 382
			String type = "projet_modifie";
877 aurelien 383
			if (mode.equals(Formulaire.MODE_AJOUTER)) {
878 aurelien 384
				type = "projet_ajoute";
877 aurelien 385
			}
386
			Information info = new Information(type);
387
			info.setDonnee(0, projet);
388
			vueExterneARafraichirApresValidation.rafraichir(info);
389
		}
390
	}
391
 
392
	public boolean soumettreFormulaire() {
393
		formulaireValideOk = verifierFormulaire();
394
		GWT.log("Form?"+formulaireValideOk, null);
395
		if (formulaireValideOk) {
396
			Projet projetCollecte = collecterProjet();
397
			if (projetCollecte != null) {
398
				GWT.log("Info collectée ? ok", null);
399
				if (mode.equals(Formulaire.MODE_AJOUTER)) {
400
					mediateur.ajouterProjet(this, projetCollecte);
401
				} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
402
					mediateur.modifierProjet(this, projetCollecte);
403
				}
404
			}
405
		}
406
		return formulaireValideOk;
407
	}
408
 
409
	protected boolean verifierFormulaire() {
410
		boolean valide = true;
411
		ArrayList<String> messages = new ArrayList<String>();
412
 
413
		String titre = nomChp.getValue();
414
		if (titre == null || titre.equals("")) {
415
			messages.add("Veuillez saisir le nom du projet !");
416
		}
417
 
886 aurelien 418
		String abr = abreviationChp.getValue();
419
		if (abr == null || abr.equals("")) {
420
			messages.add("Veuillez saisir l'abréviation du projet !");
421
		}
422
 
423
		String desc = descriptionChp.getValue();
424
		if (desc == null || desc.equals("")) {
425
			messages.add("Veuillez saisir la description du projet !");
426
		}
427
 
428
		String resume = resumeChp.getValue();
429
		if (resume == null || resume.equals("")) {
430
			messages.add("Veuillez saisir le résumé du projet !");
431
		}
432
 
877 aurelien 433
		String uri = urlChp.getValue();
886 aurelien 434
		if (uri != null && ! uri.trim().isEmpty() && ! uri.matches(Pattern.url)) {
877 aurelien 435
			messages.add("L'URL saisie n'est pas valide !");
436
		}
437
 
886 aurelien 438
		String heure = indexationHeureChp.getValue();
887 aurelien 439
		if (heure != null && ! heure.isEmpty() && !heure.matches(Pattern.heureMinute)) {
440
			messages.add("L'heureMinute d'indexation saisie n'est pas valide !");
441
		} else {
442
			if(heure.matches(Pattern.heureMinute)) {
443
				heure += ":00";
444
			}
886 aurelien 445
		}
446
 
877 aurelien 447
		if (messages.size() != 0) {
448
			String[] tableauDeMessages = {};
449
			tableauDeMessages = messages.toArray(tableauDeMessages);
450
			MessageBox.alert("Erreurs de saisies", UtilArray.implode(tableauDeMessages, "<br />"), null);
451
			valide = false;
452
		}
453
		return valide;
454
	}
455
 
456
	private void peuplerFormulaire() {
457
 
878 aurelien 458
		nomChp.setValue(projet.getNom());
459
		abreviationChp.setValue(projet.getAbreviation());
460
		descriptionChp.setValue(projet.getDescription());
461
		resumeChp.setValue(projet.getResume());
462
		urlChp.setValue(projet.getUrl());
463
 
464
		motsClesChp.setValue(projet.getMotsCles());
465
		citationChp.setValue(projet.getCitation());
466
		licenceChp.setValue(projet.getLicence());
887 aurelien 467
 
468
		if(projet.getMarkPublic().equals("1")) {
469
			markPublicChp.setValue(true);
470
		} else {
471
			markPublicChp.setValue(false);
472
		}
878 aurelien 473
 
908 aurelien 474
		if(listeLangueChargee) {
475
 
476
			if(valeurListeLangue.get(projet.getLangue()) != null) {
477
				langueChp.setValue(valeurListeLangue.get(projet.getLangue()));
478
				langueChp.validate();
479
			}
480
		}
481
 
482
		if(listeIndexationFrequenceChargee) {
483
			if(valeurListeIndexationFrequence.get(projet.getIndexationFreq()) != null) {
484
				indexationFrequenceChp.setValue(valeurListeIndexationFrequence.get(projet.getIndexationFreq()));
485
				indexationFrequenceChp.validate();
486
			}
487
		}
488
 
489
		if(listeIndexationDureeChargee) {
490
			if(valeurListeIndexationDuree.get(projet.getIndexationDuree()) != null) {
491
				indexationDureeChp.setValue(valeurListeIndexationDuree.get(projet.getIndexationDuree()));
492
				indexationDureeChp.validate();
493
			}
494
		}
495
 
887 aurelien 496
		String[] heureTab = projet.getIndexationHeure().split(":");
902 aurelien 497
		if(heureTab.length > 1) {
498
			String heure = heureTab[0]+":"+heureTab[1];
499
			if(heure.matches(Pattern.heureMinute)) {
500
				indexationHeureChp.setValue(heure);
501
			}
887 aurelien 502
		}
878 aurelien 503
 
504
		doLayout(true);
505
 
877 aurelien 506
	}
507
 
508
	private Projet collecterProjet() {
887 aurelien 509
		Projet projetARetourner = new Projet();
510
		Projet projetCollecte = (Projet) projet.cloner(new Projet());
877 aurelien 511
 
887 aurelien 512
		projetARetourner.setNom(nomChp.getValue());
513
		projetARetourner.setAbreviation(abreviationChp.getValue());
514
		projetARetourner.setDescription(descriptionChp.getValue());
515
		projetARetourner.setResume(resumeChp.getValue());
516
		projetARetourner.setUrl(urlChp.getValue());
877 aurelien 517
 
887 aurelien 518
		projetARetourner.setMotsCles(motsClesChp.getValue());
519
		projetARetourner.setCitation(citationChp.getValue());
520
		projetARetourner.setLicence(licenceChp.getValue());
521
 
522
		if(markPublicChp.getValue()) {
523
			projetCollecte.setMarkPublic("1");
524
		} else {
525
			projetCollecte.setMarkPublic("0");
877 aurelien 526
		}
527
 
887 aurelien 528
		projetARetourner.setIndexationHeure(indexationHeureChp.getValue());
529
		projetARetourner.setIndexationDuree(indexationDureeChp.getValue().getId());
530
		projetARetourner.setIndexationFreq(indexationFrequenceChp.getValue().getId());
531
 
532
		if (!projetCollecte.comparer(projet)) {
533
			projetARetourner = projet = projetCollecte;
534
		}
535
 
536
		//GWT.log(projetARetourner.toString()+" "+projetARetourner., null)
537
 
877 aurelien 538
		return projetARetourner;
539
	}
540
 
541
	protected void reinitialiserFormulaire() {
542
		if (mode.equals(Formulaire.MODE_MODIFIER)) {
543
			mediateur.afficherFormProjet(projet.getId());
544
		} else {
545
			mediateur.afficherFormProjet(null);
546
		}
547
	}
548
 
549
	@Override
550
	protected SelectionListener<ButtonEvent> creerEcouteurValidation() {
551
		SelectionListener<ButtonEvent> ecouteur = new SelectionListener<ButtonEvent>() {
552
			@Override
553
			public void componentSelected(ButtonEvent ce) {
554
				String code = ((Button) ce.getComponent()).getData("code");
555
				if (code.equals(FormulaireBarreValidation.CODE_BOUTON_VALIDER)) {
556
					soumettreFormulaire();
557
					clicBoutonvalidation = true;
558
				} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_APPLIQUER)) {
559
					soumettreFormulaire();
560
				} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_ANNULER)) {
561
					mediateur.clicMenu(menuIdCourant);
562
				} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_REINITIALISER)) {
563
					reinitialiserFormulaire();
564
				}
565
			}
566
		};
567
 
568
		return ecouteur;
569
	}
908 aurelien 570
 
877 aurelien 571
}