Hi guys, I am using vaadin 8 and to bind model to interface I use binder.
For example:
Binder<Clazz> binder = new Binder<>(Clazz.class);
Then I overrided the method beforeLeave (of View), and I would check in this method is the user have changed something on the interface.
For now I found a “shitty” solution, in my opinion. I have a global variable “modified” set to false, initially.
Then I added to binder the addValueChangeListener, where I set “modified” to true, as the follow:
binder.addValueChangeListener(event -> {
if (!modified) {
modified = true;
}
});
In the end I check the “modified” variable, to show a message which informs the user, that some changes have been detected…
There is a clean way, to do the same thing?
Thanks!