Example usage for com.vaadin.ui HorizontalLayout addStyleName

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

Introduction

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

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:org.eclipse.hawkbit.ui.login.LoginView.java

License:Open Source License

private Component buildFields() {
    final HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);// w w w . j  a v a 2s .c  o m
    fields.addStyleName("fields");
    buildTenantField();
    buildUserField();
    buildPasswordField();
    buildSignInButton();
    if (multiTenancyIndicator.isMultiTenancySupported()) {
        fields.addComponents(tenant, username, password, signin);
    } else {
        fields.addComponents(username, password, signin);
    }
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);
    signin.addClickListener(event -> handleLogin());

    return fields;
}

From source file:org.eclipse.hawkbit.ui.login.LoginView.java

License:Open Source License

private Component buildLinks() {

    final HorizontalLayout links = new HorizontalLayout();
    links.setSpacing(true);/*from   w  w w .  j  av  a2 s . co m*/
    links.addStyleName("links");
    final String linkStyle = "v-link";

    if (!uiProperties.getLinks().getDocumentation().getRoot().isEmpty()) {
        final Link docuLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_DOCUMENTATION,
                i18n.getMessage("link.documentation.name"),
                uiProperties.getLinks().getDocumentation().getRoot(), FontAwesome.QUESTION_CIRCLE, "_blank",
                linkStyle);
        links.addComponent(docuLink);
        docuLink.addStyleName(ValoTheme.LINK_SMALL);
    }

    if (!uiProperties.getDemo().getUser().isEmpty()) {
        final Link demoLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_DEMO,
                i18n.getMessage("link.demo.name"), "?demo", FontAwesome.DESKTOP, "_top", linkStyle);
        links.addComponent(demoLink);
        demoLink.addStyleName(ValoTheme.LINK_SMALL);
    }

    if (!uiProperties.getLinks().getRequestAccount().isEmpty()) {
        final Link requestAccountLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_REQUESTACCOUNT,
                i18n.getMessage("link.requestaccount.name"), uiProperties.getLinks().getRequestAccount(),
                FontAwesome.SHOPPING_CART, "", linkStyle);
        links.addComponent(requestAccountLink);
        requestAccountLink.addStyleName(ValoTheme.LINK_SMALL);
    }

    if (!uiProperties.getLinks().getUserManagement().isEmpty()) {
        final Link userManagementLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_USERMANAGEMENT,
                i18n.getMessage("link.usermanagement.name"), uiProperties.getLinks().getUserManagement(),
                FontAwesome.USERS, "_blank", linkStyle);
        links.addComponent(userManagementLink);
        userManagementLink.addStyleName(ValoTheme.LINK_SMALL);
    }

    return links;
}

From source file:org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryHeader.java

License:Open Source License

private void buildLayout() {
    final HorizontalLayout titleMaxIconsLayout = new HorizontalLayout();
    titleMaxIconsLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE);
    titleMaxIconsLayout.setSpacing(false);
    titleMaxIconsLayout.setMargin(false);
    titleMaxIconsLayout.setSizeFull();/*ww w  . ja v  a2 s  .c  om*/
    titleMaxIconsLayout.addComponents(titleOfActionHistory, maxMinButton);
    titleMaxIconsLayout.setComponentAlignment(titleOfActionHistory, Alignment.TOP_LEFT);
    titleMaxIconsLayout.setComponentAlignment(maxMinButton, Alignment.TOP_RIGHT);
    titleMaxIconsLayout.setExpandRatio(titleOfActionHistory, 0.8f);
    titleMaxIconsLayout.setExpandRatio(maxMinButton, 0.2f);

    // Note: here the only purpose of adding drop hints to the layout is to
    // maintain consistent
    // height for all widgets headers.
    addComponent(titleMaxIconsLayout);
    setComponentAlignment(titleMaxIconsLayout, Alignment.TOP_LEFT);
    setWidth(100, Unit.PERCENTAGE);
    setImmediate(true);
    addStyleName("action-history-header");
    addStyleName("bordered-layout");
    addStyleName("no-border-bottom");
}

From source file:org.eclipse.hawkbit.ui.management.targettable.TargetBulkUpdateWindowLayout.java

License:Open Source License

private void buildLayout() {
    mainLayout = new VerticalLayout();
    mainLayout.setSpacing(Boolean.TRUE);
    mainLayout.setSizeUndefined();//w w  w  .ja va 2  s .co m
    mainLayout.setWidth("200px");

    final HorizontalLayout captionLayout = new HorizontalLayout();
    captionLayout.setSizeFull();
    captionLayout.addComponents(windowCaption, minimizeButton, closeButton);
    captionLayout.setExpandRatio(windowCaption, 1.0F);
    captionLayout.addStyleName("v-window-header");

    final HorizontalLayout uploaderLayout = new HorizontalLayout();
    uploaderLayout.addComponent(bulkUploader);
    uploaderLayout.addComponent(linkToSystemConfigHelp);
    uploaderLayout.setComponentAlignment(linkToSystemConfigHelp, Alignment.BOTTOM_RIGHT);
    uploaderLayout.setExpandRatio(bulkUploader, 1.0F);
    uploaderLayout.setSizeFull();
    mainLayout.addComponents(captionLayout, dsNamecomboBox, descTextArea, tokenVerticalLayout, descTextArea,
            progressBar, targetsCountLabel, uploaderLayout);
}

From source file:org.ikasan.dashboard.ui.framework.panel.LandingViewPanel.java

License:BSD License

private Component createContentWrapper(final Component content) {
    final CssLayout slot = new CssLayout();
    slot.setWidth("100%");
    slot.addStyleName("dashboard-panel-slot");

    CssLayout card = new CssLayout();
    card.setWidth("100%");
    card.addStyleName(ValoTheme.LAYOUT_CARD);

    HorizontalLayout toolbar = new HorizontalLayout();
    toolbar.addStyleName("dashboard-panel-toolbar");
    toolbar.setWidth("100%");

    Label caption = new Label(content.getCaption());
    caption.addStyleName(ValoTheme.LABEL_H4);
    caption.addStyleName(ValoTheme.LABEL_COLORED);
    caption.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    content.setCaption(null);/*  w w  w  . ja v  a 2s.co  m*/

    MenuBar tools = new MenuBar();
    tools.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
    MenuItem max = tools.addItem("", VaadinIcons.EXPAND, new Command() {

        @Override
        public void menuSelected(final MenuItem selectedItem) {
            if (!slot.getStyleName().contains("max")) {
                selectedItem.setIcon(FontAwesome.COMPRESS);
                toggleMaximized(slot, true);
            } else {
                slot.removeStyleName("max");
                selectedItem.setIcon(FontAwesome.EXPAND);
                toggleMaximized(slot, false);
            }
        }
    });
    max.setStyleName("icon-only");
    MenuItem root = tools.addItem("", VaadinIcons.COG, null);
    root.addItem("Configure", new Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            Notification.show("Not implemented in this demo");
        }
    });
    root.addSeparator();
    root.addItem("Close", new Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            Notification.show("Not implemented in this demo");
        }
    });

    toolbar.addComponents(caption, tools);
    toolbar.setExpandRatio(caption, 1);
    toolbar.setComponentAlignment(caption, Alignment.MIDDLE_LEFT);

    card.addComponents(toolbar, content);
    slot.addComponent(card);
    return slot;
}

From source file:org.ikasan.dashboard.ui.monitor.component.MonitorPanel.java

License:BSD License

protected Component createContentWrapper(final Component small, final Component large) {
    final CssLayout slot = new CssLayout();
    slot.setWidth("100%");
    slot.addStyleName("monitor-panel-slot");

    final CssLayout card1 = new CssLayout();
    card1.setWidth("100%");
    card1.addStyleName(ValoTheme.LAYOUT_CARD);

    final CssLayout card2 = new CssLayout();
    card2.setWidth("100%");
    card2.addStyleName(ValoTheme.LAYOUT_CARD);

    final HorizontalLayout toolbar = new HorizontalLayout();
    toolbar.addStyleName("dashboard-panel-toolbar");
    toolbar.setWidth("100%");

    Label caption = new Label(large.getCaption());
    caption.addStyleName(ValoTheme.LABEL_H4);
    caption.addStyleName(ValoTheme.LABEL_COLORED);
    caption.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    large.setCaption(null);/*  w ww.ja v a 2  s. co  m*/

    MenuBar tools = new MenuBar();
    tools.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
    MenuItem max = tools.addItem("", VaadinIcons.EXPAND, new Command() {

        @Override
        public void menuSelected(final MenuItem selectedItem) {
            if (!slot.getStyleName().contains("max")) {
                selectedItem.setIcon(FontAwesome.COMPRESS);
                slot.removeAllComponents();
                card2.removeAllComponents();
                card2.addComponents(toolbar, large);
                slot.addComponents(card2);
                toggleMaximized(slot, true);
            } else {
                slot.removeStyleName("max");
                selectedItem.setIcon(FontAwesome.EXPAND);
                toggleMaximized(slot, false);
                card1.removeAllComponents();
                card1.addComponents(toolbar, small);
                slot.removeAllComponents();
                slot.addComponents(card1);
            }
        }
    });
    max.setStyleName("icon-only");
    MenuItem root = tools.addItem("", VaadinIcons.COG, null);
    root.addItem("Configure", new Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            Notification.show("Not implemented in this demo");
        }
    });
    root.addSeparator();
    root.addItem("Close", new Command() {
        @Override
        public void menuSelected(final MenuItem selectedItem) {
            Notification.show("Not implemented in this demo");
        }
    });

    toolbar.addComponents(caption, tools);
    toolbar.setExpandRatio(caption, 1);
    toolbar.setComponentAlignment(caption, Alignment.MIDDLE_LEFT);

    card1.addComponents(toolbar, small);
    //        card2.addComponents(toolbar, large);
    slot.addComponent(card1);
    return slot;
}

From source file:org.inakirj.imagerulette.screens.DiceURLSetupView.java

License:Open Source License

/**
 * Sets the layout./*www.  j  a v a  2  s  .c o  m*/
 */
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.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);// w  ww .  j  a  v a2  s  . co  m
        //            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.login.LoginView.java

License:Open Source License

private HorizontalLayout createTitle() {
    HorizontalLayout labels = new HorizontalLayout();
    labels.setWidth("100%");
    labels.setMargin(new MarginInfo(false, false, true, false));
    labels.addStyleName("labels");

    Label title = new Label(app.getMessage("login.title"));
    title.setSizeUndefined();//from  ww w  .  j a v a 2  s .co  m
    title.addStyleName(ValoTheme.LABEL_H4);
    title.addStyleName(ValoTheme.LABEL_COLORED);
    labels.addComponent(title);
    labels.setComponentAlignment(title, Alignment.BOTTOM_LEFT);

    Embedded logo = new Embedded("", QIResources.JPOS_LOGO);
    logo.setHeight("80px");
    labels.addComponent(logo);
    labels.setComponentAlignment(logo, Alignment.TOP_RIGHT);

    return labels;
}

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

License:Open Source License

public Layout createForm(final Object entity, String[] params, boolean isNew) {
    VerticalLayout profileLayout = new VerticalLayout();
    profileLayout.setMargin(true);//from w ww.  ja  va2 s. c  o m
    profileLayout.setSpacing(true);

    //Add Back Button
    if (params.length <= 1 || !"profile".equals(params[1])) {
        Button back = new Button(getApp().getMessage("back"));
        back.addStyleName("borderless-colored");
        back.setIcon(VaadinIcons.ARROW_LEFT);
        back.addClickListener(event -> app.getNavigator().navigateTo(getGeneralRoute()));
        profileLayout.addComponent(back);
        profileLayout.setComponentAlignment(back, Alignment.MIDDLE_LEFT);
    }

    binder = new Binder<T>(clazz) {
        @Override
        public void setReadOnly(boolean readOnly) {
            super.setReadOnly(readOnly);
            if (readOnlyFields != null) {
                for (String fieldId : readOnlyFields) {
                    if (binder.getBinding(fieldId).isPresent()) {
                        HasValue field = binder.getBinding(fieldId).get().getField();
                        if ((field != null && !field.isEmpty()) || !field.isRequiredIndicatorVisible()) {
                            field.setReadOnly(true);
                            binder.bind(field, fieldId);
                        }
                    }

                }
            }
        }
    };
    bean = (T) entity;
    final Layout formLayout = createLayout();
    getHelper().setOriginalEntity(bean);
    binder.readBean((T) entity);
    binder.setReadOnly(true);
    profileLayout.addComponent(formLayout);

    HorizontalLayout footer = new HorizontalLayout();
    footer.addStyleName("footer");
    footer.setMargin(new MarginInfo(true, false, false, false));
    footer.setSpacing(true);
    formLayout.addComponent(footer);

    //Add Save, Remove & Cancel Buttons
    editBtn = new Button(app.getMessage("edit"));
    removeBtn = new Button(app.getMessage("remove"));
    saveBtn = new Button(app.getMessage("save"));
    cancelBtn = new Button(app.getMessage("cancel"));

    editBtn.addClickListener(event -> editClick(event, formLayout));
    editBtn.addStyleName("icon-edit");

    saveBtn.addClickListener(event -> saveClick(event, formLayout));
    saveBtn.setVisible(false);
    saveBtn.setStyleName("icon-ok");
    saveBtn.setClickShortcut(ShortcutAction.KeyCode.ENTER);

    removeBtn.addClickListener(event -> app.addWindow(new ConfirmDialog(app.getMessage("confirmTitle"),
            app.getMessage("removeConfirmationMessage"), confirm -> {
                if (confirm) {
                    removeEntity();
                }
            })));
    removeBtn.addStyleName("icon-trash");

    cancelBtn.addClickListener(event -> {
        if (isNew) {
            app.getNavigator().navigateTo(getGeneralRoute());
        } else {
            cancelClick(event, formLayout);
        }
    });

    cancelBtn.setClickShortcut(ShortcutAction.KeyCode.ESCAPE);
    cancelBtn.setVisible(false);
    cancelBtn.addStyleName("icon-cancel");

    if (canEdit()) {
        footer.addComponent(editBtn);
        footer.addComponent(saveBtn);
        footer.addComponent(cancelBtn);
        footer.setComponentAlignment(editBtn, Alignment.MIDDLE_RIGHT);
        footer.setComponentAlignment(saveBtn, Alignment.MIDDLE_RIGHT);
        footer.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT);
    }
    if (canRemove()) {
        footer.addComponent(removeBtn);
        footer.setComponentAlignment(removeBtn, Alignment.MIDDLE_RIGHT);
    }
    if (isNew) {
        editBtn.click();
    }
    errorLabel = new Label();
    errorLabel.setVisible(false);
    errorLabel.setStyleName(ValoTheme.LABEL_FAILURE);
    profileLayout.addComponent(errorLabel);
    return profileLayout;
}