| Line 112... |
Line 112... |
| 112 |
mediateurCourrant.selectionnerPublicationAPersonne(this, publicationId, null, PublicationAPersonne.ROLE_AUTEUR);
|
112 |
mediateurCourrant.selectionnerPublicationAPersonne(this, publicationId, null, PublicationAPersonne.ROLE_AUTEUR);
|
| 113 |
}
|
113 |
}
|
| 114 |
}
|
114 |
}
|
| Line 115... |
Line 115... |
| 115 |
|
115 |
|
| 116 |
private String genererTitreFormulaire() {
|
116 |
private String genererTitreFormulaire() {
|
| 117 |
String titre = "Ajout d'une publication";
|
117 |
String titre = i18nC.publicationTitreFormAjout();
|
| 118 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
118 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| 119 |
titre = "Modification d'une publication - "+i18nC.id()+": "+publication.getId();
|
119 |
titre = i18nC.publicationTitreFormModif()+" - "+i18nC.id()+": "+publication.getId();
|
| 120 |
}
|
120 |
}
|
| 121 |
return titre;
|
121 |
return titre;
|
| Line 122... |
Line 122... |
| 122 |
}
|
122 |
}
|
| 123 |
|
123 |
|
| 124 |
private void creerZoneAuteurs() {
|
124 |
private void creerZoneAuteurs() {
|
| Line 125... |
Line 125... |
| 125 |
FormLayout layout = new FormLayout();
|
125 |
FormLayout layout = new FormLayout();
|
| 126 |
layout.setLabelWidth(200);
|
126 |
layout.setLabelWidth(200);
|
| 127 |
|
127 |
|
| 128 |
// Fieldset Auteur
|
128 |
// Fieldset Auteur
|
| 129 |
auteursFieldset = new FieldSet();
|
129 |
auteursFieldset = new FieldSet();
|
| Line 130... |
Line 130... |
| 130 |
auteursFieldset.setHeading("Auteur(s)");
|
130 |
auteursFieldset.setHeading(i18nC.publicationAuteursTitre());
|
| 131 |
auteursFieldset.setCollapsible(true);
|
131 |
auteursFieldset.setCollapsible(true);
|
| Line 141... |
Line 141... |
| 141 |
private void creerChampsAuteur() {
|
141 |
private void creerChampsAuteur() {
|
| 142 |
auteursFieldset.removeAll();
|
142 |
auteursFieldset.removeAll();
|
| Line 143... |
Line 143... |
| 143 |
|
143 |
|
| Line 144... |
Line 144... |
| 144 |
conteneurChamps = new LayoutContainer();
|
144 |
conteneurChamps = new LayoutContainer();
|
| 145 |
|
145 |
|
| 146 |
Button ajouterAuteurBouton = new Button("Ajouter un auteur");
|
146 |
Button ajouterAuteurBouton = new Button(i18nC.publicationAuteurBoutonAjouter());
|
| 147 |
ajouterAuteurBouton.setIcon(Images.ICONES.ajouter());
|
147 |
ajouterAuteurBouton.setIcon(Images.ICONES.ajouter());
|
| 148 |
ajouterAuteurBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
148 |
ajouterAuteurBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
| 149 |
@Override
|
149 |
@Override
|
| Line 165... |
Line 165... |
| 165 |
final HorizontalPanel panneauHorizontal = new HorizontalPanel();
|
165 |
final HorizontalPanel panneauHorizontal = new HorizontalPanel();
|
| 166 |
panneauHorizontal.setLayout(new FormLayout());
|
166 |
panneauHorizontal.setLayout(new FormLayout());
|
| Line 167... |
Line 167... |
| 167 |
|
167 |
|
| 168 |
final ComboBox<Personne> auteursSaisisComboBox = creerComboBoxAuteursSaisis();
|
168 |
final ComboBox<Personne> auteursSaisisComboBox = creerComboBoxAuteursSaisis();
|
| 169 |
if (auteur != null) {
|
- |
|
| 170 |
GWT.log("Auteur peuplé : "+auteur.getId(), null);
|
169 |
if (auteur != null) {
|
| 171 |
auteursSaisisComboBox.setValue(auteursStorePartage.findModel("id_personne", auteur.getId()));
|
170 |
auteursSaisisComboBox.setValue(auteursStorePartage.findModel("id_personne", auteur.getId()));
|
| 172 |
auteursSaisisComboBox.validate();
|
171 |
auteursSaisisComboBox.validate();
|
| 173 |
}
|
172 |
}
|
| 174 |
auteurComboboxListe.add(auteursSaisisComboBox);
|
173 |
auteurComboboxListe.add(auteursSaisisComboBox);
|
| 175 |
auteursSaisisComboBox.setFieldLabel("Auteur "+auteurComboboxListe.size());
|
- |
|
| Line 176... |
Line 174... |
| 176 |
GWT.log("Nbre de combobox auteur dans liste : "+auteurComboboxListe.size(), null);
|
174 |
auteursSaisisComboBox.setFieldLabel(i18nC.publicationAuteurSingulier()+" "+auteurComboboxListe.size());
|
| 177 |
|
175 |
|
| 178 |
LayoutContainer panneauChampTxtEtBouton = new LayoutContainer();
|
176 |
LayoutContainer panneauChampTxtEtBouton = new LayoutContainer();
|
| 179 |
panneauChampTxtEtBouton.setLayout(new FormLayout());
|
177 |
panneauChampTxtEtBouton.setLayout(new FormLayout());
|
| Line 189... |
Line 187... |
| 189 |
auteurComboboxListe.remove(auteursSaisisComboBox);
|
187 |
auteurComboboxListe.remove(auteursSaisisComboBox);
|
| 190 |
conteneurChamps.remove(panneauHorizontal);
|
188 |
conteneurChamps.remove(panneauHorizontal);
|
| Line 191... |
Line 189... |
| 191 |
|
189 |
|
| 192 |
int numeroAuteurs = 1;
|
190 |
int numeroAuteurs = 1;
|
| 193 |
for (Iterator<ComboBox<Personne>> it = auteurComboboxListe.iterator(); it.hasNext();) {
|
191 |
for (Iterator<ComboBox<Personne>> it = auteurComboboxListe.iterator(); it.hasNext();) {
|
| 194 |
it.next().setFieldLabel("Auteur "+numeroAuteurs);
|
192 |
it.next().setFieldLabel(i18nC.publicationAuteurSingulier()+" "+numeroAuteurs);
|
| 195 |
numeroAuteurs++;
|
193 |
numeroAuteurs++;
|
| Line 196... |
Line 194... |
| 196 |
}
|
194 |
}
|
| 197 |
|
195 |
|
| Line 313... |
Line 311... |
| 313 |
controlerFermetureApresRafraichissement();
|
311 |
controlerFermetureApresRafraichissement();
|
| 314 |
}
|
312 |
}
|
| 315 |
}
|
313 |
}
|
| Line 316... |
Line 314... |
| 316 |
|
314 |
|
| 317 |
private void miseAJourPublicationAPersonneListe() {
|
- |
|
| 318 |
GWT.log("Mise à jour liste publication à personne", null);
|
315 |
private void miseAJourPublicationAPersonneListe() {
|
| 319 |
Iterator<String> clesAjoutees = auteursAjoutes.keySet().iterator();
|
316 |
Iterator<String> clesAjoutees = auteursAjoutes.keySet().iterator();
|
| 320 |
while (clesAjoutees.hasNext()) {
|
317 |
while (clesAjoutees.hasNext()) {
|
| 321 |
String id = clesAjoutees.next();
|
318 |
String id = clesAjoutees.next();
|
| 322 |
publicationAPersonneListe.put(id, auteursAjoutes.get(id));
|
- |
|
| 323 |
GWT.log("Auteurs ajouté :"+publicationAPersonneListe.get(id).getPersonne().getNomComplet(), null);
|
319 |
publicationAPersonneListe.put(id, auteursAjoutes.get(id));
|
| Line 324... |
Line 320... |
| 324 |
}
|
320 |
}
|
| 325 |
|
321 |
|
| 326 |
Iterator<String> clesSupprimees = auteursSupprimes.keySet().iterator();
|
322 |
Iterator<String> clesSupprimees = auteursSupprimes.keySet().iterator();
|
| 327 |
while (clesSupprimees.hasNext()) {
|
323 |
while (clesSupprimees.hasNext()) {
|
| 328 |
String id = clesSupprimees.next();
|
- |
|
| 329 |
publicationAPersonneListe.remove(id);
|
324 |
String id = clesSupprimees.next();
|
| 330 |
GWT.log("Personne surpprimé :"+id, null);
|
- |
|
| 331 |
}
|
325 |
publicationAPersonneListe.remove(id);
|
| Line 332... |
Line 326... |
| 332 |
GWT.log("Nbre auteurs après maj :"+publicationAPersonneListe.size(), null);
|
326 |
}
|
| 333 |
}
|
327 |
}
|
| 334 |
|
328 |
|
| Line 392... |
Line 386... |
| 392 |
return ok;
|
386 |
return ok;
|
| 393 |
}
|
387 |
}
|
| Line 394... |
Line 388... |
| 394 |
|
388 |
|
| 395 |
private void afficherAuteurs() {
|
389 |
private void afficherAuteurs() {
|
| 396 |
Iterator<String> itap = publicationAPersonneListe.keySet().iterator();
|
- |
|
| 397 |
GWT.log("Auteur"+publicationAPersonneListe.size(), null);
|
390 |
Iterator<String> itap = publicationAPersonneListe.keySet().iterator();
|
| 398 |
while (itap.hasNext()) {
|
391 |
while (itap.hasNext()) {
|
| 399 |
creerChampAuteurEtBoutonSupprimer(publicationAPersonneListe.get(itap.next()).getPersonne());
|
392 |
creerChampAuteurEtBoutonSupprimer(publicationAPersonneListe.get(itap.next()).getPersonne());
|
| 400 |
}
|
393 |
}
|
| Line 413... |
Line 406... |
| 413 |
return ok;
|
406 |
return ok;
|
| 414 |
}
|
407 |
}
|
| Line 415... |
Line 408... |
| 415 |
|
408 |
|
| 416 |
private Boolean etreValide() {
|
409 |
private Boolean etreValide() {
|
| 417 |
Boolean valide = false;
|
410 |
Boolean valide = false;
|
| 418 |
GWT.log("formulaire"+formulaireValideOk+" - Publication :"+publicationValideOk+" - Auteurs :"+auteursValideOk, null);
|
411 |
//Debug.log("formulaire"+formulaireValideOk+" - Publication :"+publicationValideOk+" - Auteurs :"+auteursValideOk, null);
|
| 419 |
if (formulaireValideOk && publicationValideOk && auteursValideOk) {
|
412 |
if (formulaireValideOk && publicationValideOk && auteursValideOk) {
|
| 420 |
valide = true;
|
413 |
valide = true;
|
| 421 |
}
|
414 |
}
|
| 422 |
return valide;
|
415 |
return valide;
|
| Line 448... |
Line 441... |
| 448 |
}
|
441 |
}
|
| 449 |
}
|
442 |
}
|
| Line 450... |
Line 443... |
| 450 |
|
443 |
|
| 451 |
public boolean soumettreFormulaire() {
|
444 |
public boolean soumettreFormulaire() {
|
| 452 |
formulaireValideOk = verifierFormulaire();
|
- |
|
| 453 |
GWT.log("Form?"+formulaireValideOk, null);
|
445 |
formulaireValideOk = verifierFormulaire();
|
| 454 |
if (formulaireValideOk) {
|
446 |
if (formulaireValideOk) {
|
| 455 |
soumettrePublication();
|
447 |
soumettrePublication();
|
| 456 |
soumettreAuteurs();
|
448 |
soumettreAuteurs();
|
| 457 |
}
|
449 |
}
|
| 458 |
return formulaireValideOk;
|
450 |
return formulaireValideOk;
|
| Line 459... |
Line 451... |
| 459 |
}
|
451 |
}
|
| 460 |
|
452 |
|
| 461 |
private void soumettrePublication() {
|
453 |
private void soumettrePublication() {
|
| 462 |
Publication publicationCollectee = collecterPublication();
|
- |
|
| 463 |
if (publicationCollectee != null) {
|
454 |
Publication publicationCollectee = collecterPublication();
|
| 464 |
GWT.log("Info public collectée ? ok", null);
|
455 |
if (publicationCollectee != null) {
|
| 465 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
456 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
| 466 |
mediateur.ajouterPublication(this, publicationCollectee);
|
457 |
mediateur.ajouterPublication(this, publicationCollectee);
|
| 467 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
458 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| Line 474... |
Line 465... |
| 474 |
attenteAjoutAuteursOk = false;
|
465 |
attenteAjoutAuteursOk = false;
|
| 475 |
attenteSuppressionAuteursOk = false;
|
466 |
attenteSuppressionAuteursOk = false;
|
| Line 476... |
Line 467... |
| 476 |
|
467 |
|
| 477 |
PersonneListe personnesInitiales = new PersonneListe();
|
468 |
PersonneListe personnesInitiales = new PersonneListe();
|
| 478 |
if (publicationAPersonneListe != null) {
|
- |
|
| 479 |
GWT.log("Nbre auteur initial :"+publicationAPersonneListe.size(), null);
|
469 |
if (publicationAPersonneListe != null) {
|
| 480 |
Iterator<String> itap = publicationAPersonneListe.keySet().iterator();
|
470 |
Iterator<String> itap = publicationAPersonneListe.keySet().iterator();
|
| 481 |
while (itap.hasNext()) {
|
471 |
while (itap.hasNext()) {
|
| 482 |
Personne personne = publicationAPersonneListe.get(itap.next()).getPersonne();
|
- |
|
| 483 |
GWT.log("Auteur initial :"+personne.getNomComplet(), null);
|
472 |
Personne personne = publicationAPersonneListe.get(itap.next()).getPersonne();
|
| 484 |
personnesInitiales.put(personne.getId(), personne);
|
473 |
personnesInitiales.put(personne.getId(), personne);
|
| 485 |
}
|
474 |
}
|
| Line 486... |
Line 475... |
| 486 |
}
|
475 |
}
|
| 487 |
|
- |
|
| 488 |
PersonneListe personnesActuelles = new PersonneListe();
|
476 |
|
| 489 |
GWT.log("Nbre auteur actuel :"+auteurComboboxListe.size(), null);
|
477 |
PersonneListe personnesActuelles = new PersonneListe();
|
| 490 |
for (int i = 0; i < auteurComboboxListe.size(); i++) {
|
478 |
for (int i = 0; i < auteurComboboxListe.size(); i++) {
|
| 491 |
if (auteurComboboxListe.get(i).getValue() != null) {
|
479 |
if (auteurComboboxListe.get(i).getValue() != null) {
|
| 492 |
Personne personne = auteurComboboxListe.get(i).getValue();
|
480 |
Personne personne = auteurComboboxListe.get(i).getValue();
|
| Line 498... |
Line 486... |
| 498 |
Iterator<String> clesActuelles = personnesActuelles.keySet().iterator();
|
486 |
Iterator<String> clesActuelles = personnesActuelles.keySet().iterator();
|
| 499 |
while (clesActuelles.hasNext()) {
|
487 |
while (clesActuelles.hasNext()) {
|
| 500 |
String idActuel = clesActuelles.next();
|
488 |
String idActuel = clesActuelles.next();
|
| 501 |
if (personnesInitiales.size() == 0 || personnesInitiales.get(idActuel) == null) {
|
489 |
if (personnesInitiales.size() == 0 || personnesInitiales.get(idActuel) == null) {
|
| 502 |
Personne personne = personnesActuelles.get(idActuel);
|
490 |
Personne personne = personnesActuelles.get(idActuel);
|
| 503 |
GWT.log("Auteur ajouté :"+personne.getNomComplet(), null);
|
- |
|
| 504 |
PublicationAPersonne publicationAAuteur = new PublicationAPersonne();
|
491 |
PublicationAPersonne publicationAAuteur = new PublicationAPersonne();
|
| 505 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
492 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| 506 |
publicationAAuteur.setIdPublication(publication.getId());
|
493 |
publicationAAuteur.setIdPublication(publication.getId());
|
| 507 |
}
|
494 |
}
|
| 508 |
publicationAAuteur.setPersonne(personne);
|
495 |
publicationAAuteur.setPersonne(personne);
|
| Line 517... |
Line 504... |
| 517 |
Iterator<String> clesInitiales = personnesInitiales.keySet().iterator();
|
504 |
Iterator<String> clesInitiales = personnesInitiales.keySet().iterator();
|
| 518 |
while (clesInitiales.hasNext()) {
|
505 |
while (clesInitiales.hasNext()) {
|
| 519 |
String idInitial = clesInitiales.next();
|
506 |
String idInitial = clesInitiales.next();
|
| 520 |
if (personnesActuelles.size() == 0 || personnesActuelles.get(idInitial) == null) {
|
507 |
if (personnesActuelles.size() == 0 || personnesActuelles.get(idInitial) == null) {
|
| 521 |
Personne personne = personnesInitiales.get(idInitial);
|
508 |
Personne personne = personnesInitiales.get(idInitial);
|
| 522 |
GWT.log("Auteur supprimé :"+personne.getNomComplet(), null);
|
- |
|
| 523 |
PublicationAPersonne publicationAAuteur = new PublicationAPersonne();
|
509 |
PublicationAPersonne publicationAAuteur = new PublicationAPersonne();
|
| 524 |
publicationAAuteur.setIdPublication(publication.getId());
|
510 |
publicationAAuteur.setIdPublication(publication.getId());
|
| 525 |
publicationAAuteur.setPersonne(personne);
|
511 |
publicationAAuteur.setPersonne(personne);
|
| 526 |
publicationAAuteur.setIdRole(PublicationAPersonne.ROLE_AUTEUR);
|
512 |
publicationAAuteur.setIdRole(PublicationAPersonne.ROLE_AUTEUR);
|
| 527 |
auteursSupprimes.put(publicationAAuteur.getId(), publicationAAuteur);
|
513 |
auteursSupprimes.put(publicationAAuteur.getId(), publicationAAuteur);
|
| Line 621... |
Line 607... |
| 621 |
if (i != (auteursNombre - 1)) {
|
607 |
if (i != (auteursNombre - 1)) {
|
| 622 |
auteurIntituleFormate += ", ";
|
608 |
auteurIntituleFormate += ", ";
|
| 623 |
}
|
609 |
}
|
| 624 |
}
|
610 |
}
|
| 625 |
}
|
611 |
}
|
| 626 |
GWT.log("Auteurs formaté :"+auteurIntituleFormate, null);
|
- |
|
| 627 |
publicationCollectee.setAuteur(auteurIntituleFormate);
|
612 |
publicationCollectee.setAuteur(auteurIntituleFormate);
|
| Line 628... |
Line 613... |
| 628 |
|
613 |
|
| 629 |
String titre = titreChp.getValue();
|
614 |
String titre = titreChp.getValue();
|