Change-Id: I8facb7e89af09eec3331c21e04124b5e5827a66etags/8.0.0.alpha1
@@ -99,16 +99,17 @@ is needed in the class. For example: | |||
public class MyClass { | |||
private final static Logger logger = | |||
Logger.getLogger(MyClass.class.getName()); | |||
public void myMethod() { | |||
try { | |||
// do something that might fail | |||
} catch (Exception e) { | |||
logger.log(Level.SEVERE, "FAILED CATASTROPHICALLY!", e); | |||
} | |||
} | |||
} | |||
} | |||
---- | |||
ifdef::vaadin7[] | |||
((("static"))) | |||
((("memory | |||
@@ -125,13 +126,11 @@ classloader would prevent garbage-collecting the classes after redeploying, | |||
hence leaking memory. As the size of the PermGen memory where class object are | |||
stored is fixed, the leakage will lead to a server crash after many | |||
redeployments. The issue depends on the way how the server manages classloaders, | |||
on the hardness of the back-references, and may also be different between Java 6 | |||
and 7. So, if you experience PermGen issues, or want to play it on the safe | |||
side, you should consider using non-static [classname]#Logger# instances.//As | |||
discussed in Forum thread 1175841 | |||
(24.2.2012). | |||
on the hardness of the back-references. | |||
So, if you experience PermGen issues, or want to play it on the safe | |||
side, you should consider using non-static [classname]#Logger# instances. | |||
//As discussed in Forum thread 1175841 (24.2.2012). | |||
endif::vaadin7[] | |||
(((range="endofrange", startref="term.advanced.logging"))) | |||
@@ -16,8 +16,8 @@ Using anonymous class for listeners is recommended in most cases. | |||
[[application.events.anonymous]] | |||
== Using Anonymous Classes | |||
By far the easiest and the most common way to handle events in Java 6 and 7 is | |||
to use anonymous local classes. It encapsulates the handling of events to where | |||
By far the easiest and the most common way to handle events in Java 8 lambdas. | |||
It encapsulates the handling of events to where | |||
the component is defined and does not require cumbering the managing class with | |||
interface implementations. The following example defines an anonymous class that | |||
inherits the [classname]#Button.ClickListener# interface. | |||
@@ -27,7 +27,7 @@ inherits the [classname]#Button.ClickListener# interface. | |||
---- | |||
// Have a component that fires click events | |||
final Button button = new Button("Click Me!"); | |||
// Handle the events with an anonymous class | |||
button.addClickListener(new Button.ClickListener() { | |||
public void buttonClick(ClickEvent event) { | |||
@@ -92,11 +92,11 @@ Directing events to handler methods is easy with method references: | |||
---- | |||
public class Java8Buttons extends CustomComponent { | |||
public Java8Buttons() { | |||
setCompositionRoot(new HorizontalLayout( | |||
setCompositionRoot(new HorizontalLayout( | |||
new Button("OK", this::ok), | |||
new Button("Cancel", this::cancel))); | |||
} | |||
public void ok(ClickEvent event) { | |||
event.getButton().setCaption ("OK!"); | |||
} | |||
@@ -126,15 +126,15 @@ public class MyComposite extends CustomComponent | |||
public MyComposite() { | |||
Layout layout = new HorizontalLayout(); | |||
// Just a single component in this composition | |||
button = new Button("Do not push this"); | |||
button.addClickListener(this); | |||
layout.addComponent(button); | |||
setCompositionRoot(layout); | |||
} | |||
// The listener method implementation | |||
public void buttonClick(ClickEvent event) { | |||
button.setCaption("Do not push this again"); | |||
@@ -166,12 +166,12 @@ public class TheButtons extends CustomComponent | |||
toobutton = new Button("A Button Too", this); | |||
// Put them in some layout | |||
Layout root = new HorizontalLayout(); | |||
Layout root = new HorizontalLayout(); | |||
root.addComponent(onebutton); | |||
root.addComponent(toobutton); | |||
setCompositionRoot(root); | |||
} | |||
@Override | |||
public void buttonClick(ClickEvent event) { | |||
// Differentiate targets by event source | |||
@@ -189,7 +189,3 @@ object properties, names, or captions to separate between them. Using captions | |||
or any other visible text is generally discouraged, as it may create problems | |||
for internationalization. Using other symbolic strings can also be dangerous, | |||
because the syntax of such strings is checked only at runtime. | |||
@@ -32,7 +32,7 @@ instructed in <<dummy/../../../framework/getting-started/getting-started-package | |||
. Enter a [guilabel]#Project name# and [guilabel]#Project location#, and select | |||
the [guilabel]#Java SDK# to be used for the project. | |||
Vaadin requires at least Java 6. | |||
Vaadin requires at least Java 8. | |||
If you have not configured a Java SDK previously, you can configure it here. | |||
+ | |||
image::img/idea-newproject-1.png[scaledwidth=100%] | |||
@@ -90,7 +90,7 @@ server using a run/debug configuration. | |||
//<?dbfo-need height="8cm" ?> | |||
. Enter a project name, location, and the Java SDK to be used for the project. | |||
Vaadin requires at least Java 6. | |||
Vaadin requires at least Java 8. | |||
+ | |||
image::img/idea-maven-newproject-1.png[scaledwidth=100%] | |||
+ |
@@ -13,7 +13,7 @@ Vaadin supports a wide variety of tools, so you can use any IDE for writing the | |||
In this example, we use the following toolchain: | |||
* Windows, Linux, or Mac OS X | |||
* link:http://www.oracle.com/technetwork/java/javase/downloads/index.html[Oracle Java SE 8] (Java 6 or newer is required) | |||
* link:http://www.oracle.com/technetwork/java/javase/downloads/index.html[Oracle Java SE 8] | |||
* link:http://www.eclipse.org/downloads/[Eclipse IDE for Java EE Developers] | |||
* link:http://tomcat.apache.org/[Apache Tomcat 8.0 (Core)] | |||
* link:http://www.getfirefox.com/[Mozilla Firefox] browser |