Search in sources :

Example 6 with SplitLayout

use of com.vaadin.flow.component.splitlayout.SplitLayout 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 7 with SplitLayout

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

the class SplitLayoutView method addResizeNotificationLayout.

private void addResizeNotificationLayout() {
    SplitLayout layout = new SplitLayout();
    layout.setId("split-layout-resize");
    layout.addToPrimary(new Label("First content component"));
    layout.addToSecondary(new Label("Second content component"));
    Label message = new Label("Drag and drop the splitter");
    AtomicInteger resizeCounter = new AtomicInteger();
    layout.addSplitterDragendListener(event -> message.setText("SplitLayout Resized " + resizeCounter.incrementAndGet() + " times."));
    message.setId("resize-message");
    setMinHeightForLayout(layout);
    addCard("Resize Event", layout, message);
}
Also used : SplitLayout(com.vaadin.flow.component.splitlayout.SplitLayout) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Label(com.vaadin.flow.component.html.Label)

Example 8 with SplitLayout

use of com.vaadin.flow.component.splitlayout.SplitLayout in project vaadin-chip-combobox by xdev-software.

the class SimpleDemo method initUI.

private void initUI() {
    this.stringBox.setWidthFull();
    final SplitLayout slLimit = new SplitLayout(new VerticalLayout(this.stringBox), new Div());
    slLimit.setOrientation(Orientation.HORIZONTAL);
    slLimit.setSplitterPosition(40);
    slLimit.setWidthFull();
    this.btnRestoreStringDefaults.addClickListener(ev -> this.restoreStringDefaults());
    this.btnClear.addClickListener(ev -> this.stringBox.clear());
    this.btnSetValueNull.addClickListener(ev -> this.stringBox.setValue(null));
    this.btnSetInvalid.addClickListener(ev -> {
        this.stringBox.setErrorMessage("An error message");
        this.stringBox.setInvalid(true);
    });
    this.btnClearInvalid.addClickListener(ev -> {
        this.stringBox.setErrorMessage(null);
        this.stringBox.setInvalid(false);
    });
    this.taValueChangeString.setReadOnly(true);
    this.taValueChangeInt.setReadOnly(true);
    this.vlLeft.add(slLimit, this.btnRestoreStringDefaults, new HorizontalLayout(this.btnClear, this.btnSetValueNull), new HorizontalLayout(this.btnSetInvalid, this.btnClearInvalid), this.taValueChangeString);
    this.vlRight.add(this.intBox, this.btnSetAvailableInts1to10, this.btnSetAvailableInts5to15, this.btnSetAvailableInts11to20, this.btnSetRandomAvailableInts, this.btnShowSelectedInt, this.taValueChangeInt);
    this.add(this.vlLeft, this.vlRight);
    this.setWidthFull();
}
Also used : SplitLayout(com.vaadin.flow.component.splitlayout.SplitLayout) Div(com.vaadin.flow.component.html.Div) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 9 with SplitLayout

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

the class BindingSampleView method setParameter.

@Override
public void setParameter(BeforeEvent event, @OptionalParameter String parameter) {
    removeAll();
    // can be switched with URL:
    // http://localhost:8080/linkki-sample-test-playground-vaadin23/binding/readOnly
    boolean readOnly = StringUtils.equals("readOnly", parameter);
    BindingManager bindingManager = new DefaultBindingManager(ValidationService.NOP_VALIDATION_SERVICE);
    // tag::property-behavior[]
    PropertyBehaviorProvider behaviorProvider = PropertyBehaviorProvider.with(PropertyBehavior.readOnly(() -> readOnly));
    // end::property-behavior[]
    // tag::property-behavior-binding-manager
    BindingContext context = bindingManager.createContext("binding-sample", behaviorProvider);
    // end::property-behavior-binding-manager
    ContactComponent contactComponent = new ContactComponent(p -> save(p, PERSON_STORAGE), context);
    ContactsTableComponent contactsTable = new ContactsTableComponent(PERSON_STORAGE, contactComponent::editContact, context);
    // Make ContactsTableComponent call uiUpdated explicitly to switch between label or table
    bindingManager.addUiUpdateObserver(contactsTable);
    SplitLayout panel = new SplitLayout(contactComponent, contactsTable);
    panel.setOrientation(Orientation.HORIZONTAL);
    panel.setSplitterPosition(50);
    panel.setSizeFull();
    add(panel);
    setSizeFull();
}
Also used : DefaultBindingManager(org.linkki.core.binding.manager.DefaultBindingManager) BindingManager(org.linkki.core.binding.manager.BindingManager) SplitLayout(com.vaadin.flow.component.splitlayout.SplitLayout) ContactsTableComponent(org.linkki.samples.playground.binding.components.ContactsTableComponent) ContactComponent(org.linkki.samples.playground.binding.components.ContactComponent) PropertyBehaviorProvider(org.linkki.core.binding.dispatcher.behavior.PropertyBehaviorProvider) BindingContext(org.linkki.core.binding.BindingContext) DefaultBindingManager(org.linkki.core.binding.manager.DefaultBindingManager)

Example 10 with SplitLayout

use of com.vaadin.flow.component.splitlayout.SplitLayout in project SODevelopment by syampillai.

the class ObjectTree method setSplitView.

public void setSplitView() {
    if (getView(false) != null) {
        return;
    }
    layout = new SplitLayout();
    layout.setOrientation(SplitLayout.Orientation.HORIZONTAL);
    layout.setSplitterPosition(50);
    layout.addToPrimary(this);
    addItemSelectedListener((forest, item) -> itemSelected());
}
Also used : SplitLayout(com.vaadin.flow.component.splitlayout.SplitLayout)

Aggregations

SplitLayout (com.vaadin.flow.component.splitlayout.SplitLayout)13 Label (com.vaadin.flow.component.html.Label)6 NativeButton (com.vaadin.flow.component.html.NativeButton)3 Span (com.vaadin.flow.component.html.Span)3 Component (com.vaadin.flow.component.Component)2 Test (org.junit.Test)2 HasSize (com.vaadin.flow.component.HasSize)1 Div (com.vaadin.flow.component.html.Div)1 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)1 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 BindingContext (org.linkki.core.binding.BindingContext)1 PropertyBehaviorProvider (org.linkki.core.binding.dispatcher.behavior.PropertyBehaviorProvider)1 BindingManager (org.linkki.core.binding.manager.BindingManager)1 DefaultBindingManager (org.linkki.core.binding.manager.DefaultBindingManager)1 ContactComponent (org.linkki.samples.playground.binding.components.ContactComponent)1 ContactsTableComponent (org.linkki.samples.playground.binding.components.ContactsTableComponent)1