Example usage for com.vaadin.ui Panel setSizeFull

List of usage examples for com.vaadin.ui Panel setSizeFull

Introduction

In this page you can find the example usage for com.vaadin.ui Panel setSizeFull.

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:fr.univlorraine.mondossierweb.views.windows.DetailGroupesWindow.java

License:Apache License

private void init() {

    /* Style *///from  ww w. jav  a  2s  .c  om
    setWidth(80, Unit.PERCENTAGE);
    setHeight(95, Unit.PERCENTAGE);
    setModal(true);
    setResizable(false);

    /* Layout */
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    layout.setMargin(true);
    layout.setSpacing(true);

    /* Titre */
    setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale()));

    //Sous titre avec l'anne 
    HorizontalLayout titleLayout = new HorizontalLayout();
    titleLayout.setSizeFull();
    titleLayout.setHeight("20px");
    Label labelAnneeUniv = new Label();
    labelAnneeUniv.setValue(applicationContext.getMessage(NAME + ".label.anneeuniv", null, getLocale()) + " <b>"
            + annee + "</b>");
    labelAnneeUniv.setContentMode(ContentMode.HTML);
    titleLayout.addComponent(labelAnneeUniv);
    titleLayout.setComponentAlignment(labelAnneeUniv, Alignment.MIDDLE_LEFT);

    if (StringUtils.hasText(vetLibelle)) {
        Label labelEtape = new Label();
        labelEtape.setValue(applicationContext.getMessage(NAME + ".label.vet", null, getLocale()) + " : <b>"
                + vetLibelle + "</b>");
        labelEtape.setContentMode(ContentMode.HTML);
        titleLayout.addComponent(labelEtape);
        titleLayout.setComponentAlignment(labelEtape, Alignment.MIDDLE_RIGHT);
    }

    layout.addComponent(titleLayout);

    Panel panelDetailGroupes = new Panel(elpLibelle);
    panelDetailGroupes.setSizeFull();

    if (lgroupes != null && lgroupes.size() > 0) {
        TreeTable detailGroupesTable = new TreeTable();
        detailGroupesTable.setSizeFull();
        HierarchicalContainer hc = new HierarchicalContainer();
        hc.addContainerProperty(ID_PROPERTY, String.class, "");
        hc.addContainerProperty(CODE_COLLECTION_PROPERTY, String.class, "");
        hc.addContainerProperty(CODE_GROUPE_PROPERTY, String.class, "");
        hc.addContainerProperty(LIBELLE_GROUPE_PROPERTY, String.class, "");
        hc.addContainerProperty(CAP_MAX_PROPERTY, String.class, "");
        hc.addContainerProperty(CAP_INT_PROPERTY, String.class, "");
        hc.addContainerProperty(NB_INSCRITS_PROPERTY, String.class, "");
        detailGroupesTable.setContainerDataSource(hc);
        int id = 0;
        for (ElpDeCollection edc : lgroupes) {
            id++;
            for (CollectionDeGroupes cdg : edc.getListeCollection()) {
                id++;
                ObjetBaseCollectionGroupe obj = new ObjetBaseCollectionGroupe();
                obj.setId("" + id);
                obj.setCod_coll(cdg.getCodCollection());
                obj.setCap_max("");
                obj.setCap_int("");
                obj.setNb_inscrits("");
                Item itemCollection = hc.addItem(obj.getId());
                renseignerItem(itemCollection, obj);

                for (Groupe gpe : cdg.getListeGroupes()) {
                    id++;
                    ObjetBaseCollectionGroupe objgpe = new ObjetBaseCollectionGroupe();
                    objgpe.setId("" + id);
                    objgpe.setCod_gpe(gpe.getCodGroupe());
                    objgpe.setLib_gpe(gpe.getLibGroupe());
                    objgpe.setCap_max("" + gpe.getCapMaxGpe());
                    objgpe.setCap_int("" + gpe.getCapIntGpe());
                    objgpe.setNb_inscrits("" + gpe.getNbInscrits());
                    Item i = hc.addItem(objgpe.getId());
                    renseignerItem(i, objgpe);
                    detailGroupesTable.setParent(objgpe.getId(), obj.getId());
                    detailGroupesTable.setChildrenAllowed(objgpe.getId(), false);
                }

                detailGroupesTable.setCollapsed(obj.getId(), false);

            }
        }

        detailGroupesTable.addContainerProperty(ID_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(CODE_COLLECTION_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(CODE_GROUPE_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(LIBELLE_GROUPE_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(CAP_MAX_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(CAP_INT_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(NB_INSCRITS_PROPERTY, String.class, "");

        detailGroupesTable.setVisibleColumns(DETAIL_FIELDS_ORDER);

        detailGroupesTable.setColumnHeader(CODE_COLLECTION_PROPERTY,
                applicationContext.getMessage(NAME + ".table.codecollection", null, getLocale()));
        detailGroupesTable.setColumnHeader(CODE_GROUPE_PROPERTY,
                applicationContext.getMessage(NAME + ".table.codegroupe", null, getLocale()));
        detailGroupesTable.setColumnHeader(LIBELLE_GROUPE_PROPERTY,
                applicationContext.getMessage(NAME + ".table.libgroupe", null, getLocale()));
        detailGroupesTable.setColumnHeader(CAP_MAX_PROPERTY,
                applicationContext.getMessage(NAME + ".table.capmax", null, getLocale()));
        detailGroupesTable.setColumnHeader(CAP_INT_PROPERTY,
                applicationContext.getMessage(NAME + ".table.capint", null, getLocale()));
        detailGroupesTable.setColumnHeader(NB_INSCRITS_PROPERTY,
                applicationContext.getMessage(NAME + ".table.nbinscrits", null, getLocale()));

        detailGroupesTable.setColumnCollapsingAllowed(true);
        detailGroupesTable.setColumnReorderingAllowed(false);
        detailGroupesTable.setSelectable(false);
        detailGroupesTable.setImmediate(true);
        detailGroupesTable.addStyleName("scrollabletable");

        panelDetailGroupes.setContent(detailGroupesTable);

    }

    layout.addComponent(panelDetailGroupes);

    Panel panelCollectionInfo = new Panel(
            applicationContext.getMessage(NAME + ".info.title", null, getLocale()));
    panelCollectionInfo.setIcon(FontAwesome.INFO_CIRCLE);

    panelCollectionInfo.addStyleName("significationpanel");

    VerticalLayout significationLayout = new VerticalLayout();
    significationLayout.setMargin(true);
    significationLayout.setSpacing(true);

    Label mapSignificationLabel = new Label(
            applicationContext.getMessage(NAME + ".collection.info", null, getLocale()));
    mapSignificationLabel.setStyleName(ValoTheme.LABEL_SMALL);
    mapSignificationLabel.setContentMode(ContentMode.HTML);

    significationLayout.addComponent(mapSignificationLabel);

    panelCollectionInfo.setContent(significationLayout);

    layout.addComponent(panelCollectionInfo);

    layout.setExpandRatio(panelDetailGroupes, 1);

    setContent(layout);

    /* Centre la fentre */
    center();

}

From source file:fr.univlorraine.mondossierweb.views.windows.DetailInscriptionWindow.java

License:Apache License

private void init() {

    //On vrifie le droit d'accder  la vue
    if ((userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null
            && MainUI.getCurrent().getEtudiant() != null) {

        /* Style */
        setWidth(80, Unit.PERCENTAGE);/*  w  w  w  .  j a  va  2s. c  o m*/
        setHeight(95, Unit.PERCENTAGE);
        setModal(true);
        setResizable(false);

        //Test si user enseignant et en vue Enseignant
        if (userController.isEnseignant() && MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
            //On recupere les notes pour un enseignant
            etudiantController.renseigneDetailNotesEtResultatsEnseignant(etape);
        } else {
            //On rcupre les notes pour un tudiant
            etudiantController.renseigneDetailNotesEtResultats(etape);
        }

        /* Layout */
        VerticalLayout layout = new VerticalLayout();
        layout.setSizeFull();
        layout.setMargin(true);
        layout.setSpacing(true);

        /* Titre */
        setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale()));

        //Sous titre avec l'anne
        HorizontalLayout titleLayout = new HorizontalLayout();
        titleLayout.setSizeFull();
        titleLayout.setHeight("20px");
        Label labelAnneeUniv = new Label(
                applicationContext.getMessage(NAME + ".label.anneeuniv", null, getLocale()) + " <b>"
                        + etape.getAnnee() + "</b>");
        labelAnneeUniv.setContentMode(ContentMode.HTML);
        titleLayout.addComponent(labelAnneeUniv);
        titleLayout.setComponentAlignment(labelAnneeUniv, Alignment.MIDDLE_CENTER);
        layout.addComponent(titleLayout);

        Panel panelDetailInscription = new Panel(etape.getLibelle());
        panelDetailInscription.setSizeFull();
        panelDetailInscription.addStyleName("small-font-element");

        List<ElementPedagogique> lelp = MainUI.getCurrent().getEtudiant().getElementsPedagogiques();
        if (lelp != null && lelp.size() > 0) {
            Table detailInscriptionTable = new Table(null,
                    new BeanItemContainer<>(ElementPedagogique.class, lelp));
            detailInscriptionTable.setSizeFull();
            detailInscriptionTable.setVisibleColumns(new String[0]);
            detailInscriptionTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.code", null, getLocale()),
                    new CodeElpColumnGenerator());
            detailInscriptionTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.libelle", null, getLocale()),
                    new LibelleElpColumnGenerator());
            if (configController.isAffECTSEtudiant()) {
                detailInscriptionTable.addGeneratedColumn(
                        applicationContext.getMessage(NAME + ".table.elp.ects", null, getLocale()),
                        new ECTSColumnGenerator());
            }
            detailInscriptionTable.setColumnCollapsingAllowed(true);
            detailInscriptionTable.setColumnReorderingAllowed(false);
            detailInscriptionTable.setSelectable(false);
            detailInscriptionTable.setImmediate(true);
            detailInscriptionTable.addStyleName("scrollabletable");
            panelDetailInscription.setContent(detailInscriptionTable);
        } else {
            setHeight(30, Unit.PERCENTAGE);
            HorizontalLayout messageLayout = new HorizontalLayout();
            messageLayout.setSpacing(true);
            messageLayout.setMargin(true);
            Label labelAucuneIp = new Label(
                    applicationContext.getMessage(NAME + ".message.aucuneip", null, getLocale()));
            labelAucuneIp.setStyleName(ValoTheme.LABEL_BOLD);
            messageLayout.addComponent(labelAucuneIp);
            panelDetailInscription.setContent(messageLayout);
        }

        layout.addComponent(panelDetailInscription);

        layout.setExpandRatio(panelDetailInscription, 1);

        setContent(layout);

        /* Centre la fentre */
        center();

    }
}

From source file:fr.univlorraine.mondossierweb.views.windows.DetailNotesWindow.java

License:Apache License

private void init() {

    //On vrifie le droit d'accder  la vue
    if ((userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null
            && MainUI.getCurrent().getEtudiant() != null) {

        /* Style */
        setWidth(80, Unit.PERCENTAGE);//  w  w w  . j  a v  a 2  s . c o  m
        setHeight(95, Unit.PERCENTAGE);
        setModal(true);
        setResizable(false);

        //Test si user enseignant et en vue Enseignant
        if (userController.isEnseignant() && MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
            //On recupere les notes pour un enseignant
            etudiantController.renseigneDetailNotesEtResultatsEnseignant(etape);
        } else {
            //On rcupre les notes pour un tudiant
            etudiantController.renseigneDetailNotesEtResultats(etape);
        }

        /* Layout */
        VerticalLayout layout = new VerticalLayout();
        layout.setSizeFull();
        layout.setMargin(true);
        layout.setSpacing(true);

        /* Titre */
        setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale()));

        List<ElementPedagogique> lelp = MainUI.getCurrent().getEtudiant().getElementsPedagogiques();

        //Sous titre avec l'anne
        HorizontalLayout titleLayout = new HorizontalLayout();
        titleLayout.setSizeFull();
        titleLayout.setHeight("20px");
        Label messageLabel = new Label(
                applicationContext.getMessage(NAME + ".label.messageinfo", null, getLocale()));
        messageLabel.setContentMode(ContentMode.HTML);
        messageLabel.setStyleName(ValoTheme.LABEL_SMALL);
        titleLayout.addComponent(messageLabel);
        titleLayout.setExpandRatio(messageLabel, 1);
        titleLayout.setComponentAlignment(messageLabel, Alignment.MIDDLE_LEFT);

        //Test si user enseignant
        if (userController.isEnseignant() && lelp != null && lelp.size() > 0) {
            //Bouton pour afficher les filtres
            btnDisplayFiltres = new Button();
            btnDisplayFiltres.setWidth("52px");
            btnDisplayFiltres.setHeight("32px");
            btnDisplayFiltres.setStyleName(ValoTheme.BUTTON_PRIMARY);
            if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
                btnDisplayFiltres.setStyleName(ValoTheme.BUTTON_FRIENDLY);
            }
            btnDisplayFiltres.setIcon(FontAwesome.FILTER);
            btnDisplayFiltres.setDescription(
                    applicationContext.getMessage(NAME + ".btn.displayFilters", null, getLocale()));
            btnDisplayFiltres.addClickListener(e -> {
                btnDisplayFiltres.setVisible(false);
                panelVue.setVisible(true);
            });
            titleLayout.addComponent(btnDisplayFiltres);
            titleLayout.setComponentAlignment(btnDisplayFiltres, Alignment.MIDDLE_RIGHT);
            //titleLayout.setExpandRatio(btnDisplayFiltres, 1);
            btnDisplayFiltres.setVisible(true);
        }

        if (lelp != null && lelp.size() > 0 && configController.isPdfNotesActive()) {
            Button pdfButton = new Button();
            pdfButton.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
            pdfButton.addStyleName("button-icon");
            pdfButton.addStyleName("red-button-icon");
            pdfButton.setIcon(FontAwesome.FILE_PDF_O);
            pdfButton.setDescription(
                    applicationContext.getMessage(NAME + ".btn.pdf.description", null, getLocale()));

            if (PropertyUtils.isPushEnabled()) {
                MyFileDownloader fd = new MyFileDownloader(noteController.exportPdfDetail(etape));
                fd.extend(pdfButton);
            } else {
                FileDownloader fd = new FileDownloader(noteController.exportPdfDetail(etape));
                fd.extend(pdfButton);
            }

            titleLayout.addComponent(pdfButton);
            titleLayout.setComponentAlignment(pdfButton, Alignment.MIDDLE_RIGHT);
        }
        layout.addComponent(titleLayout);

        //Test si user enseignant
        if (userController.isEnseignant() && lelp != null && lelp.size() > 0) {
            panelVue = new Panel();

            HorizontalLayout vueLayout = new HorizontalLayout();
            vueLayout.setMargin(true);
            vueLayout.setSpacing(true);
            vueLayout.setSizeFull();

            Button changerVueButton = new Button(
                    applicationContext.getMessage(NAME + ".button.vueEnseignant", null, getLocale()));
            changerVueButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
            if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
                changerVueButton.setStyleName(ValoTheme.BUTTON_FRIENDLY);
                changerVueButton.setCaption(
                        applicationContext.getMessage(NAME + ".button.vueEtudiant", null, getLocale()));
            }
            //On change la variable vueEnseignantNotesEtResultats et on recr la vue en cours
            changerVueButton.addClickListener(e -> {
                etudiantController.changerVueNotesEtResultats();
                init();
            });

            Label vueLabel = new Label(
                    applicationContext.getMessage(NAME + ".label.vueEtudiant", null, getLocale()));
            if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
                vueLabel.setValue(
                        applicationContext.getMessage(NAME + ".label.vueEnseignant", null, getLocale()));
            }
            vueLabel.setContentMode(ContentMode.HTML);
            vueLabel.setStyleName(ValoTheme.LABEL_SMALL);

            vueLayout.addComponent(changerVueButton);
            vueLayout.setComponentAlignment(changerVueButton, Alignment.MIDDLE_CENTER);
            vueLayout.addComponent(vueLabel);
            vueLayout.setExpandRatio(vueLabel, 1);

            panelVue.setContent(vueLayout);
            layout.addComponent(panelVue);
            panelVue.setVisible(false);
        }

        Panel panelDetailNotes = new Panel(etape.getLibelle() + " - "
                + applicationContext.getMessage(NAME + ".label.anneeuniv", null, getLocale()) + " "
                + etape.getAnnee());
        panelDetailNotes.addStyleName("small-font-element");
        panelDetailNotes.setSizeFull();

        if (lelp != null && lelp.size() > 0) {
            Table detailNotesTable = new Table(null, new BeanItemContainer<>(ElementPedagogique.class, lelp));
            detailNotesTable.setSizeFull();
            detailNotesTable.setVisibleColumns(new String[0]);
            if (contientElpObtenusPrecedemment(lelp)) {
                detailNotesTable.addGeneratedColumn(
                        applicationContext.getMessage(NAME + ".table.elp.annee", null, getLocale()),
                        new AnneeColumnGenerator());
            }
            detailNotesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.code", null, getLocale()),
                    new CodeElpColumnGenerator());
            detailNotesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.libelle", null, getLocale()),
                    new LibelleElpColumnGenerator());
            detailNotesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.notesession1", null, getLocale()),
                    new Session1ColumnGenerator());
            detailNotesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.resultatsession1", null, getLocale()),
                    new ResultatSession1ColumnGenerator());
            detailNotesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.notesession2", null, getLocale()),
                    new Session2ColumnGenerator());
            detailNotesTable.addGeneratedColumn("resultatsession2", new ResultatSession2ColumnGenerator());
            detailNotesTable.setColumnHeader("resultatsession2",
                    applicationContext.getMessage(NAME + ".table.elp.resultatsession2", null, getLocale()));
            if (configController.isAffRangEtudiant() || etudiantController.isAfficherRangElpEpr()) {
                detailNotesTable.addGeneratedColumn(
                        applicationContext.getMessage(NAME + ".table.elp.rang", null, getLocale()),
                        new RangColumnGenerator());
            }
            if (configController.isAffECTSEtudiant()) {
                detailNotesTable.addGeneratedColumn(
                        applicationContext.getMessage(NAME + ".table.elp.ects", null, getLocale()),
                        new ECTSColumnGenerator());
            }
            detailNotesTable.setColumnCollapsingAllowed(true);
            detailNotesTable.setColumnReorderingAllowed(false);
            detailNotesTable.setSelectable(false);
            detailNotesTable.setImmediate(true);
            detailNotesTable.addStyleName("scrollabletable");
            panelDetailNotes.setContent(detailNotesTable);
        } else {
            setHeight(30, Unit.PERCENTAGE);
            HorizontalLayout messageLayout = new HorizontalLayout();
            messageLayout.setSpacing(true);
            messageLayout.setMargin(true);
            Label labelAucunResultat = new Label(
                    applicationContext.getMessage(NAME + ".message.aucuneresultat", null, getLocale()));
            labelAucunResultat.setStyleName(ValoTheme.LABEL_BOLD);
            messageLayout.addComponent(labelAucunResultat);
            panelDetailNotes.setContent(messageLayout);

        }
        layout.addComponent(panelDetailNotes);

        if (lelp != null && lelp.size() > 0
                && MainUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) {
            Panel panelSignificationResultats = new Panel(
                    applicationContext.getMessage(NAME + ".info.significations.resultats", null, getLocale()));

            panelSignificationResultats.addStyleName("significationpanel");
            panelSignificationResultats.addStyleName("small-font-element");
            panelSignificationResultats.setIcon(FontAwesome.INFO_CIRCLE);

            VerticalLayout significationLayout = new VerticalLayout();
            significationLayout.setMargin(true);
            significationLayout.setSpacing(true);

            String grilleSignficationResultats = "";
            //grilleSignficationResultats = significationResultats.toString().substring(1,significationResultats.toString().length()-1);
            Set<String> ss = MainUI.getCurrent().getEtudiant().getSignificationResultats().keySet();
            for (String k : ss) {
                if (k != null && !k.equals("") && !k.equals(" ")) {
                    grilleSignficationResultats = grilleSignficationResultats + "<b>" + k + "</b>&#160;:&#160;"
                            + MainUI.getCurrent().getEtudiant().getSignificationResultats().get(k);
                    grilleSignficationResultats = grilleSignficationResultats + "&#160;&#160;&#160;";
                }
            }
            Label mapSignificationLabel = new Label(grilleSignficationResultats);
            mapSignificationLabel.setStyleName(ValoTheme.LABEL_SMALL);
            mapSignificationLabel.setContentMode(ContentMode.HTML);
            significationLayout.addComponent(mapSignificationLabel);

            panelSignificationResultats.setContent(significationLayout);
            layout.addComponent(panelSignificationResultats);

        }

        layout.setExpandRatio(panelDetailNotes, 1);

        setContent(layout);

        /* Centre la fentre */
        center();

    }

}

From source file:jp.primecloud.auto.ui.MainView.java

License:Open Source License

@Override
public void attach() {
    setSizeFull();//from   www .  j  av a  2 s .c om
    addStyleName("mycloud-panel");
    setMargin(false);
    setSpacing(false);

    // ???
    topBar = new TopBar(this);
    addComponent(topBar);

    // ???
    CssLayout topLayout = new CssLayout();
    topLayout.setWidth("100%");
    topLayout.setHeight("28px");
    topLayout.addStyleName("mycloud-name");
    topLayout.setMargin(true);
    addComponent(topLayout);

    // myCloud??
    myCloudField = new TextField();
    myCloudField.setWidth("80%");
    myCloudField.addStyleName("mycloud-label");
    myCloudField.setEnabled(false);
    myCloudField.setReadOnly(true);
    topLayout.addComponent(myCloudField);

    // Reload
    reloadButton = new Button(ViewProperties.getCaption("button.reload"));
    reloadButton.setDescription(ViewProperties.getCaption("description.reload"));
    reloadButton.addStyleName("sync-button");
    reloadButton.addStyleName("borderless");
    reloadButton.setIcon(Icons.SYNC.resource());
    reloadButton.setEnabled(false);
    reloadButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            refresh();
        }
    });
    topLayout.addComponent(reloadButton);

    // myCloud
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    mainLayout.setSpacing(false);
    mainLayout.setMargin(false);

    Panel mainPanel = new Panel(mainLayout);
    mainPanel.setSizeFull();
    mainPanel.addStyleName(Reindeer.PANEL_LIGHT);
    addComponent(mainPanel);
    setExpandRatio(mainPanel, 100);

    // 
    tab = new TabSheet();
    tab.setSizeFull();
    tab.setEnabled(false);
    tab.addStyleName(Reindeer.TABSHEET_BORDERLESS);
    mainLayout.addComponent(tab);
    mainLayout.setExpandRatio(tab, 100);

    // 
    String enableService = Config.getProperty("ui.enableService");
    if (enableService == null || BooleanUtils.toBoolean(enableService)) {
        servicePanel = new ServicePanel(this);
        tab.addTab(servicePanel, ViewProperties.getCaption("tab.service"), Icons.SERVICETAB.resource());
    }

    // ?
    serverPanel = new ServerPanel(this);
    tab.addTab(serverPanel, ViewProperties.getCaption("tab.server"), Icons.SERVERTAB.resource());

    // ?
    String enableLoadBalancer = Config.getProperty("ui.enableLoadBalancer");
    if (enableLoadBalancer == null || BooleanUtils.toBoolean(enableLoadBalancer)) {
        loadBalancerPanel = new LoadBalancerPanel(this);
        tab.addTab(loadBalancerPanel, ViewProperties.getCaption("tab.loadbalancer"),
                Icons.LOADBALANCER_TAB.resource());
    }

    // ???????
    tab.addListener(new SelectedTabChangeListener() {
        @Override
        public void selectedTabChange(SelectedTabChangeEvent event) {
            MainView.this.selectedTabChange(event);
        }
    });

    // ?
    Refresher timer = new Refresher();
    timer.setRefreshInterval(15 * 1000); //(msec)
    timer.addListener(new Refresher.RefreshListener() {
        @Override
        public void refresh(Refresher source) {
            if (needsRefresh()) {
                refreshTableOnly();
            }
        }
    });
    mainLayout.addComponent(timer);

    // ?
    showLogin();
}

From source file:management.limbr.ui.VaadinUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {

    final VerticalLayout root = new VerticalLayout();
    root.setSizeFull();//from w ww. jav a  2 s . c  om
    root.setMargin(true);
    root.setSpacing(true);
    setContent(root);

    Image logo = new Image(null, new ExternalResource("images/logo1.png"));
    logo.setHeight(1.2f, Unit.EM);
    logo.setWidthUndefined();

    CssLayout navBar = new CssLayout();
    navBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    navBar.addComponent(logo);
    navBar.addComponent(createNavButton("Users", UsersViewImpl.VIEW_NAME));
    root.addComponent(navBar);

    final Panel viewContainer = new Panel();
    viewContainer.setSizeFull();
    root.addComponent(viewContainer);
    root.setExpandRatio(viewContainer, 1.0f);

    Navigator navigator = new Navigator(this, viewContainer);
    navigator.addProvider(viewProvider);

}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private Component getBennuInterface() {
    GridSystemLayout gsl = new GridSystemLayout();
    gsl.setMargin(false);/*from   w  ww . j a  v  a  2 s  . c  o  m*/

    Label lblBigTitle = new Label("A Big Title (H1)", Label.CONTENT_TEXT);
    lblBigTitle.setStyleName(BennuTheme.LABEL_H1);

    Label lblBigText = new Label(LOREM_TEXT_LARGE, Label.CONTENT_TEXT);

    gsl.setCell("big_title", 16, lblBigTitle);
    gsl.setCell("big_text", 16, lblBigText);

    Label lblOneLink = new Label(
            "<a href='http://www.google.com'>Label Link : One link a day keeps the doctor away</a>",
            Label.CONTENT_XHTML);
    gsl.setCell("label_one_link", 16, lblOneLink);

    Button btOneLink = new Button("Button Link: One link a day keeps the doctor away", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            event.getButton().getWindow().showNotification("You just clicked a button link!");
        }
    });

    btOneLink.setStyleName(BaseTheme.BUTTON_LINK);
    gsl.setCell("button_one_link", 16, btOneLink);

    Label lblTitleH2 = new Label("A Not So Big Title (H2)", Label.CONTENT_TEXT);
    lblTitleH2.setStyleName(BennuTheme.LABEL_H2);
    gsl.setCell("not_so_big_title", 16, lblTitleH2);

    Label lblSmallText = new Label(LOREM_TEXT_SMALL, Label.CONTENT_TEXT);
    gsl.setCell("small_text", 16, lblSmallText);

    Table table = new Table();
    table.setSizeFull();
    table.setPageLength(0);
    table.addContainerProperty("Name", String.class, "");
    table.addContainerProperty("Age", Integer.class, "");
    table.addContainerProperty("Nickname", String.class, "");

    table.addItem(new Object[] { "Giacomo Guilizzoni", 34, "Peidi" }, 1);
    table.addItem(new Object[] { "Giodp Jack Guilizzoni", 4, "The Guids" }, 2);
    table.addItem(new Object[] { "Marco Botton", 31, "" }, 3);
    table.addItem(new Object[] { "Mariah Maciachlan", 35, "Patata" }, 4);
    table.addItem(new Object[] { "Valerie Libery WOW! Division", 23, "Val" }, 5);
    table.addItem(new Object[] { "Guido Master lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum", 99,
            "Booya Master" }, 6);

    gsl.setCell("table", 16, table);

    Label lblTitleH3 = new Label("A Getting Smaller Title (H3)", Label.CONTENT_TEXT);
    lblTitleH3.setStyleName(BennuTheme.LABEL_H3);
    gsl.setCell("getting_smaller_title", 16, lblTitleH3);

    Panel panelLeft = new Panel();
    panelLeft.setScrollable(true);
    panelLeft.setSizeFull();
    panelLeft.setHeight("145px");
    panelLeft.addComponent(new Label(LOREM_TEXT_ALL));

    Panel panelRight = new Panel();
    panelRight.addComponent(new Label(LOREM_TEXT_LARGE));

    gsl.setCell("panel_left", 8, panelLeft);
    gsl.setCell("panel_right", 8, panelRight);

    Label lblTitleH4 = new Label("A Smaller Title (H4)", Label.CONTENT_TEXT);
    lblTitleH4.setStyleName(BennuTheme.LABEL_H4);
    gsl.setCell("smaller_title", 16, lblTitleH4);

    Label lblTextb4Form = new Label(LOREM_TEXT_SMALL, Label.CONTENT_TEXT);
    gsl.setCell("txtB4Form", 0, 8, 8, lblTextb4Form);

    Form form = new Form();
    form.setSizeFull();
    form.addField("form_label", new TextField("Form Label"));
    form.addField("large_form_label", new DateField("Large Form Label"));
    form.addField("much_larger_form_label", new Select("Much Larger Form Label"));
    form.addField("something_diff", new TextArea("And now for something completely different"));

    final OptionGroup checkboxes = new OptionGroup("Checkboxes fun");
    checkboxes.setMultiSelect(true);
    checkboxes.addItem("not selected");
    checkboxes.addItem("selected");
    checkboxes.select("selected");
    checkboxes.addItem("disabled");
    checkboxes.setItemEnabled("disabled", false);
    checkboxes.addItem("disabled selected");
    checkboxes.select("disabled selected");
    checkboxes.setItemEnabled("disabled selected", false);

    form.addField("checkboxes", checkboxes);

    final OptionGroup radiobuttons = new OptionGroup("Radio on/off");
    radiobuttons.addItem("option 1(selected)");
    radiobuttons.select("option 1(selected)");
    radiobuttons.addItem("option 2");
    radiobuttons.addItem("option 3 (disabled)");
    radiobuttons.setItemEnabled("option 3 (disabled)", false);

    radiobuttons.addItem("option 4 (disabled and selected)");
    radiobuttons.select("option 4 (disabled and selected)");
    radiobuttons.setItemEnabled("option 4 (disabled and selected)", false);

    form.addField("radiobuttons", radiobuttons);

    form.getFooter().addComponent(new Button("Submit the info"));
    form.getFooter().addComponent(new Button("Cancel the info"));

    final Panel rightFormPanel = new Panel();
    rightFormPanel.setScrollable(true);
    rightFormPanel.setSizeFull();
    rightFormPanel.setHeight("400px");
    rightFormPanel.addComponent(new Label(LOREM_TEXT_ALL, Label.CONTENT_TEXT));

    gsl.setCell("form", 12, form);
    gsl.setCell("rightFormPanel", 4, rightFormPanel);

    return gsl;
}

From source file:net.sf.gazpachoquest.questionnaires.views.QuestionnaireView.java

License:Open Source License

@Override
public void enter(ViewChangeEvent event) {
    logger.debug("Entering {} view ", QuestionnaireView.NAME);
    addStyleName(Reindeer.LAYOUT_BLUE);/*from   w w  w.ja  v  a 2s .c  o  m*/
    addStyleName("questionnaires");

    WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    Integer screenWidth = webBrowser.getScreenWidth();
    Integer heightWidth = webBrowser.getScreenHeight();

    logger.debug("Browser screen settings  {} x {}", screenWidth, heightWidth);

    if (heightWidth <= 480) {
        renderingMode = RenderingMode.QUESTION_BY_QUESTION;
    }

    // centralLayout.addStyleName("questionnaires");
    // new Responsive(centralLayout);

    RespondentAccount respondent = (RespondentAccount) VaadinServletService.getCurrentServletRequest()
            .getUserPrincipal();
    if (respondent.hasPreferredLanguage()) {
        preferredLanguage = Language.fromString(respondent.getPreferredLanguage());
    } else {
        preferredLanguage = Language.fromLocale(webBrowser.getLocale());
    }
    questionnaireId = respondent.getGrantedquestionnaireIds().iterator().next();
    logger.debug("Trying to fetch questionnair identified with id  = {} ", questionnaireId);
    QuestionnaireDefinitionDTO definition = questionnaireResource.getDefinition(questionnaireId);
    sectionInfoVisible = definition.isSectionInfoVisible();
    QuestionnairePageDTO page = questionnaireResource.getPage(questionnaireId, renderingMode, preferredLanguage,
            NavigationAction.ENTERING);

    logger.debug("Displaying page {}/{} with {} questions", page.getMetadata().getNumber(),
            page.getMetadata().getCount(), page.getQuestions().size());
    questionsLayout = new VerticalLayout();
    update(page);

    Label questionnaireTitle = new Label(definition.getLanguageSettings().getTitle());
    questionnaireTitle.addStyleName(Reindeer.LABEL_H1);

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    mainLayout.setMargin(true);
    mainLayout.addComponent(questionnaireTitle);
    mainLayout.addComponent(questionsLayout);
    // Add the responsive capabilities to the components

    Panel centralLayout = new Panel();
    centralLayout.setContent(mainLayout);
    centralLayout.setSizeFull();
    centralLayout.getContent().setSizeUndefined();

    Responsive.makeResponsive(questionnaireTitle);
    setCompositionRoot(centralLayout);
    setSizeFull();
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.admin.AdminScreenProvider.java

License:Apache License

private Component displaySetting(VmSetting s, boolean edit) {
    Panel form = new Panel(TRANSLATOR.translate("setting.detail"));
    FormLayout layout = new FormLayout();
    form.setContent(layout);//from w w w. jav  a  2s.  c  o m
    form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    BeanFieldGroup binder = new BeanFieldGroup(s.getClass());
    binder.setItemDataSource(s);
    Field<?> id = (TextField) binder.buildAndBind(TRANSLATOR.translate("general.setting"), "setting");
    layout.addComponent(id);
    Field bool = binder.buildAndBind(TRANSLATOR.translate("bool.value"), "boolVal");
    bool.setSizeFull();
    layout.addComponent(bool);
    Field integerVal = binder.buildAndBind(TRANSLATOR.translate("int.value"), "intVal");
    integerVal.setSizeFull();
    layout.addComponent(integerVal);
    Field longVal = binder.buildAndBind(TRANSLATOR.translate("long.val"), "longVal");
    longVal.setSizeFull();
    layout.addComponent(longVal);
    Field stringVal = binder.buildAndBind(TRANSLATOR.translate("string.val"), "stringVal", TextArea.class);
    stringVal.setSizeFull();
    layout.addComponent(stringVal);
    Button cancel = new Button(TRANSLATOR.translate("general.cancel"));
    cancel.addClickListener((Button.ClickEvent event) -> {
        binder.discard();
    });
    //Editing existing one
    Button update = new Button(TRANSLATOR.translate("general.update"));
    update.addClickListener((Button.ClickEvent event) -> {
        try {
            binder.commit();
            displaySetting(s);
        } catch (FieldGroup.CommitException ex) {
            LOG.log(Level.SEVERE, null, ex);
            Notification.show(TRANSLATOR.translate("general.error.record.update"), ex.getLocalizedMessage(),
                    Notification.Type.ERROR_MESSAGE);
        }
    });
    boolean blocked = !s.getSetting().startsWith("version.");
    if (blocked) {
        HorizontalLayout hl = new HorizontalLayout();
        hl.addComponent(update);
        hl.addComponent(cancel);
        layout.addComponent(hl);
    }
    binder.setBuffered(true);
    binder.setReadOnly(edit);
    binder.bindMemberFields(form);
    //The version settigns are not modifiable from the GUI
    binder.setEnabled(blocked);
    //Id is always blocked.
    id.setEnabled(false);
    form.setSizeFull();
    return form;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.template.TemplateScreenProvider.java

License:Apache License

private Component getLeftComponent() {
    Panel p = new Panel();
    VerticalLayout layout = new VerticalLayout();
    templates.setNullSelectionAllowed(true);
    templates.setWidth(100, Sizeable.Unit.PERCENTAGE);
    BeanItemContainer<Template> container = new BeanItemContainer<>(Template.class,
            new TemplateJpaController(DataBaseManager.getEntityManagerFactory()).findTemplateEntities());
    templates.setContainerDataSource(container);
    templates.getItemIds().forEach(id -> {
        Template temp = ((Template) id);
        templates.setItemCaption(id, TRANSLATOR.translate(temp.getTemplateName()));
    });//from   ww w  . ja v  a  2  s .com
    templates.addValueChangeListener(event -> {
        hs.setSecondComponent(getRightComponent());
    });
    templates.setNullSelectionAllowed(false);
    templates.setWidth(100, Sizeable.Unit.PERCENTAGE);
    layout.addComponent(templates);
    HorizontalLayout hl = new HorizontalLayout();
    Button create = new Button(TRANSLATOR.translate("general.add"));
    create.addClickListener(listener -> {
        displayTemplateCreateWizard();
    });
    hl.addComponent(create);
    Button copy = new Button(TRANSLATOR.translate("general.copy"));
    copy.addClickListener(listener -> {
        displayTemplateCopyWizard();
    });
    hl.addComponent(copy);
    Button delete = new Button(TRANSLATOR.translate("general.delete"));
    delete.addClickListener(listener -> {
        displayTemplateDeleteWizard();
    });
    hl.addComponent(delete);
    templates.addValueChangeListener(listener -> {
        if (templates.getValue() != null) {
            Template t = (Template) templates.getValue();
            delete.setEnabled(t.getId() >= 1_000);
            copy.setEnabled(t.getTemplateNodeList().size() > 0);
        }
    });
    layout.addComponent(hl);
    layout.setSizeFull();
    p.setContent(layout);
    p.setSizeFull();
    return p;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.wizard.plan.DetailStep.java

License:Apache License

@Override
public Component getContent() {
    Panel form = new Panel("execution.detail");
    FormLayout layout = new FormLayout();
    form.setContent(layout);//w  ww .  j av  a  2 s . c o  m
    form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    BeanFieldGroup binder = new BeanFieldGroup(TestCaseExecution.class);
    binder.setItemDataSource(tce);
    TextArea name = new TextArea("general.name");
    name.setConverter(new ByteToStringConverter());
    binder.bind(name, "name");
    layout.addComponent(name);
    TextArea scope = new TextArea("general.scope");
    scope.setConverter(new ByteToStringConverter());
    binder.bind(scope, "scope");
    layout.addComponent(scope);
    if (tce.getId() != null) {
        TextArea conclusion = new TextArea("general.conclusion");
        conclusion.setConverter(new ByteToStringConverter());
        binder.bind(conclusion, "conclusion");
        layout.addComponent(conclusion);
        conclusion.setSizeFull();
        layout.addComponent(conclusion);
    }
    binder.setBuffered(false);
    binder.bindMemberFields(form);
    form.setSizeFull();
    return form;
}