List of usage examples for com.vaadin.ui AbstractOrderedLayout setStyleName
@Override public void setStyleName(String style)
From source file:com.haulmont.cuba.web.gui.components.WebGroupBox.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"); }/* w w w.ja v a 2 s. c o m*/ AbstractOrderedLayout newContent = null; if (orientation == Orientation.VERTICAL && !(component.getContent() instanceof CubaVerticalActionsLayout)) { newContent = new CubaVerticalActionsLayout(); } else if (orientation == Orientation.HORIZONTAL && !(component.getContent() instanceof CubaHorizontalActionsLayout)) { newContent = new CubaHorizontalActionsLayout(); } if (newContent != null) { newContent.setStyleName("c-groupbox-inner"); component.setContent(newContent); CubaOrderedActionsLayout currentContent = (CubaOrderedActionsLayout) component.getContent(); newContent.setMargin(currentContent.getMargin()); newContent.setSpacing(currentContent.isSpacing()); } if (ownComponents.contains(childComponent)) { int existingIndex = getComponentContent() .getComponentIndex(WebComponentsHelper.getComposition(childComponent)); if (index > existingIndex) { index--; } remove(childComponent); } com.vaadin.ui.Component vComponent = WebComponentsHelper.getComposition(childComponent); getComponentContent().addComponent(vComponent, index); getComponentContent().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); }
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"); }// w w w . j a v 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); }