alejandro-du / crudui

Automatically generate CRUD-like Vaadin views for any Java Bean
https://vaadin.com/directory#!addon/crud-ui-add-on
Apache License 2.0
86 stars 54 forks source link

Margin of Filter Layout causes misalignment #36

Closed Juchar closed 5 years ago

Juchar commented 5 years ago

Using the VerticalCrudLayout in combination with a filter causes a misalignment:

image

This seems to be caused by a margin around the HorizontalLayout wrapping the filter components: image

alejandro-du commented 5 years ago

I'm not able to reproduce. My guess is that you are adding a that HorizontalLayout with padding or margin enabled.

Juchar commented 5 years ago

@alejandro-du This is the code I am using (no wrapping layout, Vaadin 11.0.0):

DefaultCrudFormFactory<User> crudFormFactory = new DefaultCrudFormFactory<>(User.class);
crudFormFactory.setUseBeanValidation(true);
crudFormFactory.setDisabledProperties("id");
crudFormFactory.setVisibleProperties("firstName", "lastName", "birthDate", "email", "phone");

TextField lastNameFilter = new TextField();
lastNameFilter.setValueChangeMode(ValueChangeMode.EAGER);
lastNameFilter.setPlaceholder("Search by lastname");

CrudLayout crudLayout = new VerticalCrudLayout();
crudLayout.addFilterComponent(lastNameFilter);

GridCrud<User> crud = new GridCrud<>(User.class, crudLayout, crudFormFactory);

And this is part of the constructor code from AbstractTwoComponentsCrudLayout:

this.filterLayout.setSpacing(true);
this.filterLayout.setMargin(true);
this.firstComponentHeaderLayout.add(new Component[]{this.filterLayout});

I assume it might be related.