@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 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); }
@Override protected void applyCaption() { if (GroupType.COLLAPSIBLE.equals(getVElement().getGroupType())) { final Component controlComponent = ((AbstractOrderedLayout) getControlComponent()).getComponent(0); setControlComponent(controlComponent); super.applyCaption(); return; } super.applyCaption(); }
@Override protected boolean isSpacing() { return !GroupType.COLLAPSIBLE.equals(getVElement().getGroupType()); }