From f85c152a48686a8a0dca38ca12b4f3509cac056f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Fri, 31 Aug 2012 12:14:52 +0300 Subject: [PATCH] Remove @EagerInit (#9445) --- server/src/com/vaadin/Application.java | 7 ---- .../src/com/vaadin/annotations/EagerInit.java | 42 ------------------- .../com/vaadin/server/BootstrapHandler.java | 7 ---- .../src/com/vaadin/server/WrappedRequest.java | 4 +- server/src/com/vaadin/ui/UI.java | 14 +------ .../tests/components/ui/LazyInitUIs.java | 3 +- 6 files changed, 4 insertions(+), 73 deletions(-) delete mode 100644 server/src/com/vaadin/annotations/EagerInit.java diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java index b1a9ae1d26..cd34fb7540 100644 --- a/server/src/com/vaadin/Application.java +++ b/server/src/com/vaadin/Application.java @@ -40,7 +40,6 @@ import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; -import com.vaadin.annotations.EagerInit; import com.vaadin.annotations.PreserveOnRefresh; import com.vaadin.annotations.Theme; import com.vaadin.annotations.Title; @@ -2287,10 +2286,4 @@ public class Application implements Terminal.ErrorListener, Serializable { return titleAnnotation.value(); } } - - public boolean isEagerInit(WrappedRequest request, - Class uiClass) { - EagerInit eagerInit = getAnnotationFor(uiClass, EagerInit.class); - return eagerInit != null; - } } diff --git a/server/src/com/vaadin/annotations/EagerInit.java b/server/src/com/vaadin/annotations/EagerInit.java deleted file mode 100644 index f08d46b551..0000000000 --- a/server/src/com/vaadin/annotations/EagerInit.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2011 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import com.vaadin.server.WrappedRequest; -import com.vaadin.ui.UI; - -/** - * Indicates that the init method in a UI class can be called before full - * browser details ({@link WrappedRequest#getBrowserDetails()}) are available. - * This will make the UI appear more quickly, as ensuring the availability of - * this information typically requires an additional round trip to the client. - * - * @see UI#init(com.vaadin.server.WrappedRequest) - * @see WrappedRequest#getBrowserDetails() - * - * @since 7.0 - * - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface EagerInit { - // No values -} diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java index 2b31d5d3bc..60ac40916c 100644 --- a/server/src/com/vaadin/server/BootstrapHandler.java +++ b/server/src/com/vaadin/server/BootstrapHandler.java @@ -406,13 +406,6 @@ public abstract class BootstrapHandler implements RequestHandler { appConfig.put("widgetset", context.getWidgetsetName()); - if (application.isEagerInit(context.getRequest(), context.getUIClass())) { - throw new RuntimeException( - "Eager UI init is currently not supported"); - // write the initial UIDL into the config - // appConfig.put("uidl", - // getInitialUIDL(context.getRequest(), context.getUI())); - } appConfig.put("initialPath", context.getRequest().getRequestPathInfo()); Map parameterMap = context.getRequest() diff --git a/server/src/com/vaadin/server/WrappedRequest.java b/server/src/com/vaadin/server/WrappedRequest.java index e95b2d599b..0714f73cad 100644 --- a/server/src/com/vaadin/server/WrappedRequest.java +++ b/server/src/com/vaadin/server/WrappedRequest.java @@ -26,7 +26,6 @@ import javax.portlet.PortletRequest; import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletRequest; -import com.vaadin.annotations.EagerInit; import com.vaadin.ui.UI; /** @@ -216,8 +215,7 @@ public interface WrappedRequest extends Serializable { * for instance using javascript in the browser. * * This information is only guaranteed to be available in some special - * cases, for instance in {@link UI#init(WrappedRequest)} for a UI class not - * annotated with {@link EagerInit} + * cases, for instance in {@link UI#init(WrappedRequest)}. * * @return the browser details, or null if details are not * available diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index b6ac271942..d1ccaacde3 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -28,7 +28,6 @@ import java.util.LinkedHashSet; import java.util.Map; import com.vaadin.Application; -import com.vaadin.annotations.EagerInit; import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; import com.vaadin.event.ActionManager; @@ -77,12 +76,6 @@ import com.vaadin.tools.ReflectTools; * passing a {@link ComponentContainer} with the main layout of the view to * {@link #setContent(ComponentContainer)}. *

- *

- * If a {@link EagerInit} annotation is present on a class extending - * UI, the framework will use a faster initialization method which - * will not ensure that {@link BrowserDetails} are present in the - * {@link WrappedRequest} passed to the init method. - *

* * @see #init(WrappedRequest) * @see Application#createUI(WrappedRequest) @@ -961,11 +954,8 @@ public abstract class UI extends AbstractComponentContainer implements * state of the UI is not properly set up when the constructor is invoked. *

* The {@link WrappedRequest} can be used to get information about the - * request that caused this UI to be created. By default, the - * {@link BrowserDetails} will be available in the request. If the browser - * details are not required, loading the application in the browser can take - * some shortcuts giving a faster initial rendering. This can be indicated - * by adding the {@link EagerInit} annotation to the UI class. + * request that caused this UI to be created. {@link BrowserDetails} will be + * available in the request. *

* * @param request diff --git a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java index 4cd786593a..18267e90b6 100644 --- a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java +++ b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java @@ -1,7 +1,6 @@ package com.vaadin.tests.components.ui; import com.vaadin.Application; -import com.vaadin.annotations.EagerInit; import com.vaadin.server.ExternalResource; import com.vaadin.server.UIProvider; import com.vaadin.server.WrappedRequest; @@ -13,7 +12,7 @@ import com.vaadin.ui.UI; public class LazyInitUIs extends AbstractTestApplication { - @EagerInit + // @EagerInit private static class EagerInitUI extends UI { @Override public void init(WrappedRequest request) { -- 2.39.5