summaryrefslogtreecommitdiffstats
path: root/documentation/architecture/architecture-events.asciidoc
diff options
context:
space:
mode:
authorMarko Gronroos <magi@vaadin.com>2016-05-20 14:44:42 +0300
committerMarko Grönroos <magi@vaadin.com>2016-06-30 11:13:20 +0000
commit93767cf76b2fb14c65b758066c67fc8b48cc2eeb (patch)
tree958ddb8c45271e9a505280ef750ae07ebeda170f /documentation/architecture/architecture-events.asciidoc
parentedad7348bb8eba807225bfa72d4b0a4342426c71 (diff)
downloadvaadin-framework-93767cf76b2fb14c65b758066c67fc8b48cc2eeb.tar.gz
vaadin-framework-93767cf76b2fb14c65b758066c67fc8b48cc2eeb.zip
Scaled images for print edition and fixed errors up to the beginning of layouts chapter (#19835). Also major revision of Tree, CustomField, and layouts overview.
Change-Id: I19f5e9511b83f953ce4707f324d81c2821ebb69d
Diffstat (limited to 'documentation/architecture/architecture-events.asciidoc')
-rw-r--r--documentation/architecture/architecture-events.asciidoc19
1 files changed, 12 insertions, 7 deletions
diff --git a/documentation/architecture/architecture-events.asciidoc b/documentation/architecture/architecture-events.asciidoc
index e832c581fe..e273a28e97 100644
--- a/documentation/architecture/architecture-events.asciidoc
+++ b/documentation/architecture/architecture-events.asciidoc
@@ -37,7 +37,6 @@ corresponding listener class. For example, the [classname]#Button# has
In the following, we handle button clicks with a listener implemented as an
anonymous class:
-
[source, java]
----
final Button button = new Button("Push it!");
@@ -60,15 +59,21 @@ in this case the [classname]#Button#.
[[figure.eventlistenerdiagram]]
.Class Diagram of a Button Click Listener
-image::img/events-classdiagram-hi.png[]
+image::img/events-classdiagram-hi.png[width=50%, scaledwidth=75%]
+
+In Java 8, you can implement such functional interfaces with a lambda expression:
+
+[source, java]
+----
+Button button = new Button("Push it!");
+
+button.addClickListener(event ->
+ button.setCaption("You pushed it!"));
+----
In the ancient times of C programming, __callback functions__ filled largely the
same need as listeners do now. In object-oriented languages, we usually only
have classes and methods, not functions, so the application has to give a class
interface instead of a callback function pointer to the framework.
-<<dummy/../../../framework/application/application-events#application.events,"Handling
-Events with Listeners">> goes into details of handling events in practice.
-
-
-
+<<dummy/../../../framework/application/application-events#application.events,"Handling Events with Listeners">> goes into details of handling events in practice.