Subversion Repositories eFlore/Applications.coel

Rev

Rev 322 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package org.tela_botanica.client.vues;

import org.tela_botanica.client.RegistreId;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.PublicationListe;
import org.tela_botanica.client.modeles.StructureListe;

import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import com.google.gwt.user.client.Window;

public class PublicationVue extends LayoutContainer implements Rafraichissable {

        private PublicationListeVue panneauPublicationListe;
        private PublicationDetailVue panneauPublicationDetail;
        
        public PublicationVue() {
                BorderLayout layout = new BorderLayout();
                layout.setEnableState(false);
                setLayout(layout);

                panneauPublicationListe = new PublicationListeVue();
                this.add(panneauPublicationListe, new BorderLayoutData(LayoutRegion.CENTER));

                panneauPublicationDetail = new PublicationDetailVue();
                BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH, .5f, 200, 1000);
                southData.setSplit(true);
                southData.setMargins(new Margins(5, 0, 0, 0));
                this.add(panneauPublicationDetail, southData);
        }
        
        public void rafraichir(Object nouvelleDonnees) {
                if (nouvelleDonnees instanceof PublicationListe) {
                        remplirListe((PublicationListe) nouvelleDonnees);
                } else {
                        MessageBox.alert("Attention", "Une erreur est survenue", null);
                }
        }
        
        private void remplirListe(PublicationListe listePublication) {
                
                LayoutContainer panneauCentre = (LayoutContainer) Registry.get(RegistreId.PANNEAU_CENTRE);
                panneauPublicationListe.rafraichir(listePublication);
                panneauPublicationDetail.rafraichir(listePublication);
                panneauCentre.layout();
        }

}