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 355... |
Line 357... |
355 |
if (!listePublicationsLiees.containsKey(publication.getId())) {
|
357 |
if (!listePublicationsLiees.containsKey(publication.getId())) {
|
356 |
PublicationAPersonne publicationLiee = new PublicationAPersonne();
|
358 |
PublicationAPersonne publicationLiee = new PublicationAPersonne();
|
357 |
publicationLiee.setPersonne(personneSelectionnee);
|
359 |
publicationLiee.setPersonne(personneSelectionnee);
|
358 |
publicationLiee.setPublicationLiee(publication);
|
360 |
publicationLiee.setPublicationLiee(publication);
|
359 |
publicationLiee.setIdPublication(publication.getId());
|
361 |
publicationLiee.setIdPublication(publication.getId());
|
- |
|
362 |
|
- |
|
363 |
Debug.log("\\\\> set ETAT_AJOUTE");
|
- |
|
364 |
|
360 |
publicationLiee.set("_etat_", aDonnee.ETAT_AJOUTE);
|
365 |
publicationLiee.set("_etat_", aDonnee.ETAT_AJOUTE);
|
361 |
listePublicationsLiees.put(publication.getId(), publicationLiee);
|
366 |
listePublicationsLiees.put(publication.getId(), publicationLiee);
|
Line 362... |
Line 367... |
362 |
|
367 |
|
363 |
Debug.log("|--> personneSelectionneeID="+personneSelectionnee.getId());
|
368 |
Debug.log("|--> personneSelectionneeID="+personneSelectionnee.getId());
|
Line 415... |
Line 420... |
415 |
storeGrille.addListener(Store.Remove, new Listener<StoreEvent<PublicationAPersonne>>() {
|
420 |
storeGrille.addListener(Store.Remove, new Listener<StoreEvent<PublicationAPersonne>>() {
|
416 |
public void handleEvent(StoreEvent<PublicationAPersonne> ce) {
|
421 |
public void handleEvent(StoreEvent<PublicationAPersonne> ce) {
|
417 |
actualiserEtatBoutonsBarreOutils();
|
422 |
actualiserEtatBoutonsBarreOutils();
|
418 |
}
|
423 |
}
|
419 |
});
|
424 |
});
|
- |
|
425 |
storeGrille.addListener(Store.Update, new Listener<StoreEvent<PublicationAPersonne>>() {
|
- |
|
426 |
public void handleEvent(StoreEvent<PublicationAPersonne> ce) {
|
- |
|
427 |
if (ce.getRecord().isModified("_role_") && !ce.getModel().get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
|
- |
|
428 |
Debug.log("||| PersonneFormPublication.creerGrille, storeGrille LISTENER : set ETAT_MODIFIE");
|
- |
|
429 |
ce.getModel().set("_etat_", aDonnee.ETAT_MODIFIE);
|
- |
|
430 |
}
|
- |
|
431 |
}
|
- |
|
432 |
});
|
Line 420... |
Line 433... |
420 |
|
433 |
|
421 |
RowNumberer numeroPlugin = new RowNumberer();
|
434 |
RowNumberer numeroPlugin = new RowNumberer();
|
Line 422... |
Line 435... |
422 |
numeroPlugin.setHeader("#");
|
435 |
numeroPlugin.setHeader("#");
|
Line 482... |
Line 495... |
482 |
if (typeRelationCombo.getStore() != null && role!=null && role.matches("[0-9]+")) {
|
495 |
if (typeRelationCombo.getStore() != null && role!=null && role.matches("[0-9]+")) {
|
483 |
roleNom = typeRelationCombo.getStore().findModel("id_valeur", role).getNom();
|
496 |
roleNom = typeRelationCombo.getStore().findModel("id_valeur", role).getNom();
|
484 |
role = typeRelationCombo.getStore().findModel("id_valeur", role).getId();
|
497 |
role = typeRelationCombo.getStore().findModel("id_valeur", role).getId();
|
485 |
}
|
498 |
}
|
486 |
modele.set("_role_", role);
|
499 |
modele.set("_role_", role);
|
487 |
modele.set("_etat_", aDonnee.ETAT_MODIFIE);
|
- |
|
488 |
return roleNom;
|
500 |
return roleNom;
|
489 |
}
|
501 |
}
|
490 |
};
|
502 |
};
|
Line -... |
Line 503... |
- |
|
503 |
|
- |
|
504 |
|
Line 491... |
Line 505... |
491 |
|
505 |
|
492 |
|
506 |
|
493 |
ColumnConfig typeRelationColonne = new ColumnConfig("_role_", i18nC.typeRelationPersonneCollection(), 75);
|
507 |
ColumnConfig typeRelationColonne = new ColumnConfig("_role_", i18nC.typeRelationPersonneCollection(), 75);
|
Line 567... |
Line 581... |
567 |
|
581 |
|
Line 568... |
Line 582... |
568 |
public void rafraichir(Object nouvellesDonnees) {
|
582 |
public void rafraichir(Object nouvellesDonnees) {
|
Line 569... |
Line 583... |
569 |
|
583 |
|
- |
|
584 |
Debug.log("|> PersonneFormPublication.rafraichir() BEGIN");
|
- |
|
585 |
|
570 |
Debug.log("|> PersonneFormPublication.rafraichir() BEGIN");
|
586 |
if (nouvellesDonnees instanceof Information)
|
571 |
|
587 |
{
|
- |
|
588 |
Debug.log("|>>>>>>>>>>>>>");
|
572 |
if (nouvellesDonnees instanceof Information) {
|
589 |
Information info = (Information) nouvellesDonnees;
|
- |
|
590 |
rafraichirInformation(info);
|
Line 573... |
Line 591... |
573 |
Information info = (Information) nouvellesDonnees;
|
591 |
}
|
Line 574... |
Line 592... |
574 |
rafraichirInformation(info);
|
592 |
else if (nouvellesDonnees instanceof ValeurListe)
|
575 |
} else if (nouvellesDonnees instanceof ValeurListe) {
|
593 |
{
|
576 |
|
594 |
|
577 |
Debug.log("|--> instanceof ValeurListe");
|
595 |
Debug.log("|--> instanceof ValeurListe");
|
578 |
|
596 |
|
579 |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
|
597 |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
|
- |
|
598 |
if (listeValeurs.getId().equals(config.getListeId("relationPersonnePublication"))) {
|
580 |
if (listeValeurs.getId().equals(config.getListeId("relationPersonnePublication"))) {
|
599 |
Formulaire.rafraichirComboBox(listeValeurs, typeRelationCombo);
|
- |
|
600 |
roles = listeValeurs.toList();
|
Line 581... |
Line 601... |
581 |
Formulaire.rafraichirComboBox(listeValeurs, typeRelationCombo);
|
601 |
mettreAJourPersonne();
|
Line 582... |
Line 602... |
582 |
roles = listeValeurs.toList();
|
602 |
}
|
583 |
mettreAJourPersonne();
|
603 |
}
|
- |
|
604 |
else if (nouvellesDonnees instanceof PublicationListe)
|
584 |
}
|
605 |
{
|
- |
|
606 |
|
Line 585... |
Line 607... |
585 |
} else if (nouvellesDonnees instanceof PublicationListe) {
|
607 |
Debug.log("|--> instanceof PublicationListe");
|
Line 586... |
Line 608... |
586 |
|
608 |
|
587 |
Debug.log("|--> instanceof PublicationListe");
|
609 |
PublicationListe listePublications = (PublicationListe) nouvellesDonnees;
|
Line 610... |
Line 632... |
610 |
mettreAJourGrille();
|
632 |
mettreAJourGrille();
|
611 |
}
|
633 |
}
|
612 |
else {
|
634 |
else {
|
613 |
Debug.log("|--> paplListe.size()<=0");
|
635 |
Debug.log("|--> paplListe.size()<=0");
|
614 |
}
|
636 |
}
|
- |
|
637 |
}
|
615 |
} else {
|
638 |
else
|
- |
|
639 |
{
|
- |
|
640 |
Debug.log("|>*** CROTTE");
|
616 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
641 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
617 |
}
|
642 |
}
|
- |
|
643 |
|
618 |
Debug.log("|> PersonneFormPublication.rafraichir() END");
|
644 |
Debug.log("|> PersonneFormPublication.rafraichir() END");
|
619 |
}
|
645 |
}
|
Line 620... |
Line 646... |
620 |
|
646 |
|
Line 629... |
Line 655... |
629 |
|
655 |
|
Line 630... |
Line 656... |
630 |
public void rafraichirInformation(Information info) {
|
656 |
public void rafraichirInformation(Information info) {
|
Line -... |
Line 657... |
- |
|
657 |
|
- |
|
658 |
Debug.log("|> PersonneFormPublication.rafraichirInformation(Information info) BEGIN");
|
631 |
|
659 |
|
632 |
Debug.log("|> PersonneFormPublication.rafraichirInformation(Information info) BEGIN");
|
660 |
Debug.log("|*^*| type de l'info="+info.getType());
|
633 |
|
661 |
|
634 |
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
|
662 |
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
|
635 |
GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
|
663 |
GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
|
Line 652... |
Line 680... |
652 |
} else if (type.equals("publication_ajoutee")) {
|
680 |
} else if (type.equals("publication_ajoutee")) {
|
653 |
if (info.getDonnee(0) != null) {
|
681 |
if (info.getDonnee(0) != null) {
|
654 |
Publication publication = (Publication) info.getDonnee(0);
|
682 |
Publication publication = (Publication) info.getDonnee(0);
|
655 |
ajouterDansGrille(publication);
|
683 |
ajouterDansGrille(publication);
|
656 |
}
|
684 |
}
|
657 |
} else if (type.equals("suppression_collection_a_publication")) {
|
685 |
} else if (type.equals("ajout_publication_a_personne")) {
|
658 |
InfoLogger.display("Suppression des publications liées à la collection", info.toString());
|
686 |
InfoLogger.display("Ajout publication à personne", info.getDonnees().toString());
|
659 |
} else if (type.equals("ajout_collection_a_publication")) {
|
687 |
} else if (type.equals("suppression_publication_a_personne")) {
|
660 |
InfoLogger.display("Ajout des publications liées à la collection", info.toString());
|
688 |
InfoLogger.display("Suppression publication à personne", info.getMessages().toString());
|
661 |
} else {
|
689 |
} else {
|
662 |
GWT.log(Mediateur.i18nM.erreurRafraichir(info.getClass(), this.getClass()), null);
|
690 |
GWT.log(Mediateur.i18nM.erreurRafraichir(info.getClass(), this.getClass()), null);
|
663 |
}
|
691 |
}
|
- |
|
692 |
|
- |
|
693 |
Debug.log("|> PersonneFormPublication.rafraichirInformation(Information info) END");
|
664 |
}
|
694 |
}
|
Line 665... |
Line 695... |
665 |
|
695 |
|
666 |
public void peupler() {
|
696 |
public void peupler() {
|
667 |
grille.getStore().removeAll();
|
697 |
grille.getStore().removeAll();
|
Line 679... |
Line 709... |
679 |
int nbrePublication = grille.getStore().getCount();
|
709 |
int nbrePublication = grille.getStore().getCount();
|
680 |
for (int i = 0; i < nbrePublication; i++) {
|
710 |
for (int i = 0; i < nbrePublication; i++) {
|
681 |
PublicationAPersonne publicationLiee = grille.getStore().getAt(i);
|
711 |
PublicationAPersonne publicationLiee = grille.getStore().getAt(i);
|
682 |
if (publicationLiee.get("_etat_") != null) {
|
712 |
if (publicationLiee.get("_etat_") != null) {
|
683 |
if (publicationLiee.get("_etat_").equals(aDonnee.ETAT_MODIFIE)) {
|
713 |
if (publicationLiee.get("_etat_").equals(aDonnee.ETAT_MODIFIE)) {
|
- |
|
714 |
Debug.log(">300> ETAT_MODIFE, PublicationLiee = "+publicationLiee.toString());
|
- |
|
715 |
|
- |
|
716 |
|
- |
|
717 |
Debug.log(">300> PersonneFormPublication.collecter(), ETAT_MODIFIE, publicationsSupprimees.put(\"id\"+idGenere++, publicationLiee)");
|
684 |
// Comme il est impossible de modifier les relations nous supprimons l'ancien enregistrement et ajoutons un nouveau avec le nouveau id_role
|
718 |
// Comme il est impossible de modifier les relations nous supprimons l'ancien enregistrement et ajoutons un nouveau avec le nouveau id_role
|
685 |
publicationsSupprimees.put("id"+idGenere++, publicationLiee);
|
719 |
publicationsSupprimees.put("id"+idGenere++, publicationLiee);
|
Line 686... |
Line -... |
686 |
|
- |
|
- |
|
720 |
|
687 |
Debug.log("|--> PersonneFormPublication.collecter(), ETAT_MODIFIE, relationAAjouter, clonage de publicationLiee");
|
721 |
|
- |
|
722 |
PublicationAPersonne relationAAjouter = (PublicationAPersonne) publicationLiee.cloner(new PublicationAPersonne());
|
688 |
PublicationAPersonne relationAAjouter = (PublicationAPersonne) publicationLiee.cloner(new PublicationAPersonne());
|
723 |
Debug.log(">300> PersonneFormPublication.collecter(), ETAT_MODIFIE, publicationsAjoutees.put(\"id\"+idGenere++, relationAAjouter)");
|
689 |
publicationsAjoutees.put("id"+idGenere++, relationAAjouter);
|
- |
|
690 |
Debug.log("|--> ETAT_MODIFE, PublicationLiee = "+publicationLiee.toString());
|
724 |
publicationsAjoutees.put("id"+idGenere++, relationAAjouter);
|
Line 691... |
Line 725... |
691 |
}
|
725 |
}
|
692 |
|
726 |
|
693 |
if (publicationLiee.get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
|
727 |
if (publicationLiee.get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
|
694 |
publicationsAjoutees.put("id"+idGenere++, publicationLiee);
|
728 |
publicationsAjoutees.put("id"+idGenere++, publicationLiee);
|
695 |
Debug.log("|--> ETAT_AJOUTE, PublicationLiee = "+publicationLiee.toString());
|
729 |
Debug.log(">300> ETAT_AJOUTE, PublicationLiee = "+publicationLiee.toString());
|
696 |
}
|
730 |
}
|
Line 697... |
Line 731... |
697 |
// Initialisation de la grille
|
731 |
// Initialisation de la grille
|
Line 728... |
Line 762... |
728 |
|
762 |
|
729 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
763 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
730 |
if (publicationsAjoutees.size() == 0 && publicationsSupprimees.size() == 0) {
|
764 |
if (publicationsAjoutees.size() == 0 && publicationsSupprimees.size() == 0) {
|
731 |
InfoLogger.display("Modification des publications liées", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
|
765 |
InfoLogger.display("Modification des publications liées", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
|
- |
|
766 |
} else {
|
- |
|
767 |
|
732 |
} else {
|
768 |
Debug.log("<8-8> PersonneFormPublication.soumettre() : publicationsAjoutees.size()="+publicationsAjoutees.size());
|
733 |
// Ajout des relations PublicationAPersonne
|
769 |
// Ajout des relations PublicationAPersonne
|
734 |
if (publicationsAjoutees.size() != 0) {
|
770 |
if (publicationsAjoutees.size() != 0) {
|
Line 735... |
Line 771... |
735 |
//TODO : utiliser le role d'une liste déroulante
|
771 |
//TODO : utiliser le role d'une liste déroulante
|
736 |
|
772 |
|
737 |
Debug.log("<8-8> PersonneFormPublication - Appel à mediateur.ajouterPublicationAPersonne()");
|
773 |
Debug.log("<8-8> PersonneFormPublication.soumettre() - Appel à mediateur.ajouterPublicationAPersonne()");
|
- |
|
774 |
mediateur.ajouterPublicationAPersonne(this, publicationsAjoutees, personneSelectionnee.getId(), null);
|
- |
|
775 |
}
|
738 |
mediateur.ajouterPublicationAPersonne(this, publicationsAjoutees, personneSelectionnee.getId(), null);
|
776 |
|
739 |
}
|
777 |
Debug.log("<8-8> PersonneFormPublication.soumettre() : publicationsSupprimees.size()="+publicationsSupprimees.size());
|
Line 740... |
Line 778... |
740 |
// Suppression des relations PublicationAPersonne
|
778 |
// Suppression des relations PublicationAPersonne
|
741 |
if (publicationsSupprimees.size() != 0) {
|
779 |
if (publicationsSupprimees.size() != 0) {
|
742 |
|
780 |
|
743 |
Debug.log("<8-8> PersonneFormPublication - Appel à mediateur.supprimerPublicationAPersonne()");
|
781 |
Debug.log("<8-8> PersonneFormPublication.soumettre() - Appel à mediateur.supprimerPublicationAPersonne()");
|
744 |
mediateur.supprimerPublicationAPersonne(this, publicationsSupprimees);
|
782 |
mediateur.supprimerPublicationAPersonne(this, publicationsSupprimees);
|