Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1249 Rev 1255
Line 141... Line 141...
141
		auteursFieldset = new FieldSet();
141
		auteursFieldset = new FieldSet();
142
		auteursFieldset.setHeading(i18nC.publicationAuteursTitre());
142
		auteursFieldset.setHeading(i18nC.publicationAuteursTitre());
143
		auteursFieldset.setCollapsible(true);
143
		auteursFieldset.setCollapsible(true);
144
		auteursFieldset.setLayout(layout);
144
		auteursFieldset.setLayout(layout);
Line 145... Line -...
145
		
-
 
146
		Debug.log("Dans creerZoneAuteurs");
145
		
147
		auteurComboboxListe = new ArrayList<ComboBox<Personne>>(0);
146
		auteurComboboxListe = new ArrayList<ComboBox<Personne>>(0);
148
		auteursStorePartage = new ListStore<Personne>();
147
		auteursStorePartage = new ListStore<Personne>();
Line 149... Line 148...
149
		mediateur.clicObtenirListeAuteurs(this);
148
		mediateur.clicObtenirListeAuteurs(this);
Line 355... Line 354...
355
			afficherAuteurs();
354
			afficherAuteurs();
356
			initialiserAffichageAuteurs();
355
			initialiserAffichageAuteurs();
357
		}
356
		}
Line 358... Line 357...
358
		
357
		
359
		if (etrePretAPeupler()) {
-
 
360
			Debug.log("Entrain de peupler");
358
		if (etrePretAPeupler()) {
361
			peuplerFormulaire();
359
			peuplerFormulaire();
362
			genererTitreFormulaire();
360
			genererTitreFormulaire();
363
			initialiserPeupler();
361
			initialiserPeupler();
Line 364... Line 362...
364
		}
362
		}
365
		
-
 
366
		if (avoirAuteursMiseAJourCorrectement()) {
363
		
367
			Debug.log("Mise à jour liste auteur");
364
		if (avoirAuteursMiseAJourCorrectement()) {
368
			miseAJourAuteursInitialListe();
365
			miseAJourAuteursInitialListe();
369
			initialiserAuteurs();
366
			initialiserAuteurs();
Line 406... Line 403...
406
		Iterator<String> it = auteurs.keySet().iterator();
403
		Iterator<String> it = auteurs.keySet().iterator();
407
		while (it.hasNext()) {
404
		while (it.hasNext()) {
408
			Personne auteur = auteurs.get(it.next()).getPersonne();
405
			Personne auteur = auteurs.get(it.next()).getPersonne();
409
			auteursInitialListe.put(auteur.getId(), auteur);
406
			auteursInitialListe.put(auteur.getId(), auteur);
410
		}
407
		}
411
		Debug.log("Réception liste des auteurs : "+auteurs.size());
-
 
412
		publicationAPersonneListeChargementOk = true;
408
		publicationAPersonneListeChargementOk = true;
413
	}
409
	}
Line 414... Line 410...
414
	
410
	
415
	private void rafraichirInformation(Information info) {
-
 
416
Debug.log("<8-8> BEGIN PublicationForm.rafraichirInformation()");		
-
 
417
		
411
	private void rafraichirInformation(Information info) {		
418
		String type = info.getType();
412
		String type = info.getType();
419
		if (type.equals("ajout_publication") || type.equals("modif_publication")) {
413
		if (type.equals("ajout_publication") || type.equals("modif_publication")) {
420
			publicationValideOk = true;
414
			publicationValideOk = true;
421
			if (mode.equals(Formulaire.MODE_AJOUTER)) {
415
			if (mode.equals(Formulaire.MODE_AJOUTER)) {
422
				if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
416
				if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
423
					String publicationId = (String) info.getDonnee(0);
417
					String publicationId = (String) info.getDonnee(0);
424
					if (publicationId.matches("[0-9]+")) {
418
					if (publicationId.matches("[0-9]+")) {
425
						publication.setId(publicationId);
419
						publication.setId(publicationId);
426
					}
420
					}
427
				}
421
				}
428
				attenteAjoutAuteursOk = true;
-
 
429
				
-
 
430
Debug.log("<8-8> PublicationForm.rafraichirInformation() - Appel à mediateur.ajouterPublicationAPersonne()");				
422
				attenteAjoutAuteursOk = true;		
431
				mediateur.ajouterPublicationAPersonne(this, publication.getId(), auteursAjoutes, PublicationAPersonne.ROLE_AUTEUR);
423
				mediateur.ajouterPublicationAPersonne(this, publication.getId(), auteursAjoutes, PublicationAPersonne.ROLE_AUTEUR);
432
			}
424
			}
Line 433... Line 425...
433
		}
425
		}
434
		
426
		
Line 435... Line 427...
435
		if (info.getType().equals("liste_personne")) {
427
		if (info.getType().equals("liste_personne")) {
436
			PersonneListe listePersonneAuteur = (PersonneListe) info.getDonnee(0);
428
			PersonneListe listePersonneAuteur = (PersonneListe) info.getDonnee(0);
437
			
429
			
438
			List<Personne> liste = listePersonneAuteur.toList();
-
 
439
			auteursStorePartage.removeAll();
430
			List<Personne> liste = listePersonneAuteur.toList();
440
			auteursStorePartage.add(liste);
431
			auteursStorePartage.removeAll();
441
			Debug.log("Reception nouvelle liste auteurs");
432
			auteursStorePartage.add(liste);
442
			auteurStorePartageChargementOk = true;
-
 
443
		} else if (info.getType().equals("ajout_publication_a_personne")) {
433
			auteurStorePartageChargementOk = true;
444
			attenteAjoutAuteursOk = false;
434
		} else if (info.getType().equals("ajout_publication_a_personne")) {
445
			Debug.log("attenteAjoutAuteursOk");
-
 
446
		} else if (info.getType().equals("suppression_publication_a_personne")) {
435
			attenteAjoutAuteursOk = false;
447
			attenteSuppressionAuteursOk = false;
436
		} else if (info.getType().equals("suppression_publication_a_personne")) {
448
			Debug.log("attenteSuppressionAuteursOk");
437
			attenteSuppressionAuteursOk = false;
449
		} else if (info.getType().equals("modif_publication")) {
438
		} else if (info.getType().equals("modif_publication")) {
450
			InfoLogger.display("Modification d'une publication", info.toString());
439
			InfoLogger.display("Modification d'une publication", info.toString());
451
		} else if (info.getType().equals("ajout_publication")) {
440
		} else if (info.getType().equals("ajout_publication")) {
452
			if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String && ((String) info.getDonnee(0)).matches("[0-9]+")) {
441
			if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String && ((String) info.getDonnee(0)).matches("[0-9]+")) {
453
				String publicationId = (String) info.getDonnee(0);
442
				String publicationId = (String) info.getDonnee(0);
454
				InfoLogger.display("Ajout d'une publication", "La publication '"+publicationId+"' a bien été ajoutée");
443
				InfoLogger.display("Ajout d'une publication", "La publication '"+publicationId+"' a bien été ajoutée");
455
			} else {
444
			} else {
456
				InfoLogger.display("Ajout d'une publication", info.toString());
-
 
457
			}
-
 
458
		}
445
				InfoLogger.display("Ajout d'une publication", info.toString());
Line 459... Line 446...
459
		
446
			}
460
Debug.log("<8-8> END PublicationForm.rafraichirInformation()");		
447
		}	
461
	}
448
	}
Line 501... Line 488...
501
		return ok;
488
		return ok;
502
	}
489
	}
Line 503... Line 490...
503
	
490
	
504
	private boolean etrePretAPeupler() {
491
	private boolean etrePretAPeupler() {
505
		boolean ok = false;
-
 
506
		Debug.log("Mode :"+mode.equals(Formulaire.MODE_MODIFIER)+" - PublicationOk :"+publicationOk+" - AuteursAffiches :"+auteursAffiches);
492
		boolean ok = false;
507
		if (mode.equals(Formulaire.MODE_MODIFIER) && publicationOk && auteursAffiches && editeursOk) {
493
		if (mode.equals(Formulaire.MODE_MODIFIER) && publicationOk && auteursAffiches && editeursOk) {
508
			ok = true;
494
			ok = true;
509
		}
495
		}
510
		return ok;
496
		return ok;
Line 511... Line 497...
511
	}
497
	}
512
	
498
	
513
	private Boolean etreValide() {
-
 
514
		Boolean valide = false;
499
	private Boolean etreValide() {
515
		//Debug.log("formulaire"+formulaireValideOk+" - Publication :"+publicationValideOk+" - Auteurs :"+auteursValideOk, null);
500
		Boolean valide = false;
516
		if (formulaireValideOk && publicationValideOk && auteursValideOk) {
501
		if (formulaireValideOk && publicationValideOk && auteursValideOk) {
517
			valide = true;
502
			valide = true;
518
		}
503
		}
Line 627... Line 612...
627
			
612
			
628
			if (auteursSupprimes != null && auteursSupprimes.size() != 0) {
613
			if (auteursSupprimes != null && auteursSupprimes.size() != 0) {
629
				mediateur.supprimerPublicationAPersonne(this, auteursSupprimes);
614
				mediateur.supprimerPublicationAPersonne(this, auteursSupprimes);
630
			}
615
			}
631
		}
-
 
632
		Debug.log("personnesInitiales:"+personnesInitiales.size()+" - personnesActuelles :"+personnesActuelles.size()+" - auteursSupprimes :"+auteursSupprimes.size()+" - auteursAjoutes :"+auteursAjoutes.size());
616
		}
Line 633... Line 617...
633
	}
617
	}
634
	
618
	
635
	public boolean verifierFormulaire() {
619
	public boolean verifierFormulaire() {