Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 886 Rev 887
Line 49... Line 49...
49
	
49
	
50
	private String listeValeurIndexationDureeId = "dureesIndexation";
50
	private String listeValeurIndexationDureeId = "dureesIndexation";
51
	private int listeValeurIndexationDureeInt = 1072;
51
	private int listeValeurIndexationDureeInt = 1072;
52
	private String listeValeurIndexationFrequenceId = "frequencesIndexation";
52
	private String listeValeurIndexationFrequenceId = "frequencesIndexation";
53
	private int listeValeurIndexationFrequenceInt = 1073;
-
 
-
 
53
	private int listeValeurIndexationFrequenceInt = 1073;
-
 
54
	private String listeLanguesId = "langues";
Line 54... Line 55...
54
	
55
	private int listeLanguesInt = 1071;	
55
	
56
	
-
 
57
	private ListStore<Valeur> listeIndexationDuree = null;
-
 
58
	private ListStore<Valeur> listeIndexationFrequence = null;
-
 
59
	private ListStore<Valeur> listeLangue = null;
-
 
60
	
-
 
61
	private ValeurListe valeurListeIndexationDuree = null;
Line 56... Line 62...
56
	private ListStore<Valeur> listeIndexationDuree = null;
62
	private ValeurListe valeurListeIndexationFrequence = null;
57
	private ListStore<Valeur> listeIndexationFrequence = null;
63
	private ValeurListe valeurListeLangue = null;
58
	
64
	
59
	private FieldSet generalitesFieldset = null;
65
	private FieldSet generalitesFieldset = null;
Line 65... Line 71...
65
			
71
			
66
	private FieldSet complementFieldset = null;
72
	private FieldSet complementFieldset = null;
67
	private TextField<String> motsClesChp = null;
73
	private TextField<String> motsClesChp = null;
68
	private TextField<String> citationChp = null;
74
	private TextField<String> citationChp = null;
-
 
75
	private TextField<String> licenceChp = null;
69
	private TextField<String> licenceChp = null;
76
	private ComboBox<Valeur> langueChp = null;
Line 70... Line 77...
70
	private CheckBox markPublicChp = null;
77
	private CheckBox markPublicChp = null;
71
	
78
	
72
	private FieldSet indexationFieldset = null;
79
	private FieldSet indexationFieldset = null;
73
	private TextField<String> indexationHeureChp = null;
80
	private TextField<String> indexationHeureChp = null;
74
	private ComboBox<Valeur> indexationDureeChp = null;
-
 
75
	private ComboBox<Valeur> indexationFrequenceChp = null;
-
 
76
	
-
 
Line 77... Line 81...
77
	private boolean listeIndexationDureeChargee = false;
81
	private ComboBox<Valeur> indexationDureeChp = null;
78
	private boolean listeIndexationFrequenceChargee = false;
82
	private ComboBox<Valeur> indexationFrequenceChp = null;
Line 79... Line 83...
79
 
83
 
Line 118... Line 122...
118
			mediateurCourant.selectionnerProjet(this, projetId);
122
			mediateurCourant.selectionnerProjet(this, projetId);
119
		}
123
		}
Line 120... Line 124...
120
		
124
		
121
		mediateurCourant.obtenirListeValeurEtRafraichir(this, listeValeurIndexationDureeId);
125
		mediateurCourant.obtenirListeValeurEtRafraichir(this, listeValeurIndexationDureeId);
-
 
126
		mediateurCourant.obtenirListeValeurEtRafraichir(this, listeValeurIndexationFrequenceId);
122
		mediateurCourant.obtenirListeValeurEtRafraichir(this, listeValeurIndexationFrequenceId);
127
		mediateurCourant.obtenirListeValeurEtRafraichir(this, listeLanguesId);
Line 123... Line 128...
123
	}
128
	}
124
	
129
	
125
	private String genererTitreFormulaire() {
130
	private String genererTitreFormulaire() {
126
		String titre = "Ajout d'une projet";
131
		String titre = "Ajout d'un projet";
127
		if (mode.equals(Formulaire.MODE_MODIFIER)) {
132
		if (mode.equals(Formulaire.MODE_MODIFIER)) {
128
			 titre = "Modification d'un projet - "+i18nC.id()+": "+projet.getId();
133
			 titre = "Modification d'un projet - "+i18nC.id()+": "+projet.getId();
129
		}
134
		}
Line 185... Line 190...
185
		licenceChp = new TextField<String>();
190
		licenceChp = new TextField<String>();
186
		licenceChp.setFieldLabel("Licence");
191
		licenceChp.setFieldLabel("Licence");
Line 187... Line 192...
187
		
192
		
Line -... Line 193...
-
 
193
		complementFieldset.add(licenceChp);
-
 
194
		
-
 
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
		
188
		complementFieldset.add(licenceChp);
204
		complementFieldset.add(langueChp);
189
		
205
		
Line 190... Line 206...
190
		markPublicChp = new CheckBox();
206
		markPublicChp = new CheckBox();
191
		markPublicChp.setFieldLabel("Public");
207
		markPublicChp.setFieldLabel("Public");
Line 211... Line 227...
211
		// liste 1073
227
		// liste 1073
212
		listeIndexationFrequence = new ListStore<Valeur>();
228
		listeIndexationFrequence = new ListStore<Valeur>();
213
		indexationFrequenceChp = new ComboBox<Valeur>();
229
		indexationFrequenceChp = new ComboBox<Valeur>();
214
		indexationFrequenceChp.setStore(listeIndexationFrequence);
230
		indexationFrequenceChp.setStore(listeIndexationFrequence);
215
		indexationFrequenceChp.setDisplayField("nom");
231
		indexationFrequenceChp.setDisplayField("nom");
216
		indexationFrequenceChp.setEditable(false);
232
		indexationFrequenceChp.setEditable(true);
-
 
233
		indexationFrequenceChp.setForceSelection(true);
-
 
234
		indexationFrequenceChp.setTypeAhead(true);
217
		indexationFrequenceChp.setFieldLabel(i18nC.projetIndexationFrequence());
235
		indexationFrequenceChp.setFieldLabel(i18nC.projetIndexationFrequence());
Line 218... Line 236...
218
		
236
		
Line 219... Line 237...
219
		indexationFieldset.add(indexationFrequenceChp, new FormData(120, 0));
237
		indexationFieldset.add(indexationFrequenceChp, new FormData(120, 0));
220
		
238
		
221
		// liste 1072
239
		// liste 1072
222
		listeIndexationDuree = new ListStore<Valeur>();
240
		listeIndexationDuree = new ListStore<Valeur>();
223
		indexationDureeChp = new ComboBox<Valeur>();
241
		indexationDureeChp = new ComboBox<Valeur>();
224
		indexationDureeChp.setStore(listeIndexationDuree);
242
		indexationDureeChp.setStore(listeIndexationDuree);
-
 
243
		indexationDureeChp.setDisplayField("nom");
-
 
244
		indexationDureeChp.setEditable(true);
225
		indexationDureeChp.setDisplayField("nom");
245
		indexationDureeChp.setForceSelection(true);
Line 226... Line 246...
226
		indexationDureeChp.setEditable(false);
246
		indexationDureeChp.setTypeAhead(true);
Line 227... Line 247...
227
		indexationDureeChp.setFieldLabel(i18nC.projetIndexationDuree());
247
		indexationDureeChp.setFieldLabel(i18nC.projetIndexationDuree());
Line 228... Line 248...
228
		
248
		
Line 229... Line 249...
229
		indexationFieldset.add(indexationDureeChp, new FormData(80, 0));
249
		indexationFieldset.add(indexationDureeChp, new FormData(80, 0));
230
				
250
				
231
	}
251
	}
232
	
252
	
233
	private void creerTabIndex() {
253
	private void creerTabIndex() {
Line 234... Line 254...
234
		
254
		
235
		nomChp.setTabIndex(0);
255
		nomChp.setTabIndex(1);
236
		abreviationChp.setTabIndex(1);
256
		abreviationChp.setTabIndex(2);
-
 
257
		descriptionChp.setTabIndex(3);
237
		descriptionChp.setTabIndex(2);
258
		resumeChp.setTabIndex(4);
Line 238... Line 259...
238
		resumeChp.setTabIndex(3);
259
		urlChp.setTabIndex(5);
239
		urlChp.setTabIndex(4);
260
				
240
				
261
		motsClesChp.setTabIndex(6);
Line 241... Line 262...
241
		motsClesChp.setTabIndex(6);
262
		citationChp.setTabIndex(7);
242
		citationChp.setTabIndex(7);
263
		licenceChp.setTabIndex(8);
Line 243... Line 264...
243
		licenceChp.setTabIndex(8);
264
		langueChp.setTabIndex(9);
Line 259... Line 280...
259
		
280
		
260
		if(nouvellesDonnees instanceof ValeurListe) {
281
		if(nouvellesDonnees instanceof ValeurListe) {
Line 261... Line 282...
261
			ValeurListe nValeurListe = (ValeurListe)nouvellesDonnees;
282
			ValeurListe nValeurListe = (ValeurListe)nouvellesDonnees;
-
 
283
			
-
 
284
			if(nValeurListe.getId() == listeValeurIndexationDureeInt) {
-
 
285
				
262
			
286
				valeurListeIndexationDuree = nValeurListe;
263
			if(nValeurListe.getId() == listeValeurIndexationDureeInt) {
287
				
264
				for(Iterator<String> it  = nValeurListe.keySet().iterator(); it.hasNext();) {
288
				for(Iterator<String> it  = nValeurListe.keySet().iterator(); it.hasNext();) {
265
					listeIndexationDuree.add(nValeurListe.get(it.next()));
-
 
266
					listeIndexationDuree.sort("id_valeur", SortDir.ASC);
289
					listeIndexationDuree.add(nValeurListe.get(it.next()));
-
 
290
					listeIndexationDuree.sort("id_valeur", SortDir.ASC);
-
 
291
				}
-
 
292
				
-
 
293
				if(mode.equals(MODE_MODIFIER)) {
-
 
294
					indexationDureeChp.setRawValue(valeurListeIndexationDuree.get(projet.getIndexationDuree()).getNom());
-
 
295
				}
Line 267... Line 296...
267
					listeIndexationDureeChargee = true;
296
				
Line 268... Line 297...
268
				}
297
				indexationDureeChp.expand();
-
 
298
 
-
 
299
			}
-
 
300
			
269
 
301
			if(nValeurListe.getId() == listeValeurIndexationFrequenceInt) {
270
			}
302
				
271
			
303
				valeurListeIndexationFrequence = nValeurListe;
272
			if(nValeurListe.getId() == listeValeurIndexationFrequenceInt) {
-
 
273
				for(Iterator<String> it  = nValeurListe.keySet().iterator(); it.hasNext();) {
304
				
-
 
305
				for(Iterator<String> it  = nValeurListe.keySet().iterator(); it.hasNext();) {
-
 
306
					listeIndexationFrequence.add(nValeurListe.get(it.next()));
-
 
307
					listeIndexationFrequence.sort("id_valeur", SortDir.ASC);
-
 
308
				}
-
 
309
				
-
 
310
				if(mode.equals(MODE_MODIFIER)) {
274
					listeIndexationFrequence.add(nValeurListe.get(it.next()));
311
					indexationFrequenceChp.setRawValue(valeurListeIndexationFrequence.get(projet.getIndexationFreq()).getNom());
-
 
312
				}
-
 
313
				
-
 
314
				indexationFrequenceChp.expand();
-
 
315
			}
-
 
316
			
-
 
317
			if(nValeurListe.getId() == listeLanguesInt) {
-
 
318
				
-
 
319
				valeurListeLangue = nValeurListe;
-
 
320
				
-
 
321
				for(Iterator<String> it  = nValeurListe.keySet().iterator(); it.hasNext();) {
-
 
322
					listeLangue.add(nValeurListe.get(it.next()));
-
 
323
					listeLangue.sort("id_valeur", SortDir.ASC);
-
 
324
				}
-
 
325
				
-
 
326
				if(mode.equals(MODE_MODIFIER)) {
-
 
327
					langueChp.setRawValue(valeurListeLangue.get(projet.getLangue()).getNom());
-
 
328
					GWT.log(valeurListeLangue.get(projet.getLangue()).getNom(),null);
275
					listeIndexationFrequence.sort("id_valeur", SortDir.ASC);
329
				}
Line 276... Line 330...
276
					listeIndexationFrequenceChargee = true;
330
			}
277
				}
331
			
278
			}
332
			GWT.log("une liste de valeurs est arrivée "+nValeurListe.getId(), null);
Line 361... Line 415...
361
		if (uri != null && ! uri.trim().isEmpty() && ! uri.matches(Pattern.url)) {
415
		if (uri != null && ! uri.trim().isEmpty() && ! uri.matches(Pattern.url)) {
362
			messages.add("L'URL saisie n'est pas valide !");
416
			messages.add("L'URL saisie n'est pas valide !");
363
		}
417
		}
Line 364... Line 418...
364
		
418
		
365
		String heure = indexationHeureChp.getValue();
419
		String heure = indexationHeureChp.getValue();
366
		if (heure != null && ! heure.isEmpty() && ! heure.matches(Pattern.heure)) {
420
		if (heure != null && ! heure.isEmpty() && !heure.matches(Pattern.heureMinute)) {
-
 
421
			messages.add("L'heureMinute d'indexation saisie n'est pas valide !");
-
 
422
		} else {
-
 
423
			if(heure.matches(Pattern.heureMinute)) {
-
 
424
				heure += ":00";
367
			messages.add("L'heure d'indexation saisie n'est pas valide !");
425
			}
Line 368... Line 426...
368
		}
426
		}
369
		
427
		
370
		if (messages.size() != 0) {
428
		if (messages.size() != 0) {
Line 385... Line 443...
385
		urlChp.setValue(projet.getUrl());
443
		urlChp.setValue(projet.getUrl());
Line 386... Line 444...
386
		
444
		
387
		motsClesChp.setValue(projet.getMotsCles());
445
		motsClesChp.setValue(projet.getMotsCles());
388
		citationChp.setValue(projet.getCitation());
446
		citationChp.setValue(projet.getCitation());
-
 
447
		licenceChp.setValue(projet.getLicence());
-
 
448
				
-
 
449
		if(projet.getMarkPublic().equals("1")) {
-
 
450
			markPublicChp.setValue(true);
389
		licenceChp.setValue(projet.getLicence());
451
		} else {
-
 
452
			markPublicChp.setValue(false);
Line 390... Line 453...
390
		markPublicChp.setValue(Boolean.parseBoolean(projet.getMarkPublic()));
453
		}
-
 
454
		
391
		
455
		String[] heureTab = projet.getIndexationHeure().split(":");
392
		indexationHeureChp.setValue(projet.getIndexationHeure());
456
		String heure = heureTab[0]+":"+heureTab[1];
-
 
457
		if(heure.matches(Pattern.heureMinute)) {
Line 393... Line 458...
393
		indexationFrequenceChp.select(listeIndexationFrequence.findModel(projet.getIndexationFreq()));
458
			indexationHeureChp.setValue(heure);
Line 394... Line 459...
394
		indexationDureeChp.select(listeIndexationDuree.findModel(projet.getIndexationDuree()));
459
		}
Line 395... Line 460...
395
		
460
		
396
		doLayout(true);
461
		doLayout(true);
397
		
462
		
-
 
463
	}
-
 
464
	
-
 
465
	private Projet collecterProjet() {
-
 
466
		Projet projetARetourner = new Projet();
-
 
467
		Projet projetCollecte = (Projet) projet.cloner(new Projet());
-
 
468
		
Line -... Line 469...
-
 
469
		projetARetourner.setNom(nomChp.getValue());
-
 
470
		projetARetourner.setAbreviation(abreviationChp.getValue());
398
	}
471
		projetARetourner.setDescription(descriptionChp.getValue());
Line -... Line 472...
-
 
472
		projetARetourner.setResume(resumeChp.getValue());
399
	
473
		projetARetourner.setUrl(urlChp.getValue());
-
 
474
		
400
	private Projet collecterProjet() {
475
		projetARetourner.setMotsCles(motsClesChp.getValue());
401
		Projet projetARetourner = null;
476
		projetARetourner.setCitation(citationChp.getValue());
Line -... Line 477...
-
 
477
		projetARetourner.setLicence(licenceChp.getValue());
-
 
478
		
-
 
479
		if(markPublicChp.getValue()) {
-
 
480
			projetCollecte.setMarkPublic("1");
-
 
481
		} else {
-
 
482
			projetCollecte.setMarkPublic("0");
-
 
483
		}
-
 
484
		
-
 
485
		projetARetourner.setIndexationHeure(indexationHeureChp.getValue());
-
 
486
		projetARetourner.setIndexationDuree(indexationDureeChp.getValue().getId());
402
		Projet projetCollectee = (Projet) projet.cloner(new Projet());
487
		projetARetourner.setIndexationFreq(indexationFrequenceChp.getValue().getId());
403
		
488
		
Line 404... Line 489...
404
		// TODO : collecter le reste des champs
489
		if (!projetCollecte.comparer(projet)) {
405
		
490
			projetARetourner = projet = projetCollecte;