Example usage for com.vaadin.ui CssLayout addComponent

List of usage examples for com.vaadin.ui CssLayout addComponent

Introduction

In this page you can find the example usage for com.vaadin.ui CssLayout addComponent.

Prototype

public void addComponent(Component c, int index) 

Source Link

Document

Adds a component into indexed position in this container.

Usage

From source file:org.semanticsoft.vaaclipse.presentation.renderers.TrimBarRenderer.java

License:Open Source License

@Override
public void addChildGui(MUIElement child, MElementContainer<MUIElement> element) {
    if (!(child instanceof MTrimElement && (MElementContainer<?>) element instanceof MTrimBar))
        return;/*from  w w w  . j  a v a 2s  . com*/

    MTrimBar trimBar = (MTrimBar) (MElementContainer<?>) element;

    final Component childWidget = (Component) child.getWidget();
    childWidget.setVisible(child.isVisible());
    childWidget.setSizeUndefined();
    int orientation = trimBar.getSide().getValue();
    if (orientation == SideValue.TOP_VALUE || orientation == SideValue.BOTTOM_VALUE)
        childWidget.addStyleName("horizontaltrimelement");
    else
        childWidget.addStyleName("verticaltrimelement");

    int index = indexOf(child, element);
    if (element.getWidget() instanceof CssLayout) {
        CssLayout trimWidget = (CssLayout) element.getWidget();
        trimWidget.addComponent(childWidget, index);
        trimWidget.markAsDirty();
    } else if (element.getWidget() instanceof AbstractOrderedLayout) {
        AbstractOrderedLayout trimWidget = (AbstractOrderedLayout) element.getWidget();
        trimWidget.addComponent(childWidget, index);
        trimWidget.markAsDirty();
    }

    refreshVisibility(trimBar);
}