diff options
author | Denis <denis@vaadin.com> | 2016-12-07 17:16:45 +0200 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2016-12-07 17:16:45 +0200 |
commit | 414de3c4b2ea5267808980bd23a9e56aa865e96b (patch) | |
tree | 8b6f3be67920a852fa3142ee2257846bedcc2811 /server | |
parent | 5778c65bdef65337f8cbcc9d0504abbd11f8278f (diff) | |
download | vaadin-framework-414de3c4b2ea5267808980bd23a9e56aa865e96b.tar.gz vaadin-framework-414de3c4b2ea5267808980bd23a9e56aa865e96b.zip |
Implement "afterViewChange()" as no-op by default. (#99)
* Implement "afterViewChange()" as no-op by default.
ViewChangeListener is functional interface now and has empty
implementation for "afterViewChange()"
Fixes vaadin/framework8-issues#502
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main/java/com/vaadin/navigator/ViewChangeListener.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/server/src/main/java/com/vaadin/navigator/ViewChangeListener.java b/server/src/main/java/com/vaadin/navigator/ViewChangeListener.java index b98fb967fc..9238f1bae9 100644 --- a/server/src/main/java/com/vaadin/navigator/ViewChangeListener.java +++ b/server/src/main/java/com/vaadin/navigator/ViewChangeListener.java @@ -21,13 +21,18 @@ import java.util.EventObject; /** * Interface for listening to View changes before and after they occur. - * + * <p> * Implementations of this interface can also block navigation between views - * before it is performed. + * before it is performed (using {@link #beforeViewChange(ViewChangeEvent)}). + * <p> + * The interface contains two methods {@link #beforeViewChange(ViewChangeEvent)} + * and {@link #afterViewChange(ViewChangeEvent)}. The latter one has default + * empty implementation. * * @author Vaadin Ltd * @since 7.0 */ +@FunctionalInterface public interface ViewChangeListener extends Serializable { /** @@ -124,10 +129,14 @@ public interface ViewChangeListener extends Serializable { * method blocked the view change, this method is not called. Be careful of * unbounded recursion if you decide to change the view again in the * listener. + * <p> + * By default it does nothing. Override it in your listener if you need this + * functionality. * * @param event * view change event */ - public void afterViewChange(ViewChangeEvent event); + public default void afterViewChange(ViewChangeEvent event) { + } } |