Example usage for com.vaadin.ui HorizontalLayout setExpandRatio

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

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout 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:org.inakirj.imagerulette.screens.DiceURLSetupView.java

License:Open Source License

/**
 * Sets the layout.//from   w w w .j  a  v  a  2s . c om
 */
private void setLayout() {
    imagesLayout = new VerticalComponentGroup();
    imagesLayout.setWidth(100, Unit.PERCENTAGE);

    ImageUtils.getAllImageURL().stream().forEach(i -> {
        HorizontalLayout sliderLAyout = new HorizontalLayout();
        if (imagesLayout.getComponentCount() % 2 == 0) {
            sliderLAyout.addStyleName("dice-banner-1");
        } else {
            sliderLAyout.addStyleName("dice-banner-2");
        }
        sliderLAyout.setWidth(100, Unit.PERCENTAGE);
        Image img = new Image("", i.getSource());
        img.addStyleName("dice-image");
        img.setData(i.getData());
        Slider slider = new Slider();
        slider.addStyleName("dice-slider");
        Label total = new Label();
        total.addStyleName("size-24");// TODO is not working
        // Adding image
        sliderLAyout.addComponent(img);
        // Adding slider
        slider.setMin(0);
        slider.setMax(5);
        slider.setWidth(80, Unit.PERCENTAGE);
        slider.addValueChangeListener(s -> {
            total.setValue("x " + slider.getValue().intValue());
            enableDiceTabOrNot();
        });
        sliderLAyout.addComponent(slider);
        // Adding label
        total.setValue("x 0");
        sliderLAyout.addComponent(total);
        sliderLAyout.setExpandRatio(img, 2);
        sliderLAyout.setExpandRatio(slider, 7);
        sliderLAyout.setExpandRatio(total, 1);
        sliderLAyout.setComponentAlignment(img, Alignment.BOTTOM_LEFT);
        sliderLAyout.setComponentAlignment(slider, Alignment.BOTTOM_LEFT);
        sliderLAyout.setComponentAlignment(total, Alignment.BOTTOM_LEFT);
        // Adding layout
        imagesLayout.addComponent(sliderLAyout);
    });
    addComponent(imagesLayout);
}

From source file:org.investovator.ui.nngaming.DashboardPlayingView.java

License:Open Source License

private void createUI() {

    //Setup Layout
    content = new VerticalLayout();
    content.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    HorizontalLayout row1 = new HorizontalLayout();
    HorizontalLayout row2 = new HorizontalLayout();
    HorizontalLayout row3 = new HorizontalLayout();

    row1.setWidth("100%");
    row2.setWidth("100%");
    row3.setWidth("100%");

    row1.setHeight(50, Unit.PERCENTAGE);
    row2.setHeight(20, Unit.PERCENTAGE);
    row3.setHeight(30, Unit.PERCENTAGE);

    row1.setMargin(new MarginInfo(true, true, false, true));
    row2.setMargin(new MarginInfo(true, true, false, true));
    row3.setMargin(new MarginInfo(true, true, true, true));

    content.addComponent(row1);//from   ww  w.  j  a  va 2s. c om
    content.addComponent(row2);
    content.addComponent(row3);

    currentPriceChart = new BasicChart();
    quantityChart = new QuantityChart();
    orderBookSell = getSellSideTable();
    orderBookSell.addStyleName("center-caption");
    orderBookBuy = getBuySideTable();
    orderBookBuy.addStyleName("center-caption");
    quoteUI = new QuoteUI();
    userPortfolio = new UserPortfolio();

    HorizontalLayout orderBookLayout = new HorizontalLayout();
    orderBookLayout.setWidth("100%");
    orderBookLayout.addComponent(orderBookSell);
    orderBookLayout.addComponent(orderBookBuy);
    orderBookLayout.setComponentAlignment(orderBookSell, Alignment.MIDDLE_RIGHT);
    orderBookLayout.setComponentAlignment(orderBookBuy, Alignment.MIDDLE_LEFT);

    VerticalLayout orderBook = new VerticalLayout();
    orderBook.addComponent(orderBookLayout);

    orderBook.setCaption("Order Book");
    quoteUI.setCaption("Quote UI");
    userPortfolio.setCaption(Session.getCurrentUser().toUpperCase(Locale.US) + " - Portfolio Summary");

    orderBook.addStyleName("center-caption");
    quoteUI.addStyleName("center-caption");
    userPortfolio.addStyleName("center-caption");

    row1.addComponent(currentPriceChart);
    row2.addComponent(quantityChart);
    row3.setSpacing(true);
    row3.addComponent(orderBook);
    row3.addComponent(quoteUI);
    row3.addComponent(userPortfolio);
    row3.setExpandRatio(orderBook, 1.2f);
    row3.setExpandRatio(quoteUI, 1.0f);
    row3.setExpandRatio(userPortfolio, 1.0f);

    row1.setComponentAlignment(currentPriceChart, Alignment.MIDDLE_CENTER);
    row2.setComponentAlignment(quantityChart, Alignment.MIDDLE_CENTER);

    content.setSizeFull();
    this.setContent(content);

}

From source file:org.investovator.ui.nngaming.UserPortfolio.java

License:Open Source License

public void setupUI() {

    this.setHeight("100%");

    accountBalance = new Label();
    accountBalance.setCaption("Cash Balance");

    blockedAmount = new Label();
    blockedAmount.setCaption("Blocked Amount");

    date = new Label();
    date.setCaption("Date");

    createStocksTable();/*from   w w  w  .j a  v  a  2  s  .  co  m*/

    HorizontalLayout portSummary = new HorizontalLayout();
    portSummary.addComponent(date);
    portSummary.addComponent(accountBalance);
    portSummary.addComponent(blockedAmount);
    portSummary.setWidth("80%");
    portSummary.setSpacing(true);
    portSummary.setExpandRatio(date, 1);
    portSummary.setExpandRatio(accountBalance, 1);
    portSummary.setExpandRatio(blockedAmount, 1);

    HorizontalLayout stockSummary = new HorizontalLayout();
    stockSummary.addComponent(stocksSummaryTable);
    stockSummary.setComponentAlignment(stocksSummaryTable, Alignment.MIDDLE_CENTER);
    stockSummary.setWidth("80%");

    this.addComponent(portSummary);
    this.addComponent(stockSummary);
    this.setComponentAlignment(portSummary, Alignment.MIDDLE_CENTER);
    this.setComponentAlignment(stockSummary, Alignment.MIDDLE_CENTER);

    this.setImmediate(true);
    this.setWidth("100%");

}

From source file:org.investovator.ui.utils.dashboard.dataplayback.BasicMainView.java

License:Open Source License

public void setupPanel() {
    //clear everything
    //        content.removeAllComponents();

    //add components only if components have not already been added
    if (content.getComponentCount() == 0) {

        //Main chart
        HorizontalLayout chartContainer = new HorizontalLayout();
        chartContainer.setWidth(95, Unit.PERCENTAGE);
        chartContainer.setMargin(true);//from w w  w. j  a  va 2  s .c om
        //            chartContainer.setHeight(30,Unit.PERCENTAGE);
        mainChart = buildMainChart();
        chartContainer.addComponent(mainChart);
        chartContainer.setComponentAlignment(mainChart, Alignment.MIDDLE_CENTER);
        chartContainer.setCaption(mainChart.getCaption());
        //            chartContainer.setCaption("Price");
        //            chartContainer.addStyleName("center-caption");

        content.addComponent(chartContainer);
        content.setExpandRatio(chartContainer, 1.3f);
        content.setComponentAlignment(chartContainer, Alignment.MIDDLE_CENTER);

        //Quantity chart
        HorizontalLayout quantityChartContainer = new HorizontalLayout();
        quantityChartContainer.setWidth(95, Unit.PERCENTAGE);
        //            quantityChartContainer.setMargin(true);
        quantityChartContainer.setMargin(new MarginInfo(true, true, false, true));
        //            quantityChartContainer.setHeight(30,Unit.PERCENTAGE);
        quantityChart = buildQuantityChart();
        quantityChartContainer.addComponent(quantityChart);
        quantityChartContainer.setComponentAlignment(quantityChart, Alignment.MIDDLE_CENTER);
        //            quantityChartContainer.setCaption("Quantity");
        //            quantityChartContainer.addStyleName("center-caption");

        content.addComponent(quantityChartContainer);
        content.setExpandRatio(quantityChartContainer, 1.0f);

        content.setComponentAlignment(quantityChartContainer, Alignment.MIDDLE_CENTER);

        //bottom row conatainer
        HorizontalLayout bottowRow = new HorizontalLayout();
        bottowRow.setWidth(100, Unit.PERCENTAGE);
        content.addComponent(bottowRow);
        content.setExpandRatio(bottowRow, 1.0f);

        //Stock price table
        GridLayout stockPriceTableContainer = new GridLayout(1, 2);
        //add a caption to the table
        //            Label tableCaption=new Label("Stock Price Table");
        //            stockPriceTableContainer.addComponent(tableCaption, 0, 0);
        //            stockPriceTableContainer.setComponentAlignment(tableCaption,Alignment.MIDDLE_RIGHT);
        stockPriceTable = setupStockPriceTable();
        stockPriceTableContainer.addComponent(stockPriceTable, 0, 1);
        stockPriceTableContainer.setMargin(new MarginInfo(false, true, true, true));
        stockPriceTableContainer.setCaption("Stock Price Table");
        stockPriceTableContainer.addStyleName("center-caption");

        stockPriceTableContainer.setComponentAlignment(stockPriceTable, Alignment.MIDDLE_CENTER);
        bottowRow.addComponent(stockPriceTableContainer);
        //            bottowRow.setExpandRatio(stockPriceTableContainer,1.0f);

        //buy-sell window
        GridLayout buySellWindowContainer = new GridLayout(1, 2);
        //            //add a caption to the table
        //            Label buySellWindowCaption=new Label("Buy/Sell Stocks");
        //            buySellWindowContainer.addComponent(buySellWindowCaption,0,0);
        //            buySellWindowContainer.setComponentAlignment(buySellWindowCaption,Alignment.MIDDLE_CENTER);
        Component buySellWindow = setupBuySellForm();
        buySellWindowContainer.addComponent(buySellWindow, 0, 1);
        buySellWindowContainer.setMargin(new MarginInfo(false, false, true, false));
        buySellWindowContainer.setCaption("Buy/Sell Stocks");
        buySellWindowContainer.addStyleName("center-caption");

        buySellWindowContainer.setComponentAlignment(buySellWindow, Alignment.MIDDLE_CENTER);
        bottowRow.addComponent(buySellWindowContainer);
        //            bottowRow.setExpandRatio(buySellWindowContainer,1.0f);

        //portfolio data
        //            VerticalLayout myPortfolioLayout=new VerticalLayout();
        //            myPortfolioLayout.setMargin(new MarginInfo(false,true,true,true));
        //            bottowRow.addComponent(myPortfolioLayout);
        //add a caption to the table
        //            Label portfolioCaption=new Label("My Portfolio");
        //            myPortfolioLayout.addComponent(portfolioCaption);
        //            myPortfolioLayout.setComponentAlignment(portfolioCaption,Alignment.MIDDLE_CENTER);

        HorizontalLayout portfolioContainer = new HorizontalLayout();
        portfolioContainer.setMargin(new MarginInfo(false, true, true, true));
        portfolioContainer.setCaption("My Portfolio");
        portfolioContainer.addStyleName("center-caption");
        bottowRow.addComponent(portfolioContainer);
        //            bottowRow.setExpandRatio(portfolioContainer,1.0f);

        //portfolio table
        portfolioTable = setupPortfolioTable();
        portfolioContainer.addComponent(portfolioTable);
        //            portfolioContainer.setExpandRatio(portfolioTable,1.0f);

        //profit chart
        //            HorizontalLayout profitContainer = new HorizontalLayout();
        //            bottowRow.addComponent(profitContainer);

        profitChart = setupProfitChart();
        profitChart.setCaption("Profit Chart");
        profitChart.addStyleName("center-caption");
        bottowRow.addComponent(profitChart);
        bottowRow.setExpandRatio(profitChart, 1.3f);

        //            Component accountInfo=setUpAccountInfoForm();
        //            accountInfo.setCaption("Profit Chart");
        //            accountInfo.addStyleName("center-caption");
        //
        //            bottowRow.addComponent(accountInfo);
        //            bottowRow.setExpandRatio(accountInfo,1.3f);

        this.setContent(content);
    }

}

From source file:org.jpos.qi.minigl.TransactionsView.java

License:Open Source License

private HorizontalLayout createFilters() {
    HorizontalLayout controls = new HorizontalLayout();
    controls.setWidth("100%");
    journals = new JournalsCombo(true);
    journals.setValue(journals.getDataProvider().fetch(new Query<>()).findFirst().orElse(null));
    controls.addComponents(journals, dateRangeComponent);
    controls.setComponentAlignment(dateRangeComponent, Alignment.MIDDLE_LEFT);
    controls.setComponentAlignment(journals, Alignment.MIDDLE_RIGHT);
    controls.setExpandRatio(journals, 0f);
    controls.setExpandRatio(dateRangeComponent, 1f);
    controls.setMargin(new MarginInfo(false, true, true, true));
    controls.setSpacing(true);/*ww w. j  ava2s . c  o m*/
    return controls;
}

From source file:org.jpos.qi.QILayout.java

License:Open Source License

public QILayout() {
    setSizeFull();/*from   w  w w  .ja  v  a2 s .com*/
    setMargin(false);
    setSpacing(false);
    headerLayout.setWidth("100%");
    headerLayout.setPrimaryStyleName("header");
    HorizontalLayout center = new HorizontalLayout();
    center.setSizeFull();
    center.setSpacing(false);

    menuLayout.setPrimaryStyleName("valo-menu");

    contentLayout.setPrimaryStyleName("valo-content");
    contentLayout.addStyleName("v-scrollable");
    contentLayout.setSizeFull();
    center.addComponents(menuLayout, contentLayout);
    center.setExpandRatio(contentLayout, 1);
    addComponents(headerLayout, center);
    setExpandRatio(center, 1);
}

From source file:org.jumpmind.metl.ui.views.admin.LoggingPanel.java

License:Open Source License

public LoggingPanel(ApplicationContext context, TabbedPanel tabbedPanel) {
    this.context = context;
    this.tabbedPanel = tabbedPanel;
    this.backgroundRefresherService = context.getBackgroundRefresherService();
    if (LogUtils.isFileEnabled()) {
        logFile = new File(LogUtils.getLogFilePath());
    }/*from  www.  ja  va2 s . com*/
    setSizeFull();
    setSpacing(true);
    setMargin(true);

    HorizontalLayout topPanelLayout = new HorizontalLayout();
    topPanelLayout.setWidth(100, Unit.PERCENTAGE);
    topPanelLayout.setSpacing(true);

    Button refreshButton = new Button("Refresh");
    refreshButton.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            refresh();
        }
    });
    topPanelLayout.addComponent(refreshButton);
    topPanelLayout.setComponentAlignment(refreshButton, Alignment.BOTTOM_LEFT);

    bufferSize = new TextField();
    bufferSize.setImmediate(true);
    bufferSize.setWidth(5, Unit.EM);
    bufferSize.setValue("1000");
    bufferSize.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            refresh();
        }
    });
    topPanelLayout.addComponent(bufferSize);

    filter = new TextField();
    filter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    filter.setInputPrompt("Filter");
    filter.setIcon(FontAwesome.SEARCH);
    filter.setNullRepresentation("");
    filter.setImmediate(true);
    filter.setTextChangeEventMode(TextChangeEventMode.LAZY);
    filter.setTextChangeTimeout(200);
    filter.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            refresh();
        }
    });
    topPanelLayout.addComponent(filter);
    topPanelLayout.setComponentAlignment(filter, Alignment.BOTTOM_LEFT);

    autoRefreshOn = new CheckBox("Auto Refresh");
    autoRefreshOn.setValue(true);
    autoRefreshOn.setImmediate(true);
    topPanelLayout.addComponent(autoRefreshOn);
    topPanelLayout.setComponentAlignment(autoRefreshOn, Alignment.BOTTOM_LEFT);

    Label spacer = new Label();
    topPanelLayout.addComponent(spacer);
    topPanelLayout.setExpandRatio(spacer, 1);

    if (logFile != null && logFile.exists()) {
        Button downloadButton = new Button("Download log file");
        downloadButton.addStyleName(ValoTheme.BUTTON_LINK);
        downloadButton.addStyleName(ValoTheme.BUTTON_SMALL);

        FileDownloader fileDownloader = new FileDownloader(getLogFileResource());
        fileDownloader.extend(downloadButton);
        topPanelLayout.addComponent(downloadButton);
        topPanelLayout.setComponentAlignment(downloadButton, Alignment.BOTTOM_RIGHT);
    }

    addComponent(topPanelLayout);

    logPanel = new Panel("Log Output");
    logPanel.setSizeFull();
    logView = new Label("", ContentMode.HTML);
    logView.setSizeUndefined();
    logPanel.setContent(logView);
    addComponent(logPanel);
    setExpandRatio(logPanel, 1);
    refresh();
    backgroundRefresherService.register(this);
}

From source file:org.jumpmind.metl.ui.views.DeployNavigator.java

License:Open Source License

protected HorizontalLayout buildMenuBar() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth(100, Unit.PERCENTAGE);

    MenuBar leftMenuBar = new MenuBar();
    leftMenuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
    leftMenuBar.setWidth(100, Unit.PERCENTAGE);

    MenuItem newMenu = leftMenuBar.addItem("New", null);

    newFolder = newMenu.addItem("Folder", new Command() {

        @Override/*from  w  w w .j  av  a 2s.c  o  m*/
        public void menuSelected(MenuItem selectedItem) {
            addFolder();
        }
    });

    newAgent = newMenu.addItem("Agent", new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            addAgent();
        }
    });

    MenuItem editMenu = leftMenuBar.addItem("Edit", null);

    editMenu.addItem("Open", new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            openItem(treeTable.getValue());
        }
    });

    editMenu.addItem("Rename", new Command() {
        @Override
        public void menuSelected(MenuItem selectedItem) {
            startEditingItem((AbstractObject) treeTable.getValue());
        }
    });

    delete = editMenu.addItem("Remove", new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            handleDelete();
        }
    });

    MenuBar rightMenuBar = new MenuBar();
    rightMenuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS);

    search = rightMenuBar.addItem("", Icons.SEARCH, new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            search.setChecked(!search.isChecked());
            searchBarLayout.setVisible(search.isChecked());
        }
    });
    search.setVisible(false);

    layout.addComponent(leftMenuBar);
    layout.addComponent(rightMenuBar);
    layout.setExpandRatio(leftMenuBar, 1);

    return layout;
}

From source file:org.jumpmind.metl.ui.views.design.ChooseWsdlServiceOperationWindow.java

License:Open Source License

public ChooseWsdlServiceOperationWindow(List<SoapOperation> operations, final ServiceChosenListener listener) {
    setCaption("Choose SOAP Operation");
    setModal(true);// w  ww  .j a v a2  s .c o  m
    setResizable(false);
    setSizeUndefined();
    setClosable(false);

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    setContent(layout);

    layout.addComponent(new Label("Choose the SOAP operation to use."));

    final ListSelect field = new ListSelect();
    field.setNullSelectionAllowed(false);
    field.setMultiSelect(false);
    field.setWidth(100, Unit.PERCENTAGE);
    field.setRows(15);
    layout.addComponent(field);

    Collections.sort(operations, new Comparator<SoapOperation>() {
        public int compare(SoapOperation o1, SoapOperation o2) {
            return o1.getOperationName().compareTo(o2.getOperationName());
        }
    });

    for (SoapOperation operation : operations) {
        field.addItem(operation);
        field.setItemCaption(operation,
                operation.getBindingName().getLocalPart() + "." + operation.getOperationName());
    }

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setWidth(100, Unit.PERCENTAGE);

    Label spacer = new Label(" ");
    buttonLayout.addComponent(spacer);
    buttonLayout.setExpandRatio(spacer, 1);

    Button cancelButton = new Button("Cancel");
    cancelButton.setClickShortcut(KeyCode.ESCAPE);
    cancelButton.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(ChooseWsdlServiceOperationWindow.this);
        }
    });
    buttonLayout.addComponent(cancelButton);

    Button okButton = new Button("Ok");
    okButton.setClickShortcut(KeyCode.ENTER);
    okButton.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            if (listener.onOk((SoapOperation) field.getValue())) {
                UI.getCurrent().removeWindow(ChooseWsdlServiceOperationWindow.this);
            }
        }
    });
    buttonLayout.addComponent(okButton);

    layout.addComponent(buttonLayout);
    field.focus();
}

From source file:org.jumpmind.metl.ui.views.DesignNavigator.java

License:Open Source License

protected HorizontalLayout buildMenuBar() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth(100, Unit.PERCENTAGE);

    // left menu bar
    MenuBar leftMenuBar = new MenuBar();
    leftMenuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
    leftMenuBar.setWidth(100, Unit.PERCENTAGE);

    // file menu//w w w  .j ava2s .com
    fileMenu = leftMenuBar.addItem("File", null);

    // file - new
    newMenu = fileMenu.addItem("New", null);
    newFlow = newMenu.addItem("Flow", selectedItem -> addNewFlow());
    newModel = newMenu.addItem("Model", selectedItem -> addNewModel());

    // file - new - resource
    resourceMenu = newMenu.addItem("Resource", null);
    newDataSource = resourceMenu.addItem("Database", selectedItem -> addNewDatabase());
    newFtpResource = resourceMenu.addItem("FTP", selectedItem -> addNewFtpResource());
    newFileResource = resourceMenu.addItem("Local File System", selectedItem -> addNewLocalFileSystem());
    newSSHResource = resourceMenu.addItem("Sftp", selectedItem -> addNewSSHFileSystem());
    newWebResource = resourceMenu.addItem("Web Resource", selectedItem -> addNewHttpResource());
    newJMSResource = resourceMenu.addItem("JMS", selectedItem -> addNewJMSFileSystem());

    // file - export
    exportMenu = fileMenu.addItem("Export...", selectedItem -> export());

    // file - import
    importConfig = fileMenu.addItem("Import...", selecteItem -> importConfig());

    // edit menu
    editMenu = leftMenuBar.addItem("Edit", null);
    editMenu.addItem("Open", selectedItem -> open(treeTable.getValue()));
    editMenu.addItem("Rename", selectedItem -> startEditingItem((AbstractObject) treeTable.getValue()));
    editMenu.addItem("Copy", selectedItem -> copySelected());
    delete = editMenu.addItem("Remove", selectedItem -> handleDelete());

    // project menu
    MenuItem projectMenu = leftMenuBar.addItem("Project", null);
    projectMenu.addItem("Manage", selectedItem -> viewProjects());
    closeProject = projectMenu.addItem("Close", selectedItem -> closeProject());

    // right menu
    MenuBar rightMenuBar = new MenuBar();
    rightMenuBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
    search = rightMenuBar.addItem("", Icons.SEARCH, new Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {
            search.setChecked(!search.isChecked());
            searchBarLayout.setVisible(search.isChecked());
        }
    });
    search.setVisible(false);

    layout.addComponent(leftMenuBar);
    layout.addComponent(rightMenuBar);
    layout.setExpandRatio(leftMenuBar, 1);

    return layout;
}