Java Code Examples for com.vaadin.flow.component.orderedlayout.HorizontalLayout#setSpacing()

The following examples show how to use com.vaadin.flow.component.orderedlayout.HorizontalLayout#setSpacing() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GridTest.java    From vaadin-app-layout with Apache License 2.0 6 votes vote down vote up
public GridTest() {
    Random random = new Random();
    for (int i = 0; i < 300; i++) {
        people.add(new Person(UUID.randomUUID().toString(), random.nextInt(), i));
    }

    Grid<Person> grid = getGrid();
    grid.setSelectionMode(Grid.SelectionMode.MULTI);
    grid.setSizeFull();

    HorizontalLayout gridWrapper = new HorizontalLayout(grid);
    gridWrapper.setMargin(false);
    gridWrapper.setPadding(false);
    gridWrapper.setSpacing(false);
    gridWrapper.setFlexGrow(1, grid);
    gridWrapper.setSizeFull();


    add(gridWrapper);
    setMargin(false);
    setPadding(false);
    setSpacing(false);
    setAlignItems(Alignment.STRETCH);
    setFlexGrow(1, gridWrapper);
    setSizeFull();
}
 
Example 2
Source File: GridTest.java    From vaadin-app-layout with Apache License 2.0 6 votes vote down vote up
public GridTest() {
    Random random = new Random();
    for (int i = 0; i < 300; i++) {
        people.add(new Person(UUID.randomUUID().toString(), random.nextInt(), i));
    }

    Grid<Person> grid = getGrid();
    grid.setSelectionMode(Grid.SelectionMode.MULTI);
    grid.setSizeFull();

    HorizontalLayout gridWrapper = new HorizontalLayout(grid);
    gridWrapper.setMargin(false);
    gridWrapper.setPadding(false);
    gridWrapper.setSpacing(false);
    gridWrapper.setFlexGrow(1, grid);
    gridWrapper.setSizeFull();


    add(gridWrapper);
    setMargin(false);
    setPadding(false);
    setSpacing(false);
    setAlignItems(Alignment.STRETCH);
    setFlexGrow(1, gridWrapper);
    setSizeFull();
}
 
Example 3
Source File: GridTest.java    From vaadin-app-layout with Apache License 2.0 6 votes vote down vote up
public GridTest() {
    Random random = new Random();
    for (int i = 0; i < 300; i++) {
        people.add(new Person(UUID.randomUUID().toString(), random.nextInt(), i));
    }

    Grid<Person> grid = getGrid();
    grid.setSelectionMode(Grid.SelectionMode.MULTI);
    grid.setSizeFull();

    HorizontalLayout gridWrapper = new HorizontalLayout(grid);
    gridWrapper.setMargin(false);
    gridWrapper.setPadding(false);
    gridWrapper.setSpacing(false);
    gridWrapper.setFlexGrow(1, grid);
    gridWrapper.setSizeFull();


    add(gridWrapper);
    setMargin(false);
    setPadding(false);
    setSpacing(false);
    setAlignItems(Alignment.STRETCH);
    setFlexGrow(1, gridWrapper);
    setSizeFull();
}
 
Example 4
Source File: GridTest.java    From vaadin-app-layout with Apache License 2.0 6 votes vote down vote up
public GridTest() {
    Random random = new Random();
    for (int i = 0; i < 300; i++) {
        people.add(new Person(UUID.randomUUID().toString(), random.nextInt(), i));
    }

    Grid<Person> grid = getGrid();
    grid.setSelectionMode(Grid.SelectionMode.MULTI);
    grid.setSizeFull();

    HorizontalLayout gridWrapper = new HorizontalLayout(grid);
    gridWrapper.setMargin(false);
    gridWrapper.setPadding(false);
    gridWrapper.setSpacing(false);
    gridWrapper.setFlexGrow(1, grid);
    gridWrapper.setSizeFull();


    add(gridWrapper);
    setMargin(false);
    setPadding(false);
    setSpacing(false);
    setAlignItems(Alignment.STRETCH);
    setFlexGrow(1, gridWrapper);
    setSizeFull();
}
 
Example 5
Source File: AbstractAutoGeneratedCrudFormFactory.java    From crudui with Apache License 2.0 6 votes vote down vote up
protected Component buildFooter(CrudOperation operation, T domainObject, ComponentEventListener<ClickEvent<Button>> cancelButtonClickListener, ComponentEventListener<ClickEvent<Button>> operationButtonClickListener) {
    Button operationButton = buildOperationButton(operation, domainObject, operationButtonClickListener);
    Button cancelButton = buildCancelButton(cancelButtonClickListener);

    HorizontalLayout footerLayout = new HorizontalLayout();
    footerLayout.setSizeUndefined();
    footerLayout.setSpacing(true);
    footerLayout.setPadding(false);

    if (cancelButton != null) {
        footerLayout.add(cancelButton);
    }

    if (operationButton != null) {
        footerLayout.add(operationButton);
    }

    return footerLayout;
}
 
Example 6
Source File: GridTest.java    From vaadin-app-layout with Apache License 2.0 5 votes vote down vote up
public GridTest() {
    Random random = new Random();
    for (int i = 0; i < 300; i++) {
        people.add(new Person(UUID.randomUUID().toString(), random.nextInt(), i));
    }

    Grid<Person> grid = getGrid();
    grid.setSelectionMode(Grid.SelectionMode.MULTI);
    grid.setSizeFull();

    HorizontalLayout gridWrapper = new HorizontalLayout(grid);
    gridWrapper.setMargin(false);
    gridWrapper.setPadding(false);
    gridWrapper.setSpacing(false);
    gridWrapper.setFlexGrow(1, grid);
    gridWrapper.setSizeFull();


    add(gridWrapper);
    setMargin(false);
    setPadding(false);
    setSpacing(false);
    setAlignItems(Alignment.STRETCH);
    setFlexGrow(1, gridWrapper);
    setSizeFull();

}
 
Example 7
Source File: NotificationView.java    From vaadin-app-layout with Apache License 2.0 4 votes vote down vote up
public NotificationView(T info, NotificationHolder<T> holder, NotificationListener listener, boolean isNotification) {
    this.info = info;
    this.holder = holder;
    this.isNotification = isNotification;
    setWidth("100%");
    setAlignItems(Alignment.CENTER);
    Label title = new Label(info.getTitle());
    title.getElement().getStyle()
            .set("font-size", "15px")
            .set("font-weight", "500");

    Label dot = new Label("ยท");
    dot.getElement().getStyle()
            .set("margin-left", "5px");

    Label timeAgo = new Label(holder.getDateTimeFormatter().apply(info));
    timeAgo.getElement().getStyle()
            .set("font-size", "13px")
            .set("margin-left", "5px")
            .set("font-weight", "300");

    Label description = new Label(info.getDescription());
    description.setWidth("100%");
    description.getElement().getStyle()
            .set("font-size", "15px")
            .set("font-weight", "400")
            .set("white-space", "nowrap")
            .set("text-overflow", "ellipsis")
            .set("overflow", "hidden");

    HorizontalLayout descriptionWrapper = new HorizontalLayout(description);

    descriptionWrapper.setWidth("100%");
    if (info.getImage() != null) {
        RoundImage image = new RoundImage(info.getImage());
        descriptionWrapper.add(image);
    }
    if (!isNotification) {
        setHighlightBorder(!info.isRead());
    }
    HorizontalLayout headerLine = new HorizontalLayout(title, dot, timeAgo);
    headerLine.setSpacing(false);
    headerLine.setAlignItems(FlexComponent.Alignment.CENTER);
    wrapper = new VerticalLayout(headerLine, descriptionWrapper);
    wrapper.setMargin(false);
    wrapper.setPadding(false);
    wrapper.setSpacing(false);
    wrapper.getElement().setAttribute("theme", "spacing-s");
    wrapper.getStyle().set("overflow", "hidden");
    add(wrapper);

    setNotificationListener(listener);
    if (!isNotification) {
        if (info.isDismissable()) {
            dismissButton = new IconButton(VaadinIcon.CLOSE_SMALL.create(), paperIconButtonClickEvent -> {
                if (listener != null) {
                    listener.onDismiss();
                }
            });
            dismissButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
            dismissButton.setSizeUndefined();
            add(dismissButton);
            getElement().getStyle().set("padding-right", "0");
        }
    }
}