List of usage examples for com.vaadin.ui AbstractOrderedLayout setWidth
@Override public void setWidth(String width)
From source file:com.haulmont.cuba.web.gui.components.WebScrollBoxLayout.java
License:Apache License
@Override public void add(Component childComponent, int index) { if (childComponent.getParent() != null && childComponent.getParent() != this) { throw new IllegalStateException("Component already has parent"); }/*from w w w . j av a 2s . c o m*/ AbstractOrderedLayout newContent = null; if (orientation == Orientation.VERTICAL && !(getContent() instanceof CubaVerticalActionsLayout)) { newContent = new CubaVerticalActionsLayout(); newContent.setWidth("100%"); } else if (orientation == Orientation.HORIZONTAL && !(getContent() instanceof CubaHorizontalActionsLayout)) { newContent = new CubaHorizontalActionsLayout(); } if (newContent != null) { newContent.setMargin((getContent()).getMargin()); newContent.setSpacing((getContent()).isSpacing()); newContent.setStyleName(SCROLLBOX_CONTENT_STYLENAME); com.vaadin.ui.Component oldContent = component.getComponent(0); newContent.setWidth(oldContent.getWidth(), oldContent.getWidthUnits()); newContent.setHeight(oldContent.getHeight(), oldContent.getHeightUnits()); component.removeAllComponents(); component.addComponent(newContent); applyScrollBarsPolicy(scrollBarPolicy); } if (ownComponents.contains(childComponent)) { int existingIndex = getContent().getComponentIndex(WebComponentsHelper.getComposition(childComponent)); if (index > existingIndex) { index--; } remove(childComponent); } com.vaadin.ui.Component vComponent = WebComponentsHelper.getComposition(childComponent); getContent().addComponent(vComponent, index); getContent().setComponentAlignment(vComponent, WebWrapperUtils.toVaadinAlignment(childComponent.getAlignment())); if (frame != null) { if (childComponent instanceof BelongToFrame && ((BelongToFrame) childComponent).getFrame() == null) { ((BelongToFrame) childComponent).setFrame(frame); } else { frame.registerComponent(childComponent); } } if (index == ownComponents.size()) { ownComponents.add(childComponent); } else { ownComponents.add(index, childComponent); } childComponent.setParent(this); }