Example usage for com.vaadin.ui CssLayout CssLayout

List of usage examples for com.vaadin.ui CssLayout CssLayout

Introduction

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

Prototype

public CssLayout() 

Source Link

Document

Constructs an empty CssLayout.

Usage

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

License:Open Source License

@Override
public void attach() {
    setSizeFull();//from  w  w w  .  j ava2s.  co  m
    addStyleName(Reindeer.PANEL_LIGHT);

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setSizeFull();
    layout.addStyleName("loadbalancer-tab");
    layout.setSpacing(false);
    layout.setMargin(false);

    // ?
    SplitPanel splitPanel = new SplitPanel();
    splitPanel.setOrientation(SplitPanel.ORIENTATION_VERTICAL);
    splitPanel.setSplitPosition(40);
    splitPanel.setSizeFull();
    layout.addComponent(splitPanel);

    // ?
    VerticalLayout upperLayout = new VerticalLayout();
    upperLayout.setSizeFull();
    upperLayout.setSpacing(false);
    upperLayout.setMargin(false);

    CssLayout upperTopLayout = new CssLayout();
    Label label = new Label(ViewProperties.getCaption("label.loadbalancer"));
    upperTopLayout.setWidth("100%");
    upperTopLayout.setMargin(true);
    upperTopLayout.addStyleName("loadbalancer-table-label");
    upperTopLayout.addComponent(label);
    upperTopLayout.setHeight("28px");
    upperLayout.addComponent(upperTopLayout);

    loadBalancerTable = new LoadBalancerTable(sender);
    loadBalancerTable.setContainerDataSource(new LoadBalancerDtoContainer());
    upperLayout.addComponent(loadBalancerTable);
    loadBalancerTable.addListener(new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            tableRowSelected(event);
        }
    });

    loadBalancerButtonsBottom = new LoadBalancerButtonsBottom(sender);
    upperLayout.addComponent(loadBalancerButtonsBottom);
    upperLayout.setExpandRatio(loadBalancerTable, 10);
    splitPanel.addComponent(upperLayout);

    // ?
    loadBalancerDesc = new LoadBalancerDesc(sender);
    splitPanel.addComponent(loadBalancerDesc);
}

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

License:Open Source License

@Override
public void attach() {
    setSizeFull();//  w  w w .  j  av a 2s. 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:jp.primecloud.auto.ui.MyCloud.java

License:Open Source License

public MyCloud() {
    setWidth("100%");
    setHeight("100%");
    addStyleName("mycloud-panel");

    VerticalLayout layout = this;
    layout.setMargin(false);/*from   www  .j  a  va2s  .  co  m*/
    layout.setSpacing(false);

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

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

    //
    reloadb = new Button(ViewProperties.getCaption("button.reload"));
    reloadb.setDescription(ViewProperties.getCaption("description.reload"));
    reloadb.addStyleName("sync-button");
    reloadb.addStyleName("borderless");
    reloadb.setIcon(Icons.SYNC.resource());
    reloadb.setEnabled(false);
    reloadb.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            // ????
            Component c = MyCloud.this.myCloudTabs.tabDesc.getSelectedTab();
            refresh();
            MyCloud.this.myCloudTabs.tabDesc.setSelectedTab(c);
        }
    });
    hlay.addComponent(reloadb);
    layout.addComponent(hlay);
    //myCloud?
    layout.addComponent(myCloudTabs);

    layout.setExpandRatio(myCloudTabs, 100);

}

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

License:Open Source License

MyCloudTabs() {

    // ??//*ww  w.j a  v a  2 s  .  co m*/
    String enableLoadBalancer = Config.getProperty("ui.enableLoadBalancer");
    this.enableLoadBalancer = (enableLoadBalancer == null) || (BooleanUtils.toBoolean(enableLoadBalancer));

    setSizeFull();

    // ??disable??????
    tabDesc.setSizeFull();
    tabDesc.setEnabled(false);
    tabDesc.addStyleName(Reindeer.TABSHEET_BORDERLESS);

    addStyleName(Reindeer.PANEL_LIGHT);

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setSizeFull();
    layout.setSpacing(false);
    layout.setMargin(false);

    //
    pnService.setSizeFull();
    pnService.addStyleName(Reindeer.PANEL_LIGHT);
    VerticalLayout vlService = (VerticalLayout) pnService.getContent();
    vlService.setSizeFull();
    vlService.addStyleName("service-tab");
    vlService.setSpacing(false);
    vlService.setMargin(false);

    //?
    SplitPanel splService = new SplitPanel();
    splService.setOrientation(SplitPanel.ORIENTATION_VERTICAL);
    splService.setSplitPosition(40);
    splService.setSizeFull();
    vlService.addComponent(splService);
    vlService.setExpandRatio(splService, 10);
    //?
    VerticalLayout layServiceUpper = new VerticalLayout();
    layServiceUpper.setSizeFull();
    layServiceUpper.setSpacing(false);
    layServiceUpper.setMargin(false);
    layServiceUpper.addComponent(serviceButtonsTop);
    layServiceUpper.addComponent(serviceTable);
    layServiceUpper.addComponent(serviceButtonsBottom);
    layServiceUpper.setExpandRatio(serviceTable, 10);
    splService.addComponent(layServiceUpper);
    //?
    splService.addComponent(serviceDesc);

    tabDesc.addTab(pnService, ViewProperties.getCaption("tab.service"), Icons.SERVICETAB.resource());

    //?
    pnServer.setSizeFull();
    pnServer.addStyleName(Reindeer.PANEL_LIGHT);
    VerticalLayout vlServer = (VerticalLayout) pnServer.getContent();
    vlServer.setSizeFull();
    vlServer.addStyleName("server-tab");
    vlServer.setSpacing(false);
    vlServer.setMargin(false);

    //?
    SplitPanel splServer = new SplitPanel();
    splServer.setOrientation(SplitPanel.ORIENTATION_VERTICAL);
    splServer.setSplitPosition(40);
    splServer.setSizeFull();
    vlServer.addComponent(splServer);
    //?
    VerticalLayout layServerUpper = new VerticalLayout();
    layServerUpper.setSizeFull();
    layServerUpper.setSpacing(false);
    layServerUpper.setMargin(false);
    layServerUpper.addComponent(serverButtonsTop);
    layServerUpper.addComponent(serverTable);
    layServerUpper.addComponent(serverButtonsBottom);
    layServerUpper.setExpandRatio(serverTable, 10);
    splServer.addComponent(layServerUpper);
    //?
    splServer.addComponent(serverDesc);

    tabDesc.addTab(pnServer, ViewProperties.getCaption("tab.server"), Icons.SERVERTAB.resource());

    //?
    pnLoadBalancer.setSizeFull();
    pnLoadBalancer.addStyleName(Reindeer.PANEL_LIGHT);
    VerticalLayout vlLBalancer = (VerticalLayout) pnLoadBalancer.getContent();
    vlLBalancer.setSizeFull();
    vlLBalancer.addStyleName("loadbalancer-tab");
    vlLBalancer.setSpacing(false);
    vlLBalancer.setMargin(false);

    CssLayout hLBalancer = new CssLayout();
    Label lLBalancer = new Label(ViewProperties.getCaption("label.loadbalancer"));
    hLBalancer.setWidth("100%");
    hLBalancer.setMargin(true);
    hLBalancer.addStyleName("loadbalancer-table-label");
    hLBalancer.addComponent(lLBalancer);
    hLBalancer.setHeight("28px");

    //?
    SplitPanel splLBalancer = new SplitPanel();
    splLBalancer.setOrientation(SplitPanel.ORIENTATION_VERTICAL);
    splLBalancer.setSplitPosition(40);
    splLBalancer.setSizeFull();
    vlLBalancer.addComponent(splLBalancer);
    //?
    VerticalLayout layLBUpper = new VerticalLayout();
    layLBUpper.setSizeFull();
    layLBUpper.setSpacing(false);
    layLBUpper.setMargin(false);
    layLBUpper.addComponent(hLBalancer);
    layLBUpper.addComponent(loadBalancerTable);
    layLBUpper.addComponent(loadBalancerTableOpe);
    layLBUpper.setExpandRatio(loadBalancerTable, 10);
    splLBalancer.addComponent(layLBUpper);
    //?
    splLBalancer.addComponent(loadBalancerDesc);

    if (this.enableLoadBalancer) {
        tabDesc.addTab(pnLoadBalancer, ViewProperties.getCaption("tab.loadbalancer"),
                Icons.LOADBALANCER_TAB.resource());
    }

    //
    tabDesc.addListener(TabSheet.SelectedTabChangeEvent.class, this, "selectedTabChange");
    layout.addComponent(tabDesc);

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

}

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();/*  w w  w. j  a v  a  2  s .co  m*/
    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:me.uni.emuseo.view.common.form.FormBuilder.java

License:Open Source License

protected Layout createContent() {
    CssLayout content = new CssLayout();
    return content;
}

From source file:me.uni.emuseo.view.common.form.SearchFormLayout.java

License:Open Source License

private CssLayout createButtonsLayout() {
    CssLayout buttonsLayout = new CssLayout();
    Button searchButton = new Button();
    searchButton.addStyleName("primary");
    searchButton.setIcon(FontAwesome.SEARCH);
    searchButton.addClickListener(new Button.ClickListener() {

        /**//w ww  .j av a2s  . c  om
         * 
         */
        private static final long serialVersionUID = -8034803606737706285L;

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                formBuilder.commit();
                eventPropagator.fireChangeEvent(formBuilder.getBean());
            } catch (CommitException e) {
                e.printStackTrace();
            }
        }
    });
    Button clearButton = new Button();
    clearButton.addStyleName("primary");
    clearButton.setIcon(FontAwesome.ERASER);
    clearButton.addClickListener(new Button.ClickListener() {

        /**
         * 
         */
        private static final long serialVersionUID = -8684340029871714722L;

        @Override
        public void buttonClick(ClickEvent event) {
            T bean = getBean();
            formBuilder.setBean(bean);
            eventPropagator.fireClearEvent(formBuilder.getBean());
        }

    });
    buttonsLayout.addComponents(clearButton, searchButton);
    buttonsLayout.setSizeFull();
    buttonsLayout.addStyleName("buttons-layout");
    return buttonsLayout;
}

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

License:Open Source License

private void initView() {
    setCompositionRoot(root);/*from www .j  a va2 s.com*/
    root.setSizeFull();
    root.setSplitPosition(15);
    root.setStyleName("small previews");

    previewArea.setWidth("100%");
    previewTabs = new VerticalLayout();
    previewTabs.setSizeFull();
    previewTabs.setHeight(null);

    compoundTabs = new VerticalLayout();
    compoundTabs.setSizeFull();
    compoundTabs.setHeight(null);

    bennuStylesTabs = new VerticalLayout();
    bennuStylesTabs.setSizeFull();
    bennuStylesTabs.setHeight(null);

    VerticalLayout menu = new VerticalLayout();
    menu.setSizeFull();
    menu.setStyleName("sidebar-menu");

    Button syncThemes = new Button("Sync Themes", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            syncThemes();
        }
    });
    menu.addComponent(syncThemes);
    menu.addComponent(new Label("Single Components"));
    menu.addComponent(previewTabs);
    menu.addComponent(new Label("Compound Styles"));
    menu.addComponent(compoundTabs);

    menu.addComponent(new Label("Bennu Styles"));
    menu.addComponent(bennuStylesTabs);

    root.setFirstComponent(menu);

    CssLayout toolbar = new CssLayout();
    toolbar.setWidth("100%");
    toolbar.setStyleName("toolbar");
    toolbar.addComponent(editorToggle);

    final Window downloadWindow = new Window("Download Theme");
    GridLayout l = new GridLayout(3, 2);
    l.setSizeUndefined();
    l.setMargin(true);
    l.setSpacing(true);
    downloadWindow.setContent(l);
    downloadWindow.setModal(true);
    downloadWindow.setResizable(false);
    downloadWindow.setCloseShortcut(KeyCode.ESCAPE, null);
    downloadWindow.addStyleName("opaque");
    Label caption = new Label("Theme Name");
    l.addComponent(caption);
    l.setComponentAlignment(caption, Alignment.MIDDLE_CENTER);
    final TextField name = new TextField();
    name.setValue("my-chameleon");
    name.addValidator(new RegexpValidator("[a-zA-Z0-9\\-_\\.]+", "Only alpha-numeric characters allowed"));
    name.setRequired(true);
    name.setRequiredError("Please give a name for the theme");
    downloadWindow.addComponent(name);
    Label info = new Label(
            "This is the name you will use to set the theme in your application code, i.e. <code>setTheme(\"my-cameleon\")</code>.",
            Label.CONTENT_XHTML);
    info.addStyleName("tiny");
    info.setWidth("200px");
    l.addComponent(info, 1, 1, 2, 1);

    Button download = new Button(null, new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            getApplication().getMainWindow().addWindow(downloadWindow);
            name.focus();
        }
    });
    download.setDescription("Donwload the current theme");
    download.setIcon(new ThemeResource("download.png"));
    download.setStyleName("icon-only");
    toolbar.addComponent(download);

    menu.addComponent(toolbar);
    menu.setExpandRatio(toolbar, 1);
    menu.setComponentAlignment(toolbar, Alignment.BOTTOM_CENTER);

}

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

License:Open Source License

Layout getCompoundMenus() {
    Layout grid = getPreviewLayout("Compound Menus");

    Label title = new Label("Sidebar Menu");
    title.setStyleName("h1");
    grid.addComponent(title);//from  ww  w . jav a  2 s .c om
    ((GridLayout) grid).newLine();

    Label menus = new Label(
            "<strong>The sidebar menu</strong> control is just a set of labels and buttons inside a CssLayout or a VerticalLayout. Use the structure shown on the right, <strong>and remember that you need to implement all logic yourself</strong>. This theme just provides suitable stylenames for you to use.<br><br>You can also use the <a href=\"http://vaadin.com/forum/-/message_boards/message/119172\">DetachedTabs add-on</a> inside the sidebar-menu, it will style automatically.<br><br><strong>Note: only NativeButtons are styled inside the menu, normal buttons are left untouched.</strong>",
            Label.CONTENT_XHTML);
    grid.addComponent(menus);
    menus = new Label(
            "CssLayout.setStyleName(\"sidebar-menu\")\n  +  Label\n  +  NativeButton\n  +  NativeButton\n\t...\n  +  Label\n  +  DetachedTabs\n\t...",
            Label.CONTENT_PREFORMATTED);
    grid.addComponent(menus);

    SidebarMenu sidebar = new SidebarMenu();
    sidebar.setWidth("200px");
    sidebar.addComponent(new Label("Fruits"));
    NativeButton b = new NativeButton("Apples");
    b.setIcon(new ThemeResource("../runo/icons/16/note.png"));
    sidebar.addButton(b);
    sidebar.setSelected(b);
    sidebar.addButton(new NativeButton("Oranges"));
    sidebar.addButton(new NativeButton("Bananas"));
    sidebar.addButton(new NativeButton("Grapes"));
    sidebar.addComponent(new Label("Vegetables"));
    sidebar.addButton(new NativeButton("Tomatoes"));
    sidebar.addButton(new NativeButton("Cabbages"));
    sidebar.addButton(new NativeButton("Potatoes"));
    sidebar.addButton(new NativeButton("Carrots"));
    grid.addComponent(sidebar);
    ((GridLayout) grid).setColumnExpandRatio(0, 1);
    ((GridLayout) grid).setColumnExpandRatio(1, 1);

    title = new Label("Toolbar");
    title.setStyleName("h1");
    grid.addComponent(title);
    ((GridLayout) grid).newLine();

    CssLayout toolbars = new CssLayout();

    menus = new Label(
            "<strong>Toolbar</strong> is a simple CssLayout with a stylename. It provides the background and a little padding for its contents. Normally you will want to put buttons inside it, but segment controls fit in nicely as well.",
            Label.CONTENT_XHTML);
    grid.addComponent(menus);
    menus = new Label("CssLayout.setStyleName(\"toolbar\")", Label.CONTENT_PREFORMATTED);
    grid.addComponent(menus);

    CssLayout toolbar = new CssLayout();
    toolbar.setStyleName("toolbar");
    toolbar.setWidth("300px");

    Button b2 = new Button("Action");
    b2.setStyleName("small");
    toolbar.addComponent(b2);

    Segment segment = new Segment();
    segment.addStyleName("segment-alternate");
    b2 = new Button("Apples");
    b2.setStyleName("small");
    b2.addStyleName("down");
    segment.addButton(b2);
    b2 = new Button("Oranges");
    b2.setStyleName("small");
    segment.addButton(b2);
    toolbar.addComponent(segment);

    b2 = new Button("Notes");
    b2.setStyleName("small borderless");
    b2.setIcon(new ThemeResource("../runo/icons/16/note.png"));
    toolbar.addComponent(b2);
    toolbars.addComponent(toolbar);

    toolbar = new CssLayout();
    toolbar.setStyleName("toolbar");
    toolbar.setWidth("300px");

    b2 = new Button("Action");
    b2.setIcon(new ThemeResource("../runo/icons/32/document.png"));
    b2.setStyleName("borderless");
    toolbar.addComponent(b2);

    b2 = new Button("Action 2");
    b2.setStyleName("borderless");
    b2.setIcon(new ThemeResource("../runo/icons/32/user.png"));
    toolbar.addComponent(b2);

    b2 = new Button("Action 3");
    b2.setStyleName("borderless");
    b2.setIcon(new ThemeResource("../runo/icons/32/note.png"));
    toolbar.addComponent(b2);
    toolbars.addComponent(toolbar);

    grid.addComponent(toolbars);

    return grid;
}

From source file:my.vaadin.app.MyUI.java

@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout layout = new VerticalLayout();

    filterText.setPlaceholder("filter by name...");
    filterText.addValueChangeListener(e -> updateList());
    filterText.setValueChangeMode(ValueChangeMode.LAZY);

    Button clearFilterTextBtn = new Button(FontAwesome.TIMES);
    clearFilterTextBtn.setDescription("Clear the current filter");
    clearFilterTextBtn.addClickListener(e -> filterText.clear());

    CssLayout filtering = new CssLayout();
    filtering.addComponents(filterText, clearFilterTextBtn);
    filtering.setStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

    Button addCustomerBtn = new Button("Add new customer");
    addCustomerBtn.addClickListener(e -> {
        grid.asSingleSelect().clear();//from www.jav  a 2  s.  co  m
        form.setCustomer(new Customer());
    });

    HorizontalLayout toolbar = new HorizontalLayout(filtering, addCustomerBtn);

    grid.setColumns("firstName", "lastName", "email");

    HorizontalLayout main = new HorizontalLayout(grid, form);
    main.setSizeFull();
    grid.setSizeFull();
    main.setExpandRatio(grid, 1);

    layout.addComponents(toolbar, main);

    // fetch list of Customers from service and assign it to Grid
    updateList();

    setContent(layout);

    form.setVisible(false);

    grid.asSingleSelect().addValueChangeListener(event -> {
        if (event.getValue() == null) {
            form.setVisible(false);
        } else {
            form.setCustomer(event.getValue());
        }
    });
}