Example usage for com.vaadin.ui VerticalLayout setExpandRatio

List of usage examples for com.vaadin.ui VerticalLayout setExpandRatio

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setExpandRatio.

Prototype

public void setExpandRatio(Component component, float ratio) 

Source Link

Document

This method is used to control how excess space in layout is distributed among components.

Usage

From source file:com.etest.view.tq.reports.ReportGeneratorUI.java

public ReportGeneratorUI() {
    setWidth("100%");
    setMargin(true);/*  www  .  j av  a2 s .  com*/
    setSpacing(true);

    Label lineSeparator1 = new Label();
    lineSeparator1.setContentMode(ContentMode.HTML);
    lineSeparator1.setStyleName("line-separator");

    Label lineSeparator2 = new Label();
    lineSeparator2.setContentMode(ContentMode.HTML);
    lineSeparator2.setStyleName("line-separator");

    Label lineSeparator3 = new Label();
    lineSeparator3.setContentMode(ContentMode.HTML);
    lineSeparator3.setStyleName("line-separator");

    searchSubject1.addValueChangeListener(dropDownChangeListener);
    searchSubject1.setEnabled(false);
    searchApproveTq1.setWidth("100%");
    searchApproveTq1.setInputPrompt("Search Approved TQ");
    searchApproveTq1.setEnabled(false);
    searchApproveTq1.addStyleName(ValoTheme.COMBOBOX_SMALL);

    searchSubject2.addValueChangeListener(dropDownChangeListener);
    searchSubject2.setEnabled(false);
    searchApproveTq2.setWidth("100%");
    searchApproveTq2.setInputPrompt("Search TQ Ticket No.");
    searchApproveTq2.setEnabled(false);
    searchApproveTq2.addStyleName(ValoTheme.COMBOBOX_SMALL);

    GridLayout g1 = new GridLayout(3, 1);
    g1.setWidth("70%");
    g1.setSpacing(true);

    VerticalLayout v1 = new VerticalLayout();
    v1.setWidth("5px");

    reportType1.addItem("Test Questionnaire");
    reportType1.setWidth("200px");
    reportType1.addValueChangeListener(optionChangeListener);
    reportType1.setImmediate(true);
    v1.addComponent(reportType1);
    v1.setExpandRatio(reportType1, 1);
    g1.addComponent(v1, 0, 0);
    g1.addComponent(searchSubject1, 1, 0);
    g1.addComponent(searchApproveTq1, 2, 0);

    addComponent(g1);

    addComponent(lineSeparator1);

    GridLayout g2 = new GridLayout(3, 1);
    g2.setWidth("70%");
    g2.setSpacing(true);

    VerticalLayout v2 = new VerticalLayout();
    v2.setWidth("5px");

    reportType2.addItem("Item Analysis");
    reportType2.setWidth("200px");
    reportType2.addValueChangeListener(optionChangeListener);
    reportType2.setImmediate(true);
    v2.addComponent(reportType2);
    v2.setExpandRatio(reportType2, 1);
    g2.addComponent(v2, 0, 0);
    g2.addComponent(searchSubject2, 1, 0);
    g2.addComponent(searchApproveTq2, 2, 0);

    addComponent(g2);

    addComponent(lineSeparator2);

    GridLayout g3 = new GridLayout(3, 1);
    g3.setWidth("70%");
    g3.setSpacing(true);

    VerticalLayout v3 = new VerticalLayout();
    v3.setWidth("5px");

    reportType3.addItem("Test Bank Inventory");
    reportType3.setWidth("200px");
    reportType3.addValueChangeListener(optionChangeListener);
    reportType3.setImmediate(true);

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setSpacing(true);

    testBankInventory.addItem("Summary: Case vs Items");
    testBankInventory.addItem("Summary: Items Group according to the Revised Blooms Taxonomy");
    testBankInventory.setImmediate(true);
    testBankInventory.select("Summary: Case vs Items");

    testBankInventory.setEnabled(false);
    v.addComponent(testBankInventory);

    v3.addComponent(reportType3);
    v3.setExpandRatio(reportType3, 1);
    g3.addComponent(v3, 0, 0);
    g3.setComponentAlignment(v3, Alignment.TOP_LEFT);
    g3.addComponent(v, 1, 0);
    addComponent(g3);

    //        addComponent(new Label("<HR>", ContentMode.HTML));
    addComponent(lineSeparator3);

    Button button = new Button("Calculate & Generate");
    button.addClickListener(reportBtnClickListener);
    button.setWidth("300px");

    addComponent(button);
    setComponentAlignment(button, Alignment.MIDDLE_LEFT);
}

From source file:com.example.vaadin.MyVaadinApplication.java

License:Apache License

public void authenticatedScreen() {

    VerticalLayout vLayout = new VerticalLayout();
    Label label = new Label("Logged in as " + currentUser.getPrincipal().toString());
    vLayout.setSizeFull();//from  w w  w . j a  v a2  s.  com
    vLayout.addComponent(horizontalSplit);

    /* Allocate all available extra space to the horizontal split panel */

    vLayout.setExpandRatio(horizontalSplit, 1);
    /* Set the initial split position so we can have a 200 pixel menu to the left */
    horizontalSplit.setFirstComponent(tree);
    horizontalSplit.setSplitPosition(200, SplitPanel.UNITS_PIXELS);
    vLayout.addStyleName("view");

    getMainWindow().setContent(vLayout);

    //this.addComponent(layout);

}

From source file:com.expressui.core.MainApplication.java

License:Open Source License

@Override
public void init() {
    currentInstance.set(this);

    setTheme(getCustomTheme());/*from  ww w  .  ja v a2  s.c  o m*/
    customizeConfirmDialogStyle();

    Window mainWindow = new Window();
    setMainWindow(mainWindow);
    mainWindow.addStyleName("e-main-window");
    mainWindow.setCaption(getTypeCaption());

    VerticalLayout mainLayout = new VerticalLayout();
    String id = StringUtil.generateDebugId("e", this, mainLayout, "mainLayout");
    mainLayout.setDebugId(id);

    mainWindow.setSizeFull();
    mainLayout.setSizeFull();
    mainWindow.setContent(mainLayout);

    setLogoutURL(getApplicationProperties().getRestartApplicationUrl());

    configureLeftMenuBar(mainMenuBar.getLeftMenuBarRoot());
    configureRightMenuBar(mainMenuBar.getRightMenuBarRoot());
    mainLayout.addComponent(mainMenuBar);

    pageLayoutTabSheet = new TabSheet();
    id = StringUtil.generateDebugId("e", this, pageLayoutTabSheet, "pageLayoutTabSheet");
    pageLayoutTabSheet.setDebugId(id);

    pageLayoutTabSheet.addStyleName("e-main-page-layout");
    pageLayoutTabSheet.setSizeFull();
    mainLayout.addComponent(pageLayoutTabSheet);
    mainLayout.setExpandRatio(pageLayoutTabSheet, 1.0f);

    Link expressUILink = new Link(uiMessageSource.getMessage("mainApplication.footerMessage"),
            new ExternalResource(uiMessageSource.getMessage("mainApplication.footerLink")));
    expressUILink.setTargetName("_blank");
    expressUILink.setIcon(new ThemeResource("../expressui/favicon.png"));
    expressUILink.setSizeUndefined();
    mainLayout.addComponent(expressUILink);
    mainLayout.setComponentAlignment(expressUILink, Alignment.TOP_CENTER);

    configureSessionTimeout(mainWindow);
    postWire();
    onDisplay();
}

From source file:com.foc.vaadin.FocWebApplication.java

License:Apache License

protected void init2(VaadinRequest request) {
    // Create the footer Layout with a simple Label
    VerticalLayout footerLayout = new VerticalLayout();
    {/* ww w  .j  a  va 2 s  . c om*/
        footerLayout.addComponent(new Label("This is the footer always visible"));
        footerLayout.setHeight("-1px");
    }

    // Create the Body Panel that contains a VerticalLayout itself
    Panel panel = new Panel();
    {
        panel.setSizeFull();// Panel size is undefined
        final VerticalLayout panelLayout = new VerticalLayout();
        panelLayout.setSizeUndefined();// Panel Layout size is undefined
        panel.setContent(panelLayout);

        // Fill the panel layout with lots of labels to exceed the window height 
        for (int i = 0; i < 200; i++) {
            panelLayout.addComponent(new Label("Thank you for clicking"));
        }
    }

    // Put all in the the MainVerticalLayout
    final VerticalLayout mainVerticalLayout = new VerticalLayout();
    mainVerticalLayout.setSizeFull();// Main Layout is set to size Full so that it fills all the height
    mainVerticalLayout.addComponent(panel);
    mainVerticalLayout.addComponent(footerLayout);
    mainVerticalLayout.setExpandRatio(panel, 1);
    setContent(mainVerticalLayout);
}

From source file:com.foc.vaadin.FocWebApplication.java

License:Apache License

public void initializeGUI(VaadinRequest vaadinRequest, ServletContext servletContext, HttpSession httpSession) {
    String path = vaadinRequest != null ? vaadinRequest.getPathInfo() : null;
    navigationWindow = newWindow();//from w  w  w  .  j a v a  2  s.c o  m

    if (Utils.isStringEmpty(Globals.getApp().getURL())) {
        if (Page.getCurrent() != null) {
            URI url = Page.getCurrent().getLocation();
            Globals.getApp().setURL(url.toString());
        }
    }

    applyUserThemeSelection();
    if (Globals.isValo() && !isPrintUI()) {

        navigationWindow.setHeightUndefined();
        navigationWindow.setHeight("100%");
        FocXMLGuiComponentStatic.setCaptionMargin_Zero(navigationWindow);

        //PANEL
        //         Panel bodyPanel = new Panel();
        //         bodyPanel.setSizeFull();
        //         bodyPanel.setContent(navigationWindow);
        //-----

        footerLayout = new VerticalLayout();
        footerLayout.setHeight("-1px");
        //footerLayout.addComponent(new Label(""));

        VerticalLayout mainVerticalLayout = new VerticalLayout();
        mainVerticalLayout.setSizeFull();// Main Layout is set to size Full so that it fills all the height

        //PANEL
        //         mainVerticalLayout.addComponent(bodyPanel);
        //         mainVerticalLayout.setExpandRatio(bodyPanel, 1);
        //-----

        mainVerticalLayout.addComponent(navigationWindow);
        mainVerticalLayout.setExpandRatio(navigationWindow, 1);
        mainVerticalLayout.addComponent(footerLayout);
        setContent(mainVerticalLayout);
    } else {
        setContent(navigationWindow);
        footerLayout = null;
    }

    initAccountFromDataBase();

    if (getNavigationWindow() != null) {
        INavigationWindow window = getNavigationWindow();

        URI uri = Page.getCurrent().getLocation();

        //Make sure the environment allows unit testing         
        if (ConfigInfo.isUnitAllowed() && uri.getHost().equals("localhost")) {
            //If there are no test indexes already then we need to check the URL for test request
            if (!FocUnitDictionary.getInstance().hasNextTest()) {
                String suiteName = null;
                String testName = null;

                if (path != null && path.toLowerCase().startsWith(URL_PARAMETER_KEY_UNIT_SUITE + ":")) {
                    suiteName = path.substring((URL_PARAMETER_KEY_UNIT_SUITE + ":").length());

                    if (!Utils.isStringEmpty(suiteName)) {
                        int indexOfSuperior = suiteName.indexOf(".");
                        if (indexOfSuperior > 0) {
                            testName = suiteName.substring(indexOfSuperior + 1, suiteName.length());
                            suiteName = suiteName.substring(0, indexOfSuperior);
                        }

                        FocUnitDictionary.getInstance().initializeCurrentSuiteAndTest(suiteName, testName);
                    }
                }
            }

            if (FocUnitDictionary.getInstance().hasNextTest()) {
                try {
                    Globals.getApp().setIsUnitTest(true);
                    FocUnitDictionary.getInstance().runSequence();
                } catch (Exception e) {
                    Globals.logException(e);
                } finally {
                    //                 if(       !FocUnitDictionary.getInstance().isPause()
                    //                       && !FocUnitDictionary.getInstance().isNextTestExist()
                    //                       ){
                    //                    FocUnitDictionary.getInstance().popupLogger(window);
                    //                 }
                    Globals.getApp().setIsUnitTest(false);
                }
            }
        }
    }
    //--------------------------------------------
}

From source file:com.freebox.engeneering.application.web.common.ApplicationLayout.java

License:Apache License

/**
  * Initializes view layout when system enters 'initView' action state.
  */*from ww w. j a v  a 2s. c  om*/
  * @param event -  state event.
  */
public void initView(@SuppressWarnings("rawtypes") StateEvent event) {
    final HorizontalLayout content = new HorizontalLayout();
    content.setSizeFull();
    content.setStyleName("main-view");

    final HorizontalSplitPanel leftSplitPanel = new HorizontalSplitPanel();
    leftSplitPanel.setSplitPosition(20, Sizeable.Unit.PERCENTAGE);

    final ComponentContainer leftSideBar = createPlaceholder(StateLayout.LEFT_SIDE_BAR);
    leftSideBar.setSizeFull();
    content.addComponent(leftSideBar, 0);

    final VerticalLayout verticalLayoutContent = new VerticalLayout();
    verticalLayoutContent.setStyleName("freebox-view");
    verticalLayoutContent.addComponent(createPlaceholder(StateLayout.HEADER));
    verticalLayoutContent.setSpacing(true);
    final ComponentContainer layoutContent = createPlaceholder(StateLayout.CONTENT);
    layoutContent.setSizeFull();
    verticalLayoutContent.addComponent(layoutContent);
    verticalLayoutContent.setSizeFull();
    //verticalLayoutContent.addComponent(createPlaceholder(StateLayout.FOOTER));

    verticalLayoutContent.setExpandRatio(layoutContent, 8f);

    content.addComponent(verticalLayoutContent, 1);
    content.setExpandRatio(leftSideBar, 1.0f);
    content.setExpandRatio(verticalLayoutContent, 9f);

    setView(content);
}

From source file:com.freebox.engeneering.application.web.layout.LeftSideBarController.java

License:Apache License

private void createMenuSideBar() {

    menu.addStyleName("no-vertical-drag-hints");
    menu.addStyleName("no-horizontal-drag-hints");
    menu.addStyleName("menu");
    menu.setHeight("100%");

    Button freeboxState;/*ww  w. j a  va  2  s. c o  m*/
    Button freeboxDownloads;
    Button freeboxContacts;
    Button freeboxCalls;

    freeboxState = new NativeButton("Etat Freebox");//Etat de la freebox
    freeboxState.addStyleName("icon-dashboard");

    freeboxState.addClickListener(new Button.ClickListener() {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            getEventProcessor().fireEvent("register");
        }
    });

    menu.addComponent(freeboxState);

    freeboxDownloads = new NativeButton("Dashbord");//Tlchargement
    freeboxDownloads.addStyleName("icon-sales");

    freeboxDownloads.addClickListener(new Button.ClickListener() {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            eventProcessor.fireEvent("dashboard", "");
        }
    });

    menu.addComponent(freeboxDownloads);

    freeboxContacts = new NativeButton("Contacts");
    freeboxContacts.addStyleName("icon-transactions");

    freeboxContacts.addClickListener(new Button.ClickListener() {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            getEventProcessor().fireEvent("register");
        }
    });

    menu.addComponent(freeboxContacts);

    freeboxCalls = new NativeButton("Journal");
    freeboxCalls.addStyleName("icon-reports");

    freeboxCalls.addClickListener(new Button.ClickListener() {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            getEventProcessor().fireEvent("register");
        }
    });

    menu.addComponent(freeboxCalls);

    freeboxState = new NativeButton("Explorateur");
    freeboxState.addStyleName("icon-schedule");

    freeboxState.addClickListener(new Button.ClickListener() {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            getEventProcessor().fireEvent("explorer");
        }
    });

    menu.addComponent(freeboxState);

    freeboxState = new NativeButton("Etat");
    freeboxState.addStyleName("icon-dashboard");

    freeboxState.addClickListener(new Button.ClickListener() {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            getEventProcessor().fireEvent("register");
        }
    });

    menu.addComponent(freeboxState);

    freeboxState = new NativeButton("Etat");
    freeboxState.addStyleName("icon-dashboard");

    freeboxState.addClickListener(new Button.ClickListener() {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {

            getEventProcessor().fireEvent("register");
        }
    });

    menu.addComponent(freeboxState);

    freeboxState = new NativeButton("Etat");
    freeboxState.addStyleName("icon-dashboard");

    freeboxState.addClickListener(new Button.ClickListener() {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            getEventProcessor().fireEvent("register");
        }
    });

    VerticalLayout verticalLayout = super.getView();
    verticalLayout.addComponent(menu);
    verticalLayout.setExpandRatio(menu, 1);

}

From source file:com.github.djabry.platform.vaadin.ui.MainUI.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {

    VerticalLayout rootLayout = new VerticalLayout();
    rootLayout.setSizeFull();// w ww . j  a v a  2 s  .  c om

    setContent(rootLayout);

    BannerView banner = bannerPresenter.getView();
    rootLayout.addComponent(banner);

    HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setSizeFull();

    body = new VerticalLayout();
    body.setSizeFull();

    Navigator navigator = new Navigator(this, body);
    navigator.addProvider(vP);

    this.setNavigator(navigator);
    SideBarView sidebarView = sideBarPresenter.getView();

    mainLayout.addComponent(sidebarView);
    mainLayout.addComponent(body);

    rootLayout.addComponent(mainLayout);
    rootLayout.setExpandRatio(mainLayout, 10);

    sidebarView.setWidth(150, Unit.PIXELS);
    mainLayout.setExpandRatio(body, 10);
    //rootLayout.setSplitPosition(150, Unit.PIXELS);
    navigator.navigateTo(LoginView.VIEW_NAME);

    eventBus.publish(EventScope.SESSION, this, Action.START);
}

From source file:com.github.lsiu.MyVaadinApplication.java

@Override
public void init() {
    window = new Window("My Vaadin Application");
    setMainWindow(window);/*from  w  w  w. j av  a  2s .  c om*/
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();

    table = new FilterTable();
    initTable(table);

    HorizontalLayout topBar = new HorizontalLayout();
    initTopBar(topBar);
    layout.addComponent(topBar);

    layout.addComponent(table);
    layout.setExpandRatio(table, 1);
    window.setContent(layout);
}

From source file:com.github.mjvesa.herd.HerdIDE.java

License:Apache License

private Component constructStatusTab() {
    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();/*from   w  w  w  . j  ava  2  s  .  c  om*/
    vl.addComponent(createPrintStackButton());
    wordListSelect = createWordListSelect();
    vl.addComponent(wordListSelect);
    vl.setExpandRatio(wordListSelect, 1);
    return vl;
}