Java Code Examples for com.vaadin.ui.CssLayout#addStyleName()

The following examples show how to use com.vaadin.ui.CssLayout#addStyleName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CubaFileUploadWrapper.java    From cuba with Apache License 2.0 6 votes vote down vote up
protected void initLayout(UploadComponent uploadComponent) {
    this.uploadButton = uploadComponent;

    container = new CssLayout();
    container.addStyleName("c-fileupload-container");

    fileNameButton = new CubaButton();
    fileNameButton.setWidth(100, Unit.PERCENTAGE);
    fileNameButton.addStyleName(ValoTheme.BUTTON_LINK);
    fileNameButton.addStyleName("c-fileupload-filename");
    setFileNameButtonCaption(null);
    container.addComponent(fileNameButton);

    container.addComponent(uploadComponent);

    clearButton = new CubaButton("");
    clearButton.setStyleName("c-fileupload-clear");
    container.addComponent(clearButton);
    setShowClearButton(showClearButton);

    setShowFileName(false);
    setWidthUndefined();
}
 
Example 2
Source File: RowUtil.java    From cia with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the row component.
 *
 * @param row         the row
 * @param component   the component
 * @param description the description
 */
public static void createRowComponent(final ResponsiveRow row, final Component component,
		final String description) {
	final CssLayout layout = new CssLayout();
	layout.addStyleName(".v-layout-content-pagemode-panel-level2");
	Responsive.makeResponsive(layout);
	layout.setSizeUndefined();

	final Label descriptionLabel = new Label(description);
	descriptionLabel.addStyleName(ITEMBOX);
	Responsive.makeResponsive(descriptionLabel);
	descriptionLabel.setWidth(100, Unit.PERCENTAGE);
	layout.addComponent(descriptionLabel);

	component.addStyleName(ITEMBOX);
	component.addStyleName(TITLE);
	Responsive.makeResponsive(component);
	component.setWidth(100, Unit.PERCENTAGE);
	layout.addComponent(component);

	row.addColumn().withDisplayRules(DISPLAY_SIZE_XS_DEVICE, DISPLAYS_SIZE_XM_DEVICE, DISPLAY_SIZE_MD_DEVICE,
			DISPLAY_SIZE_LG_DEVICE).withComponent(layout);
}
 
Example 3
Source File: RowUtil.java    From cia with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the row item.
 *
 * @param row         the row
 * @param button      the button
 * @param description the description
 */
public static void createRowItem(final ResponsiveRow row, final Button button, final String description) {
	final CssLayout layout = new CssLayout();
	layout.addStyleName("v-layout-content-overview-panel-level2");
	Responsive.makeResponsive(layout);
	layout.setSizeUndefined();

	button.addStyleName(ITEMBOX);
	button.addStyleName(TITLE);
	Responsive.makeResponsive(button);
	button.setWidth(100, Unit.PERCENTAGE);
	layout.addComponent(button);

	final Label descriptionLabel = new Label(description);
	descriptionLabel.addStyleName(ITEMBOX);
	Responsive.makeResponsive(descriptionLabel);
	descriptionLabel.setWidth(100, Unit.PERCENTAGE);
	layout.addComponent(descriptionLabel);

	row.addColumn().withDisplayRules(DISPLAY_SIZE_XS_DEVICE, DISPLAYS_SIZE_XM_DEVICE, DISPLAY_SIZE_MD_DEVICE,
			DISPLAY_SIZE_LG_DEVICE).withComponent(layout);
}
 
Example 4
Source File: MyUI.java    From framework-spring-tutorial with Apache License 2.0 6 votes vote down vote up
@Override
protected void init(VaadinRequest request) {
    final VerticalLayout root = new VerticalLayout();
    root.setSizeFull();
    setContent(root);

    final CssLayout navigationBar = new CssLayout();
    navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    navigationBar.addComponent(createNavigationButton("UI Scoped View",
            UIScopedView.VIEW_NAME));
    navigationBar.addComponent(createNavigationButton("View Scoped View",
            ViewScopedView.VIEW_NAME));
    root.addComponent(navigationBar);

    springViewDisplay = new Panel();
    springViewDisplay.setSizeFull();
    root.addComponent(springViewDisplay);
    root.setExpandRatio(springViewDisplay, 1.0f);
}
 
Example 5
Source File: DashboardMenu.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the wrapper which contains the menu item and the adjacent label
 * for displaying the occurred events
 * 
 * @param menuItemButton
 *            the menu item
 * @param notificationLabel
 *            the label for displaying the occurred events
 * @return Component of type CssLayout
 */
private static Component buildLabelWrapper(final ValoMenuItemButton menuItemButton,
        final Component notificationLabel) {
    final CssLayout dashboardWrapper = new CssLayout(menuItemButton);
    dashboardWrapper.addStyleName("labelwrapper");
    dashboardWrapper.addStyleName(ValoTheme.MENU_ITEM);
    notificationLabel.addStyleName(ValoTheme.MENU_BADGE);
    notificationLabel.setWidthUndefined();
    notificationLabel.setVisible(false);
    notificationLabel.setId(UIComponentIdProvider.NOTIFICATION_MENU_ID + menuItemButton.getCaption().toLowerCase());
    dashboardWrapper.addComponent(notificationLabel);
    return dashboardWrapper;
}
 
Example 6
Source File: AbstractMenuItemFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
 * Creates the button link.
 *
 * @param row
 *            the panel content
 * @param linkText
 *            the link text
 * @param icon
 *            the icon
 * @param command
 *            the command
 * @param description
 *            the description
 */
protected final void createButtonLink(final ResponsiveRow row,final String linkText,final Resource icon, final ClickListener command, final String description) {
	final CssLayout layout = new CssLayout();
	layout.addStyleName("v-layout-content-overview-panel-level2");
	Responsive.makeResponsive(layout);
	layout.setSizeUndefined();


	final Button button = new Button(linkText);
	Responsive.makeResponsive(button);
	button.setStyleName(LINK_STYLE_NAME);
	button.addStyleName("title");
	button.addClickListener(command);
	button.setIcon(icon);
	button.setWidth(100, Unit.PERCENTAGE);


	layout.addComponent(button);

	final Label descriptionLabel = new Label(description);
	descriptionLabel.addStyleName("itembox");
	Responsive.makeResponsive(descriptionLabel);
	descriptionLabel.setWidth(100, Unit.PERCENTAGE);
	layout.addComponent(descriptionLabel);

	row.addColumn().withDisplayRules(DISPLAY_SIZE_XS_DEVICE,DISPLAYS_SIZE_XM_DEVICE,DISPLAY_SIZE_MD_DEVICE,DISPLAY_SIZE_LG_DEVICE).withComponent(layout);
}
 
Example 7
Source File: WebAppWorkArea.java    From cuba with Apache License 2.0 4 votes vote down vote up
public WebAppWorkArea() {
    component = new CssLayout();
    component.setPrimaryStyleName(WORKAREA_STYLENAME);
    component.addStyleName(MODE_TABBED_STYLENAME);
    component.addStyleName(STATE_INITIAL_STYLENAME);
}
 
Example 8
Source File: MyCloudAdd.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void attach() {
    // myCloud名
    cloudNameField = new TextField(ViewProperties.getCaption("field.cloudName"));
    getLayout().addComponent(cloudNameField);

    // コメント
    commentField = new TextField(ViewProperties.getCaption("field.comment"));
    commentField.setWidth("100%");
    getLayout().addComponent(commentField);

    // テンプレート選択テーブル
    templateTable = new SelectTemplateTable();
    getLayout().addComponent(templateTable);

    // テンプレート説明欄
    final Label nameLabel = new Label();
    final Label descriptionLabel = new Label();

    Panel descriptionPanel = new Panel();
    CssLayout layout = new CssLayout();
    layout.addStyleName("template-desc");
    descriptionPanel.setHeight("80px");
    descriptionPanel.setContent(layout);
    layout.setSizeFull();
    layout.addComponent(nameLabel);
    layout.addComponent(descriptionLabel);
    getLayout().addComponent(descriptionPanel);

    templateTable.addListener(new ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (templateTable.getValue() == null) {
                return;
            }

            TemplateDto template = findTemplate(templateTable.getValue());
            nameLabel.setValue(template.getTemplate().getTemplateNameDisp() + ":");
            descriptionLabel.setValue(template.getTemplate().getTemplateDescriptionDisp());
        }
    });

    cloudNameField.focus();

    initValidation();
}
 
Example 9
Source File: LoadBalancerPanel.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void attach() {
    setSizeFull();
    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);
}
 
Example 10
Source File: PieChartWrapper.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
protected final ComponentContainer createLegendBox() {
    final CssLayout mainLayout = new CssLayout();
    mainLayout.addStyleName("legend-box");
    mainLayout.setSizeUndefined();
    final List keys = pieDataSet.getKeys();

    for (int i = 0; i < keys.size(); i++) {
        MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true))
                .withStyleName("inline-block").withUndefinedWidth();
        layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

        final Comparable key = (Comparable) keys.get(i);
        int colorIndex = i % CHART_COLOR_STR.size();
        final String color = "<div style = \" width:13px;height:13px;background: #"
                + CHART_COLOR_STR.get(colorIndex) + "\" />";
        final ELabel lblCircle = ELabel.html(color);

        String btnCaption;
        if (enumKeyCls == null) {
            if (key instanceof Key) {
                btnCaption = String.format("%s (%d)", StringUtils.trim(((Key) key).getDisplayName(), 20, true),
                        pieDataSet.getValue(key).intValue());
            } else {
                btnCaption = String.format("%s (%d)", key, pieDataSet.getValue(key).intValue());
            }
        } else {
            btnCaption = String.format("%s(%d)", UserUIContext.getMessage(enumKeyCls, key.toString()),
                    pieDataSet.getValue(key).intValue());
        }
        MButton btnLink = new MButton(StringUtils.trim(btnCaption, 25, true), clickEvent -> {
            if (key instanceof Key) {
                clickLegendItem(((Key) key).getKey());
            } else {
                clickLegendItem(key.toString());
            }
        }).withStyleName(WebThemes.BUTTON_LINK).withDescription(btnCaption);

        layout.with(lblCircle, btnLink);
        mainLayout.addComponent(layout);
    }
    mainLayout.setWidth("100%");
    return mainLayout;
}
 
Example 11
Source File: LoginView.java    From gazpachoquest with GNU General Public License v3.0 4 votes vote down vote up
protected CssLayout createCompositionRoot() {
    CssLayout root = new CssLayout();
    root.setSizeFull();
    root.addStyleName(Reindeer.LAYOUT_BLUE);

    VerticalLayout loginLayout = new VerticalLayout();
    loginLayout.setSizeFull();
    loginLayout.addStyleName("login-layout");
    root.addComponent(loginLayout);

    final CssLayout loginPanel = new CssLayout();
    loginPanel.addStyleName("login-panel");
    loginLayout.addComponent(loginPanel);

    HorizontalLayout labels = new HorizontalLayout();
    labels.setWidth("100%");
    labels.setMargin(true);
    labels.addStyleName("labels");
    loginPanel.addComponent(labels);

    Label welcome = new Label("Welcome");
    welcome.setSizeUndefined();
    welcome.addStyleName(Reindeer.LABEL_H2);
    labels.addComponent(welcome);
    labels.setComponentAlignment(welcome, Alignment.MIDDLE_LEFT);

    Label title = new Label("Gazpacho Quest");
    title.setSizeUndefined();
    title.addStyleName(Reindeer.LABEL_H1);
    labels.addComponent(title);
    labels.setComponentAlignment(title, Alignment.MIDDLE_RIGHT);

    HorizontalLayout fields = new HorizontalLayout();

    fields.setWidth("100%");
    fields.setSpacing(true);
    fields.setMargin(true);
    fields.addStyleName("fields");

    invitation = new TextField("Invitation");
    invitation.setSizeUndefined();
    invitation.focus();
    // invitation.setValue("YAS5ICHRBE");
    fields.addComponent(invitation);

    login = new Button("Start");
    login.addClickListener(createLoginButtonListener());
    fields.addComponent(login);
    fields.setComponentAlignment(login, Alignment.BOTTOM_LEFT);

    loginPanel.addComponent(fields);

    return root;
}