Example usage for com.vaadin.ui CssLayout addStyleName

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

Introduction

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

Prototype

@Override
    public void addStyleName(String style) 

Source Link

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 ww w  .jav  a 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();/*www.j a  v a2  s  .c o  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();//from   w  w  w . j  a v a  2 s .c om
    addStyleName("mycloud-panel");
    setMargin(false);
    setSpacing(false);

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

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

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

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

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

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

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

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

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

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

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

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

    // ?
    showLogin();
}

From source file: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 w w  w .ja v a2s . 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  ava2  s  .com*/
    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();// www  .  j ava  2 s.c  om
    root.setMargin(true);
    root.setSpacing(true);
    setContent(root);

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

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

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

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

}

From source file: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() {

        /**/*from   w  w  w.j a v  a 2s  .co  m*/
         * 
         */
        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: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 {/*from ww  w  .j  a v a2s .co 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();//  w w  w.j  a va 2 s.  c o  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");
}

From source file:org.activiti.explorer.ui.custom.DetailPanel.java

License:Apache License

public DetailPanel() {
    setSizeFull();/*ww w  . j  a v  a2  s.  c  o  m*/
    addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL);
    setMargin(true);

    CssLayout cssLayout = new CssLayout(); // Needed for rounded corners
    cssLayout.addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL);
    cssLayout.setSizeFull();
    super.addComponent(cssLayout);

    mainPanel = new Panel();
    mainPanel.addStyleName(Reindeer.PANEL_LIGHT);
    mainPanel.setSizeFull();
    cssLayout.addComponent(mainPanel);

    // Use default layout
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setWidth(100, UNITS_PERCENTAGE);
    verticalLayout.setMargin(true);
    mainPanel.setContent(verticalLayout);
}