From f5571e30284a9124df383650c9dc13e5494ad3fd Mon Sep 17 00:00:00 2001 From: Artur Date: Thu, 22 Jun 2017 14:34:38 +0300 Subject: Make it optional to implement enter() in Views --- server/src/main/java/com/vaadin/navigator/View.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'server/src') diff --git a/server/src/main/java/com/vaadin/navigator/View.java b/server/src/main/java/com/vaadin/navigator/View.java index 6e87c6e455..aa93d7b7ab 100644 --- a/server/src/main/java/com/vaadin/navigator/View.java +++ b/server/src/main/java/com/vaadin/navigator/View.java @@ -36,16 +36,19 @@ public interface View extends Serializable { /** * Called before the view is shown on screen. *

- * {@link ViewChangeEvent#getParameters() event.getParameters()} may contain - * extra parameters relevant to the view. + * The event object contains information about parameters used when showing + * the view, in addition to references to the old view and the new view. + *

+ * Override this method to perform initialization of your view. + *

+ * By default does nothing. * * @param event - * ViewChangeEvent representing the view change that is - * occurring. {@link ViewChangeEvent#getNewView() - * event.getNewView()} returns this. - * + * an event object containing information about the parameters + * given by the user and references to the old view (if any) */ - public void enter(ViewChangeEvent event); + public default void enter(ViewChangeEvent event) { + } /** * Called when the user is requesting navigation away from the view. @@ -66,6 +69,7 @@ public interface View extends Serializable { * will be triggered. They will be handled normally and might also prevent * navigation. * + * @since 8.1 * @param event * an event object providing information about the event and * containing the {@link ViewBeforeLeaveEvent#navigate()} method -- cgit v1.2.3