April 2018
Intermediate to advanced
202 pages
4h 48m
English
In a Vaadin application, the behavior is added through listeners. A listener fires an event when the corresponding action happens, usually caused by the interaction of the user with the UI. Two of the most common listeners in Vaadin are ClickListener (for buttons) and ValueChangeListener (for input components). Listeners are usually defined by implementing a functional interface, which allows you to react to an event using a method reference:
protected void init(VaadinRequest vaadinRequest) { Button button = new Button("Click this"); button.addClickListener(this::buttonClicked);}...private void buttonClicked(Button.ClickEvent event) { Notification.show("Thanks for clicking");}
You can also use a Lambda expression instead: ...
Read now
Unlock full access