Search in sources :

Example 1 with HasSize

use of com.vaadin.flow.component.HasSize in project flow-components by vaadin.

the class LayoutComponent method toggleSidebar.

private void toggleSidebar() {
    if (sidebarWrapper == null) {
        sidebarWrapper = new SplitLayout();
        sidebarWrapper.setSplitterPosition(80);
        sidebarWrapper.setSizeFull();
        sidebarWrapper.addToPrimary(content);
        this.contentContainer.removeAll();
        sidebarWrapper.addToSecondary(new Span("Sidebar"));
        this.contentContainer.add(sidebarWrapper);
    } else {
        Component primaryComponent = sidebarWrapper.getPrimaryComponent();
        contentContainer.removeAll();
        contentContainer.add(primaryComponent);
        if (primaryComponent instanceof HasSize) {
            ((HasSize) primaryComponent).setSizeFull();
        }
        sidebarWrapper = null;
    }
}
Also used : SplitLayout(com.vaadin.flow.component.splitlayout.SplitLayout) HasSize(com.vaadin.flow.component.HasSize) Component(com.vaadin.flow.component.Component) Span(com.vaadin.flow.component.html.Span)

Example 2 with HasSize

use of com.vaadin.flow.component.HasSize in project linkki by linkki-framework.

the class ComponentColumnProvider method apply.

@Override
public Component apply(ROW source) {
    NoLabelComponentWrapper wrapper = UiCreator.createUiElement(method, source, bindingContext, c -> new NoLabelComponentWrapper((Component) c, WrapperType.FIELD));
    Component component = wrapper.getComponent();
    if (component instanceof HasValue && component instanceof HasSize) {
        ((HasSize) component).setWidthFull();
    }
    return component;
}
Also used : NoLabelComponentWrapper(org.linkki.core.ui.wrapper.NoLabelComponentWrapper) HasSize(com.vaadin.flow.component.HasSize) Component(com.vaadin.flow.component.Component) HasValue(com.vaadin.flow.component.HasValue)

Aggregations

Component (com.vaadin.flow.component.Component)2 HasSize (com.vaadin.flow.component.HasSize)2 HasValue (com.vaadin.flow.component.HasValue)1 Span (com.vaadin.flow.component.html.Span)1 SplitLayout (com.vaadin.flow.component.splitlayout.SplitLayout)1 NoLabelComponentWrapper (org.linkki.core.ui.wrapper.NoLabelComponentWrapper)1