Example usage for com.vaadin.ui NativeButton setWidth

List of usage examples for com.vaadin.ui NativeButton setWidth

Introduction

In this page you can find the example usage for com.vaadin.ui NativeButton setWidth.

Prototype

@Override
    public void setWidth(float width, Unit unit) 

Source Link

Usage

From source file:org.eclipse.emf.ecp.view.group.vaadin.GroupLayoutRendererVaadin.java

License:Open Source License

@Override
protected Component getRenderComponent(final AbstractOrderedLayout orderedLayout) {
    if (GroupType.COLLAPSIBLE.equals(getVElement().getGroupType())) {
        final VerticalLayout mainLayout = new VerticalLayout();
        final NativeButton collapseButton = new NativeButton(StringUtils.EMPTY, new Button.ClickListener() {

            @Override/*ww w  .  j av  a  2  s. c om*/
            public void buttonClick(ClickEvent event) {
                final boolean switchVisible = !orderedLayout.isVisible();
                setCollapseStyle(event.getButton(), switchVisible);
                orderedLayout.setVisible(switchVisible);
            }

        });
        collapseButton.setWidth(100, Unit.PERCENTAGE);
        mainLayout.addComponent(collapseButton);
        mainLayout.addComponent(orderedLayout);
        orderedLayout.setMargin(true);
        orderedLayout.setSpacing(true);
        orderedLayout.setVisible(getVElement().isCollapsed());
        setCollapseStyle(collapseButton, getVElement().isCollapsed());
        mainLayout.addStyleName(GROUP_STYLE_NAME);
        return mainLayout;
    }
    return super.getRenderComponent(orderedLayout);
}