| Line 12... |
Line 12... |
| 12 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
12 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| 13 |
import org.tela_botanica.client.modeles.Information;
|
13 |
import org.tela_botanica.client.modeles.Information;
|
| 14 |
import org.tela_botanica.client.modeles.Valeur;
|
14 |
import org.tela_botanica.client.modeles.Valeur;
|
| 15 |
import org.tela_botanica.client.modeles.ValeurListe;
|
15 |
import org.tela_botanica.client.modeles.ValeurListe;
|
| 16 |
import org.tela_botanica.client.modeles.aDonnee;
|
16 |
import org.tela_botanica.client.modeles.aDonnee;
|
| - |
|
17 |
import org.tela_botanica.client.modeles.collection.CollectionAPersonne;
|
| 17 |
import org.tela_botanica.client.modeles.personne.Personne;
|
18 |
import org.tela_botanica.client.modeles.personne.Personne;
|
| 18 |
import org.tela_botanica.client.modeles.publication.Publication;
|
19 |
import org.tela_botanica.client.modeles.publication.Publication;
|
| 19 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonne;
|
20 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonne;
|
| 20 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
|
21 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
|
| 21 |
import org.tela_botanica.client.modeles.publication.PublicationListe;
|
22 |
import org.tela_botanica.client.modeles.publication.PublicationListe;
|
| Line 58... |
Line 59... |
| 58 |
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
|
59 |
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
|
| 59 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
60 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
| 60 |
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
61 |
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
| 61 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
62 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
| 62 |
import com.google.gwt.core.client.GWT;
|
63 |
import com.google.gwt.core.client.GWT;
|
| - |
|
64 |
import com.google.gwt.user.client.Window;
|
| Line 63... |
Line 65... |
| 63 |
|
65 |
|
| Line 64... |
Line 66... |
| 64 |
public class PersonneFormPublication extends FormulaireOnglet implements Rafraichissable {
|
66 |
public class PersonneFormPublication extends FormulaireOnglet implements Rafraichissable {
|
| 65 |
|
67 |
|
| Line 80... |
Line 82... |
| 80 |
private PublicationAPersonneListe listePublicationsLiees = new PublicationAPersonneListe();
|
82 |
private PublicationAPersonneListe listePublicationsLiees = new PublicationAPersonneListe();
|
| Line 81... |
Line 83... |
| 81 |
|
83 |
|
| Line 82... |
Line 84... |
| 82 |
private FenetreForm fenetreFormulaire = null;
|
84 |
private FenetreForm fenetreFormulaire = null;
|
| 83 |
|
- |
|
| 84 |
public PersonneFormPublication(Formulaire formulaireCourrant) {
|
- |
|
| 85 |
|
- |
|
| 86 |
Debug.log("|> PersonneFormPublication : [constructeur]");
|
85 |
|
| 87 |
|
86 |
public PersonneFormPublication(Formulaire formulaireCourrant) {
|
| 88 |
initialiserOnglet(formulaireCourrant);
|
87 |
initialiserOnglet(formulaireCourrant);
|
| 89 |
setId("publication");
|
88 |
setId("publication");
|
| Line 99... |
Line 98... |
| 99 |
|
98 |
|
| 100 |
initialiser();
|
99 |
initialiser();
|
| Line 101... |
Line 100... |
| 101 |
}
|
100 |
}
|
| 102 |
|
- |
|
| 103 |
private void initialiser() {
|
- |
|
| Line 104... |
Line 101... |
| 104 |
|
101 |
|
| 105 |
Debug.log("|> PersonneFormPublication.initialiser()");
|
102 |
private void initialiser() {
|
| 106 |
|
103 |
|
| 107 |
// Remise à zéro des modification dans la liste des auteurs
|
104 |
// Remise à zéro des modification dans la liste des auteurs
|
| Line 108... |
Line 105... |
| 108 |
idGenere = 1;
|
105 |
idGenere = 1;
|
| 109 |
publicationsAjoutees = new PublicationAPersonneListe();
|
106 |
publicationsAjoutees = new PublicationAPersonneListe();
|
| 110 |
publicationsSupprimees = new PublicationAPersonneListe();
|
107 |
publicationsSupprimees = new PublicationAPersonneListe();
|
| Line 111... |
Line 108... |
| 111 |
|
108 |
|
| 112 |
// Actualisation de l'état des boutons de la barre d'outils
|
- |
|
| 113 |
actualiserEtatBoutonsBarreOutils();
|
- |
|
| 114 |
}
|
- |
|
| 115 |
|
- |
|
| 116 |
public void mettreAJourPersonne() {
|
- |
|
| 117 |
|
- |
|
| Line 118... |
Line 109... |
| 118 |
Debug.log("|> *** BEGIN PersonneFormPublication.mettreAJourPersonne()");
|
109 |
// Actualisation de l'état des boutons de la barre d'outils
|
| 119 |
|
- |
|
| Line 120... |
Line 110... |
| 120 |
personneSelectionnee = ((PersonneForm) formulaire).personneSelectionnee;
|
110 |
actualiserEtatBoutonsBarreOutils();
|
| Line 121... |
Line 111... |
| 121 |
|
111 |
}
|
| 122 |
Debug.log("|--> PersonneFormPublication.mettreAJourPersonne : personneSelectionnee="+personneSelectionnee.toString());
|
112 |
|
| Line 137... |
Line 127... |
| 137 |
// s'effectuent deux fois au lieu d'une, c-a-d que le formulaire lance deux fois l'operation rafraichir au lieu d'une ... et l'opération
|
127 |
// s'effectuent deux fois au lieu d'une, c-a-d que le formulaire lance deux fois l'operation rafraichir au lieu d'une ... et l'opération
|
| 138 |
// rafraichir lance à son tour de nombreuses opérations qui en conséquence sont effectuées deux fois au lieu d'une
|
128 |
// rafraichir lance à son tour de nombreuses opérations qui en conséquence sont effectuées deux fois au lieu d'une
|
| 139 |
if ((roles != null) && (personneSelectionnee!=null) && (!personneSelectionnee.toString().equals(""))) {
|
129 |
if ((roles != null) && (personneSelectionnee!=null) && (!personneSelectionnee.toString().equals(""))) {
|
| Line 140... |
Line 130... |
| 140 |
|
130 |
|
| 141 |
mediateur.selectionnerPublicationAPersonne(this, null, personneSelectionnee.getId(), roles);
|
- |
|
| 142 |
|
- |
|
| 143 |
Debug.log("|--> PersonneFormPublication.mettreAJourPersonne : selectionnerPublicationAPersonne(this, null, personneSelectionnee.getId(), roles)");
|
- |
|
| 144 |
Debug.log("| avec personneSelectionnee.getId()="+personneSelectionnee.getId());
|
- |
|
| 145 |
Debug.log("|> END PersonneFormPublication.mettreAJourPersonne()");
|
131 |
mediateur.selectionnerPublicationAPersonne(this, null, personneSelectionnee.getId(), roles);
|
| 146 |
}
|
132 |
}
|
| Line 147... |
Line 133... |
| 147 |
}
|
133 |
}
|
| 148 |
|
134 |
|
| Line 294... |
Line 280... |
| 294 |
});
|
280 |
});
|
| 295 |
return bouton;
|
281 |
return bouton;
|
| 296 |
}
|
282 |
}
|
| Line 297... |
Line 283... |
| 297 |
|
283 |
|
| 298 |
private void actualiserGrille() {
|
- |
|
| 299 |
|
- |
|
| 300 |
Debug.log("|> PersonneFormPublication.actualiserGrille()");
|
- |
|
| 301 |
|
284 |
private void actualiserGrille() {
|
| 302 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
285 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| 303 |
mediateur.selectionnerPublicationAPersonne(this, null, personneSelectionnee.getId(), "%");
|
286 |
mediateur.selectionnerPublicationAPersonne(this, null, personneSelectionnee.getId(), "%");
|
| 304 |
} else {
|
287 |
} else {
|
| 305 |
grille.getStore().removeAll();
|
288 |
grille.getStore().removeAll();
|
| Line 341... |
Line 324... |
| 341 |
private void ajouterDansGrille(Publication publication) {
|
324 |
private void ajouterDansGrille(Publication publication) {
|
| 342 |
ajouterDansGrille(publication, 0);
|
325 |
ajouterDansGrille(publication, 0);
|
| 343 |
}
|
326 |
}
|
| Line 344... |
Line 327... |
| 344 |
|
327 |
|
| 345 |
private void ajouterDansGrille(Publication publication, int index) {
|
- |
|
| 346 |
Debug.log("|> PersonneFormPublication.ajouterDansGrille(Publication publication, int index)");
|
328 |
private void ajouterDansGrille(Publication publication, int index) {
|
| 347 |
if (publication != null) {
|
- |
|
| 348 |
Debug.log("|--> publication != null");
|
329 |
if (publication != null) {
|
| 349 |
if (!listePublicationsLiees.containsKey(publication.getId())) {
|
330 |
if (!listePublicationsLiees.containsKey(publication.getId())) {
|
| 350 |
PublicationAPersonne publicationLiee = new PublicationAPersonne();
|
331 |
PublicationAPersonne publicationLiee = new PublicationAPersonne();
|
| 351 |
publicationLiee.setPersonne(personneSelectionnee);
|
332 |
publicationLiee.setPersonne(personneSelectionnee);
|
| 352 |
publicationLiee.setPublicationLiee(publication);
|
333 |
publicationLiee.setPublicationLiee(publication);
|
| - |
|
334 |
publicationLiee.setIdPublication(publication.getId());
|
| 353 |
publicationLiee.setIdPublication(publication.getId());
|
335 |
|
| 354 |
publicationLiee.set("_etat_", aDonnee.ETAT_AJOUTE);
|
336 |
publicationLiee.set("_etat_", aDonnee.ETAT_AJOUTE);
|
| 355 |
listePublicationsLiees.put(publication.getId(), publicationLiee);
|
- |
|
| 356 |
|
- |
|
| 357 |
Debug.log("|--> personneSelectionneeID="+personneSelectionnee.getId());
|
- |
|
| Line 358... |
Line 337... |
| 358 |
Debug.log("|--> publicationID="+publication.getId());
|
337 |
listePublicationsLiees.put(publication.getId(), publicationLiee);
|
| 359 |
|
338 |
|
| 360 |
// Ajout à la grille
|
339 |
// Ajout à la grille
|
| 361 |
grille.stopEditing();
|
340 |
grille.stopEditing();
|
| Line 370... |
Line 349... |
| 370 |
|
349 |
|
| 371 |
/**
|
350 |
/**
|
| 372 |
* Met à jour la grille avec les informations contenus dans la variable listePublicationsLiees
|
351 |
* Met à jour la grille avec les informations contenus dans la variable listePublicationsLiees
|
| 373 |
*/
|
352 |
*/
|
| 374 |
private void mettreAJourGrille() {
|
- |
|
| 375 |
|
- |
|
| Line 376... |
Line 353... |
| 376 |
Debug.log("|> PersonneFormPublication.mettreAJourGrille()");
|
353 |
private void mettreAJourGrille() {
|
| 377 |
|
354 |
|
| 378 |
grille.getStore().removeAll();
|
355 |
grille.getStore().removeAll();
|
| Line 383... |
Line 360... |
| 383 |
if (publicationLiee != null) {
|
360 |
if (publicationLiee != null) {
|
| 384 |
// Ajout de la personne supprimée à la liste
|
361 |
// Ajout de la personne supprimée à la liste
|
| 385 |
if ((publicationLiee.get("_etat_").equals("") || !publicationLiee.get("_etat_").equals(aDonnee.ETAT_AJOUTE))
|
362 |
if ((publicationLiee.get("_etat_").equals("") || !publicationLiee.get("_etat_").equals(aDonnee.ETAT_AJOUTE))
|
| 386 |
&& publicationLiee.getId() != null
|
363 |
&& publicationLiee.getId() != null
|
| 387 |
&& !publicationLiee.getId().equals("")) {
|
364 |
&& !publicationLiee.getId().equals("")) {
|
| 388 |
Debug.log("Nbre publications supprimées avant:"+publicationsSupprimees.size());
|
- |
|
| 389 |
publicationsSupprimees.put("id"+idGenere++, publicationLiee);
|
365 |
publicationsSupprimees.put("id"+idGenere++, publicationLiee);
|
| 390 |
//GWT.log("Publications supprimée : "+publicationLiee.getIdPublication()+" "+publicationLiee.get.getNomComplet(), null);
|
- |
|
| 391 |
Debug.log("Nbre publications supprimées :"+publicationsSupprimees.size());
|
- |
|
| 392 |
}
|
366 |
}
|
| Line 393... |
Line 367... |
| 393 |
|
367 |
|
| 394 |
// Suppression de l'enregistrement de la grille
|
368 |
// Suppression de l'enregistrement de la grille
|
| 395 |
grille.getStore().remove(publicationLiee);
|
369 |
grille.getStore().remove(publicationLiee);
|
| 396 |
}
|
370 |
}
|
| Line 397... |
Line 371... |
| 397 |
}
|
371 |
}
|
| Line 398... |
Line -... |
| 398 |
|
- |
|
| 399 |
private EditorGrid<PublicationAPersonne> creerGrille() {
|
- |
|
| 400 |
|
372 |
|
| 401 |
Debug.log("|> PersonneFormPublication.creerGrille()");
|
373 |
private EditorGrid<PublicationAPersonne> creerGrille() {
|
| 402 |
|
374 |
|
| 403 |
ListStore<PublicationAPersonne> storeGrille = new ListStore<PublicationAPersonne>();
|
375 |
ListStore<PublicationAPersonne> storeGrille = new ListStore<PublicationAPersonne>();
|
| 404 |
storeGrille.addListener(Store.Add, new Listener<StoreEvent<PublicationAPersonne>>() {
|
376 |
storeGrille.addListener(Store.Add, new Listener<StoreEvent<PublicationAPersonne>>() {
|
| Line 409... |
Line 381... |
| 409 |
storeGrille.addListener(Store.Remove, new Listener<StoreEvent<PublicationAPersonne>>() {
|
381 |
storeGrille.addListener(Store.Remove, new Listener<StoreEvent<PublicationAPersonne>>() {
|
| 410 |
public void handleEvent(StoreEvent<PublicationAPersonne> ce) {
|
382 |
public void handleEvent(StoreEvent<PublicationAPersonne> ce) {
|
| 411 |
actualiserEtatBoutonsBarreOutils();
|
383 |
actualiserEtatBoutonsBarreOutils();
|
| 412 |
}
|
384 |
}
|
| 413 |
});
|
385 |
});
|
| - |
|
386 |
storeGrille.addListener(Store.Update, new Listener<StoreEvent<PublicationAPersonne>>() {
|
| - |
|
387 |
public void handleEvent(StoreEvent<PublicationAPersonne> ce) {
|
| - |
|
388 |
if (ce.getRecord().isModified("_role_") && !ce.getModel().get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
|
| - |
|
389 |
ce.getModel().set("_etat_", aDonnee.ETAT_MODIFIE);
|
| - |
|
390 |
}
|
| - |
|
391 |
}
|
| - |
|
392 |
});
|
| Line 414... |
Line 393... |
| 414 |
|
393 |
|
| 415 |
RowNumberer numeroPlugin = new RowNumberer();
|
394 |
RowNumberer numeroPlugin = new RowNumberer();
|
| Line 416... |
Line 395... |
| 416 |
numeroPlugin.setHeader("#");
|
395 |
numeroPlugin.setHeader("#");
|
| Line 473... |
Line 452... |
| 473 |
if (typeRelationCombo.getStore() != null && role!=null && role.matches("[0-9]+")) {
|
452 |
if (typeRelationCombo.getStore() != null && role!=null && role.matches("[0-9]+")) {
|
| 474 |
roleNom = typeRelationCombo.getStore().findModel("id_valeur", role).getNom();
|
453 |
roleNom = typeRelationCombo.getStore().findModel("id_valeur", role).getNom();
|
| 475 |
role = typeRelationCombo.getStore().findModel("id_valeur", role).getId();
|
454 |
role = typeRelationCombo.getStore().findModel("id_valeur", role).getId();
|
| 476 |
}
|
455 |
}
|
| 477 |
modele.set("_role_", role);
|
456 |
modele.set("_role_", role);
|
| 478 |
modele.set("_etat_", aDonnee.ETAT_MODIFIE);
|
- |
|
| 479 |
return roleNom;
|
457 |
return roleNom;
|
| 480 |
}
|
458 |
}
|
| 481 |
};
|
459 |
};
|
| Line -... |
Line 460... |
| - |
|
460 |
|
| - |
|
461 |
|
| Line 482... |
Line 462... |
| 482 |
|
462 |
|
| 483 |
|
463 |
|
| 484 |
ColumnConfig typeRelationColonne = new ColumnConfig("_role_", i18nC.typeRelationPersonneCollection(), 75);
|
464 |
ColumnConfig typeRelationColonne = new ColumnConfig("_role_", i18nC.typeRelationPersonneCollection(), 75);
|
| Line 554... |
Line 534... |
| 554 |
}
|
534 |
}
|
| 555 |
}
|
535 |
}
|
| Line 556... |
Line 536... |
| 556 |
|
536 |
|
| Line 557... |
Line 537... |
| 557 |
public void rafraichir(Object nouvellesDonnees) {
|
537 |
public void rafraichir(Object nouvellesDonnees) {
|
| - |
|
538 |
|
| 558 |
|
539 |
if (nouvellesDonnees instanceof Information)
|
| 559 |
if (nouvellesDonnees instanceof Information) {
|
540 |
{
|
| - |
|
541 |
Information info = (Information) nouvellesDonnees;
|
| 560 |
Information info = (Information) nouvellesDonnees;
|
542 |
rafraichirInformation(info);
|
| 561 |
rafraichirInformation(info);
|
543 |
}
|
| 562 |
} else if (nouvellesDonnees instanceof ValeurListe) {
|
544 |
else if (nouvellesDonnees instanceof ValeurListe)
|
| 563 |
|
545 |
{
|
| 564 |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
|
546 |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
|
| 565 |
if (listeValeurs.getId().equals(config.getListeId("relationPersonnePublication"))) {
|
547 |
if (listeValeurs.getId().equals(config.getListeId("relationPersonnePublication"))) {
|
| 566 |
Formulaire.rafraichirComboBox(listeValeurs, typeRelationCombo);
|
548 |
Formulaire.rafraichirComboBox(listeValeurs, typeRelationCombo);
|
| 567 |
roles = listeValeurs.toList();
|
549 |
roles = listeValeurs.toList();
|
| - |
|
550 |
mettreAJourPersonne();
|
| 568 |
mettreAJourPersonne();
|
551 |
}
|
| 569 |
}
|
552 |
}
|
| 570 |
} else if (nouvellesDonnees instanceof PublicationListe) {
|
553 |
else if (nouvellesDonnees instanceof PublicationListe)
|
| 571 |
|
554 |
{
|
| - |
|
555 |
PublicationListe listePublications = (PublicationListe) nouvellesDonnees;
|
| 572 |
PublicationListe listePublications = (PublicationListe) nouvellesDonnees;
|
556 |
rafraichirPublicationListe(listePublications);
|
| 573 |
rafraichirPublicationListe(listePublications);
|
557 |
}
|
| 574 |
} else if (nouvellesDonnees instanceof PublicationAPersonneListe) {
|
558 |
else if (nouvellesDonnees instanceof PublicationAPersonneListe)
|
| 575 |
|
559 |
{
|
| 576 |
PublicationAPersonneListe papl = (PublicationAPersonneListe) nouvellesDonnees;
|
560 |
PublicationAPersonneListe papl = (PublicationAPersonneListe) nouvellesDonnees;
|
| 577 |
List<PublicationAPersonne> paplListe = papl.toList();
|
- |
|
| 578 |
if (paplListe.size()>0){
|
- |
|
| 579 |
|
- |
|
| 580 |
Debug.log("|--> paplListe.size()>0");
|
- |
|
| 581 |
Debug.log("|--> paplListe="+paplListe.toString());
|
561 |
List<PublicationAPersonne> paplListe = papl.toList();
|
| 582 |
|
562 |
if (paplListe.size()>0){
|
| 583 |
Iterator<PublicationAPersonne> it = paplListe.iterator();
|
563 |
Iterator<PublicationAPersonne> it = paplListe.iterator();
|
| 584 |
while (it.hasNext()) {
|
- |
|
| 585 |
PublicationAPersonne pap = it.next();
|
- |
|
| 586 |
|
- |
|
| 587 |
Debug.log("|--> listePublicationsLiees.size="+listePublicationsLiees.size());
|
564 |
while (it.hasNext()) {
|
| 588 |
|
565 |
PublicationAPersonne pap = it.next();
|
| 589 |
listePublicationsLiees.put(pap.getPublicationLiee().getId(), pap);
|
566 |
listePublicationsLiees.put(pap.getPublicationLiee().getId(), pap);
|
| 590 |
}
|
567 |
}
|
| - |
|
568 |
mettreAJourGrille();
|
| 591 |
mettreAJourGrille();
|
569 |
}
|
| - |
|
570 |
}
|
| 592 |
}
|
571 |
else
|
| 593 |
} else {
|
572 |
{
|
| 594 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
573 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
| Line 595... |
Line 574... |
| 595 |
}
|
574 |
}
|
| 596 |
}
|
- |
|
| 597 |
|
- |
|
| 598 |
private void rafraichirPublicationListe(PublicationListe listePublications) {
|
- |
|
| 599 |
|
575 |
}
|
| 600 |
Debug.log("|> PersonneFormPublication.rafraichirPublicationListe(PublicationListe listePublications)");
|
576 |
|
| 601 |
|
577 |
private void rafraichirPublicationListe(PublicationListe listePublications) {
|
| 602 |
publicationsSaisiesComboBox.getStore().removeAll();
|
578 |
publicationsSaisiesComboBox.getStore().removeAll();
|
| Line 603... |
Line 579... |
| 603 |
publicationsSaisiesComboBox.getStore().add(listePublications.toList());
|
579 |
publicationsSaisiesComboBox.getStore().add(listePublications.toList());
|
| 604 |
publicationsSaisiesComboBox.expand();
|
- |
|
| 605 |
}
|
580 |
publicationsSaisiesComboBox.expand();
|
| 606 |
|
581 |
}
|
| 607 |
public void rafraichirInformation(Information info) {
|
582 |
|
| 608 |
|
583 |
public void rafraichirInformation(Information info) {
|
| 609 |
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
|
584 |
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
|
| Line 627... |
Line 602... |
| 627 |
} else if (type.equals("publication_ajoutee")) {
|
602 |
} else if (type.equals("publication_ajoutee")) {
|
| 628 |
if (info.getDonnee(0) != null) {
|
603 |
if (info.getDonnee(0) != null) {
|
| 629 |
Publication publication = (Publication) info.getDonnee(0);
|
604 |
Publication publication = (Publication) info.getDonnee(0);
|
| 630 |
ajouterDansGrille(publication);
|
605 |
ajouterDansGrille(publication);
|
| 631 |
}
|
606 |
}
|
| 632 |
} else if (type.equals("suppression_collection_a_publication")) {
|
607 |
} else if (type.equals("ajout_publication_a_personne")) {
|
| 633 |
InfoLogger.display("Suppression des publications liées à la collection", info.toString());
|
608 |
InfoLogger.display("Ajout publication à personne", info.getDonnees().toString());
|
| 634 |
} else if (type.equals("ajout_collection_a_publication")) {
|
609 |
} else if (type.equals("suppression_publication_a_personne")) {
|
| 635 |
InfoLogger.display("Ajout des publications liées à la collection", info.toString());
|
610 |
InfoLogger.display("Suppression publication à personne", info.getMessages().toString());
|
| 636 |
} else {
|
611 |
} else {
|
| 637 |
GWT.log(Mediateur.i18nM.erreurRafraichir(info.getClass(), this.getClass()), null);
|
612 |
GWT.log(Mediateur.i18nM.erreurRafraichir(info.getClass(), this.getClass()), null);
|
| 638 |
}
|
613 |
}
|
| 639 |
}
|
614 |
}
|
| Line 640... |
Line 615... |
| 640 |
|
615 |
|
| 641 |
public void peupler() {
|
616 |
public void peupler() {
|
| 642 |
grille.getStore().removeAll();
|
617 |
grille.getStore().removeAll();
|
| 643 |
grille.getStore().add(personneSelectionnee.getPublicationsLiees().toList());
|
618 |
grille.getStore().add(personneSelectionnee.getPublicationsLiees().toList());
|
| 644 |
layout();
|
619 |
layout();
|
| Line 645... |
Line 620... |
| 645 |
InfoLogger.display(i18nC.chargementPublication(), i18nC.ok());
|
620 |
InfoLogger.display(i18nC.chargementPublication(), i18nC.ok());
|
| Line 646... |
Line 621... |
| 646 |
|
621 |
|
| 647 |
}
|
- |
|
| 648 |
|
- |
|
| 649 |
public void collecter() {
|
- |
|
| 650 |
|
622 |
}
|
| 651 |
Debug.log("|*** PersonneFormPublication.collecter() BEGIN");
|
623 |
|
| 652 |
|
624 |
public void collecter() {
|
| 653 |
if (etreAccede()) {
|
625 |
if (etreAccede()) {
|
| 654 |
int nbrePublication = grille.getStore().getCount();
|
626 |
int nbrePublication = grille.getStore().getCount();
|
| 655 |
for (int i = 0; i < nbrePublication; i++) {
|
627 |
for (int i = 0; i < nbrePublication; i++) {
|
| 656 |
PublicationAPersonne publicationLiee = grille.getStore().getAt(i);
|
628 |
PublicationAPersonne publicationLiee = grille.getStore().getAt(i);
|
| 657 |
if (publicationLiee.get("_etat_") != null) {
|
629 |
if (publicationLiee.get("_etat_") != null) {
|
| 658 |
if (publicationLiee.get("_etat_").equals(aDonnee.ETAT_MODIFIE)) {
|
- |
|
| 659 |
// Comme il est impossible de modifier les relations nous supprimons l'ancien enregistrement et ajoutons un nouveau avec le nouveau id_role
|
630 |
if (publicationLiee.get("_etat_").equals(aDonnee.ETAT_MODIFIE)) {
|
| 660 |
publicationsSupprimees.put("id"+idGenere++, publicationLiee);
|
631 |
// Comme il est impossible de modifier les relations nous supprimons l'ancien enregistrement et ajoutons un nouveau avec le nouveau id_role
|
| 661 |
|
632 |
publicationsSupprimees.put("id"+idGenere++, publicationLiee);
|
| Line 662... |
Line 633... |
| 662 |
PublicationAPersonne relationAAjouter = (PublicationAPersonne) publicationLiee.cloner(new PublicationAPersonne());
|
633 |
PublicationAPersonne relationAAjouter = (PublicationAPersonne) publicationLiee.cloner(new PublicationAPersonne());
|
| Line 670... |
Line 641... |
| 670 |
publicationLiee.set("_etat_", "");
|
641 |
publicationLiee.set("_etat_", "");
|
| Line 671... |
Line 642... |
| 671 |
|
642 |
|
| 672 |
}
|
643 |
}
|
| 673 |
}
|
644 |
}
|
| 674 |
grille.getStore().commitChanges();
|
645 |
grille.getStore().commitChanges();
|
| 675 |
}
|
- |
|
| 676 |
|
- |
|
| 677 |
Debug.log("|*** PersonneFormPublication.collecter() END");
|
646 |
}
|
| Line 678... |
Line 647... |
| 678 |
}
|
647 |
}
|
| 679 |
|
- |
|
| 680 |
public List verifier() {
|
- |
|
| 681 |
|
- |
|
| 682 |
Debug.log("|> PersonneFormPublication.verifier()");
|
648 |
|
| 683 |
|
649 |
public List verifier() {
|
| 684 |
List lstMessageErreur = new LinkedList<String>();
|
650 |
List lstMessageErreur = new LinkedList<String>();
|
| 685 |
//Vérifier les roles
|
651 |
//Vérifier les roles
|
| 686 |
List<PublicationAPersonne> listePublis = grille.getStore().getModels();
|
652 |
List<PublicationAPersonne> listePublis = grille.getStore().getModels();
|
| Line 694... |
Line 660... |
| 694 |
return lstMessageErreur;
|
660 |
return lstMessageErreur;
|
| 695 |
}
|
661 |
}
|
| Line 696... |
Line 662... |
| 696 |
|
662 |
|
| Line 697... |
Line -... |
| 697 |
public void soumettre() {
|
- |
|
| 698 |
|
- |
|
| 699 |
Debug.log("<8-8> BEGIN PersonneFormPublication.soumettre()");
|
663 |
public void soumettre() {
|
| 700 |
|
664 |
|
| 701 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
665 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| 702 |
if (publicationsAjoutees.size() == 0 && publicationsSupprimees.size() == 0) {
|
666 |
if (publicationsAjoutees.size() == 0 && publicationsSupprimees.size() == 0) {
|
| 703 |
InfoLogger.display("Modification des publications liées", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
|
667 |
InfoLogger.display("Modification des publications liées", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
|
| 704 |
} else {
|
668 |
} else {
|
| 705 |
// Ajout des relations PublicationAPersonne
|
669 |
// Ajout des relations PublicationAPersonne
|
| 706 |
if (publicationsAjoutees.size() != 0) {
|
- |
|
| 707 |
//TODO : utiliser le role d'une liste déroulante
|
670 |
if (publicationsAjoutees.size() != 0) {
|
| 708 |
|
671 |
//TODO : utiliser le role d'une liste déroulante
|
| 709 |
mediateur.ajouterPublicationAPersonne(this, publicationsAjoutees, personneSelectionnee.getId(), null);
|
672 |
mediateur.ajouterPublicationAPersonne(this, publicationsAjoutees, personneSelectionnee.getId(), null);
|
| 710 |
}
|
673 |
}
|
| 711 |
// Suppression des relations PublicationAPersonne
|
- |
|
| 712 |
if (publicationsSupprimees.size() != 0) {
|
674 |
// Suppression des relations PublicationAPersonne
|
| 713 |
|
675 |
if (publicationsSupprimees.size() != 0) {
|
| 714 |
mediateur.supprimerPublicationAPersonne(this, publicationsSupprimees);
|
676 |
mediateur.supprimerPublicationAPersonne(this, publicationsSupprimees);
|
| 715 |
}
|
677 |
}
|
| 716 |
}
|
- |
|
| 717 |
}
|
- |
|
| 718 |
|
678 |
}
|
| Line 719... |
Line 679... |
| 719 |
Debug.log("<8-8> END PersonneFormPublication.soumettre()");
|
679 |
}
|
| 720 |
}
|
680 |
}
|
| 721 |
|
681 |
|