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