The document discusses improving editing of customer records in Vaadin 7 applications. It outlines issues with directly using setters and listeners on each field, such as lots of code, implicit saving, and difficulty validating values. It recommends using a FieldGroup to bind fields to properties, which avoids explicit setters, allows committing or discarding changes, and integrates validation into the commit process. However, it notes there may still be room for improvement over the Vaadin 7 approach.
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
Vaadin DevDay 2017 - Data Binding in Vaadin 8
1. B I N D I N G D ATA T O U I C O M P O N E N T S
5
S T O R Y A N D P H I L O S O P H Y
Software is eating the world and what most of us see of it is the user interface. The user
interface has become the key component of how the users experience the business
behind it. Competition is lost or won due to user experience. Simplicity is king and the
users get frustrated by anything ugly, slow or not working on the device they happen to
use at the time. We at Vaadin fight for simplicity and invite everyone to join this fight.
Together we want to build a user interface that puts a smile on the user’s face.
Vaadin is the technology that empowers developers to build the best web-apps for
business purposes. Our priority over everything else is developer productivity because
we believe that by simplifying the developer experience and saving the developer’s
time, they are best able to focus on building great user interfaces.
Our brand is what we want everyone to think about us. When everyone - both us and
the people around us - have a consistent understanding of what Vaadin is and what we
stand for, it enables that image to spread and amplify. This book defines what we want
that image to be. It defines what the Vaadin brand is.
I hope that You are as excited and proud of living and breathing the Vaadin brand as
I am. You are the one who is shaping what everyone thinks about Vaadin - using this
brand as a tool and a guideline every day.
Let’s fight for simplicity for both the users and the developers!
Joonas Lehtinen
Founder & CEO
Vaadin
I N T R O D U C T I O N
@peter_lehto
5. Session’s content
• Average day with Vaadin 7
• Binder, Java 8 and Functions
• Binding custom data types with CustomField<T>
6. Session’s content
• Average day with Vaadin 7
• Binder, Java 8 and Functions
• Binding custom data types with CustomField<T>
• Where are my Items & Properties?
7. Session’s content
• Average day with Vaadin 7
• Binder, Java 8 and Functions
• Binding custom data types with CustomField<T>
• Where are my Items & Properties?
• How to be as Lazy as possible?
8. Session’s content
• Average day with Vaadin 7
• Binder, Java 8 and Functions
• Binding custom data types with CustomField<T>
• Where are my Items & Properties?
• How to be as Lazy as possible?
9. H o w w o u l d y o u e d i t
c u s t o m e r r e c o r d s ?
VAADIN 7
10. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
Setters and Getters
VAADIN 7
11. Setters and Getters
VAADIN 7
protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
12. Setters and Getters
VAADIN 7
protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
firstName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setFirstName(firstName.getValue());
}
});
13. Setters and Getters
VAADIN 7
protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
firstName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setFirstName(firstName.getValue());
}
});
lastName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setLastName(lastName.getValue());
}
});
14. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
firstName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setFirstName(firstName.getValue());
}
});
lastName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setLastName(lastName.getValue());
}
});
WHAT’S WRONG?
15. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
firstName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setFirstName(firstName.getValue());
}
});
lastName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setLastName(lastName.getValue());
}
});
• Setters used explicitly
WHAT’S WRONG?
16. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
firstName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setFirstName(firstName.getValue());
}
});
lastName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setLastName(lastName.getValue());
}
});
• Setters used explicitly
• Every Field has a Listener
WHAT’S WRONG?
17. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
firstName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setFirstName(firstName.getValue());
}
});
lastName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setLastName(lastName.getValue());
}
});
• Setters used explicitly
• Every Field has a Listener
• Implicit save, cannot discard
WHAT’S WRONG?
18. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
firstName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setFirstName(firstName.getValue());
}
});
lastName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setLastName(lastName.getValue());
}
});
• Setters used explicitly
• Every Field has a Listener
• Implicit save, cannot discard
• Lots of code
WHAT’S WRONG?
19. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
firstName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setFirstName(firstName.getValue());
}
});
lastName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setLastName(lastName.getValue());
}
});
• Setters used explicitly
• Every Field has a Listener
• Implicit save, cannot discard
• Lots of code
• Prone to error and change
WHAT’S WRONG?
20. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
firstName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setFirstName(firstName.getValue());
}
});
lastName.addValueChangeListener(
new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
customer.setLastName(lastName.getValue());
}
});
• Setters used explicitly
• Every Field has a Listener
• Implicit save, cannot discard
• Lots of code
• Prone to error and change
• Invalid values not prevented
WHAT’S WRONG?
21. LET’S IMPROVE!
protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
22. LET’S IMPROVE!
protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
customer.setFirstName(firstName.getValue());
customer.setLastName(lastName.getValue());
}
});
}
23. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
customer.setFirstName(firstName.getValue());
customer.setLastName(lastName.getValue());
}
});
}
BENEFITS?
24. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
customer.setFirstName(firstName.getValue());
customer.setLastName(lastName.getValue());
}
});
}
BENEFITS?
• Centralized value setting
25. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
customer.setFirstName(firstName.getValue());
customer.setLastName(lastName.getValue());
}
});
}
BENEFITS?
• Centralized value setting
• Validation could be added
26. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
customer.setFirstName(firstName.getValue());
customer.setLastName(lastName.getValue());
}
});
}
WHAT’S WRONG?
27. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
customer.setFirstName(firstName.getValue());
customer.setLastName(lastName.getValue());
}
});
}
• Setters used explicitly
WHAT’S WRONG?
28. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
customer.setFirstName(firstName.getValue());
customer.setLastName(lastName.getValue());
}
});
}
• Setters used explicitly
• Lots of code
WHAT’S WRONG?
29. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
customer.setFirstName(firstName.getValue());
customer.setLastName(lastName.getValue());
}
});
}
• Setters used explicitly
• Lots of code
• Prone to error and change
WHAT’S WRONG?
30. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
customer.setFirstName(firstName.getValue());
customer.setLastName(lastName.getValue());
}
});
}
• Setters used explicitly
• Lots of code
• Prone to error and change
• Hard to Validate
WHAT’S WRONG?
31. With properties
VAADIN 7
protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
32. With properties
VAADIN 7
protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
FieldGroup fieldGroup = new FieldGroup();
fieldGroup.bind(firstName, "firstName");
fieldGroup.bind(lastName, "lastName");
fieldGroup.setItemDataSource(
new BeanItem<CustomerDTO>(customer));
33. With properties
VAADIN 7
fieldGroup.setItemDataSource(
new BeanItem<CustomerDTO>(customer));
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
}
catch(CommitException e) {
// show errors
}
}
});
34. BENEFITS?
protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
FieldGroup fieldGroup = new FieldGroup();
fieldGroup.bind(firstName, "firstName");
fieldGroup.bind(lastName, "lastName");
fieldGroup.setItemDataSource(new
BeanItem<CustomerDTO>(customer));
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
}
catch(CommitException e) {
// show errors
}
}
});
35. • No more explicit setters
BENEFITS?
protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
FieldGroup fieldGroup = new FieldGroup();
fieldGroup.bind(firstName, "firstName");
fieldGroup.bind(lastName, "lastName");
fieldGroup.setItemDataSource(new
BeanItem<CustomerDTO>(customer));
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
}
catch(CommitException e) {
// show errors
}
}
});
36. • No more explicit setters
• Committable / Discardable
BENEFITS?
protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
FieldGroup fieldGroup = new FieldGroup();
fieldGroup.bind(firstName, "firstName");
fieldGroup.bind(lastName, "lastName");
fieldGroup.setItemDataSource(new
BeanItem<CustomerDTO>(customer));
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
}
catch(CommitException e) {
// show errors
}
}
});
37. • No more explicit setters
• Committable / Discardable
• Validation part of Commit
BENEFITS?
protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
FieldGroup fieldGroup = new FieldGroup();
fieldGroup.bind(firstName, "firstName");
fieldGroup.bind(lastName, "lastName");
fieldGroup.setItemDataSource(new
BeanItem<CustomerDTO>(customer));
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
}
catch(CommitException e) {
// show errors
}
}
});
38. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
FieldGroup fieldGroup = new FieldGroup();
fieldGroup.bind(firstName, "firstName");
fieldGroup.bind(lastName, "lastName");
fieldGroup.setItemDataSource(new
BeanItem<CustomerDTO>(customer));
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
}
catch(CommitException e) {
// show errors
}
}
});
WHAT’S WRONG?
39. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
FieldGroup fieldGroup = new FieldGroup();
fieldGroup.bind(firstName, "firstName");
fieldGroup.bind(lastName, "lastName");
fieldGroup.setItemDataSource(new
BeanItem<CustomerDTO>(customer));
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
}
catch(CommitException e) {
// show errors
}
}
});
• Not type safe
WHAT’S WRONG?
40. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
FieldGroup fieldGroup = new FieldGroup();
fieldGroup.bind(firstName, "firstName");
fieldGroup.bind(lastName, "lastName");
fieldGroup.setItemDataSource(new
BeanItem<CustomerDTO>(customer));
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
}
catch(CommitException e) {
// show errors
}
}
});
• Not type safe
• Prone to error and change
WHAT’S WRONG?
41. protected void init(VaadinRequest vaadinRequest) {
VerticalLayout layout = new VerticalLayout();
TextField firstName = new TextField("Firstname");
TextField lastName = new TextField("Lastname");
CustomerDTO customer = new CustomerDTO();
FieldGroup fieldGroup = new FieldGroup();
fieldGroup.bind(firstName, "firstName");
fieldGroup.bind(lastName, "lastName");
fieldGroup.setItemDataSource(new
BeanItem<CustomerDTO>(customer));
Button save = new Button("Save",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
}
catch(CommitException e) {
// show errors
}
}
});
• Not type safe
• Prone to error and change
• BeanItem boiler plate and
checked CommitException
WHAT’S WRONG?
45. Session’s content
• Average day with Vaadin 7
• Binder, Java 8 and Functions
• Binding custom data types with CustomField<T>
• Where are my Items & Properties?
• How to be as Lazy as possible?
46. c . v. u i . A b s t r a c t F i e l d < T >
VAADIN 7
1 8 5 3 l o c 2 2 8 l o c
VAADIN 8
74. TextField yearOfBirth = …
Customer customer = …
customer.setYearOfBirth(1984);
Binder<CustomerDTO> binder = new Binder<>();
binder.forField(yearOfBirth)
.withValidator(value -> value.length() == 4,
"Must have 4 characters")
.withConverter(Integer::valueOf, String::valueOf)
.withValidator(value -> value > 2000,
"Must be after year 2000")
Validation with
Conversion
VAADIN 8
75. TextField yearOfBirth = …
Customer customer = …
customer.setYearOfBirth(1984);
Binder<CustomerDTO> binder = new Binder<>();
binder.forField(yearOfBirth)
.withValidator(value -> value.length() == 4,
"Must have 4 characters")
.withConverter(Integer::valueOf, String::valueOf)
.withValidator(value -> value > 2000,
"Must be after year 2000")
.bind(CustomerDTO::getYearOfBirth,
CustomerDTO::setYearOfBirth);
Validation with
Conversion
VAADIN 8
76. TextField yearOfBirth = …
Customer customer = …
customer.setYearOfBirth(1984);
Binder<CustomerDTO> binder = new Binder<>();
binder.forField(yearOfBirth)
.withValidator(value -> value.length() == 4,
"Must have 4 characters")
.withConverter(Integer::valueOf, String::valueOf)
.withValidator(value -> value > 2000,
"Must be after year 2000")
.bind(CustomerDTO::getYearOfBirth,
CustomerDTO::setYearOfBirth);
Button save = new Button("Save", e -> {
try {
binder.writeBean(customer);
} catch (ValidationException ve) {
ve.getFieldValidationErrors().forEach(error -> …);
}
});
Validation with
Conversion
VAADIN 8
77. Session’s content
• Average day with Vaadin 7
• Binder, Java 8 and Functions
• Binding custom data types with CustomField<T>
• Where are my Items & Properties?
• How to be as Lazy as possible?
85. Session’s content
• Average day with Vaadin 7
• Binder, Java 8 and Functions
• Binding custom data types with CustomField<T>
• Where are my Items & Properties?
• How to be as Lazy as possible?
103. H o w w o u l d y o u f i l t e r
e n t r i e s i n a d r o p d o w n ?
VAADIN 8
104. D a t a P r o v i d e r < T Y P E , F I LT E R >
105. Session’s content
• Average day with Vaadin 7
• Binder, Java 8 and Functions
• Binding custom data types with CustomField<T>
• Where are my Items & Properties?
• How to be as Lazy as possible?
106. D a t a P r o v i d e r < C o u n t r y, S t r i n g >
115. public class Query<TYPE, FILTER> {
int getOffset();
int getLimit();
List<QuerySortOrder> getSortOrders();
}
116. public class Query<TYPE, FILTER> {
int getOffset();
int getLimit();
List<QuerySortOrder> getSortOrders();
Comparator<TYPE> getInMemorySorting();
}
117. public class Query<TYPE, FILTER> {
int getOffset();
int getLimit();
List<QuerySortOrder> getSortOrders();
Comparator<TYPE> getInMemorySorting();
Optional<FILTER> getFilter();
}
118. T h e c l a s s i c C o n t a i n e r d i s c r e p a n c y
VAADIN 7
119. Grid grid = new Grid();
grid.addColumn("firstName");
grid.addColumn("lastName");
grid.addColumn("yearsOld");
grid.setContainerDataSource(
new BeanItemContainer<>(CustomerDTO.class));
120. HTTP Status 500 - com.vaadin.server.ServiceException:
java.lang.IllegalStateException:
Found at least one column in Grid that does not exist
in the given container: yearsOld with the header “Years
Old”.
Call removeAllColumns() before setContainerDataSource()
if you want to reconfigure the columns based on the new
container.
122. Grid grid = new Grid();
grid.addColumn("firstName");
grid.addColumn("lastName");
grid.addColumn("yearsOld");
123. Grid grid = new Grid();
grid.addColumn("firstName");
grid.addColumn("lastName");
grid.addColumn("yearsOld");
GeneratedPropertyContainer generatedProps =
new GeneratedPropertyContainer(
new BeanItemContainer<>(CustomerDTO.class));
generatedProps.addContainerProperty("yearsOld", Integer.class, null);
grid.setContainerDataSource(generatedProps);
124. HTTP Status 500 - com.vaadin.server.ServiceException: java.lang.UnsupportedOperationException:
GeneratedPropertyContainer does not support adding properties.
137. Lessons learned
• Vaadin 8 - built on Java 8
• Lambdas and Functional paradigm at large
• Data binding completely redone
138. Lessons learned
• Vaadin 8 - built on Java 8
• Lambdas and Functional paradigm at large
• Data binding completely redone
• Targets simplifications and flexibility, #FFS
139. Lessons learned
• Vaadin 8 - built on Java 8
• Lambdas and Functional paradigm at large
• Data binding completely redone
• Targets simplifications and flexibility, #FFS
• Drops Containers, Items and Properties
140. Lessons learned
• Vaadin 8 - built on Java 8
• Lambdas and Functional paradigm at large
• Data binding completely redone
• Targets simplifications and flexibility, #FFS
• Drops Containers, Items and Properties
• Gathers all data binding to Binder, simplifies Fields