Subversion Repositories eFlore/Applications.coel

Rev

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

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