From 69f703100ed57720672467e6e53319781cb8ebc9 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Tue, 19 Jul 2016 14:57:05 +0300 Subject: BoV: Components/Button,CheckBox: Listener API updates Change-Id: I266bf780d24e411b17d449ff5f9ce880fad53d36 --- .../components/components-button.asciidoc | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'documentation/components/components-button.asciidoc') diff --git a/documentation/components/components-button.asciidoc b/documentation/components/components-button.asciidoc index 9105aa5e9b..fdd6cf594f 100644 --- a/documentation/components/components-button.asciidoc +++ b/documentation/components/components-button.asciidoc @@ -15,8 +15,8 @@ endif::web[] The [classname]#Button# component is normally used for initiating some action, such as finalizing input in forms. When the user clicks a button, a -[classname]#Button.ClickEvent# is fired, which can be handled with a -[interfacename]#Button.ClickListener# in the [methodname]#buttonClick()# method. +[classname]#Button.ClickEvent# is fired, which can be handled by adding a __click listener__ +using either the [methodname]#onClick()# or the [methodname]#addClickListener()# method. You can handle button clicks with an anonymous class as follows: @@ -25,14 +25,7 @@ You can handle button clicks with an anonymous class as follows: ---- Button button = new Button("Do not press this button"); -button.addClickListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - Notification.show("Do not press this button again"); - } -}); - -// Java 8 -button.addClickListener(click -> +button.addClickListener(clickEvent -> Notification.show("Do not press this button again")); ---- See the http://demo.vaadin.com/book-examples-vaadin7/book#component.button.basic[on-line example, window="_blank"]. @@ -45,11 +38,10 @@ The button component can be styled in many ways, as illustrated in <>. == CSS Style Rules -- cgit v1.2.3