Example usage for com.vaadin.ui AbstractLayout setSizeUndefined

List of usage examples for com.vaadin.ui AbstractLayout setSizeUndefined

Introduction

In this page you can find the example usage for com.vaadin.ui AbstractLayout setSizeUndefined.

Prototype

@Override
    public void setSizeUndefined() 

Source Link

Usage

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

License:Open Source License

@Override
public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
    if (!(element instanceof MToolBar)) {
        return;/*from w ww. j  ava 2  s . com*/
    }

    MToolBar toolbarModel = (MToolBar) element;
    processContribution(toolbarModel);

    AbstractLayout toolBarWidget;

    if ((MElementContainer<?>) toolbarModel.getParent() instanceof MTrimBar) {
        MTrimBar parentTrimBar = (MTrimBar) (MElementContainer<?>) toolbarModel.getParent();
        int orientation = parentTrimBar.getSide().getValue();

        if (orientation == SideValue.TOP_VALUE || orientation == SideValue.BOTTOM_VALUE) {
            toolBarWidget = new HorizontalLayout() {
                @Override
                public void addComponent(Component c) {
                    if (!c.getStyleName().contains("horizontalseparator"))
                        c.addStyleName("horizontaltoolbarlement");
                    super.addComponent(c);
                }

                @Override
                public void addComponent(Component c, int index) {
                    if (!c.getStyleName().contains("horizontalseparator"))
                        c.addStyleName("horizontaltoolbarlement");
                    super.addComponent(c, index);
                }
            };
            toolBarWidget.addStyleName("horizontaltoolbar");
        } else {
            toolBarWidget = new VerticalLayout() {
                @Override
                public void addComponent(Component c) {
                    if (!c.getStyleName().contains("verticalseparator"))
                        c.addStyleName("verticaltoolbarlement");
                    super.addComponent(c);
                }

                @Override
                public void addComponent(Component c, int index) {
                    if (!c.getStyleName().contains("verticalseparator"))
                        c.addStyleName("verticaltoolbarlement");
                    super.addComponent(c, index);
                }
            };
            toolBarWidget.addStyleName("verticaltoolbar");
        }

        Component separator = GuiUtils.createSeparator(toolbarModel);
        if (separator != null)
            toolBarWidget.addComponent(separator);
    } else
        toolBarWidget = new HorizontalLayout();

    toolBarWidget.setSizeUndefined();
    toolBarWidget.addStyleName("toolbar");

    for (String css : toolbarModel.getTags()) {
        toolBarWidget.addStyleName(css);
    }

    element.setWidget(toolBarWidget);
}

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

License:Open Source License

@Override
public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
    if (!(element instanceof MTrimBar)) {
        return;/*ww  w  . jav a  2s . co m*/
    }

    MTrimBar mTrimBar = (MTrimBar) element;
    int orientation = mTrimBar.getSide().getValue();

    AbstractLayout trimBar = null;

    if (orientation == SideValue.BOTTOM_VALUE) {
        trimBar = new CssLayout();
        trimBar.addStyleName("horizontaltrimbar");
    } else if (orientation == SideValue.TOP_VALUE) {
        trimBar = new CssLayout();
        trimBar.addStyleName("toptrimbar");
    } else if (orientation == SideValue.LEFT_VALUE || orientation == SideValue.RIGHT_VALUE) {
        trimBar = new VerticalLayout();
        trimBar.addStyleName("verticaltrimbar");
    }

    trimBar.setSizeUndefined();

    if (orientation == SideValue.BOTTOM_VALUE || orientation == SideValue.TOP_VALUE) {
        trimBar.setWidth("100%");
    }

    element.setWidget(trimBar);
}