Example usage for com.vaadin.ui AbstractOrderedLayout setVisible

List of usage examples for com.vaadin.ui AbstractOrderedLayout setVisible

Introduction

In this page you can find the example usage for com.vaadin.ui AbstractOrderedLayout setVisible.

Prototype

@Override
    public void setVisible(boolean visible) 

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  a  va2 s.  c o  m*/
            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);
}