Example usage for com.vaadin.ui AbstractOrderedLayout setMargin

List of usage examples for com.vaadin.ui AbstractOrderedLayout setMargin

Introduction

In this page you can find the example usage for com.vaadin.ui AbstractOrderedLayout setMargin.

Prototype

@Override
    public void setMargin(MarginInfo marginInfo) 

Source Link

Usage

From source file:com.expressui.core.view.RootComponent.java

License:Open Source License

/**
 * Adds code popup button next to this component to the right.
 *
 * @param alignment alignment for button
 * @param classes   classes for displaying related source code and Javadoc
 *///from w w  w.  j a v  a 2s  . c  o m
protected void addCodePopupButtonIfEnabled(Alignment alignment, Class... classes) {
    if (isCodePopupEnabled()) {
        Component firstComponent = getCompositionRoot();
        AbstractOrderedLayout codePopupButtonLayout = new HorizontalLayout();
        codePopupButtonLayout.setMargin(false);
        setDebugId(codePopupButtonLayout, "codePopupButtonLayout");
        setCompositionRoot(codePopupButtonLayout);
        codePopupButtonLayout.addComponent(firstComponent);
        Button codePopupButton = codePopup.createPopupCodeButton(autoAddCodeClasses(classes));
        codePopupButtonLayout.addComponent(codePopupButton);
        codePopupButtonLayout.setComponentAlignment(codePopupButton, alignment);
    }
}

From source file:com.foc.vaadin.gui.FocXMLGuiComponentStatic.java

License:Apache License

public static void setCaptionMargin_Zero(Component component) {
    component.setCaption(null);//from ww  w . ja v  a  2  s.  co  m
    component.addStyleName("focNoCaptionMargin");
    if (Globals.isValo()) {
        if (component instanceof AbstractOrderedLayout) {
            AbstractOrderedLayout lay = (AbstractOrderedLayout) component;
            lay.setMargin(false);
        }
    }
}

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");
    }/*from   w ww .  j a  va  2 s. co 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");
    }/*from   ww  w  . ja  v a2s .  c om*/

    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);
}

From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.DefaultPanelContentView.java

License:Apache License

@Override
public void initialize(boolean useHorizontalLayout) {

    AbstractOrderedLayout layout = useHorizontalLayout ? new HorizontalLayout() : new VerticalLayout();
    setCompositionRoot(layout);/*from   www. ja v a 2 s. c  om*/

    layout.setSpacing(true);
    layout.setMargin(true);
}

From source file:org.eclipse.emf.ecp.view.core.vaadin.AbstractContainerRendererVaadin.java

License:Open Source License

@Override
protected Component render() {
    final T renderable = getVElement();

    final AbstractOrderedLayout layout = getAbstractOrderedLayout();
    for (final VContainedElement composite : renderable.getChildren()) {
        final Component renderResult = getRendererFactory().render(composite, getViewModelContext());
        layout.addComponent(renderResult);
    }//  ww  w .  j av  a2s  .  co  m
    final Component renderComponent = getRenderComponent(layout);
    renderComponent.setWidth(100, Unit.PERCENTAGE);
    if (renderComponent instanceof AbstractOrderedLayout) {
        final AbstractOrderedLayout abstractOrderedLayout = (AbstractOrderedLayout) renderComponent;
        abstractOrderedLayout.setMargin(isMargin());
        abstractOrderedLayout.setSpacing(isSpacing());
    }
    return renderComponent;
}

From source file:org.eclipse.emf.ecp.view.group.vaadin.GroupLayoutRendererVaadin.java

License:Open Source License

@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//w w w . j  av a  2 s . c o m
            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);
}

From source file:org.eclipse.emf.ecp.view.vaadin.ViewRendererVaadin.java

License:Open Source License

@Override
public Component render() {
    final AbstractOrderedLayout layout = getLayout();
    layout.setSpacing(true);//from  w  ww. jav  a  2  s . com
    layout.setMargin(true);
    layout.setSizeFull();
    for (final VContainedElement composite : getVElement().getChildren()) {
        final Component renderResult = getRendererFactory().render(composite, getViewModelContext());
        layout.addComponent(renderResult);

    }
    final ECPVaadinViewComponent ecpVaadinViewComponent = new ECPVaadinViewComponent();
    ecpVaadinViewComponent.addStyleName(BORDERLESS);
    ecpVaadinViewComponent.setContent(layout);
    return ecpVaadinViewComponent;
}