Subversion Repositories eFlore/Applications.coel

Rev

Rev 1080 | Rev 1102 | 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();
1080 gduche 299
		} else if (type.equals("ajout_projet") ) {
928 jpm 300
			if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
1094 jpm 301
				projetValideOk = true;
928 jpm 302
				String projetId = (String) info.getDonnee(0);
1094 jpm 303
				if (vueExterneARafraichirApresValidation != null) {
304
					projet.setId(projetId);
305
				}
928 jpm 306
			}
307
		}
308
 
309
		// Gestion des messages
310
		if (type.equals("selection_projet")) {
311
			Info.display(i18nC.projetTitreFormModif(), info.toString());
312
		} else if (type.equals("modif_projet")) {
313
			Info.display(i18nC.projetTitreFormModif(), info.toString());
314
		} else if (type.equals("ajout_projet")) {
1094 jpm 315
			if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
316
				String projetId = (String) info.getDonnee(0);
317
				Info.display(i18nC.projetTitreFormAjout(), "Le projet '"+projetId+"' a bien été ajouté");
318
			} else {
319
				Info.display(i18nC.projetTitreFormAjout(), info.toString());
928 jpm 320
			}
321
		}
877 aurelien 322
	}
323
 
928 jpm 324
	private void rafraichirValeurListe(ValeurListe valeursListe) {
325
		if (valeursListe.getId() == listeValeurIndexationDureeInt) {
326
			valeurListeIndexationDuree = valeursListe;
327
			for (Iterator<String> it  = valeursListe.keySet().iterator(); it.hasNext();) {
328
				listeIndexationDuree.add(valeursListe.get(it.next()));
329
				listeIndexationDuree.sort("id_valeur", SortDir.ASC);
330
			}
331
			listeIndexationDureeChargee = true;
332
 
333
			if (mode.equals(MODE_MODIFIER)) {
334
				if (valeurListeIndexationDuree.get(projet.getIndexationDuree()) != null) {
335
					indexationDureeChp.setValue(valeurListeIndexationDuree.get(projet.getIndexationDuree()));
336
					indexationDureeChp.validate();
337
				}
338
			}
339
			indexationDureeChp.expand();
340
		} else if (valeursListe.getId() == listeValeurIndexationFrequenceInt) {
341
			valeurListeIndexationFrequence = valeursListe;
342
			for (Iterator<String> it  = valeursListe.keySet().iterator(); it.hasNext();) {
343
				listeIndexationFrequence.add(valeursListe.get(it.next()));
344
				listeIndexationFrequence.sort("id_valeur", SortDir.ASC);
345
			}
346
			listeIndexationFrequenceChargee = true;
347
 
348
			if (mode.equals(MODE_MODIFIER)) {
349
				if (valeurListeIndexationFrequence.get(projet.getIndexationFreq()) != null) {
350
					indexationFrequenceChp.setValue(valeurListeIndexationFrequence.get(projet.getIndexationFreq()));
351
					indexationFrequenceChp.validate();
352
				}
353
			}
354
			indexationFrequenceChp.expand();
355
		} else if (valeursListe.getId() == listeLanguesInt) {
356
			valeurListeLangue = valeursListe;
357
			for (Iterator<String> it  = valeursListe.keySet().iterator(); it.hasNext();) {
358
				listeLangue.add(valeursListe.get(it.next()));
359
				listeLangue.sort("id_valeur", SortDir.ASC);
360
			}
361
			listeLangueChargee = true;
362
 
363
			if (mode.equals(MODE_MODIFIER)) {
364
				if (valeurListeLangue.get(projet.getLangue()) != null) {
365
					langueChp.setValue(valeurListeLangue.get(projet.getLangue()));
366
					langueChp.validate();
367
				}
368
			}
369
		}
370
	}
371
 
877 aurelien 372
	private Boolean etreValide() {
373
		Boolean valide = false;
374
		if (formulaireValideOk && projetValideOk) {
375
			valide = true;
376
		}
377
		return valide;
378
	}
379
 
380
	private void initialiserValidation() {
381
		formulaireValideOk = false;
382
		projetValideOk = false;
383
	}
384
 
385
	private void repandreRafraichissement() {
386
		if (vueExterneARafraichirApresValidation != null) {
878 aurelien 387
			String type = "projet_modifie";
877 aurelien 388
			if (mode.equals(Formulaire.MODE_AJOUTER)) {
878 aurelien 389
				type = "projet_ajoute";
877 aurelien 390
			}
391
			Information info = new Information(type);
392
			info.setDonnee(0, projet);
393
			vueExterneARafraichirApresValidation.rafraichir(info);
394
		}
395
	}
396
 
397
	public boolean soumettreFormulaire() {
398
		formulaireValideOk = verifierFormulaire();
399
		if (formulaireValideOk) {
400
			Projet projetCollecte = collecterProjet();
401
			if (projetCollecte != null) {
402
				if (mode.equals(Formulaire.MODE_AJOUTER)) {
403
					mediateur.ajouterProjet(this, projetCollecte);
404
				} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
405
					mediateur.modifierProjet(this, projetCollecte);
406
				}
407
			}
408
		}
409
		return formulaireValideOk;
410
	}
411
 
934 jpm 412
	public boolean verifierFormulaire() {
877 aurelien 413
		boolean valide = true;
414
		ArrayList<String> messages = new ArrayList<String>();
415
 
416
		String titre = nomChp.getValue();
417
		if (titre == null || titre.equals("")) {
418
			messages.add("Veuillez saisir le nom du projet !");
419
		}
420
 
886 aurelien 421
		String abr = abreviationChp.getValue();
422
		if (abr == null || abr.equals("")) {
423
			messages.add("Veuillez saisir l'abréviation du projet !");
424
		}
425
 
426
		String desc = descriptionChp.getValue();
427
		if (desc == null || desc.equals("")) {
428
			messages.add("Veuillez saisir la description du projet !");
429
		}
430
 
431
		String resume = resumeChp.getValue();
432
		if (resume == null || resume.equals("")) {
433
			messages.add("Veuillez saisir le résumé du projet !");
434
		}
435
 
877 aurelien 436
		String uri = urlChp.getValue();
886 aurelien 437
		if (uri != null && ! uri.trim().isEmpty() && ! uri.matches(Pattern.url)) {
877 aurelien 438
			messages.add("L'URL saisie n'est pas valide !");
439
		}
440
 
886 aurelien 441
		String heure = indexationHeureChp.getValue();
928 jpm 442
		if (!UtilString.isEmpty(heure)) {
443
			if (!heure.matches(Pattern.heureMinute)) {
444
				messages.add("L'heureMinute d'indexation saisie n'est pas valide !");
887 aurelien 445
			}
886 aurelien 446
		}
447
 
877 aurelien 448
		if (messages.size() != 0) {
449
			String[] tableauDeMessages = {};
450
			tableauDeMessages = messages.toArray(tableauDeMessages);
451
			MessageBox.alert("Erreurs de saisies", UtilArray.implode(tableauDeMessages, "<br />"), null);
452
			valide = false;
453
		}
454
		return valide;
455
	}
456
 
457
	private void peuplerFormulaire() {
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
 
924 jpm 468
		if (projet.getMarkPublic().equals("1")) {
887 aurelien 469
			markPublicChp.setValue(true);
470
		} else {
471
			markPublicChp.setValue(false);
472
		}
878 aurelien 473
 
924 jpm 474
		if (listeLangueChargee) {
908 aurelien 475
			if(valeurListeLangue.get(projet.getLangue()) != null) {
476
				langueChp.setValue(valeurListeLangue.get(projet.getLangue()));
477
				langueChp.validate();
478
			}
479
		}
480
 
924 jpm 481
		if (listeIndexationFrequenceChargee) {
482
			if (valeurListeIndexationFrequence.get(projet.getIndexationFreq()) != null) {
908 aurelien 483
				indexationFrequenceChp.setValue(valeurListeIndexationFrequence.get(projet.getIndexationFreq()));
484
				indexationFrequenceChp.validate();
485
			}
486
		}
487
 
924 jpm 488
		if (listeIndexationDureeChargee) {
489
			if (valeurListeIndexationDuree.get(projet.getIndexationDuree()) != null) {
908 aurelien 490
				indexationDureeChp.setValue(valeurListeIndexationDuree.get(projet.getIndexationDuree()));
491
				indexationDureeChp.validate();
492
			}
493
		}
494
 
887 aurelien 495
		String[] heureTab = projet.getIndexationHeure().split(":");
924 jpm 496
		if (heureTab.length > 1) {
902 aurelien 497
			String heure = heureTab[0]+":"+heureTab[1];
924 jpm 498
			if (heure.matches(Pattern.heureMinute)) {
902 aurelien 499
				indexationHeureChp.setValue(heure);
500
			}
887 aurelien 501
		}
878 aurelien 502
 
503
		doLayout(true);
877 aurelien 504
	}
505
 
506
	private Projet collecterProjet() {
887 aurelien 507
		Projet projetCollecte = (Projet) projet.cloner(new Projet());
877 aurelien 508
 
928 jpm 509
		projetCollecte.setNom(nomChp.getValue());
510
		projetCollecte.setAbreviation(abreviationChp.getValue());
511
		projetCollecte.setDescription(descriptionChp.getValue());
512
		projetCollecte.setResume(resumeChp.getValue());
513
		projetCollecte.setUrl(urlChp.getValue());
877 aurelien 514
 
928 jpm 515
		projetCollecte.setMotsCles(motsClesChp.getValue());
516
		projetCollecte.setCitation(citationChp.getValue());
517
		projetCollecte.setLicence(licenceChp.getValue());
518
		if (langueChp.getValue() != null) {
519
			projetCollecte.setLangue(langueChp.getValue().getId());
520
		}
521
		String markPublic = (markPublicChp.getValue()) ? "1" : "0";
522
		projetCollecte.setMarkPublic(markPublic);
887 aurelien 523
 
928 jpm 524
		projetCollecte.setIndexationHeure(indexationHeureChp.getValue());
525
		if (indexationFrequenceChp.getValue() != null) {
526
			projetCollecte.setIndexationFreq(indexationFrequenceChp.getValue().getId());
877 aurelien 527
		}
928 jpm 528
		if (indexationDureeChp.getValue() != null) {
529
			projetCollecte.setIndexationDuree(indexationDureeChp.getValue().getId());
530
		}
531
 
532
		Projet projetARetourner = null;
887 aurelien 533
		if (!projetCollecte.comparer(projet)) {
534
			projetARetourner = projet = projetCollecte;
928 jpm 535
			Debug.log(projetARetourner.toString());
887 aurelien 536
		}
877 aurelien 537
		return projetARetourner;
538
	}
539
 
934 jpm 540
	public void reinitialiserFormulaire() {
877 aurelien 541
		if (mode.equals(Formulaire.MODE_MODIFIER)) {
542
			mediateur.afficherFormProjet(projet.getId());
543
		} else {
544
			mediateur.afficherFormProjet(null);
545
		}
546
	}
908 aurelien 547
 
877 aurelien 548
}