use of com.vaadin.flow.data.bean.Person in project flow-components by vaadin.
the class GridViewStylingPage method createStyling.
private void createStyling() {
String instructions = "<p>In order to inject styles into Grid cells, " + "create a style-module like in the snippet below, " + "put it into an html-file in your resources folder, " + "and import it with <code>@HtmlImport</code>. " + "After this you can apply the CSS classes " + "(<code>subscriber</code> and <code>minor</code> in this case) " + "into grid rows and cells as shown in the next example.</p>";
addCard("Styling", "Styling Grid Cells", new Html(instructions));
Grid<Person> grid = new Grid<>();
grid.setItems(getItems());
grid.setSelectionMode(SelectionMode.NONE);
grid.addColumn(Person::getFirstName).setHeader("Name");
Column<Person> ageColumn = grid.addColumn(Person::getAge).setHeader("Age");
grid.addColumn(person -> person.isSubscriber() ? "Yes" : "").setHeader("Subscriber");
grid.setClassNameGenerator(person -> person.isSubscriber() ? "subscriber" : "");
ageColumn.setClassNameGenerator(person -> person.getAge() < 18 ? "minor" : "");
grid.setId("class-name-generator");
addCard("Styling", "Generating CSS Class Names for Cells", grid);
}
use of com.vaadin.flow.data.bean.Person in project flow-components by vaadin.
the class HiddenColumnPage method createPerson.
private Person createPerson(String name, String email) {
Person person = new Person();
person.setFirstName(name);
person.setEmail(email);
return person;
}
use of com.vaadin.flow.data.bean.Person in project flow-components by vaadin.
the class GridEditorRefreshPage method createAnotherPerson.
private Person createAnotherPerson() {
Person person = new Person();
person.setFirstName("bar");
person.setEmail("baz@gmail.com");
return person;
}
Aggregations