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

The following examples show how to use com.vaadin.ui.CssLayout#setSizeUndefined() . 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: 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 2
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 3
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 4
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;
}