Subversion Repositories eFlore/Applications.coel

Rev

Rev 60 | Rev 156 | 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.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.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import com.google.gwt.user.client.Window;

public class StructureVue extends LayoutContainer implements Rafraichissable {

        private StructureListePanneauVue panneauInstitutionListe;
        private StructureDetailPanneauVue panneauInstitutionDetail;

        public StructureVue() {
                BorderLayout layout = new BorderLayout();
                layout.setEnableState(false);
                setLayout(layout);

                panneauInstitutionListe = new StructureListePanneauVue();
                this.add(panneauInstitutionListe, new BorderLayoutData(LayoutRegion.CENTER));

                panneauInstitutionDetail = new StructureDetailPanneauVue();
                BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH, .5f, 200, 1000);
                southData.setSplit(true);
                southData.setMargins(new Margins(5, 0, 0, 0));
                this.add(panneauInstitutionDetail, southData);
        }

        public void rafraichir(Object nouvelleDonnees) {
                if (nouvelleDonnees instanceof StructureListe) {
                        remplirListe((StructureListe) nouvelleDonnees);
                } else {
                        Window.alert("Problème!");
                }
        }
        
        private void remplirListe(StructureListe listeInstitutions) {
                LayoutContainer panneauCentre = (LayoutContainer) Registry.get(RegistreId.PANNEAU_CENTRE);
                panneauInstitutionListe.rafraichir(listeInstitutions);
                panneauInstitutionDetail.rafraichir(listeInstitutions);
                panneauCentre.layout();
        }

}