Example usage for com.vaadin.ui CssLayout addComponent

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

Introduction

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

Prototype

@Override
public void addComponent(Component c) 

Source Link

Document

Add a component into this container.

Usage

From source file:it.vige.greenarea.bpm.custom.ui.dettaglio.trasportatoreautonomo.visualizzamissioniautorizzate.VisualizzaMissioniAutorizzateTrPanel.java

License:Apache License

protected void initTaskForm() {
    // Check if task requires a form
    TaskFormData formData = formService.getTaskFormData(task.getId());
    if (formData != null && formData.getFormProperties() != null && formData.getFormProperties().size() > 0) {
        taskForm = new GreenareaFormPropertiesForm();
        taskForm.setMainTitle(taskPage.getMainTitle());
        if (task.getTaskDefinitionKey().equals("visualizzaReport")
                || task.getTaskDefinitionKey().equals("visualizzaDettaglio"))
            ((Form) ((FormPropertiesComponent) taskForm.getComponent(1)).getComponent(0))
                    .setLayout(new GreenareaFormLayout());
        taskForm.setFormProperties(formData.getFormProperties());

        final VisualizzaMissioniAutorizzateTrPanel visualizzaMissioniAutorizzateTrPanel = this;
        taskForm.addListener(new FormPropertiesEventListener() {

            private static final long serialVersionUID = -3893467157397686736L;

            @Override/*from  w w w  .  j  a va  2 s  .  c o m*/
            protected void handleFormSubmit(FormPropertiesEvent event) {
                Map<String, String> properties = event.getFormProperties();
                String missioni_autorizzate_op_missione = properties.get("missioni_autorizzate_tr_missione");
                if (missioni_autorizzate_op_missione != null && missioni_autorizzate_op_missione.equals(""))
                    properties.remove("missioni_autorizzate_tr_missione");
                formService.submitTaskFormData(task.getId(), properties);
                notificationManager.showInformationNotification(TASK_COMPLETED, task.getName());
                List<Task> tasks = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId())
                        .active().list();
                if (tasks.size() == 1) {
                    task = tasks.get(0);
                    visualizzaMissioniAutorizzateTrPanel.setTask(task);
                    visualizzaMissioniAutorizzateTrPanel.attach();
                } else
                    taskPage.refreshSelectNext();
            }

            @Override
            protected void handleFormCancel(FormPropertiesEvent event) {
                // Clear the form values
                taskForm.clear();
            }
        });
        // Only if current user is task's assignee
        taskForm.setEnabled(isCurrentUserAssignee());

        // Add component to page
        centralLayout.addComponent(taskForm);
    } else {
        // Just add a button to complete the task
        // TODO: perhaps move to a better place

        CssLayout buttonLayout = new CssLayout();
        buttonLayout.addStyleName(STYLE_DETAIL_BLOCK);
        buttonLayout.setWidth(100, UNITS_PERCENTAGE);
        centralLayout.addComponent(buttonLayout);

        completeButton = new Button(i18nManager.getMessage(TASK_COMPLETE));

        completeButton.addListener(new ClickListener() {

            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {
                // If no owner, make assignee owner (will go into archived
                // then)
                if (task.getOwner() == null) {
                    task.setOwner(task.getAssignee());
                    taskService.setOwner(task.getId(), task.getAssignee());
                }

                taskService.complete(task.getId());
                notificationManager.showInformationNotification(TASK_COMPLETED, task.getName());
                taskPage.refreshSelectNext();
            }
        });

        completeButton.setEnabled(isCurrentUserAssignee() || isCurrentUserOwner());
        buttonLayout.addComponent(completeButton);
    }
}

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

License:Open Source License

@Override
public void attach() {
    setSizeFull();//  w w  w  .  j a  v a2  s.  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  a  va  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);//  w  w  w .ja  va2  s  .c  o 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() {

    // ??///from  w  ww  . j  av  a 2 s .c  o 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();/*ww  w  .j  a v a2s.c  o 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:module.pandabox.presentation.PandaBox.java

License:Open Source License

private void initView() {
    setCompositionRoot(root);//from   w ww.ja  v a 2  s.c o m
    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  w  w w .  j  a  va  2s. 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:net.pkhsolutions.pecsapp.ui.components.PagePanel.java

License:Open Source License

private void updateLayout(Property.ValueChangeEvent event) {
    final PageLayout layout = Objects.requireNonNull(model.getLayout().getValue());
    if (layout.getOrientation().equals(PageOrientation.PORTRAIT)) {
        page.setWidth(layout.getPageSize().getWidthMm(), Unit.MM);
        page.setHeight(layout.getPageSize().getHeightMm(), Unit.MM);
    } else {/*  w  ww. j av  a  2  s.  c o m*/
        page.setWidth(layout.getPageSize().getHeightMm(), Unit.MM);
        page.setHeight(layout.getPageSize().getWidthMm(), Unit.MM);
    }
    page.removeAllComponents();
    final float rowHeight = page.getHeight() / layout.getRows();
    final float cellWidth = page.getWidth() / layout.getColumns();
    rows = new CssLayout[layout.getRows()];
    cells = new PictureLayout[layout.getRows()][layout.getColumns()];
    for (int i = 0; i < layout.getRows(); ++i) {
        CssLayout row = new CssLayout();
        row.addStyleName("page-row");
        row.setWidth("100%");
        row.setHeight(rowHeight, page.getHeightUnits());
        page.addComponent(row);
        rows[i] = row;
        for (int j = 0; j < layout.getColumns(); ++j) {
            PictureLayout cell = new PictureLayout(model.getPictureModel(j, i));
            cell.addStyleName("page-row-cell");
            cell.setWidth(cellWidth, page.getWidthUnits());
            cell.setHeight("100%");
            row.addComponent(cell);
            cells[i][j] = cell;
        }
    }
}

From source file:nl.kpmg.lcm.ui.Application.java

License:Apache License

@Override
protected void init(VaadinRequest vaadinRequest) {
    getPage().setTitle("Local Catalog Manager");

    final VerticalLayout root = new VerticalLayout();
    root.setSizeFull();/*from w  ww . ja va  2 s  . co m*/
    root.setMargin(true);
    root.setSpacing(true);
    setContent(root);

    final CssLayout navigationBar = new CssLayout();
    navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

    Label logo = new Label("LCM");
    logo.addStyleName("logo");
    logo.setWidthUndefined();

    navigationBar.addComponent(logo);
    navigationBar.addComponent(createNavigationButton("Metadata", MetadataOverviewViewImpl.VIEW_NAME));
    navigationBar.addComponent(createNotImplementedButton("Analytics"));
    navigationBar.addComponent(createNavigationButton("Transfer", TransferViewImpl.VIEW_NAME));
    navigationBar.addComponent(createNavigationButton("Administration", AdministrationViewImpl.VIEW_NAME));
    navigationBar.addComponent(createLogoutButton("Logout"));
    root.addComponent(navigationBar);

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

    navigator = new Navigator(this, viewContainer);
    navigator.addProvider(viewProvider);
    navigator.navigateTo("login");
}