From aa913676e513170244169352dd97d6b583b50065 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Tue, 4 Sep 2012 11:15:53 +0300 Subject: Move UI class info querying to UIProvider (#9402) --- uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java | 4 ++-- uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java | 4 ++-- .../minitutorials/v7a1/DifferentFeaturesForDifferentClients.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'uitest/src') diff --git a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java index 0f576a0f69..bad5b53478 100644 --- a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java +++ b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java @@ -1,9 +1,9 @@ package com.vaadin.tests.application; import com.vaadin.Application; +import com.vaadin.server.AbstractUIProvider; import com.vaadin.server.DownloadStream; import com.vaadin.server.PaintException; -import com.vaadin.server.UIProvider; import com.vaadin.server.WrappedRequest; import com.vaadin.tests.components.AbstractTestApplication; import com.vaadin.tests.integration.FlagSeResource; @@ -73,7 +73,7 @@ public class ThreadLocalInstances extends AbstractTestApplication { @Override public void init() { reportCurrentStatus("app init"); - addUIProvider(new UIProvider() { + addUIProvider(new AbstractUIProvider() { @Override public UI createInstance(Application application, Class type, WrappedRequest request) { diff --git a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java index 3980cbd4de..f33037f171 100644 --- a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java +++ b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java @@ -1,8 +1,8 @@ package com.vaadin.tests.components.ui; import com.vaadin.Application; +import com.vaadin.server.AbstractUIProvider; import com.vaadin.server.ExternalResource; -import com.vaadin.server.UIProvider; import com.vaadin.server.WrappedRequest; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.components.AbstractTestApplication; @@ -22,7 +22,7 @@ public class LazyInitUIs extends AbstractTestApplication { @Override public void init() { - addUIProvider(new UIProvider() { + addUIProvider(new AbstractUIProvider() { @Override public UI createInstance(Application application, diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java index 9e4c719830..8c2a816e1c 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java @@ -17,7 +17,7 @@ package com.vaadin.tests.minitutorials.v7a1; import com.vaadin.Application; -import com.vaadin.server.UIProvider; +import com.vaadin.server.AbstractUIProvider; import com.vaadin.server.WebBrowser; import com.vaadin.server.WrappedRequest; import com.vaadin.ui.Label; @@ -36,7 +36,7 @@ public class DifferentFeaturesForDifferentClients extends Application { @Override public void init() { super.init(); - addUIProvider(new UIProvider() { + addUIProvider(new AbstractUIProvider() { @Override public Class getUIClass(Application application, WrappedRequest request) { -- cgit v1.2.3 From b3525638865cdea297c7f2e32c96221132af949f Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Tue, 4 Sep 2012 14:08:41 +0300 Subject: Unify ThreadLocal handling (#9469) --- server/src/com/vaadin/Application.java | 12 +- .../vaadin/server/PortletApplicationContext2.java | 12 +- .../vaadin/server/ServletApplicationContext.java | 4 +- server/src/com/vaadin/server/VaadinPortlet.java | 14 +-- server/src/com/vaadin/server/VaadinServlet.java | 14 +-- server/src/com/vaadin/ui/UI.java | 10 +- server/src/com/vaadin/util/CurrentInstance.java | 131 +++++++++++++++++++++ .../tests/application/ThreadLocalInstances.html | 6 +- 8 files changed, 159 insertions(+), 44 deletions(-) create mode 100644 server/src/com/vaadin/util/CurrentInstance.java (limited to 'uitest/src') diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java index d2313c0566..088934c5f9 100644 --- a/server/src/com/vaadin/Application.java +++ b/server/src/com/vaadin/Application.java @@ -70,6 +70,7 @@ import com.vaadin.ui.AbstractField; import com.vaadin.ui.Table; import com.vaadin.ui.UI; import com.vaadin.ui.Window; +import com.vaadin.util.CurrentInstance; import com.vaadin.util.ReflectTools; /** @@ -1798,13 +1799,6 @@ public class Application implements Terminal.ErrorListener, Serializable { return Collections.unmodifiableCollection(requestHandlers); } - /** - * Thread local for keeping track of currently used application instance - * - * @since 7.0 - */ - private static final ThreadLocal currentApplication = new ThreadLocal(); - /** * Gets the currently used application. The current application is * automatically defined when processing requests to the server. In other @@ -1819,7 +1813,7 @@ public class Application implements Terminal.ErrorListener, Serializable { * @since 7.0 */ public static Application getCurrent() { - return currentApplication.get(); + return CurrentInstance.get(Application.class); } /** @@ -1840,7 +1834,7 @@ public class Application implements Terminal.ErrorListener, Serializable { * @since 7.0 */ public static void setCurrent(Application application) { - currentApplication.set(application); + CurrentInstance.setInheritable(Application.class, application); } /** diff --git a/server/src/com/vaadin/server/PortletApplicationContext2.java b/server/src/com/vaadin/server/PortletApplicationContext2.java index 3efcc91c08..6a12eafc47 100644 --- a/server/src/com/vaadin/server/PortletApplicationContext2.java +++ b/server/src/com/vaadin/server/PortletApplicationContext2.java @@ -46,6 +46,7 @@ import javax.xml.namespace.QName; import com.vaadin.Application; import com.vaadin.ui.UI; +import com.vaadin.util.CurrentInstance; /** * TODO Write documentation, fix JavaDoc tags. @@ -153,8 +154,9 @@ public class PortletApplicationContext2 extends ApplicationContext { } private PortletResponse getCurrentResponse() { - WrappedPortletResponse currentResponse = VaadinPortlet - .getCurrentResponse(); + WrappedPortletResponse currentResponse = (WrappedPortletResponse) CurrentInstance + .get(WrappedResponse.class); + if (currentResponse != null) { return currentResponse.getPortletResponse(); } else { @@ -163,8 +165,10 @@ public class PortletApplicationContext2 extends ApplicationContext { } public PortletConfig getPortletConfig() { - return VaadinPortlet.getCurrentResponse().getDeploymentConfiguration() - .getPortlet().getPortletConfig(); + WrappedPortletResponse response = (WrappedPortletResponse) CurrentInstance + .get(WrappedResponse.class); + return response.getDeploymentConfiguration().getPortlet() + .getPortletConfig(); } public void addPortletListener(Application app, PortletListener listener) { diff --git a/server/src/com/vaadin/server/ServletApplicationContext.java b/server/src/com/vaadin/server/ServletApplicationContext.java index ecf6202917..4184b68de4 100644 --- a/server/src/com/vaadin/server/ServletApplicationContext.java +++ b/server/src/com/vaadin/server/ServletApplicationContext.java @@ -25,6 +25,7 @@ import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionBindingListener; import com.vaadin.Application; +import com.vaadin.util.CurrentInstance; /** * Web application context for Vaadin applications. @@ -84,7 +85,8 @@ public class ServletApplicationContext extends ApplicationContext { reinitializingSession = false; // Create a new session - HttpSession newSession = VaadinServlet.getCurrentRequest().getSession(); + HttpSession newSession = WrappedHttpServletRequest.cast( + CurrentInstance.get(WrappedRequest.class)).getSession(); // Restores all attributes (security key, reference to this context // instance) diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index 199b8e1fc1..0a99644735 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -57,6 +57,7 @@ import com.vaadin.Application.ApplicationStartEvent; import com.vaadin.server.AbstractCommunicationManager.Callback; import com.vaadin.server.ServletPortletHelper.ApplicationClassException; import com.vaadin.ui.UI; +import com.vaadin.util.CurrentInstance; /** * Portlet 2.0 base class. This replaces the servlet in servlet/portlet 1.0 @@ -296,8 +297,6 @@ public class VaadinPortlet extends GenericPortlet implements Constants { private PortletDeploymentConfiguration deploymentConfiguration; private AddonContext addonContext; - private static ThreadLocal currentResponse = new ThreadLocal(); - @Override public void init(PortletConfig config) throws PortletException { super.init(config); @@ -395,10 +394,6 @@ public class VaadinPortlet extends GenericPortlet implements Constants { return deploymentConfiguration.isProductionMode(); } - public static WrappedPortletResponse getCurrentResponse() { - return currentResponse.get(); - } - protected void handleRequest(PortletRequest request, PortletResponse response) throws PortletException, IOException { RequestTimer requestTimer = new RequestTimer(); @@ -412,7 +407,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants { WrappedPortletResponse wrappedResponse = new WrappedPortletResponse( response, getDeploymentConfiguration()); - currentResponse.set(wrappedResponse); + CurrentInstance.set(WrappedRequest.class, wrappedRequest); + CurrentInstance.set(WrappedResponse.class, wrappedResponse); RequestType requestType = getRequestType(wrappedRequest); @@ -608,9 +604,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { } } finally { - UI.setCurrent(null); - Application.setCurrent(null); - currentResponse.set(null); + CurrentInstance.clearAll(); PortletSession session = request .getPortletSession(false); diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 078263c623..81569030e7 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -50,6 +50,7 @@ import com.vaadin.server.AbstractCommunicationManager.Callback; import com.vaadin.server.ServletPortletHelper.ApplicationClassException; import com.vaadin.shared.ApplicationConstants; import com.vaadin.ui.UI; +import com.vaadin.util.CurrentInstance; @SuppressWarnings("serial") public class VaadinServlet extends HttpServlet implements Constants { @@ -157,8 +158,6 @@ public class VaadinServlet extends HttpServlet implements Constants { } } - private static ThreadLocal currentRequest = new ThreadLocal(); - // TODO Move some (all?) of the constants to a separate interface (shared // with portlet) @@ -263,17 +262,14 @@ public class VaadinServlet extends HttpServlet implements Constants { service(createWrappedRequest(request), createWrappedResponse(response)); } - public static WrappedHttpServletRequest getCurrentRequest() { - return currentRequest.get(); - } - private void service(WrappedHttpServletRequest request, WrappedHttpServletResponse response) throws ServletException, IOException { RequestTimer requestTimer = new RequestTimer(); requestTimer.start(); - currentRequest.set(request); + CurrentInstance.set(WrappedResponse.class, response); + CurrentInstance.set(WrappedRequest.class, request); AbstractApplicationServletWrapper servletWrapper = new AbstractApplicationServletWrapper( this); @@ -423,9 +419,7 @@ public class VaadinServlet extends HttpServlet implements Constants { .onRequestEnd(request, response); } } finally { - UI.setCurrent(null); - Application.setCurrent(null); - currentRequest.set(null); + CurrentInstance.clearAll(); HttpSession session = request.getSession(false); if (session != null) { diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index 7ae4e6bda3..e016e9432c 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -49,6 +49,7 @@ import com.vaadin.shared.ui.BorderStyle; import com.vaadin.shared.ui.ui.UIConstants; import com.vaadin.shared.ui.ui.UIServerRpc; import com.vaadin.shared.ui.ui.UIState; +import com.vaadin.util.CurrentInstance; import com.vaadin.util.ReflectTools; /** @@ -450,11 +451,6 @@ public abstract class UI extends AbstractComponentContainer implements */ protected ActionManager actionManager; - /** - * Thread local for keeping track of the current UI. - */ - private static final ThreadLocal currentUI = new ThreadLocal(); - /** Identifies the click event */ private ConnectorTracker connectorTracker = new ConnectorTracker(this); @@ -982,7 +978,7 @@ public abstract class UI extends AbstractComponentContainer implements * @see ThreadLocal */ public static void setCurrent(UI ui) { - currentUI.set(ui); + CurrentInstance.setInheritable(UI.class, ui); } /** @@ -995,7 +991,7 @@ public abstract class UI extends AbstractComponentContainer implements * @see #setCurrent(UI) */ public static UI getCurrent() { - return currentUI.get(); + return CurrentInstance.get(UI.class); } public void setScrollTop(int scrollTop) { diff --git a/server/src/com/vaadin/util/CurrentInstance.java b/server/src/com/vaadin/util/CurrentInstance.java new file mode 100644 index 0000000000..8478ba9486 --- /dev/null +++ b/server/src/com/vaadin/util/CurrentInstance.java @@ -0,0 +1,131 @@ +/* + * 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.util; + +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +/** + * Keeps track of various thread local instances used by the framework. + * + * @author Vaadin Ltd + * @version @VERSION@ + * @since 7.0.0 + */ +public class CurrentInstance { + private final Object instance; + private final boolean inheritable; + + private static InheritableThreadLocal, CurrentInstance>> instances = new InheritableThreadLocal, CurrentInstance>>() { + @Override + protected Map, CurrentInstance> childValue( + Map, CurrentInstance> parentValue) { + Map, CurrentInstance> value = new HashMap, CurrentInstance>(); + + // Copy all inheritable values to child map + for (Entry, CurrentInstance> e : parentValue.entrySet()) { + if (e.getValue().inheritable) { + value.put(e.getKey(), e.getValue()); + } + } + + return value; + } + + @Override + protected Map, CurrentInstance> initialValue() { + return new HashMap, CurrentInstance>(); + } + }; + + private CurrentInstance(Object instance, boolean inheritable) { + this.instance = instance; + this.inheritable = inheritable; + } + + /** + * Gets the current instance of a specific type if available. + * + * @param type + * the class to get an instance of + * @return the current instance or the provided type, or null + * if there is no current instance. + */ + public static T get(Class type) { + CurrentInstance currentInstance = instances.get().get(type); + if (currentInstance != null) { + return type.cast(currentInstance.instance); + } else { + return null; + } + } + + /** + * Sets the current instance of the given type. + * + * @see #setInheritable(Class, Object) + * @see ThreadLocal + * + * @param type + * the class that should be used when getting the current + * instance back + * @param instance + * the actual instance + */ + public static void set(Class type, T instance) { + set(type, instance, false); + } + + /** + * Sets the current inheritable instance of the given type. A current + * instance that is inheritable will be available for child threads. + * + * @see #set(Class, Object) + * @see InheritableThreadLocal + * + * @param type + * the class that should be used when getting the current + * instance back + * @param instance + * the actual instance + */ + public static void setInheritable(Class type, T instance) { + set(type, instance, true); + } + + private static void set(Class type, T instance, boolean inheritable) { + if (instance == null) { + instances.get().remove(type); + } else { + assert type.isInstance(instance) : "Invald instance type"; + CurrentInstance previousInstance = instances.get().put(type, + new CurrentInstance(instance, inheritable)); + if (previousInstance != null) { + assert previousInstance.inheritable == inheritable : "Inheritable status mismatch for " + + type; + } + } + } + + /** + * Clears all current instances. + */ + public static void clearAll() { + instances.get().clear(); + } +} diff --git a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.html b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.html index 35657c73fc..b7fbca4c04 100644 --- a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.html +++ b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.html @@ -79,12 +79,12 @@ assertText vaadin=runcomvaadintestsapplicationThreadLocalInstances::PID_SLog_row_5 - 11. null app in background thread + 11. this app in background thread assertText vaadin=runcomvaadintestsapplicationThreadLocalInstances::PID_SLog_row_4 - 12. null root in background thread + 12. this root in background thread assertText @@ -94,7 +94,7 @@ assertText vaadin=runcomvaadintestsapplicationThreadLocalInstances::PID_SLog_row_2 - 14. null root in resource handler + 14. this root in resource handler assertText -- cgit v1.2.3 From 437e700dfc4173da66d45abd95b6f661d7216218 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Tue, 4 Sep 2012 14:20:13 +0300 Subject: Remove transaction listener support (#9402) --- .../src/com/vaadin/server/ApplicationContext.java | 139 -------------- server/src/com/vaadin/server/VaadinPortlet.java | 32 +--- server/src/com/vaadin/server/VaadinServlet.java | 31 +--- .../server/TransactionListenersConcurrency.java | 201 --------------------- .../RemoveTransactionListener.java | 84 --------- 5 files changed, 15 insertions(+), 472 deletions(-) delete mode 100644 server/tests/src/com/vaadin/tests/server/TransactionListenersConcurrency.java delete mode 100644 uitest/src/com/vaadin/tests/applicationcontext/RemoveTransactionListener.java (limited to 'uitest/src') diff --git a/server/src/com/vaadin/server/ApplicationContext.java b/server/src/com/vaadin/server/ApplicationContext.java index 7577639a3f..2c09ed3857 100644 --- a/server/src/com/vaadin/server/ApplicationContext.java +++ b/server/src/com/vaadin/server/ApplicationContext.java @@ -16,15 +16,11 @@ package com.vaadin.server; import java.io.File; -import java.io.PrintWriter; import java.io.Serializable; -import java.io.StringWriter; -import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; -import java.util.LinkedList; import java.util.logging.Level; import java.util.logging.Logger; @@ -48,50 +44,6 @@ import com.vaadin.Application; public abstract class ApplicationContext implements HttpSessionBindingListener, Serializable { - /** - * Interface for listening to transaction events. Implement this interface - * to listen to all transactions between the client and the application. - * - */ - public static interface TransactionListener extends Serializable { - - /** - * Invoked at the beginning of every transaction. - * - * The transaction is linked to the context, not the application so if - * you have multiple applications running in the same context you need - * to check that the request is associated with the application you are - * interested in. This can be done looking at the application parameter. - * - * @param application - * the Application object. - * @param transactionData - * the Data identifying the transaction. - */ - public void transactionStart(Application application, - Object transactionData); - - /** - * Invoked at the end of every transaction. - * - * The transaction is linked to the context, not the application so if - * you have multiple applications running in the same context you need - * to check that the request is associated with the application you are - * interested in. This can be done looking at the application parameter. - * - * @param applcation - * the Application object. - * @param transactionData - * the Data identifying the transaction. - */ - public void transactionEnd(Application application, - Object transactionData); - - } - - protected Collection listeners = Collections - .synchronizedList(new LinkedList()); - protected final HashSet applications = new HashSet(); protected WebBrowser browser = new WebBrowser(); @@ -104,97 +56,6 @@ public abstract class ApplicationContext implements HttpSessionBindingListener, private transient WrappedSession session; - /** - * Adds a transaction listener to this context. The transaction listener is - * called before and after each each request related to this session except - * when serving static resources. - * - * The transaction listener must not be null. - * - * @see com.vaadin.service.ApplicationContext#addTransactionListener(com.vaadin.service.ApplicationContext.TransactionListener) - */ - public void addTransactionListener( - ApplicationContext.TransactionListener listener) { - if (listener != null) { - listeners.add(listener); - } - } - - /** - * Removes a transaction listener from this context. - * - * @param listener - * the listener to be removed. - * @see ApplicationContext.TransactionListener - */ - public void removeTransactionListener( - ApplicationContext.TransactionListener listener) { - listeners.remove(listener); - } - - /** - * Sends a notification that a transaction is starting. - * - * @param application - * The application associated with the transaction. - * @param request - * the HTTP or portlet request that triggered the transaction. - */ - protected void startTransaction(Application application, Object request) { - ArrayList currentListeners; - synchronized (listeners) { - currentListeners = new ArrayList( - listeners); - } - for (ApplicationContext.TransactionListener listener : currentListeners) { - listener.transactionStart(application, request); - } - } - - /** - * Sends a notification that a transaction has ended. - * - * @param application - * The application associated with the transaction. - * @param request - * the HTTP or portlet request that triggered the transaction. - */ - protected void endTransaction(Application application, Object request) { - LinkedList exceptions = null; - - ArrayList currentListeners; - synchronized (listeners) { - currentListeners = new ArrayList( - listeners); - } - - for (ApplicationContext.TransactionListener listener : currentListeners) { - try { - listener.transactionEnd(application, request); - } catch (final RuntimeException t) { - if (exceptions == null) { - exceptions = new LinkedList(); - } - exceptions.add(t); - } - } - - // If any runtime exceptions occurred, throw a combined exception - if (exceptions != null) { - final StringBuffer msg = new StringBuffer(); - for (Exception e : exceptions) { - if (msg.length() == 0) { - msg.append("\n\n--------------------------\n\n"); - } - msg.append(e.getMessage() + "\n"); - final StringWriter trace = new StringWriter(); - e.printStackTrace(new PrintWriter(trace, true)); - msg.append(trace.toString()); - } - throw new RuntimeException(msg.toString()); - } - } - /** * @see javax.servlet.http.HttpSessionBindingListener#valueBound(HttpSessionBindingEvent) */ diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index 0a99644735..3d99cf603e 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -432,7 +432,6 @@ public class VaadinPortlet extends GenericPortlet implements Constants { (ResourceResponse) response); } else { Application application = null; - boolean transactionStarted = false; boolean requestStarted = false; boolean applicationRunning = false; @@ -485,13 +484,6 @@ public class VaadinPortlet extends GenericPortlet implements Constants { startApplication(request, application, applicationContext); applicationRunning = true; - /* - * Transaction starts. Call transaction listeners. Transaction - * end is called in the finally block below. - */ - applicationContext.startTransaction(application, request); - transactionStarted = true; - /* Notify listeners */ // Finds the window within the application @@ -592,25 +584,17 @@ public class VaadinPortlet extends GenericPortlet implements Constants { // Notifies transaction end try { - if (transactionStarted) { - ((PortletApplicationContext2) application.getContext()) - .endTransaction(application, request); + if (requestStarted) { + ((PortletRequestListener) application).onRequestEnd( + request, response); + } } finally { - try { - if (requestStarted) { - ((PortletRequestListener) application) - .onRequestEnd(request, response); + CurrentInstance.clearAll(); - } - } finally { - CurrentInstance.clearAll(); - - PortletSession session = request - .getPortletSession(false); - if (session != null) { - requestTimer.stop(getApplicationContext(session)); - } + PortletSession session = request.getPortletSession(false); + if (session != null) { + requestTimer.stop(getApplicationContext(session)); } } } diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 81569030e7..29e473a16a 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -285,7 +285,6 @@ public class VaadinServlet extends HttpServlet implements Constants { } Application application = null; - boolean transactionStarted = false; boolean requestStarted = false; boolean applicationRunning = false; @@ -350,13 +349,6 @@ public class VaadinServlet extends HttpServlet implements Constants { startApplication(request, application, webApplicationContext); applicationRunning = true; - /* - * Transaction starts. Call transaction listeners. Transaction end - * is called in the finally block below. - */ - webApplicationContext.startTransaction(application, request); - transactionStarted = true; - /* Handle the request */ if (requestType == RequestType.FILE_UPLOAD) { // UI is resolved in communication manager @@ -406,25 +398,16 @@ public class VaadinServlet extends HttpServlet implements Constants { // Notifies transaction end try { - if (transactionStarted) { - ((ServletApplicationContext) application.getContext()) - .endTransaction(application, request); - + if (requestStarted) { + ((HttpServletRequestListener) application).onRequestEnd( + request, response); } - } finally { - try { - if (requestStarted) { - ((HttpServletRequestListener) application) - .onRequestEnd(request, response); - } - } finally { - CurrentInstance.clearAll(); + CurrentInstance.clearAll(); - HttpSession session = request.getSession(false); - if (session != null) { - requestTimer.stop(getApplicationContext(session)); - } + HttpSession session = request.getSession(false); + if (session != null) { + requestTimer.stop(getApplicationContext(session)); } } diff --git a/server/tests/src/com/vaadin/tests/server/TransactionListenersConcurrency.java b/server/tests/src/com/vaadin/tests/server/TransactionListenersConcurrency.java deleted file mode 100644 index 05ffcd1e36..0000000000 --- a/server/tests/src/com/vaadin/tests/server/TransactionListenersConcurrency.java +++ /dev/null @@ -1,201 +0,0 @@ -package com.vaadin.tests.server; - -import static org.easymock.EasyMock.createMock; - -import java.lang.Thread.UncaughtExceptionHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; -import java.util.Random; - -import javax.servlet.http.HttpSession; - -import junit.framework.TestCase; - -import org.easymock.EasyMock; - -import com.vaadin.Application; -import com.vaadin.Application.ApplicationStartEvent; -import com.vaadin.server.ApplicationContext; -import com.vaadin.server.DeploymentConfiguration; -import com.vaadin.server.ServletApplicationContext; - -public class TransactionListenersConcurrency extends TestCase { - - /** - * This test starts N threads concurrently. Each thread creates an - * application which adds a transaction listener to the context. A - * transaction is then started for each application. Some semi-random delays - * are included so that calls to addTransactionListener and - * WebApplicationContext.startTransaction are mixed. - * - */ - public void testTransactionListeners() throws Exception { - final List exceptions = new ArrayList(); - - HttpSession session = createSession(); - final ServletApplicationContext context = ServletApplicationContext - .getApplicationContext(session); - List threads = new ArrayList(); - - for (int i = 0; i < 5; i++) { - Thread t = new Thread(new Runnable() { - - @Override - public void run() { - Application app = new Application() { - - @Override - public void init() { - // Sleep 0-1000ms so another transaction has time to - // start before we add the transaction listener. - try { - Thread.sleep((long) (1000 * new Random() - .nextDouble())); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - getContext().addTransactionListener( - new DelayTransactionListener(2000)); - } - - }; - - // Start the application so the transaction listener is - // called later on. - try { - DeploymentConfiguration dc = EasyMock - .createMock(DeploymentConfiguration.class); - EasyMock.expect(dc.isProductionMode()).andReturn(true); - EasyMock.expect(dc.getInitParameters()).andReturn( - new Properties()); - EasyMock.replay(dc); - - app.start(new ApplicationStartEvent(new URL( - "http://localhost/"), dc, context)); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - try { - // Call the transaction listener using reflection as - // startTransaction is protected. - - Method m = ApplicationContext.class.getDeclaredMethod( - "startTransaction", Application.class, - Object.class); - m.setAccessible(true); - m.invoke(context, app, null); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - }); - - threads.add(t); - t.setUncaughtExceptionHandler(new UncaughtExceptionHandler() { - - @Override - public void uncaughtException(Thread t, Throwable e) { - if (e.getCause() != null) { - e = e.getCause(); - } - exceptions.add(e); - } - }); - } - - // Start the threads and wait for all of them to finish - for (Thread t : threads) { - t.start(); - } - int running = threads.size(); - - while (running > 0) { - for (Iterator i = threads.iterator(); i.hasNext();) { - Thread t = i.next(); - if (!t.isAlive()) { - running--; - i.remove(); - } - } - } - - for (Throwable t : exceptions) { - if (t instanceof InvocationTargetException) { - t = t.getCause(); - } - if (t != null) { - t.printStackTrace(System.err); - fail(t.getClass().getName()); - } - } - - System.out.println("Done, all ok"); - - } - - /** - * Creates a HttpSession mock - * - */ - private static HttpSession createSession() { - HttpSession session = createMock(HttpSession.class); - EasyMock.expect( - session.getAttribute(ServletApplicationContext.class.getName())) - .andReturn(null).anyTimes(); - session.setAttribute( - EasyMock.eq(ServletApplicationContext.class.getName()), - EasyMock.anyObject()); - - EasyMock.replay(session); - return session; - } - - /** - * A transaction listener that just sleeps for the given amount of time in - * transactionStart and transactionEnd. - * - */ - public static class DelayTransactionListener implements - ApplicationContext.TransactionListener { - - private int delay; - - public DelayTransactionListener(int delay) { - this.delay = delay; - } - - @Override - public void transactionStart(Application application, - Object transactionData) { - try { - Thread.sleep(delay); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - } - - @Override - public void transactionEnd(Application application, - Object transactionData) { - try { - Thread.sleep(delay); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - } - } - -} diff --git a/uitest/src/com/vaadin/tests/applicationcontext/RemoveTransactionListener.java b/uitest/src/com/vaadin/tests/applicationcontext/RemoveTransactionListener.java deleted file mode 100644 index 5927e9c19f..0000000000 --- a/uitest/src/com/vaadin/tests/applicationcontext/RemoveTransactionListener.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.vaadin.tests.applicationcontext; - -import com.vaadin.Application; -import com.vaadin.server.ApplicationContext; -import com.vaadin.server.ApplicationContext.TransactionListener; -import com.vaadin.tests.components.TestBase; -import com.vaadin.tests.util.Log; - -public class RemoveTransactionListener extends TestBase { - - private final Log log = new Log(10); - - @Override - protected void setup() { - // Add one listener that will remove itself from within transactionEnd - getMainWindow().getApplication().getContext() - .addTransactionListener(new TransactionListener() { - @Override - public void transactionStart(Application application, - Object transactionData) { - } - - @Override - public void transactionEnd(Application application, - Object transactionData) { - removeListener(this); - log.log("Listener removed in transactionEnd"); - } - }); - - // Add one listener that will remove itself from within transactionStart - getMainWindow().getApplication().getContext() - .addTransactionListener(new TransactionListener() { - @Override - public void transactionStart(Application application, - Object transactionData) { - removeListener(this); - log.log("Listener removed in transactionStart"); - } - - @Override - public void transactionEnd(Application application, - Object transactionData) { - } - }); - - // Add one listener to verify that all listeners are called, as thrown - // ConcurrentModificationException causes subsequent listeners to be - // ignored - getMainWindow().getApplication().getContext() - .addTransactionListener(new TransactionListener() { - @Override - public void transactionStart(Application application, - Object transactionData) { - log.log("transactionStart from last listener"); - } - - @Override - public void transactionEnd(Application application, - Object transactionData) { - log.log("transactionEnd from last listener"); - } - }); - - addComponent(log); - } - - private void removeListener(TransactionListener l) { - ApplicationContext context = getMainWindow().getApplication() - .getContext(); - context.removeTransactionListener(l); - } - - @Override - protected String getDescription() { - return "Tests that a transaction listener can be removed from within the listener."; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(7065); - } - -} -- cgit v1.2.3 From c71563c8a6e9993cbbdff3ddfdfccfee4aa34f7b Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Tue, 4 Sep 2012 16:48:13 +0300 Subject: Extract ApplicationConfiguration from DeploymentConfiguration (#9382) --- server/src/com/vaadin/Application.java | 56 ++--- .../vaadin/DefaultApplicationConfiguration.java | 229 +++++++++++++++++++++ .../server/AbstractCommunicationManager.java | 4 +- .../server/AbstractDeploymentConfiguration.java | 208 +------------------ .../vaadin/server/ApplicationConfiguration.java | 99 +++++++++ server/src/com/vaadin/server/BootstrapHandler.java | 4 +- .../src/com/vaadin/server/DefaultUIProvider.java | 4 +- .../com/vaadin/server/DeploymentConfiguration.java | 76 +------ .../vaadin/server/PortletCommunicationManager.java | 5 +- .../com/vaadin/server/ServletPortletHelper.java | 8 +- server/src/com/vaadin/server/VaadinPortlet.java | 36 ++-- server/src/com/vaadin/server/VaadinServlet.java | 58 +++--- ...tractApplicationServletStaticFilesLocation.java | 4 +- .../server/component/root/CustomUIClassLoader.java | 24 +-- .../vaadin/launcher/ApplicationRunnerServlet.java | 7 +- .../src/com/vaadin/tests/util/SampleDirectory.java | 8 +- 16 files changed, 429 insertions(+), 401 deletions(-) create mode 100644 server/src/com/vaadin/DefaultApplicationConfiguration.java create mode 100644 server/src/com/vaadin/server/ApplicationConfiguration.java (limited to 'uitest/src') diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java index 088934c5f9..745d0ad784 100644 --- a/server/src/com/vaadin/Application.java +++ b/server/src/com/vaadin/Application.java @@ -24,7 +24,6 @@ import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.Enumeration; import java.util.EventObject; import java.util.HashMap; import java.util.Iterator; @@ -45,6 +44,7 @@ import com.vaadin.data.util.converter.DefaultConverterFactory; import com.vaadin.event.EventRouter; import com.vaadin.server.AbstractErrorMessage; import com.vaadin.server.AbstractUIProvider; +import com.vaadin.server.ApplicationConfiguration; import com.vaadin.server.ApplicationContext; import com.vaadin.server.BootstrapFragmentResponse; import com.vaadin.server.BootstrapListener; @@ -400,7 +400,7 @@ public class Application implements Terminal.ErrorListener, Serializable { public static class ApplicationStartEvent implements Serializable { private final URL applicationUrl; - private final DeploymentConfiguration configuration; + private final ApplicationConfiguration configuration; private final ApplicationContext context; @@ -408,12 +408,12 @@ public class Application implements Terminal.ErrorListener, Serializable { * @param applicationUrl * the URL the application should respond to. * @param configuration - * the deployment configuration for the application. + * the application configuration for the application. * @param context * the context application will be running in. */ public ApplicationStartEvent(URL applicationUrl, - DeploymentConfiguration configuration, + ApplicationConfiguration configuration, ApplicationContext context) { this.applicationUrl = applicationUrl; this.configuration = configuration; @@ -433,11 +433,11 @@ public class Application implements Terminal.ErrorListener, Serializable { } /** - * Returns the deployment configuration used by this application. + * Returns the application configuration used by this application. * * @return the deployment configuration. */ - public DeploymentConfiguration getConfiguration() { + public ApplicationConfiguration getConfiguration() { return configuration; } @@ -462,9 +462,9 @@ public class Application implements Terminal.ErrorListener, Serializable { private ApplicationContext context; /** - * Deployment configuration for the application. + * Configuration for the application. */ - private DeploymentConfiguration configuration; + private ApplicationConfiguration configuration; /** * The application's URL. @@ -604,44 +604,12 @@ public class Application implements Terminal.ErrorListener, Serializable { } /** - * Returns the properties of this application as specified in the deployment - * configuration. + * Gets the configuration for this application * - * @return Application properties + * @return the application configuration */ - protected Properties getProperties() { - return configuration.getInitParameters(); - } - - /** - * Returns an enumeration of all the names in this application. - * - *

- * See {@link #start(URL, Properties, ApplicationContext)} how properties - * are defined. - *

- * - * @return an enumeration of all the keys in this property list, including - * the keys in the default property list. - * - */ - public Enumeration getPropertyNames() { - return getProperties().propertyNames(); - } - - /** - * Searches for the property with the specified name in this application. - * This method returns null if the property is not found. - * - * See {@link #start(URL, Properties, ApplicationContext)} how properties - * are defined. - * - * @param name - * the name of the property. - * @return the value in this property list with the specified key value. - */ - public String getProperty(String name) { - return getProperties().getProperty(name); + public ApplicationConfiguration getConfiguration() { + return configuration; } /** diff --git a/server/src/com/vaadin/DefaultApplicationConfiguration.java b/server/src/com/vaadin/DefaultApplicationConfiguration.java new file mode 100644 index 0000000000..2e2267193e --- /dev/null +++ b/server/src/com/vaadin/DefaultApplicationConfiguration.java @@ -0,0 +1,229 @@ +/* + * 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; + +import java.util.Properties; +import java.util.logging.Logger; + +import com.vaadin.server.ApplicationConfiguration; +import com.vaadin.server.Constants; + +public class DefaultApplicationConfiguration implements + ApplicationConfiguration { + private final Properties applicationProperties; + private boolean productionMode; + private boolean xsrfProtectionEnabled; + private int resourceCacheTime; + private int heartbeatInterval; + private boolean idleRootCleanupEnabled; + private final Class systemPropertyBaseClass; + + public DefaultApplicationConfiguration(Class systemPropertyBaseClass, + Properties applicationProperties) { + this.applicationProperties = applicationProperties; + this.systemPropertyBaseClass = systemPropertyBaseClass; + + checkProductionMode(); + checkXsrfProtection(); + checkResourceCacheTime(); + checkHeartbeatInterval(); + checkIdleUICleanup(); + } + + @Override + public String getApplicationOrSystemProperty(String propertyName, + String defaultValue) { + String val = null; + + // Try application properties + val = getApplicationProperty(propertyName); + if (val != null) { + return val; + } + + // Try system properties + val = getSystemProperty(propertyName); + if (val != null) { + return val; + } + + return defaultValue; + } + + /** + * Gets an system property value. + * + * @param parameterName + * the Name or the parameter. + * @return String value or null if not found + */ + protected String getSystemProperty(String parameterName) { + String val = null; + + String pkgName; + final Package pkg = systemPropertyBaseClass.getPackage(); + if (pkg != null) { + pkgName = pkg.getName(); + } else { + final String className = systemPropertyBaseClass.getName(); + pkgName = new String(className.toCharArray(), 0, + className.lastIndexOf('.')); + } + val = System.getProperty(pkgName + "." + parameterName); + if (val != null) { + return val; + } + + // Try lowercased system properties + val = System.getProperty(pkgName + "." + parameterName.toLowerCase()); + return val; + } + + /** + * Gets an application property value. + * + * @param parameterName + * the Name or the parameter. + * @return String value or null if not found + */ + public String getApplicationProperty(String parameterName) { + + String val = applicationProperties.getProperty(parameterName); + if (val != null) { + return val; + } + + // Try lower case application properties for backward compatibility with + // 3.0.2 and earlier + val = applicationProperties.getProperty(parameterName.toLowerCase()); + + return val; + } + + /** + * {@inheritDoc} + * + * The default is false. + */ + @Override + public boolean isProductionMode() { + return productionMode; + } + + /** + * {@inheritDoc} + *

+ * The default is true. + */ + @Override + public boolean isXsrfProtectionEnabled() { + return xsrfProtectionEnabled; + } + + /** + * {@inheritDoc} + *

+ * The default interval is 3600 seconds (1 hour). + */ + @Override + public int getResourceCacheTime() { + return resourceCacheTime; + } + + /** + * {@inheritDoc} + *

+ * The default interval is 300 seconds (5 minutes). + */ + @Override + public int getHeartbeatInterval() { + return heartbeatInterval; + } + + @Override + public boolean isIdleUICleanupEnabled() { + return idleRootCleanupEnabled; + } + + /** + * Log a warning if Vaadin is not running in production mode. + */ + private void checkProductionMode() { + productionMode = getApplicationOrSystemProperty( + Constants.SERVLET_PARAMETER_PRODUCTION_MODE, "false").equals( + "true"); + if (!productionMode) { + getLogger().warning(Constants.NOT_PRODUCTION_MODE_INFO); + } + } + + /** + * Log a warning if cross-site request forgery protection is disabled. + */ + private void checkXsrfProtection() { + xsrfProtectionEnabled = !getApplicationOrSystemProperty( + Constants.SERVLET_PARAMETER_DISABLE_XSRF_PROTECTION, "false") + .equals("true"); + if (!xsrfProtectionEnabled) { + getLogger().warning(Constants.WARNING_XSRF_PROTECTION_DISABLED); + } + } + + /** + * Log a warning if resource cache time is set but is not an integer. + */ + private void checkResourceCacheTime() { + try { + resourceCacheTime = Integer + .parseInt(getApplicationOrSystemProperty( + Constants.SERVLET_PARAMETER_RESOURCE_CACHE_TIME, + "3600")); + } catch (NumberFormatException e) { + getLogger().warning( + Constants.WARNING_RESOURCE_CACHING_TIME_NOT_NUMERIC); + resourceCacheTime = 3600; + } + } + + private void checkHeartbeatInterval() { + try { + heartbeatInterval = Integer + .parseInt(getApplicationOrSystemProperty( + Constants.SERVLET_PARAMETER_HEARTBEAT_RATE, "300")); + } catch (NumberFormatException e) { + getLogger().warning( + Constants.WARNING_HEARTBEAT_INTERVAL_NOT_NUMERIC); + heartbeatInterval = 300; + } + } + + private void checkIdleUICleanup() { + idleRootCleanupEnabled = getApplicationOrSystemProperty( + Constants.SERVLET_PARAMETER_CLOSE_IDLE_UIS, "false").equals( + "true"); + } + + private Logger getLogger() { + return Logger.getLogger(getClass().getName()); + } + + @Override + public Properties getInitParameters() { + return applicationProperties; + } + +} diff --git a/server/src/com/vaadin/server/AbstractCommunicationManager.java b/server/src/com/vaadin/server/AbstractCommunicationManager.java index 253542db48..3d27dd18b9 100644 --- a/server/src/com/vaadin/server/AbstractCommunicationManager.java +++ b/server/src/com/vaadin/server/AbstractCommunicationManager.java @@ -1522,9 +1522,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * @return false if the XSRF is turned off, true otherwise */ public boolean isXSRFEnabled(Application application) { - return !"true" - .equals(application - .getProperty(VaadinServlet.SERVLET_PARAMETER_DISABLE_XSRF_PROTECTION)); + return application.getConfiguration().isXsrfProtectionEnabled(); } /** diff --git a/server/src/com/vaadin/server/AbstractDeploymentConfiguration.java b/server/src/com/vaadin/server/AbstractDeploymentConfiguration.java index d1280d29ce..3d7efa6711 100644 --- a/server/src/com/vaadin/server/AbstractDeploymentConfiguration.java +++ b/server/src/com/vaadin/server/AbstractDeploymentConfiguration.java @@ -18,87 +18,28 @@ package com.vaadin.server; import java.lang.reflect.Constructor; import java.util.Iterator; -import java.util.Properties; import java.util.ServiceLoader; -import java.util.logging.Logger; public abstract class AbstractDeploymentConfiguration implements DeploymentConfiguration { - private final Class systemPropertyBaseClass; - private final Properties applicationProperties; private AddonContext addonContext; - private boolean productionMode; - private boolean xsrfProtectionEnabled; - private int resourceCacheTime; - private int heartbeatInterval; - private boolean idleRootCleanupEnabled; + private final ApplicationConfiguration applicationConfiguration; - public AbstractDeploymentConfiguration(Class systemPropertyBaseClass, - Properties applicationProperties) { - this.systemPropertyBaseClass = systemPropertyBaseClass; - this.applicationProperties = applicationProperties; - - checkProductionMode(); - checkXsrfProtection(); - checkResourceCacheTime(); - checkHeartbeatInterval(); - checkIdleUICleanup(); + public AbstractDeploymentConfiguration( + ApplicationConfiguration applicationConfiguration) { + this.applicationConfiguration = applicationConfiguration; } @Override - public String getApplicationOrSystemProperty(String propertyName, - String defaultValue) { - String val = null; - - // Try application properties - val = getApplicationProperty(propertyName); - if (val != null) { - return val; - } - - // Try system properties - val = getSystemProperty(propertyName); - if (val != null) { - return val; - } - - return defaultValue; - } - - /** - * Gets an system property value. - * - * @param parameterName - * the Name or the parameter. - * @return String value or null if not found - */ - protected String getSystemProperty(String parameterName) { - String val = null; - - String pkgName; - final Package pkg = systemPropertyBaseClass.getPackage(); - if (pkg != null) { - pkgName = pkg.getName(); - } else { - final String className = systemPropertyBaseClass.getName(); - pkgName = new String(className.toCharArray(), 0, - className.lastIndexOf('.')); - } - val = System.getProperty(pkgName + "." + parameterName); - if (val != null) { - return val; - } - - // Try lowercased system properties - val = System.getProperty(pkgName + "." + parameterName.toLowerCase()); - return val; + public ApplicationConfiguration getApplicationConfiguration() { + return applicationConfiguration; } @Override public ClassLoader getClassLoader() { - final String classLoaderName = getApplicationOrSystemProperty( - "ClassLoader", null); + final String classLoaderName = getApplicationConfiguration() + .getApplicationOrSystemProperty("ClassLoader", null); ClassLoader classLoader; if (classLoaderName == null) { classLoader = getClass().getClassLoader(); @@ -119,32 +60,6 @@ public abstract class AbstractDeploymentConfiguration implements return classLoader; } - /** - * Gets an application property value. - * - * @param parameterName - * the Name or the parameter. - * @return String value or null if not found - */ - protected String getApplicationProperty(String parameterName) { - - String val = applicationProperties.getProperty(parameterName); - if (val != null) { - return val; - } - - // Try lower case application properties for backward compatibility with - // 3.0.2 and earlier - val = applicationProperties.getProperty(parameterName.toLowerCase()); - - return val; - } - - @Override - public Properties getInitParameters() { - return applicationProperties; - } - @Override public Iterator getAddonContextListeners() { // Called once for init and then no more, so there's no point in caching @@ -163,111 +78,4 @@ public abstract class AbstractDeploymentConfiguration implements public AddonContext getAddonContext() { return addonContext; } - - /** - * {@inheritDoc} - * - * The default is false. - */ - @Override - public boolean isProductionMode() { - return productionMode; - } - - /** - * {@inheritDoc} - * - * The default is true. - */ - @Override - public boolean isXsrfProtectionEnabled() { - return xsrfProtectionEnabled; - } - - /** - * {@inheritDoc} - * - * The default interval is 3600 seconds (1 hour). - */ - @Override - public int getResourceCacheTime() { - return resourceCacheTime; - } - - /** - * {@inheritDoc} - * - * The default interval is 300 seconds (5 minutes). - */ - @Override - public int getHeartbeatInterval() { - return heartbeatInterval; - } - - @Override - public boolean isIdleUICleanupEnabled() { - return idleRootCleanupEnabled; - } - - /** - * Log a warning if Vaadin is not running in production mode. - */ - private void checkProductionMode() { - productionMode = getApplicationOrSystemProperty( - Constants.SERVLET_PARAMETER_PRODUCTION_MODE, "false").equals( - "true"); - if (!productionMode) { - getLogger().warning(Constants.NOT_PRODUCTION_MODE_INFO); - } - } - - /** - * Log a warning if cross-site request forgery protection is disabled. - */ - private void checkXsrfProtection() { - xsrfProtectionEnabled = !getApplicationOrSystemProperty( - Constants.SERVLET_PARAMETER_DISABLE_XSRF_PROTECTION, "false") - .equals("true"); - if (!xsrfProtectionEnabled) { - getLogger().warning(Constants.WARNING_XSRF_PROTECTION_DISABLED); - } - } - - /** - * Log a warning if resource cache time is set but is not an integer. - */ - private void checkResourceCacheTime() { - try { - resourceCacheTime = Integer - .parseInt(getApplicationOrSystemProperty( - Constants.SERVLET_PARAMETER_RESOURCE_CACHE_TIME, - "3600")); - } catch (NumberFormatException e) { - getLogger().warning( - Constants.WARNING_RESOURCE_CACHING_TIME_NOT_NUMERIC); - resourceCacheTime = 3600; - } - } - - private void checkHeartbeatInterval() { - try { - heartbeatInterval = Integer - .parseInt(getApplicationOrSystemProperty( - Constants.SERVLET_PARAMETER_HEARTBEAT_RATE, "300")); - } catch (NumberFormatException e) { - getLogger().warning( - Constants.WARNING_HEARTBEAT_INTERVAL_NOT_NUMERIC); - heartbeatInterval = 300; - } - } - - private void checkIdleUICleanup() { - idleRootCleanupEnabled = getApplicationOrSystemProperty( - Constants.SERVLET_PARAMETER_CLOSE_IDLE_UIS, "false").equals( - "true"); - } - - private Logger getLogger() { - return Logger.getLogger(getClass().getName()); - } } diff --git a/server/src/com/vaadin/server/ApplicationConfiguration.java b/server/src/com/vaadin/server/ApplicationConfiguration.java new file mode 100644 index 0000000000..edb33e6c39 --- /dev/null +++ b/server/src/com/vaadin/server/ApplicationConfiguration.java @@ -0,0 +1,99 @@ +/* + * 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.server; + +import java.util.Properties; + + +/** + * A collection of properties configured for all applications as well as a way + * of accessing third party properties not explicitely supported by this class. + * + * @author Vaadin Ltd + * @version @VERSION@ + * @since 7.0.0 + */ +public interface ApplicationConfiguration { + /** + * Returns whether Vaadin is in production mode. + * + * @return true if in production mode, false otherwise. + */ + public boolean isProductionMode(); + + /** + * Returns whether cross-site request forgery protection is enabled. + * + * @return true if XSRF protection is enabled, false otherwise. + */ + public boolean isXsrfProtectionEnabled(); + + /** + * Returns the time resources can be cached in the browsers, in seconds. + * + * @return The resource cache time. + */ + public int getResourceCacheTime(); + + /** + * Returns the number of seconds between heartbeat requests of a UI, or a + * non-positive number if heartbeat is disabled. + * + * @return The time between heartbeats. + */ + public int getHeartbeatInterval(); + + /** + * Returns whether UIs that have no other activity than heartbeat requests + * should be closed after they have been idle the maximum inactivity time + * enforced by the session. + * + * @see ApplicationContext#getMaxInactiveInterval() + * + * @since 7.0.0 + * + * @return True if UIs receiving only heartbeat requests are eventually + * closed; false if heartbeat requests extend UI lifetime + * indefinitely. + */ + public boolean isIdleUICleanupEnabled(); + + /** + * Gets the properties configured for the deployment, e.g. as init + * parameters to the servlet or portlet. + * + * @return properties for the application. + */ + public Properties getInitParameters(); + + /** + * Gets a configured property. The properties are typically read from e.g. + * web.xml or from system properties of the JVM. + * + * @param propertyName + * The simple of the property, in some contexts, lookup might be + * performed using variations of the provided name. + * @param defaultValue + * the default value that should be used if no value has been + * defined + * @return the property value, or the passed default value if no property + * value is found + */ + public String getApplicationOrSystemProperty(String propertyName, + String defaultValue); + +} diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java index 4d200b5063..a793214942 100644 --- a/server/src/com/vaadin/server/BootstrapHandler.java +++ b/server/src/com/vaadin/server/BootstrapHandler.java @@ -463,8 +463,8 @@ public abstract class BootstrapHandler implements RequestHandler { defaults.put("standalone", true); } - defaults.put("heartbeatInterval", - deploymentConfiguration.getHeartbeatInterval()); + defaults.put("heartbeatInterval", deploymentConfiguration + .getApplicationConfiguration().getHeartbeatInterval()); defaults.put("appUri", getAppUri(context)); diff --git a/server/src/com/vaadin/server/DefaultUIProvider.java b/server/src/com/vaadin/server/DefaultUIProvider.java index 93128aad28..b326e3229e 100644 --- a/server/src/com/vaadin/server/DefaultUIProvider.java +++ b/server/src/com/vaadin/server/DefaultUIProvider.java @@ -24,8 +24,8 @@ public class DefaultUIProvider extends AbstractUIProvider { @Override public Class getUIClass(Application application, WrappedRequest request) { - Object uiClassNameObj = application - .getProperty(Application.UI_PARAMETER); + Object uiClassNameObj = application.getConfiguration() + .getInitParameters().getProperty(Application.UI_PARAMETER); if (uiClassNameObj instanceof String) { String uiClassName = uiClassNameObj.toString(); diff --git a/server/src/com/vaadin/server/DeploymentConfiguration.java b/server/src/com/vaadin/server/DeploymentConfiguration.java index 6150edbafb..1f202eb923 100644 --- a/server/src/com/vaadin/server/DeploymentConfiguration.java +++ b/server/src/com/vaadin/server/DeploymentConfiguration.java @@ -18,7 +18,6 @@ package com.vaadin.server; import java.io.Serializable; import java.util.Iterator; -import java.util.Properties; import javax.portlet.PortletContext; import javax.servlet.ServletContext; @@ -81,22 +80,6 @@ public interface DeploymentConfiguration extends Serializable { */ public boolean isStandalone(WrappedRequest request); - /** - * Gets a configured property. The properties are typically read from e.g. - * web.xml or from system properties of the JVM. - * - * @param propertyName - * The simple of the property, in some contexts, lookup might be - * performed using variations of the provided name. - * @param defaultValue - * the default value that should be used if no value has been - * defined - * @return the property value, or the passed default value if no property - * value is found - */ - public String getApplicationOrSystemProperty(String propertyName, - String defaultValue); - /** * Get the class loader to use for loading classes loaded by name, e.g. * custom UI classes. null indicates that the default class @@ -122,12 +105,11 @@ public interface DeploymentConfiguration extends Serializable { public String getMimeType(String resourceName); /** - * Gets the properties configured for the deployment, e.g. as init - * parameters to the servlet or portlet. + * Gets the application configuration. * - * @return properties for the application. + * @return the application configuration */ - public Properties getInitParameters(); + public ApplicationConfiguration getApplicationConfiguration(); public Iterator getAddonContextListeners(); @@ -135,58 +117,6 @@ public interface DeploymentConfiguration extends Serializable { public void setAddonContext(AddonContext vaadinContext); - /** - * Returns whether Vaadin is in production mode. - * - * @since 7.0.0 - * - * @return true if in production mode, false otherwise. - */ - public boolean isProductionMode(); - - /** - * Returns whether cross-site request forgery protection is enabled. - * - * @since 7.0.0 - * - * @return true if XSRF protection is enabled, false otherwise. - */ - public boolean isXsrfProtectionEnabled(); - - /** - * Returns the time resources can be cached in the browsers, in seconds. - * - * @since 7.0.0 - * - * @return The resource cache time. - */ - public int getResourceCacheTime(); - - /** - * Returns the number of seconds between heartbeat requests of a UI, or a - * non-positive number if heartbeat is disabled. - * - * @since 7.0.0 - * - * @return The time between heartbeats. - */ - public int getHeartbeatInterval(); - - /** - * Returns whether UIs that have no other activity than heartbeat requests - * should be closed after they have been idle the maximum inactivity time - * enforced by the session. - * - * @see ApplicationContext#getMaxInactiveInterval() - * - * @since 7.0.0 - * - * @return True if UIs receiving only heartbeat requests are eventually - * closed; false if heartbeat requests extend UI lifetime - * indefinitely. - */ - public boolean isIdleUICleanupEnabled(); - /** * Gets the system messages object * diff --git a/server/src/com/vaadin/server/PortletCommunicationManager.java b/server/src/com/vaadin/server/PortletCommunicationManager.java index cb3a8eab80..f7214f108c 100644 --- a/server/src/com/vaadin/server/PortletCommunicationManager.java +++ b/server/src/com/vaadin/server/PortletCommunicationManager.java @@ -130,8 +130,9 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { protected String getMainDivStyle(BootstrapContext context) { DeploymentConfiguration deploymentConfiguration = context .getRequest().getDeploymentConfiguration(); - return deploymentConfiguration.getApplicationOrSystemProperty( - VaadinPortlet.PORTLET_PARAMETER_STYLE, null); + return deploymentConfiguration.getApplicationConfiguration() + .getApplicationOrSystemProperty( + VaadinPortlet.PORTLET_PARAMETER_STYLE, null); } @Override diff --git a/server/src/com/vaadin/server/ServletPortletHelper.java b/server/src/com/vaadin/server/ServletPortletHelper.java index f9ca55b50e..26913d8ba8 100644 --- a/server/src/com/vaadin/server/ServletPortletHelper.java +++ b/server/src/com/vaadin/server/ServletPortletHelper.java @@ -1,6 +1,7 @@ package com.vaadin.server; import java.io.Serializable; +import java.util.Properties; import com.vaadin.Application; import com.vaadin.shared.ApplicationConstants; @@ -43,9 +44,10 @@ class ServletPortletHelper implements Serializable { static Class getApplicationClass( DeploymentConfiguration deploymentConfiguration) throws ApplicationClassException { - String applicationParameter = deploymentConfiguration - .getInitParameters().getProperty("application"); - String uiParameter = deploymentConfiguration.getInitParameters() + Properties initParameters = deploymentConfiguration + .getApplicationConfiguration().getInitParameters(); + String applicationParameter = initParameters.getProperty("application"); + String uiParameter = initParameters .getProperty(Application.UI_PARAMETER); ClassLoader classLoader = deploymentConfiguration.getClassLoader(); diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index 3d99cf603e..923fcd3b71 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -54,6 +54,7 @@ import com.liferay.portal.kernel.util.PortalClassInvoker; import com.liferay.portal.kernel.util.PropsUtil; import com.vaadin.Application; import com.vaadin.Application.ApplicationStartEvent; +import com.vaadin.DefaultApplicationConfiguration; import com.vaadin.server.AbstractCommunicationManager.Callback; import com.vaadin.server.ServletPortletHelper.ApplicationClassException; import com.vaadin.ui.UI; @@ -76,8 +77,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants { private final VaadinPortlet portlet; public PortletDeploymentConfiguration(VaadinPortlet portlet, - Properties applicationProperties) { - super(portlet.getClass(), applicationProperties); + ApplicationConfiguration applicationConfiguration) { + super(applicationConfiguration); this.portlet = portlet; } @@ -88,8 +89,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants { @Override public String getConfiguredWidgetset(WrappedRequest request) { - String widgetset = getApplicationOrSystemProperty( - PARAMETER_WIDGETSET, null); + String widgetset = getApplicationConfiguration() + .getApplicationOrSystemProperty(PARAMETER_WIDGETSET, null); if (widgetset == null) { // If no widgetset defined for the application, check the @@ -319,15 +320,23 @@ public class VaadinPortlet extends GenericPortlet implements Constants { config.getInitParameter(name)); } - deploymentConfiguration = createDeploymentConfiguration(applicationProperties); + ApplicationConfiguration applicationConfiguration = createApplicationConfiguration(applicationProperties); + deploymentConfiguration = createDeploymentConfiguration(applicationConfiguration); addonContext = new AddonContext(deploymentConfiguration); addonContext.init(); } - protected PortletDeploymentConfiguration createDeploymentConfiguration( + protected ApplicationConfiguration createApplicationConfiguration( Properties applicationProperties) { - return new PortletDeploymentConfiguration(this, applicationProperties); + return new DefaultApplicationConfiguration(getClass(), + applicationProperties); + } + + protected PortletDeploymentConfiguration createDeploymentConfiguration( + ApplicationConfiguration applicationConfiguration) { + return new PortletDeploymentConfiguration(this, + applicationConfiguration); } @Override @@ -384,16 +393,6 @@ public class VaadinPortlet extends GenericPortlet implements Constants { && request.getResourceID().equals("DUMMY"); } - /** - * Returns true if the portlet is running in production mode. Production - * mode disables all debug facilities. - * - * @return true if in production mode, false if in debug mode - */ - public boolean isProductionMode() { - return deploymentConfiguration.isProductionMode(); - } - protected void handleRequest(PortletRequest request, PortletResponse response) throws PortletException, IOException { RequestTimer requestTimer = new RequestTimer(); @@ -769,7 +768,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants { application.setLocale(locale); // No application URL when running inside a portlet application.start(new ApplicationStartEvent(null, - getDeploymentConfiguration(), context)); + getDeploymentConfiguration().getApplicationConfiguration(), + context)); addonContext.fireApplicationStarted(application); } } diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 29e473a16a..3cf2c645a0 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -46,6 +46,7 @@ import javax.servlet.http.HttpSession; import com.vaadin.Application; import com.vaadin.Application.ApplicationStartEvent; +import com.vaadin.DefaultApplicationConfiguration; import com.vaadin.server.AbstractCommunicationManager.Callback; import com.vaadin.server.ServletPortletHelper.ApplicationClassException; import com.vaadin.shared.ApplicationConstants; @@ -60,8 +61,8 @@ public class VaadinServlet extends HttpServlet implements Constants { private final VaadinServlet servlet; public ServletDeploymentConfiguration(VaadinServlet servlet, - Properties applicationProperties) { - super(servlet.getClass(), applicationProperties); + ApplicationConfiguration applicationProperties) { + super(applicationProperties); this.servlet = servlet; } @@ -75,8 +76,9 @@ public class VaadinServlet extends HttpServlet implements Constants { .cast(request); String staticFileLocation; // if property is defined in configurations, use that - staticFileLocation = getApplicationOrSystemProperty( - PARAMETER_VAADIN_RESOURCES, null); + staticFileLocation = getApplicationConfiguration() + .getApplicationOrSystemProperty(PARAMETER_VAADIN_RESOURCES, + null); if (staticFileLocation != null) { return staticFileLocation; } @@ -112,9 +114,10 @@ public class VaadinServlet extends HttpServlet implements Constants { @Override public String getConfiguredWidgetset(WrappedRequest request) { - return getApplicationOrSystemProperty( - VaadinServlet.PARAMETER_WIDGETSET, - VaadinServlet.DEFAULT_WIDGETSET); + return getApplicationConfiguration() + .getApplicationOrSystemProperty( + VaadinServlet.PARAMETER_WIDGETSET, + VaadinServlet.DEFAULT_WIDGETSET); } @Override @@ -201,15 +204,23 @@ public class VaadinServlet extends HttpServlet implements Constants { servletConfig.getInitParameter(name)); } - deploymentConfiguration = createDeploymentConfiguration(applicationProperties); + ApplicationConfiguration applicationConfiguration = createApplicationConfiguration(applicationProperties); + deploymentConfiguration = createDeploymentConfiguration(applicationConfiguration); addonContext = new AddonContext(deploymentConfiguration); addonContext.init(); } - protected ServletDeploymentConfiguration createDeploymentConfiguration( + protected ApplicationConfiguration createApplicationConfiguration( Properties applicationProperties) { - return new ServletDeploymentConfiguration(this, applicationProperties); + return new DefaultApplicationConfiguration(getClass(), + applicationProperties); + } + + protected ServletDeploymentConfiguration createDeploymentConfiguration( + ApplicationConfiguration applicationConfiguration) { + return new ServletDeploymentConfiguration(this, + applicationConfiguration); } @Override @@ -219,26 +230,6 @@ public class VaadinServlet extends HttpServlet implements Constants { addonContext.destroy(); } - /** - * Returns true if the servlet is running in production mode. Production - * mode disables all debug facilities. - * - * @return true if in production mode, false if in debug mode - */ - public boolean isProductionMode() { - return getDeploymentConfiguration().isProductionMode(); - } - - /** - * Returns the number of seconds the browser should cache a file. Default is - * 1 hour (3600 s). - * - * @return The number of seconds files are cached in the browser - */ - public int getResourceCacheTime() { - return getDeploymentConfiguration().getResourceCacheTime(); - } - /** * Receives standard HTTP requests from the public service method and * dispatches them. @@ -917,7 +908,8 @@ public class VaadinServlet extends HttpServlet implements Constants { Locale locale = request.getLocale(); application.setLocale(locale); application.start(new ApplicationStartEvent(applicationUrl, - getDeploymentConfiguration(), webApplicationContext)); + getDeploymentConfiguration().getApplicationConfiguration(), + webApplicationContext)); addonContext.fireApplicationStarted(application); } } @@ -1062,8 +1054,10 @@ public class VaadinServlet extends HttpServlet implements Constants { * cache timeout can be configured by setting the resourceCacheTime * parameter in web.xml */ + int resourceCacheTime = getDeploymentConfiguration() + .getApplicationConfiguration().getResourceCacheTime(); response.setHeader("Cache-Control", - "max-age= " + String.valueOf(getResourceCacheTime())); + "max-age= " + String.valueOf(resourceCacheTime)); } // Write the resource to the client. diff --git a/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java b/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java index b936cae1a5..2aa8d04364 100644 --- a/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java +++ b/server/tests/src/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java @@ -13,6 +13,7 @@ import javax.servlet.http.HttpServletRequest; import junit.framework.TestCase; +import com.vaadin.DefaultApplicationConfiguration; import com.vaadin.server.VaadinServlet.ServletDeploymentConfiguration; public class TestAbstractApplicationServletStaticFilesLocation extends TestCase { @@ -32,7 +33,8 @@ public class TestAbstractApplicationServletStaticFilesLocation extends TestCase .getDeclaredField("deploymentConfiguration"); f.setAccessible(true); f.set(servlet, new ServletDeploymentConfiguration(servlet, - new Properties())); + new DefaultApplicationConfiguration(servlet.getClass(), + new Properties()))); } diff --git a/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java b/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java index 89da55a31f..aef35084f8 100644 --- a/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java +++ b/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java @@ -10,6 +10,8 @@ import org.easymock.EasyMock; import com.vaadin.Application; import com.vaadin.Application.ApplicationStartEvent; +import com.vaadin.DefaultApplicationConfiguration; +import com.vaadin.server.ApplicationConfiguration; import com.vaadin.server.DefaultUIProvider; import com.vaadin.server.DeploymentConfiguration; import com.vaadin.server.WrappedRequest; @@ -62,15 +64,11 @@ public class CustomUIClassLoader extends TestCase { assertEquals(MyUI.class, uiClass); } - private static DeploymentConfiguration createConfigurationMock() { - DeploymentConfiguration configurationMock = EasyMock - .createMock(DeploymentConfiguration.class); - EasyMock.expect(configurationMock.isProductionMode()).andReturn(false); - EasyMock.expect(configurationMock.getInitParameters()).andReturn( - new Properties()); - - EasyMock.replay(configurationMock); - return configurationMock; + private static ApplicationConfiguration createConfigurationMock() { + Properties properties = new Properties(); + properties.put(Application.UI_PARAMETER, MyUI.class.getName()); + return new DefaultApplicationConfiguration(CustomUIClassLoader.class, + properties); } private static WrappedRequest createRequestMock(ClassLoader classloader) { @@ -117,12 +115,8 @@ public class CustomUIClassLoader extends TestCase { private Application createStubApplication() { return new Application() { @Override - public String getProperty(String name) { - if (name.equals(UI_PARAMETER)) { - return MyUI.class.getName(); - } else { - return super.getProperty(name); - } + public ApplicationConfiguration getConfiguration() { + return createConfigurationMock(); } }; } diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java index 11685033a9..3d63c7dfb9 100644 --- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java +++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java @@ -21,7 +21,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.Collections; import java.util.LinkedHashSet; -import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; @@ -32,6 +31,7 @@ import javax.servlet.http.HttpServletResponse; import com.vaadin.Application; import com.vaadin.server.AbstractUIProvider; +import com.vaadin.server.ApplicationConfiguration; import com.vaadin.server.VaadinServlet; import com.vaadin.server.WrappedHttpServletRequest; import com.vaadin.server.WrappedRequest; @@ -259,8 +259,9 @@ public class ApplicationRunnerServlet extends VaadinServlet { @Override protected ServletDeploymentConfiguration createDeploymentConfiguration( - Properties applicationProperties) { - return new ServletDeploymentConfiguration(this, applicationProperties) { + ApplicationConfiguration applicationConfiguration) { + return new ServletDeploymentConfiguration(this, + applicationConfiguration) { @Override public String getStaticFileLocation(WrappedRequest request) { URIS uris = getApplicationRunnerURIs(WrappedHttpServletRequest diff --git a/uitest/src/com/vaadin/tests/util/SampleDirectory.java b/uitest/src/com/vaadin/tests/util/SampleDirectory.java index ef20da788d..e15f0ccfe3 100644 --- a/uitest/src/com/vaadin/tests/util/SampleDirectory.java +++ b/uitest/src/com/vaadin/tests/util/SampleDirectory.java @@ -52,8 +52,10 @@ public class SampleDirectory { // cannot access example directory, possible security issue with // Application Server or Servlet Container // Try to read sample directory from web.xml parameter - if (application.getProperty("sampleDirectory") != null) { - file = new File(application.getProperty("sampleDirectory")); + String sampleDirProperty = application.getConfiguration() + .getInitParameters().getProperty("sampleDirectory"); + if (sampleDirProperty != null) { + file = new File(sampleDirProperty); if ((file != null) && (file.canRead()) && (file.getAbsolutePath() != null)) { // Success using property @@ -61,7 +63,7 @@ public class SampleDirectory { } // Failure using property errorMessage += "Failed also to access sample directory [" - + application.getProperty("sampleDirectory") + + sampleDirProperty + "] defined in sampleDirectory property."; } else { // Failure using application context base dir, no property set -- cgit v1.2.3 From b0b1a13247bf931eb7f33ff6d0a88fc1833144e9 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Tue, 4 Sep 2012 16:59:24 +0300 Subject: Move getBaseDirectory() to DeploymentConfiguration (#9402) --- .../src/com/vaadin/server/ApplicationContext.java | 15 ----------- .../com/vaadin/server/DeploymentConfiguration.java | 15 +++++++++++ .../vaadin/server/PortletApplicationContext2.java | 30 ---------------------- .../vaadin/server/ServletApplicationContext.java | 16 ------------ server/src/com/vaadin/server/VaadinPortlet.java | 26 +++++++++++++++++++ server/src/com/vaadin/server/VaadinServlet.java | 11 ++++++++ .../tests/resources/NonExistingFileResource.java | 8 ++++-- .../src/com/vaadin/tests/tickets/Ticket1975.java | 10 +++++--- .../src/com/vaadin/tests/util/SampleDirectory.java | 5 +++- 9 files changed, 68 insertions(+), 68 deletions(-) (limited to 'uitest/src') diff --git a/server/src/com/vaadin/server/ApplicationContext.java b/server/src/com/vaadin/server/ApplicationContext.java index 2c09ed3857..85a77241d9 100644 --- a/server/src/com/vaadin/server/ApplicationContext.java +++ b/server/src/com/vaadin/server/ApplicationContext.java @@ -15,7 +15,6 @@ */ package com.vaadin.server; -import java.io.File; import java.io.Serializable; import java.util.Collection; import java.util.Collections; @@ -148,20 +147,6 @@ public abstract class ApplicationContext implements HttpSessionBindingListener, return Logger.getLogger(ApplicationContext.class.getName()); } - /** - * Returns application context base directory. - * - * Typically an application is deployed in a such way that is has an - * application directory. For web applications this directory is the root - * directory of the web applications. In some cases applications might not - * have an application directory (for example web applications running - * inside a war). - * - * @return The application base directory or null if the application has no - * base directory. - */ - public abstract File getBaseDirectory(); - /** * Gets the session to which this application context is currently * associated. diff --git a/server/src/com/vaadin/server/DeploymentConfiguration.java b/server/src/com/vaadin/server/DeploymentConfiguration.java index 1f202eb923..0a70ef09b3 100644 --- a/server/src/com/vaadin/server/DeploymentConfiguration.java +++ b/server/src/com/vaadin/server/DeploymentConfiguration.java @@ -16,6 +16,7 @@ package com.vaadin.server; +import java.io.File; import java.io.Serializable; import java.util.Iterator; @@ -123,4 +124,18 @@ public interface DeploymentConfiguration extends Serializable { * @return the system messages object */ public SystemMessages getSystemMessages(); + + /** + * Returns application context base directory. + * + * Typically an application is deployed in a such way that is has an + * application directory. For web applications this directory is the root + * directory of the web applications. In some cases applications might not + * have an application directory (for example web applications running + * inside a war). + * + * @return The application base directory or null if the application has no + * base directory. + */ + public File getBaseDirectory(); } diff --git a/server/src/com/vaadin/server/PortletApplicationContext2.java b/server/src/com/vaadin/server/PortletApplicationContext2.java index 6a12eafc47..f157dc9ae6 100644 --- a/server/src/com/vaadin/server/PortletApplicationContext2.java +++ b/server/src/com/vaadin/server/PortletApplicationContext2.java @@ -15,15 +15,11 @@ */ package com.vaadin.server; -import java.io.File; import java.io.Serializable; -import java.net.URL; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; @@ -69,28 +65,6 @@ public class PortletApplicationContext2 extends ApplicationContext { private final Map sharedParameterActionNameMap = new HashMap(); private final Map sharedParameterActionValueMap = new HashMap(); - @Override - public File getBaseDirectory() { - PortletSession session = getPortletSession(); - String resultPath = session.getPortletContext().getRealPath("/"); - if (resultPath != null) { - return new File(resultPath); - } else { - try { - final URL url = session.getPortletContext().getResource("/"); - return new File(url.getFile()); - } catch (final Exception e) { - // FIXME: Handle exception - getLogger() - .log(Level.INFO, - "Cannot access base directory, possible security issue " - + "with Application Server or Servlet Container", - e); - } - } - return null; - } - protected PortletCommunicationManager getApplicationManager( Application application) { PortletCommunicationManager mgr = (PortletCommunicationManager) applicationToAjaxAppMgrMap @@ -403,8 +377,4 @@ public class PortletApplicationContext2 extends ApplicationContext { "Portlet mode can only be changed from a portlet request"); } } - - private Logger getLogger() { - return Logger.getLogger(PortletApplicationContext2.class.getName()); - } } diff --git a/server/src/com/vaadin/server/ServletApplicationContext.java b/server/src/com/vaadin/server/ServletApplicationContext.java index 4184b68de4..910051a26b 100644 --- a/server/src/com/vaadin/server/ServletApplicationContext.java +++ b/server/src/com/vaadin/server/ServletApplicationContext.java @@ -16,7 +16,6 @@ package com.vaadin.server; -import java.io.File; import java.util.Enumeration; import java.util.HashMap; @@ -98,21 +97,6 @@ public class ServletApplicationContext extends ApplicationContext { setSession(new WrappedHttpSession(newSession)); } - /** - * Gets the application context base directory. - * - * @see com.vaadin.server.ApplicationContext#getBaseDirectory() - */ - @Override - public File getBaseDirectory() { - final String realPath = VaadinServlet.getResourcePath(getHttpSession() - .getServletContext(), "/"); - if (realPath == null) { - return null; - } - return new File(realPath); - } - /** * Gets the http-session application is running in. * diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index 923fcd3b71..5fb2340bc8 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -16,6 +16,7 @@ package com.vaadin.server; import java.io.BufferedWriter; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -24,11 +25,13 @@ import java.io.PrintWriter; import java.io.Serializable; import java.lang.reflect.Method; import java.net.MalformedURLException; +import java.net.URL; import java.security.GeneralSecurityException; import java.util.Enumeration; import java.util.Locale; import java.util.Map; import java.util.Properties; +import java.util.logging.Level; import java.util.logging.Logger; import javax.portlet.ActionRequest; @@ -154,6 +157,29 @@ public class VaadinPortlet extends GenericPortlet implements Constants { public SystemMessages getSystemMessages() { return ServletPortletHelper.DEFAULT_SYSTEM_MESSAGES; } + + @Override + public File getBaseDirectory() { + PortletContext context = getPortlet().getPortletContext(); + String resultPath = context.getRealPath("/"); + if (resultPath != null) { + return new File(resultPath); + } else { + try { + final URL url = context.getResource("/"); + return new File(url.getFile()); + } catch (final Exception e) { + // FIXME: Handle exception + getLogger() + .log(Level.INFO, + "Cannot access base directory, possible security issue " + + "with Application Server or Servlet Container", + e); + } + } + return null; + } + } public static class WrappedHttpAndPortletRequest extends diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 3cf2c645a0..62fb8ba71e 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -16,6 +16,7 @@ package com.vaadin.server; import java.io.BufferedWriter; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -140,6 +141,16 @@ public class VaadinServlet extends HttpServlet implements Constants { public SystemMessages getSystemMessages() { return ServletPortletHelper.DEFAULT_SYSTEM_MESSAGES; } + + @Override + public File getBaseDirectory() { + final String realPath = VaadinServlet.getResourcePath( + servlet.getServletContext(), "/"); + if (realPath == null) { + return null; + } + return new File(realPath); + } } private static class AbstractApplicationServletWrapper implements Callback { diff --git a/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java b/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java index eb8559f746..45552df39c 100644 --- a/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java +++ b/uitest/src/com/vaadin/tests/resources/NonExistingFileResource.java @@ -3,9 +3,11 @@ package com.vaadin.tests.resources; import java.io.File; import com.vaadin.server.FileResource; +import com.vaadin.server.WrappedRequest; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.util.CurrentInstance; public class NonExistingFileResource extends TestBase { @@ -24,8 +26,10 @@ public class NonExistingFileResource extends TestBase { @Override public void buttonClick(ClickEvent event) { - FileResource res = new FileResource(new File(getContext() - .getBaseDirectory() + "/" + filename)); + FileResource res = new FileResource(new File(CurrentInstance + .get(WrappedRequest.class).getDeploymentConfiguration() + .getBaseDirectory() + + "/" + filename)); getMainWindow().open(res); } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java index e85fe294f2..4fa3470f0b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java @@ -5,13 +5,14 @@ import java.io.File; import java.io.FileInputStream; import com.vaadin.Application; -import com.vaadin.server.ServletApplicationContext; +import com.vaadin.server.WrappedRequest; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.CustomLayout; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; +import com.vaadin.util.CurrentInstance; public class Ticket1975 extends Application.LegacyApplication { @@ -33,7 +34,6 @@ public class Ticket1975 extends Application.LegacyApplication { try { cl1 = new CustomLayout(new ByteArrayInputStream(s.getBytes())); layout.addComponent(cl1); - ServletApplicationContext wc = ((ServletApplicationContext) getContext()); layout.addComponent(new Button("Disable/Enable", new ClickListener() { @@ -47,8 +47,10 @@ public class Ticket1975 extends Application.LegacyApplication { } })); - File f = new File(wc.getBaseDirectory().getAbsoluteFile() - + "/VAADIN/themes/" + getTheme() + File baseDir = CurrentInstance.get(WrappedRequest.class) + .getDeploymentConfiguration().getBaseDirectory() + .getAbsoluteFile(); + File f = new File(baseDir + "/VAADIN/themes/" + getTheme() + "/layouts/Ticket1975.html"); cl2 = new CustomLayout(new FileInputStream(f)); diff --git a/uitest/src/com/vaadin/tests/util/SampleDirectory.java b/uitest/src/com/vaadin/tests/util/SampleDirectory.java index e15f0ccfe3..7304f1cab8 100644 --- a/uitest/src/com/vaadin/tests/util/SampleDirectory.java +++ b/uitest/src/com/vaadin/tests/util/SampleDirectory.java @@ -20,10 +20,12 @@ import java.io.File; import com.vaadin.Application; import com.vaadin.server.SystemError; +import com.vaadin.server.WrappedRequest; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.UI; +import com.vaadin.util.CurrentInstance; /** * Provides sample directory based on application directory. If this fails then @@ -46,7 +48,8 @@ public class SampleDirectory { + "context base directory failed, " + "possible security constraint with Application " + "Server or Servlet Container.
"; - File file = application.getContext().getBaseDirectory(); + File file = CurrentInstance.get(WrappedRequest.class) + .getDeploymentConfiguration().getBaseDirectory(); if ((file == null) || (!file.canRead()) || (file.getAbsolutePath() == null)) { // cannot access example directory, possible security issue with -- cgit v1.2.3 From 0a64a44e5fc9e7f79d5540aefd39262d50424477 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 5 Sep 2012 10:42:27 +0300 Subject: Only support one Application per session (#9402) --- .../src/com/vaadin/server/ApplicationContext.java | 71 +++++++++++++--------- .../vaadin/server/PortletApplicationContext2.java | 37 ----------- .../vaadin/server/ServletApplicationContext.java | 27 -------- server/src/com/vaadin/server/VaadinPortlet.java | 18 +++--- server/src/com/vaadin/server/VaadinServlet.java | 47 ++++++-------- .../tests/application/ApplicationCloseTest.java | 7 +-- 6 files changed, 71 insertions(+), 136 deletions(-) (limited to 'uitest/src') diff --git a/server/src/com/vaadin/server/ApplicationContext.java b/server/src/com/vaadin/server/ApplicationContext.java index 85a77241d9..0b317486e4 100644 --- a/server/src/com/vaadin/server/ApplicationContext.java +++ b/server/src/com/vaadin/server/ApplicationContext.java @@ -16,10 +16,6 @@ package com.vaadin.server; import java.io.Serializable; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; import java.util.logging.Level; import java.util.logging.Logger; @@ -43,11 +39,11 @@ import com.vaadin.Application; public abstract class ApplicationContext implements HttpSessionBindingListener, Serializable { - protected final HashSet applications = new HashSet(); + private Application application; protected WebBrowser browser = new WebBrowser(); - protected HashMap applicationToAjaxAppMgrMap = new HashMap(); + private AbstractCommunicationManager communicationManager; private long totalSessionTime = 0; @@ -70,22 +66,7 @@ public abstract class ApplicationContext implements HttpSessionBindingListener, public void valueUnbound(HttpSessionBindingEvent event) { // If we are going to be unbound from the session, the session must be // closing - try { - while (!applications.isEmpty()) { - final Application app = applications.iterator().next(); - app.close(); - removeApplication(app); - } - } catch (Exception e) { - // This should never happen but is possible with rare - // configurations (e.g. robustness tests). If you have one - // thread doing HTTP socket write and another thread trying to - // remove same application here. Possible if you got e.g. session - // lifetime 1 min but socket write may take longer than 1 min. - // FIXME: Handle exception - getLogger().log(Level.SEVERE, - "Could not remove application, leaking memory.", e); - } + removeApplication(); } /** @@ -102,19 +83,36 @@ public abstract class ApplicationContext implements HttpSessionBindingListener, } /** - * Returns a collection of all the applications in this context. + * Returns the applications in this context. * - * Each application context contains all active applications for one user. + * Each application context contains the application for one user. * - * @return A collection containing all the applications in this context. + * @return The application of this context, or null if there is + * no application */ - public Collection getApplications() { - return Collections.unmodifiableCollection(applications); + public Application getApplication() { + return application; } - protected void removeApplication(Application application) { - applications.remove(application); - applicationToAjaxAppMgrMap.remove(application); + public void removeApplication() { + if (application == null) { + return; + } + try { + application.close(); + } catch (Exception e) { + // This should never happen but is possible with rare + // configurations (e.g. robustness tests). If you have one + // thread doing HTTP socket write and another thread trying to + // remove same application here. Possible if you got e.g. session + // lifetime 1 min but socket write may take longer than 1 min. + // FIXME: Handle exception + getLogger().log(Level.SEVERE, + "Could not close application, leaking memory.", e); + } finally { + application = null; + communicationManager = null; + } } /** @@ -168,4 +166,17 @@ public abstract class ApplicationContext implements HttpSessionBindingListener, this.session = session; } + public AbstractCommunicationManager getApplicationManager() { + return communicationManager; + } + + public void setApplication(Application application, + AbstractCommunicationManager communicationManager) { + if (this.application != null) { + removeApplication(); + } + this.application = application; + this.communicationManager = communicationManager; + } + } \ No newline at end of file diff --git a/server/src/com/vaadin/server/PortletApplicationContext2.java b/server/src/com/vaadin/server/PortletApplicationContext2.java index f157dc9ae6..63f02ac4ec 100644 --- a/server/src/com/vaadin/server/PortletApplicationContext2.java +++ b/server/src/com/vaadin/server/PortletApplicationContext2.java @@ -57,32 +57,12 @@ public class PortletApplicationContext2 extends ApplicationContext { protected Map> portletListeners = new HashMap>(); - protected HashMap portletWindowIdToApplicationMap = new HashMap(); - private final Map eventActionDestinationMap = new HashMap(); private final Map eventActionValueMap = new HashMap(); private final Map sharedParameterActionNameMap = new HashMap(); private final Map sharedParameterActionValueMap = new HashMap(); - protected PortletCommunicationManager getApplicationManager( - Application application) { - PortletCommunicationManager mgr = (PortletCommunicationManager) applicationToAjaxAppMgrMap - .get(application); - - if (mgr == null) { - // Creates a new manager - mgr = createPortletCommunicationManager(application); - applicationToAjaxAppMgrMap.put(application, mgr); - } - return mgr; - } - - protected PortletCommunicationManager createPortletCommunicationManager( - Application application) { - return new PortletCommunicationManager(application); - } - public static PortletApplicationContext2 getApplicationContext( PortletSession session) { Object cxattr = session.getAttribute(PortletApplicationContext2.class @@ -103,23 +83,6 @@ public class PortletApplicationContext2 extends ApplicationContext { return cx; } - @Override - protected void removeApplication(Application application) { - super.removeApplication(application); - // values() is backed by map, removes the key-value pair from the map - portletWindowIdToApplicationMap.values().remove(application); - } - - protected void addApplication(Application application, - String portletWindowId) { - applications.add(application); - portletWindowIdToApplicationMap.put(portletWindowId, application); - } - - public Application getApplicationForWindowId(String portletWindowId) { - return portletWindowIdToApplicationMap.get(portletWindowId); - } - public PortletSession getPortletSession() { WrappedSession wrappedSession = getSession(); PortletSession session = ((WrappedPortletSession) wrappedSession) diff --git a/server/src/com/vaadin/server/ServletApplicationContext.java b/server/src/com/vaadin/server/ServletApplicationContext.java index 910051a26b..a1f5a81624 100644 --- a/server/src/com/vaadin/server/ServletApplicationContext.java +++ b/server/src/com/vaadin/server/ServletApplicationContext.java @@ -23,7 +23,6 @@ import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionBindingListener; -import com.vaadin.Application; import com.vaadin.util.CurrentInstance; /** @@ -125,30 +124,4 @@ public class ServletApplicationContext extends ApplicationContext { cx.setSession(new WrappedHttpSession(session)); return cx; } - - protected void addApplication(Application application) { - applications.add(application); - } - - /** - * Gets communication manager for an application. - * - * If this application has not been running before, a new manager is - * created. - * - * @param application - * @return CommunicationManager - */ - public CommunicationManager getApplicationManager(Application application, - VaadinServlet servlet) { - CommunicationManager mgr = (CommunicationManager) applicationToAjaxAppMgrMap - .get(application); - - if (mgr == null) { - // Creates new manager - mgr = servlet.createCommunicationManager(application); - applicationToAjaxAppMgrMap.put(application, mgr); - } - return mgr; - } } diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index 5fb2340bc8..2bec4249ed 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -478,8 +478,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants { PortletApplicationContext2 applicationContext = getApplicationContext(request .getPortletSession()); - PortletCommunicationManager applicationManager = applicationContext - .getApplicationManager(application); + PortletCommunicationManager applicationManager = (PortletCommunicationManager) applicationContext + .getApplicationManager(); if (requestType == RequestType.CONNECTOR_RESOURCE) { applicationManager.serveConnectorResource(wrappedRequest, @@ -805,7 +805,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { throws IOException { final PortletSession session = request.getPortletSession(); if (session != null) { - getApplicationContext(session).removeApplication(application); + getApplicationContext(session).removeApplication(); } // Do not send any redirects when running inside a portlet. } @@ -863,16 +863,17 @@ public class VaadinPortlet extends GenericPortlet implements Constants { application.close(); if (session != null) { PortletApplicationContext2 context = getApplicationContext(session); - context.removeApplication(application); + context.removeApplication(); } } private Application createApplication(PortletRequest request) - throws PortletException, MalformedURLException { + throws PortletException { Application newApplication = getNewApplication(request); final PortletApplicationContext2 context = getApplicationContext(request .getPortletSession()); - context.addApplication(newApplication, request.getWindowID()); + context.setApplication(newApplication, new PortletCommunicationManager( + newApplication)); return newApplication; } @@ -888,8 +889,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { } PortletApplicationContext2 context = getApplicationContext(session); - Application application = context.getApplicationForWindowId(request - .getWindowID()); + Application application = context.getApplication(); if (application == null) { return null; } @@ -897,7 +897,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { return application; } // application found but not running - context.removeApplication(application); + context.removeApplication(); return null; } diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 62fb8ba71e..af66a3496e 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -31,7 +31,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.Enumeration; import java.util.HashSet; -import java.util.Iterator; import java.util.Locale; import java.util.Properties; import java.util.logging.Level; @@ -322,8 +321,8 @@ public class VaadinServlet extends HttpServlet implements Constants { */ ServletApplicationContext webApplicationContext = getApplicationContext(request .getSession()); - CommunicationManager applicationManager = webApplicationContext - .getApplicationManager(application, this); + CommunicationManager applicationManager = (CommunicationManager) webApplicationContext + .getApplicationManager(); if (requestType == RequestType.CONNECTOR_RESOURCE) { applicationManager.serveConnectorResource(request, response); @@ -726,7 +725,8 @@ public class VaadinServlet extends HttpServlet implements Constants { final ServletApplicationContext context = getApplicationContext(request .getSession()); - context.addApplication(newApplication); + context.setApplication(newApplication, + createCommunicationManager(newApplication)); return newApplication; } @@ -1334,30 +1334,19 @@ public class VaadinServlet extends HttpServlet implements Constants { ServletApplicationContext context = getApplicationContext(session); - // Gets application list for the session. - final Collection applications = context.getApplications(); - - // Search for the application (using the application URI) from the list - for (final Iterator i = applications.iterator(); i - .hasNext();) { - final Application sessionApplication = i.next(); - final String sessionApplicationPath = sessionApplication.getURL() - .getPath(); - String requestApplicationPath = getApplicationUrl(request) - .getPath(); - - if (requestApplicationPath.equals(sessionApplicationPath)) { - // Found a running application - if (sessionApplication.isRunning()) { - return sessionApplication; - } - // Application has stopped, so remove it before creating a new - // application - getApplicationContext(session).removeApplication( - sessionApplication); - break; - } + Application sessionApplication = context.getApplication(); + + if (sessionApplication == null) { + return null; + } + + if (sessionApplication.isRunning()) { + // Found a running application + return sessionApplication; } + // Application has stopped, so remove it before creating a new + // application + getApplicationContext(session).removeApplication(); // Existing application not found return null; @@ -1386,7 +1375,7 @@ public class VaadinServlet extends HttpServlet implements Constants { final HttpSession session = request.getSession(); if (session != null) { - getApplicationContext(session).removeApplication(application); + getApplicationContext(session).removeApplication(); } response.sendRedirect(response.encodeRedirectURL(logoutUrl)); @@ -1439,7 +1428,7 @@ public class VaadinServlet extends HttpServlet implements Constants { application.close(); if (session != null) { ServletApplicationContext context = getApplicationContext(session); - context.removeApplication(application); + context.removeApplication(); } } diff --git a/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java b/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java index 1f5f0dc691..f2fe90f4b1 100644 --- a/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java +++ b/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java @@ -1,6 +1,5 @@ package com.vaadin.tests.application; -import com.vaadin.Application; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; @@ -15,9 +14,9 @@ public class ApplicationCloseTest extends TestBase { protected void setup() { Label applications = new Label("Applications in session:
", ContentMode.XHTML); - for (Application a : getContext().getApplications()) { - applications.setValue(applications.getValue() + "App: " + a - + "
"); + if (getContext().getApplication() != null) { + applications.setValue(applications.getValue() + "App: " + + getContext().getApplication() + "
"); } applications.setValue(applications.getValue() + "

"); -- cgit v1.2.3 From c8ba35652ebdea8c659b5fc2485690cc637da96a Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 5 Sep 2012 10:58:12 +0300 Subject: Don't require an Application with portlet listeners (#9402) --- .../vaadin/server/PortletApplicationContext2.java | 70 +++++++++------------- server/src/com/vaadin/server/VaadinPortlet.java | 16 +++-- .../integration/JSR286PortletApplication.java | 2 +- 3 files changed, 35 insertions(+), 53 deletions(-) (limited to 'uitest/src') diff --git a/server/src/com/vaadin/server/PortletApplicationContext2.java b/server/src/com/vaadin/server/PortletApplicationContext2.java index 63f02ac4ec..a7b6d5b40a 100644 --- a/server/src/com/vaadin/server/PortletApplicationContext2.java +++ b/server/src/com/vaadin/server/PortletApplicationContext2.java @@ -16,6 +16,7 @@ package com.vaadin.server; import java.io.Serializable; +import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.Map; @@ -40,7 +41,6 @@ import javax.portlet.StateAwareResponse; import javax.servlet.http.HttpSessionBindingListener; import javax.xml.namespace.QName; -import com.vaadin.Application; import com.vaadin.ui.UI; import com.vaadin.util.CurrentInstance; @@ -55,7 +55,7 @@ import com.vaadin.util.CurrentInstance; @SuppressWarnings("serial") public class PortletApplicationContext2 extends ApplicationContext { - protected Map> portletListeners = new HashMap>(); + private final Set portletListeners = new LinkedHashSet(); private final Map eventActionDestinationMap = new HashMap(); private final Map eventActionValueMap = new HashMap(); @@ -108,35 +108,25 @@ public class PortletApplicationContext2 extends ApplicationContext { .getPortletConfig(); } - public void addPortletListener(Application app, PortletListener listener) { - Set l = portletListeners.get(app); - if (l == null) { - l = new LinkedHashSet(); - portletListeners.put(app, l); - } - l.add(listener); + public void addPortletListener(PortletListener listener) { + portletListeners.add(listener); } - public void removePortletListener(Application app, PortletListener listener) { - Set l = portletListeners.get(app); - if (l != null) { - l.remove(listener); - } + public void removePortletListener(PortletListener listener) { + portletListeners.remove(listener); } - public void firePortletRenderRequest(Application app, UI uI, - RenderRequest request, RenderResponse response) { - Set listeners = portletListeners.get(app); - if (listeners != null) { - for (PortletListener l : listeners) { - l.handleRenderRequest(request, new RestrictedRenderResponse( - response), uI); - } + public void firePortletRenderRequest(UI uI, RenderRequest request, + RenderResponse response) { + for (PortletListener l : new ArrayList( + portletListeners)) { + l.handleRenderRequest(request, new RestrictedRenderResponse( + response), uI); } } - public void firePortletActionRequest(Application app, UI uI, - ActionRequest request, ActionResponse response) { + public void firePortletActionRequest(UI uI, ActionRequest request, + ActionResponse response) { String key = request.getParameter(ActionRequest.ACTION_NAME); if (eventActionDestinationMap.containsKey(key)) { // this action request is only to send queued portlet events @@ -154,32 +144,26 @@ public class PortletApplicationContext2 extends ApplicationContext { sharedParameterActionValueMap.remove(key); } else { // normal action request, notify listeners - Set listeners = portletListeners.get(app); - if (listeners != null) { - for (PortletListener l : listeners) { - l.handleActionRequest(request, response, uI); - } + for (PortletListener l : new ArrayList( + portletListeners)) { + l.handleActionRequest(request, response, uI); } } } - public void firePortletEventRequest(Application app, UI uI, - EventRequest request, EventResponse response) { - Set listeners = portletListeners.get(app); - if (listeners != null) { - for (PortletListener l : listeners) { - l.handleEventRequest(request, response, uI); - } + public void firePortletEventRequest(UI uI, EventRequest request, + EventResponse response) { + for (PortletListener l : new ArrayList( + portletListeners)) { + l.handleEventRequest(request, response, uI); } } - public void firePortletResourceRequest(Application app, UI uI, - ResourceRequest request, ResourceResponse response) { - Set listeners = portletListeners.get(app); - if (listeners != null) { - for (PortletListener l : listeners) { - l.handleResourceRequest(request, response, uI); - } + public void firePortletResourceRequest(UI uI, ResourceRequest request, + ResourceResponse response) { + for (PortletListener l : new ArrayList( + portletListeners)) { + l.handleResourceRequest(request, response, uI); } } diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index 2bec4249ed..3b8e7cd7ba 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -544,19 +544,17 @@ public class VaadinPortlet extends GenericPortlet implements Constants { // TODO Should this happen before or after the transaction // starts? if (request instanceof RenderRequest) { - applicationContext.firePortletRenderRequest(application, - uI, (RenderRequest) request, - (RenderResponse) response); + applicationContext.firePortletRenderRequest(uI, + (RenderRequest) request, (RenderResponse) response); } else if (request instanceof ActionRequest) { - applicationContext.firePortletActionRequest(application, - uI, (ActionRequest) request, - (ActionResponse) response); + applicationContext.firePortletActionRequest(uI, + (ActionRequest) request, (ActionResponse) response); } else if (request instanceof EventRequest) { - applicationContext.firePortletEventRequest(application, uI, + applicationContext.firePortletEventRequest(uI, (EventRequest) request, (EventResponse) response); } else if (request instanceof ResourceRequest) { - applicationContext.firePortletResourceRequest(application, - uI, (ResourceRequest) request, + applicationContext.firePortletResourceRequest(uI, + (ResourceRequest) request, (ResourceResponse) response); } diff --git a/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java b/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java index 2243adf336..50de6b4882 100644 --- a/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java +++ b/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java @@ -89,7 +89,7 @@ public class JSR286PortletApplication extends Application.LegacyApplication { if (getContext() instanceof PortletApplicationContext2) { PortletApplicationContext2 ctx = (PortletApplicationContext2) getContext(); - ctx.addPortletListener(this, new DemoPortletListener()); + ctx.addPortletListener(new DemoPortletListener()); } else { getMainWindow().showNotification("Not inited via Portal!", Notification.TYPE_ERROR_MESSAGE); -- cgit v1.2.3 From 8bdaf8732e660d1b9595c9d503999022320b0314 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 5 Sep 2012 12:24:14 +0300 Subject: Remove servlet and portlet request listeners (#9402) --- .../vaadin/server/HttpServletRequestListener.java | 64 --------------------- .../com/vaadin/server/PortletRequestListener.java | 66 ---------------------- server/src/com/vaadin/server/VaadinPortlet.java | 28 ++------- server/src/com/vaadin/server/VaadinServlet.java | 28 ++------- .../window/AttachShouldBeCalledForSubWindows.java | 31 ++++------ 5 files changed, 18 insertions(+), 199 deletions(-) delete mode 100644 server/src/com/vaadin/server/HttpServletRequestListener.java delete mode 100644 server/src/com/vaadin/server/PortletRequestListener.java (limited to 'uitest/src') diff --git a/server/src/com/vaadin/server/HttpServletRequestListener.java b/server/src/com/vaadin/server/HttpServletRequestListener.java deleted file mode 100644 index e871dca05d..0000000000 --- a/server/src/com/vaadin/server/HttpServletRequestListener.java +++ /dev/null @@ -1,64 +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.server; - -import java.io.Serializable; - -import javax.servlet.Filter; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.vaadin.Application; - -/** - * {@link Application} that implements this interface gets notified of request - * start and end by terminal. - *

- * Interface can be used for several helper tasks including: - *

    - *
  • Opening and closing database connections - *
  • Implementing {@link ThreadLocal} - *
  • Setting/Getting {@link Cookie} - *
- *

- * Alternatives for implementing similar features are are Servlet {@link Filter} - * s and {@link ApplicationContext.TransactionListener}s in Vaadin. - * - * @since 6.2 - * @see PortletRequestListener - */ -public interface HttpServletRequestListener extends Serializable { - - /** - * This method is called before {@link Terminal} applies the request to - * Application. - * - * @param request - * @param response - */ - public void onRequestStart(HttpServletRequest request, - HttpServletResponse response); - - /** - * This method is called at the end of each request. - * - * @param request - * @param response - */ - public void onRequestEnd(HttpServletRequest request, - HttpServletResponse response); -} \ No newline at end of file diff --git a/server/src/com/vaadin/server/PortletRequestListener.java b/server/src/com/vaadin/server/PortletRequestListener.java deleted file mode 100644 index 4562ddf7b9..0000000000 --- a/server/src/com/vaadin/server/PortletRequestListener.java +++ /dev/null @@ -1,66 +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.server; - -import java.io.Serializable; - -import javax.portlet.PortletRequest; -import javax.portlet.PortletResponse; -import javax.servlet.Filter; - -import com.vaadin.Application; - -/** - * An {@link Application} that implements this interface gets notified of - * request start and end by the terminal. It is quite similar to the - * {@link HttpServletRequestListener}, but the parameters are Portlet specific. - * If an Application is deployed as both a Servlet and a Portlet, one most - * likely needs to implement both. - *

- * Only JSR 286 style Portlets are supported. - *

- * The interface can be used for several helper tasks including: - *

    - *
  • Opening and closing database connections - *
  • Implementing {@link ThreadLocal} - *
  • Inter-portlet communication - *
- *

- * Alternatives for implementing similar features are are Servlet {@link Filter} - * s and {@link ApplicationContext.TransactionListener}s in Vaadin. - * - * @since 6.2 - * @see HttpServletRequestListener - */ -public interface PortletRequestListener extends Serializable { - - /** - * This method is called before {@link Terminal} applies the request to - * Application. - * - * @param requestData - * the {@link PortletRequest} about to change Application state - */ - public void onRequestStart(PortletRequest request, PortletResponse response); - - /** - * This method is called at the end of each request. - * - * @param requestData - * the {@link PortletRequest} - */ - public void onRequestEnd(PortletRequest request, PortletResponse response); -} \ No newline at end of file diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index 3b8e7cd7ba..bf8fb5dc84 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -457,7 +457,6 @@ public class VaadinPortlet extends GenericPortlet implements Constants { (ResourceResponse) response); } else { Application application = null; - boolean requestStarted = false; boolean applicationRunning = false; try { @@ -495,16 +494,6 @@ public class VaadinPortlet extends GenericPortlet implements Constants { applicationContext.getBrowser().updateRequestDetails( wrappedRequest); - /* - * Call application requestStart before Application.init() is - * called (bypasses the limitation in TransactionListener) - */ - if (application instanceof PortletRequestListener) { - ((PortletRequestListener) application).onRequestStart( - request, response); - requestStarted = true; - } - /* Start the newly created application */ startApplication(request, application, applicationContext); applicationRunning = true; @@ -605,20 +594,11 @@ public class VaadinPortlet extends GenericPortlet implements Constants { application.closeInactiveUIs(); } - // Notifies transaction end - try { - if (requestStarted) { - ((PortletRequestListener) application).onRequestEnd( - request, response); - - } - } finally { - CurrentInstance.clearAll(); + CurrentInstance.clearAll(); - PortletSession session = request.getPortletSession(false); - if (session != null) { - requestTimer.stop(getApplicationContext(session)); - } + PortletSession session = request.getPortletSession(false); + if (session != null) { + requestTimer.stop(getApplicationContext(session)); } } } diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index af66a3496e..ba19072503 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -286,7 +286,6 @@ public class VaadinServlet extends HttpServlet implements Constants { } Application application = null; - boolean requestStarted = false; boolean applicationRunning = false; try { @@ -336,16 +335,6 @@ public class VaadinServlet extends HttpServlet implements Constants { /* Update browser information from the request */ webApplicationContext.getBrowser().updateRequestDetails(request); - /* - * Call application requestStart before Application.init() is called - * (bypasses the limitation in TransactionListener) - */ - if (application instanceof HttpServletRequestListener) { - ((HttpServletRequestListener) application).onRequestStart( - request, response); - requestStarted = true; - } - // Start the application if it's newly created startApplication(request, application, webApplicationContext); applicationRunning = true; @@ -397,21 +386,12 @@ public class VaadinServlet extends HttpServlet implements Constants { application.closeInactiveUIs(); } - // Notifies transaction end - try { - if (requestStarted) { - ((HttpServletRequestListener) application).onRequestEnd( - request, response); - } - } finally { - CurrentInstance.clearAll(); + CurrentInstance.clearAll(); - HttpSession session = request.getSession(false); - if (session != null) { - requestTimer.stop(getApplicationContext(session)); - } + HttpSession session = request.getSession(false); + if (session != null) { + requestTimer.stop(getApplicationContext(session)); } - } } diff --git a/uitest/src/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java b/uitest/src/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java index 6d2623c199..6f21346b7d 100644 --- a/uitest/src/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java +++ b/uitest/src/com/vaadin/tests/components/window/AttachShouldBeCalledForSubWindows.java @@ -1,10 +1,7 @@ package com.vaadin.tests.components.window; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import com.vaadin.event.ShortcutAction.KeyCode; -import com.vaadin.server.HttpServletRequestListener; +import com.vaadin.server.WrappedRequest; import com.vaadin.tests.components.AbstractTestCase; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; @@ -14,9 +11,9 @@ import com.vaadin.ui.Component; import com.vaadin.ui.Label; import com.vaadin.ui.UI; import com.vaadin.ui.Window; +import com.vaadin.util.CurrentInstance; -public class AttachShouldBeCalledForSubWindows extends AbstractTestCase - implements HttpServletRequestListener { +public class AttachShouldBeCalledForSubWindows extends AbstractTestCase { private static final long serialVersionUID = 1L; private Log log = new Log(20); @@ -26,6 +23,13 @@ public class AttachShouldBeCalledForSubWindows extends AbstractTestCase @Override public void init() { + WrappedRequest request = CurrentInstance.get(WrappedRequest.class); + if (request.getParameter("attachMainFirst") != null) { + addSubWindowBeforeMainWindow = false; + } else { + addSubWindowBeforeMainWindow = true; + } + UI.LegacyWindow mainWindow = new UI.LegacyWindow() { @Override public void attach() { @@ -115,19 +119,4 @@ public class AttachShouldBeCalledForSubWindows extends AbstractTestCase return 8170; } - @Override - public void onRequestStart(HttpServletRequest request, - HttpServletResponse response) { - if (request.getParameter("attachMainFirst") != null) { - addSubWindowBeforeMainWindow = false; - } - - } - - @Override - public void onRequestEnd(HttpServletRequest request, - HttpServletResponse response) { - // TODO Auto-generated method stub - - } } -- cgit v1.2.3 From de3ac989c85451767510917822463353bcab71cd Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 5 Sep 2012 15:42:02 +0300 Subject: Change LegacyApplication to be a UIProvider (#9402) --- server/src/com/vaadin/Application.java | 184 +++++++++++++-------- .../src/com/vaadin/server/AbstractUIProvider.java | 5 + .../src/com/vaadin/server/LegacyVaadinPortlet.java | 62 +++++++ .../src/com/vaadin/server/LegacyVaadinServlet.java | 63 +++++++ .../com/vaadin/server/ServletPortletHelper.java | 38 +++-- server/src/com/vaadin/server/UIProvider.java | 19 +++ server/src/com/vaadin/server/VaadinPortlet.java | 49 +++--- server/src/com/vaadin/server/VaadinServlet.java | 67 ++++---- .../vaadin/launcher/ApplicationRunnerServlet.java | 25 ++- uitest/src/com/vaadin/tests/Parameters.java | 4 +- uitest/src/com/vaadin/tests/TestBench.java | 4 +- uitest/src/com/vaadin/tests/TreeFilesystem.java | 6 +- .../com/vaadin/tests/TreeFilesystemContainer.java | 6 +- .../com/vaadin/tests/appengine/GAESyncTest.java | 5 +- .../tests/application/RefreshStatePreserve.html | 7 +- .../tests/application/RefreshStatePreserve.java | 31 +--- .../tests/application/ThreadLocalInstances.html | 16 +- .../tests/application/ThreadLocalInstances.java | 28 +--- .../tests/components/AbstractTestApplication.java | 17 -- .../tests/components/AbstractTestUIProvider.java | 18 ++ .../AbstractComponentDataBindingTest.java | 3 +- .../loginform/LoginFormWithMultipleWindows.java | 15 +- .../vaadin/tests/components/ui/LazyInitUIs.java | 35 ++-- .../tests/components/ui/UIsInMultipleTabs.java | 36 ++-- .../layouts/layouttester/GridLayoutTests.java | 4 +- .../layouttester/HorizontalLayoutTests.java | 4 +- .../layouts/layouttester/VerticalLayoutTests.java | 4 +- .../v7a1/DifferentFeaturesForDifferentClients.java | 46 +++--- .../src/com/vaadin/tests/tickets/Ticket1589.java | 2 +- .../src/com/vaadin/tests/tickets/Ticket1921.java | 2 +- .../src/com/vaadin/tests/tickets/Ticket2292.java | 2 +- 31 files changed, 488 insertions(+), 319 deletions(-) create mode 100644 server/src/com/vaadin/server/LegacyVaadinPortlet.java create mode 100644 server/src/com/vaadin/server/LegacyVaadinServlet.java delete mode 100644 uitest/src/com/vaadin/tests/components/AbstractTestApplication.java create mode 100644 uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java (limited to 'uitest/src') diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java index 745d0ad784..634f96bfe1 100644 --- a/server/src/com/vaadin/Application.java +++ b/server/src/com/vaadin/Application.java @@ -58,6 +58,8 @@ import com.vaadin.server.GlobalResourceHandler; import com.vaadin.server.RequestHandler; import com.vaadin.server.ServletApplicationContext; import com.vaadin.server.Terminal; +import com.vaadin.server.Terminal.ErrorEvent; +import com.vaadin.server.Terminal.ErrorListener; import com.vaadin.server.UIProvider; import com.vaadin.server.VaadinServlet; import com.vaadin.server.VariableOwner; @@ -152,7 +154,8 @@ public class Application implements Terminal.ErrorListener, Serializable { * @since 7.0 */ @Deprecated - public static class LegacyApplication extends Application { + public static abstract class LegacyApplication extends AbstractUIProvider + implements ErrorListener { /** * Ignore initial / and then get everything up to the next / */ @@ -177,8 +180,8 @@ public class Application implements Terminal.ErrorListener, Serializable { "mainWindow has already been set"); } if (mainWindow.getApplication() == null) { - mainWindow.setApplication(this); - } else if (mainWindow.getApplication() != this) { + mainWindow.setApplication(Application.getCurrent()); + } else if (mainWindow.getApplication() != Application.getCurrent()) { throw new IllegalStateException( "mainWindow is attached to another application"); } @@ -190,45 +193,44 @@ public class Application implements Terminal.ErrorListener, Serializable { this.mainWindow = mainWindow; } + public void doInit() { + Application.getCurrent().setErrorHandler(this); + init(); + } + + protected abstract void init(); + @Override - public void start(ApplicationStartEvent event) { - super.start(event); - addUIProvider(new AbstractUIProvider() { - @Override - public Class getUIClass(Application application, - WrappedRequest request) { - if (application == LegacyApplication.this) { - UI uiInstance = getUIInstance(request); - if (uiInstance != null) { - return uiInstance.getClass(); - } - } - return null; - } + public Class getUIClass(Application application, + WrappedRequest request) { + UI uiInstance = getUIInstance(request); + if (uiInstance != null) { + return uiInstance.getClass(); + } + return null; + } - @Override - public UI createInstance(Application application, - Class type, WrappedRequest request) { - return getUIInstance(request); - } + @Override + public UI createInstance(Application application, + Class type, WrappedRequest request) { + return getUIInstance(request); + } - @Override - public String getThemeForUI(WrappedRequest request, - Class uiClass) { - return theme; - } + @Override + public String getThemeForUI(WrappedRequest request, + Class uiClass) { + return theme; + } - @Override - public String getPageTitleForUI(WrappedRequest request, - Class uiClass) { - UI uiInstance = getUIInstance(request); - if (uiInstance != null) { - return uiInstance.getCaption(); - } else { - return super.getPageTitleForUI(request, uiClass); - } - } - }); + @Override + public String getPageTitleForUI(WrappedRequest request, + Class uiClass) { + UI uiInstance = getUIInstance(request); + if (uiInstance != null) { + return uiInstance.getCaption(); + } else { + return super.getPageTitleForUI(request, uiClass); + } } /** @@ -273,7 +275,7 @@ public class Application implements Terminal.ErrorListener, Serializable { * {@inheritDoc} */ @Override - public UI getUIForRequest(WrappedRequest request) { + public UI getExistingUI(WrappedRequest request) { UI uiInstance = getUIInstance(request); if (uiInstance.getUIId() == -1) { // Not initialized -> Let go through createUIInstance to make it @@ -352,7 +354,7 @@ public class Application implements Terminal.ErrorListener, Serializable { } legacyUINames.put(uI.getName(), uI); - uI.setApplication(this); + uI.setApplication(Application.getCurrent()); } /** @@ -389,6 +391,27 @@ public class Application implements Terminal.ErrorListener, Serializable { public Collection getWindows() { return Collections.unmodifiableCollection(legacyUINames.values()); } + + @Override + public void terminalError(ErrorEvent event) { + Application.getCurrent().terminalError(event); + } + + public ApplicationContext getContext() { + return Application.getCurrent().getContext(); + } + + protected void close() { + Application.getCurrent().close(); + } + + public boolean isRunning() { + return Application.getCurrent().isRunning(); + } + + public URL getURL() { + return Application.getCurrent().getURL(); + } } /** @@ -1854,39 +1877,10 @@ public class Application implements Terminal.ErrorListener, Serializable { Integer uiId = getUIId(request); synchronized (this) { - BrowserDetails browserDetails = request.getBrowserDetails(); - boolean hasBrowserDetails = browserDetails != null - && browserDetails.getUriFragment() != null; - uI = uIs.get(uiId); - Class uiClass = null; - - if (uI == null && hasBrowserDetails - && !retainOnRefreshUIs.isEmpty()) { - uiClass = getUIClass(request); - - // Check for a known UI - - @SuppressWarnings("null") - String windowName = browserDetails.getWindowName(); - Integer retainedUIId = retainOnRefreshUIs.get(windowName); - - if (retainedUIId != null) { - UI retainedUI = uIs.get(retainedUIId); - // We've had the same UI instance in a window with this - // name, but should we still use it? - if (retainedUI.getClass() == uiClass) { - uiId = retainedUIId; - uI = retainedUI; - } else { - getLogger().info( - "Not using retained UI in " + windowName - + " because retained UI was of type " - + retainedUIId.getClass() + " but " - + uiClass - + " is expected for the request."); - } - } + + if (uI == null) { + uI = findExistingUi(request); } } // end synchronized block @@ -1896,6 +1890,48 @@ public class Application implements Terminal.ErrorListener, Serializable { return uI; } + private UI findExistingUi(WrappedRequest request) { + // Check if some UI provider has an existing UI available + for (int i = uiProviders.size() - 1; i >= 0; i--) { + UIProvider provider = uiProviders.get(i); + UI existingUi = provider.getExistingUI(request); + if (existingUi != null) { + return existingUi; + } + } + + BrowserDetails browserDetails = request.getBrowserDetails(); + boolean hasBrowserDetails = browserDetails != null + && browserDetails.getUriFragment() != null; + + if (hasBrowserDetails && !retainOnRefreshUIs.isEmpty()) { + // Check for a known UI + + @SuppressWarnings("null") + String windowName = browserDetails.getWindowName(); + Integer retainedUIId = retainOnRefreshUIs.get(windowName); + + if (retainedUIId != null) { + Class expectedUIClass = getUIClass(request); + UI retainedUI = uIs.get(retainedUIId); + // We've had the same UI instance in a window with this + // name, but should we still use it? + if (retainedUI.getClass() == expectedUIClass) { + return retainedUI; + } else { + getLogger().info( + "Not using retained UI in " + windowName + + " because retained UI was of type " + + retainedUIId.getClass() + " but " + + expectedUIClass + + " is expected for the request."); + } + } + } + + return null; + } + public UI createUI(WrappedRequest request) { Class uiClass = getUIClass(request); @@ -2167,4 +2203,8 @@ public class Application implements Terminal.ErrorListener, Serializable { return globalResourceHandler; } + public Collection getUIProviders() { + return Collections.unmodifiableCollection(uiProviders); + } + } diff --git a/server/src/com/vaadin/server/AbstractUIProvider.java b/server/src/com/vaadin/server/AbstractUIProvider.java index 49f8e3ec77..c7a137ebbd 100644 --- a/server/src/com/vaadin/server/AbstractUIProvider.java +++ b/server/src/com/vaadin/server/AbstractUIProvider.java @@ -115,4 +115,9 @@ public abstract class AbstractUIProvider implements UIProvider { return titleAnnotation.value(); } } + + @Override + public UI getExistingUI(WrappedRequest request) { + return null; + } } diff --git a/server/src/com/vaadin/server/LegacyVaadinPortlet.java b/server/src/com/vaadin/server/LegacyVaadinPortlet.java new file mode 100644 index 0000000000..036242a0c2 --- /dev/null +++ b/server/src/com/vaadin/server/LegacyVaadinPortlet.java @@ -0,0 +1,62 @@ +/* + * 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.server; + +import javax.portlet.PortletException; +import javax.portlet.PortletRequest; + +import com.vaadin.Application; +import com.vaadin.Application.LegacyApplication; +import com.vaadin.server.ServletPortletHelper.ApplicationClassException; + +public class LegacyVaadinPortlet extends VaadinPortlet { + + protected Class getApplicationClass() + throws ClassNotFoundException { + try { + return ServletPortletHelper + .getLegacyApplicationClass(getDeploymentConfiguration()); + } catch (ApplicationClassException e) { + throw new RuntimeException(e); + } + } + + protected LegacyApplication getNewApplication(PortletRequest request) + throws PortletException { + try { + Class applicationClass = getApplicationClass(); + return applicationClass.newInstance(); + } catch (Exception e) { + throw new PortletException(e); + } + } + + @Override + protected Application createApplication(PortletRequest request) + throws PortletException { + Application application = super.createApplication(request); + + // Must set current before running init() + Application.setCurrent(application); + + LegacyApplication legacyApplication = getNewApplication(request); + legacyApplication.doInit(); + application.addUIProvider(legacyApplication); + + return application; + } +} diff --git a/server/src/com/vaadin/server/LegacyVaadinServlet.java b/server/src/com/vaadin/server/LegacyVaadinServlet.java new file mode 100644 index 0000000000..f53e9d4bf0 --- /dev/null +++ b/server/src/com/vaadin/server/LegacyVaadinServlet.java @@ -0,0 +1,63 @@ +/* + * 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.server; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; + +import com.vaadin.Application; +import com.vaadin.Application.LegacyApplication; +import com.vaadin.server.ServletPortletHelper.ApplicationClassException; + +public class LegacyVaadinServlet extends VaadinServlet { + + protected Class getApplicationClass() + throws ClassNotFoundException { + try { + return ServletPortletHelper + .getLegacyApplicationClass(getDeploymentConfiguration()); + } catch (ApplicationClassException e) { + throw new RuntimeException(e); + } + } + + protected LegacyApplication getNewApplication(HttpServletRequest request) + throws ServletException { + try { + Class applicationClass = getApplicationClass(); + return applicationClass.newInstance(); + } catch (Exception e) { + throw new ServletException(e); + } + } + + @Override + protected Application createApplication(HttpServletRequest request) + throws ServletException { + Application application = super.createApplication(request); + + // Must set current before running init() + Application.setCurrent(application); + + LegacyApplication legacyApplication = getNewApplication(request); + legacyApplication.doInit(); + application.addUIProvider(legacyApplication); + + return application; + } + +} diff --git a/server/src/com/vaadin/server/ServletPortletHelper.java b/server/src/com/vaadin/server/ServletPortletHelper.java index 26913d8ba8..18fbb66114 100644 --- a/server/src/com/vaadin/server/ServletPortletHelper.java +++ b/server/src/com/vaadin/server/ServletPortletHelper.java @@ -4,6 +4,7 @@ import java.io.Serializable; import java.util.Properties; import com.vaadin.Application; +import com.vaadin.Application.LegacyApplication; import com.vaadin.shared.ApplicationConstants; import com.vaadin.ui.UI; @@ -41,28 +42,22 @@ class ServletPortletHelper implements Serializable { } } - static Class getApplicationClass( + static Class getLegacyApplicationClass( DeploymentConfiguration deploymentConfiguration) throws ApplicationClassException { Properties initParameters = deploymentConfiguration .getApplicationConfiguration().getInitParameters(); String applicationParameter = initParameters.getProperty("application"); - String uiParameter = initParameters - .getProperty(Application.UI_PARAMETER); ClassLoader classLoader = deploymentConfiguration.getClassLoader(); if (applicationParameter == null) { - - // Validate the parameter value - verifyUIClass(uiParameter, classLoader); - - // Application can be used if a valid rootLayout is defined - return Application.class; + throw new ApplicationClassException( + "No \"application\" init parameter found"); } try { - return (Class) classLoader - .loadClass(applicationParameter); + return classLoader.loadClass(applicationParameter).asSubclass( + LegacyApplication.class); } catch (final ClassNotFoundException e) { throw new ApplicationClassException( "Failed to load application class: " + applicationParameter, @@ -138,4 +133,25 @@ class ServletPortletHelper implements Serializable { ApplicationConstants.HEARTBEAT_REQUEST_PATH); } + public static void initDefaultUIProvider(Application application, + DeploymentConfiguration deploymentConfiguration) + throws ApplicationClassException { + String uiProperty = deploymentConfiguration + .getApplicationConfiguration().getInitParameters() + .getProperty(Application.UI_PARAMETER); + if (uiProperty != null) { + verifyUIClass(uiProperty, deploymentConfiguration.getClassLoader()); + application.addUIProvider(new DefaultUIProvider()); + } + } + + public static void checkUiProviders(Application newApplication) + throws ApplicationClassException { + if (newApplication.getUIProviders().isEmpty()) { + throw new ApplicationClassException( + "No UIProvider has been added to the application and there is no \"" + + Application.UI_PARAMETER + "\" init parameter."); + } + } + } diff --git a/server/src/com/vaadin/server/UIProvider.java b/server/src/com/vaadin/server/UIProvider.java index 60b79cdbb9..6a45b06c63 100644 --- a/server/src/com/vaadin/server/UIProvider.java +++ b/server/src/com/vaadin/server/UIProvider.java @@ -78,4 +78,23 @@ public interface UIProvider { public String getThemeForUI(WrappedRequest request, Class uiClass); + /** + * Finds an existing {@link UI} for a request. + *

+ * Implementations should take care to not return an UI instance that might + * be used in some other browser as that might cause synchronization issues + * when changes from one browser window are not present in the other. + *

+ * If no UI provider returns an existing UI, the framework does also check + * the window.name for an existing instance with + * {@link #isUiPreserved(WrappedRequest, Class)} before falling back to + * bootstrapping and creating a new UI instance. + * + * @param request + * the request for which a UI is desired + * @return a UI belonging to the request, or null if this UI + * provider doesn't have an existing UI for the request. + */ + public UI getExistingUI(WrappedRequest request); + } diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index bf8fb5dc84..eae01e9369 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -814,7 +814,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { if (restartApplication) { closeApplication(application, request.getPortletSession(false)); - return createApplication(request); + return createAndRegisterApplication(request); } else if (closeApplication) { closeApplication(application, request.getPortletSession(false)); return null; @@ -826,7 +826,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { // No existing application was found if (requestCanCreateApplication) { - return createApplication(request); + return createAndRegisterApplication(request); } else { throw new SessionExpiredException(); } @@ -845,9 +845,16 @@ public class VaadinPortlet extends GenericPortlet implements Constants { } } - private Application createApplication(PortletRequest request) + private Application createAndRegisterApplication(PortletRequest request) throws PortletException { - Application newApplication = getNewApplication(request); + Application newApplication = createApplication(request); + + try { + ServletPortletHelper.checkUiProviders(newApplication); + } catch (ApplicationClassException e) { + throw new PortletException(e); + } + final PortletApplicationContext2 context = getApplicationContext(request .getPortletSession()); context.setApplication(newApplication, new PortletCommunicationManager( @@ -855,6 +862,20 @@ public class VaadinPortlet extends GenericPortlet implements Constants { return newApplication; } + protected Application createApplication(PortletRequest request) + throws PortletException { + Application application = new Application(); + + try { + ServletPortletHelper.initDefaultUIProvider(application, + getDeploymentConfiguration()); + } catch (ApplicationClassException e) { + throw new PortletException(e); + } + + return application; + } + private Application getExistingApplication(PortletRequest request, boolean allowSessionCreation) throws MalformedURLException, SessionExpiredException { @@ -880,26 +901,6 @@ public class VaadinPortlet extends GenericPortlet implements Constants { return null; } - protected Class getApplicationClass() - throws ApplicationClassException { - return ServletPortletHelper - .getApplicationClass(getDeploymentConfiguration()); - } - - protected Application getNewApplication(PortletRequest request) - throws PortletException { - try { - final Application application = getApplicationClass().newInstance(); - return application; - } catch (final IllegalAccessException e) { - throw new PortletException("getNewApplication failed", e); - } catch (final InstantiationException e) { - throw new PortletException("getNewApplication failed", e); - } catch (final ApplicationClassException e) { - throw new PortletException("getNewApplication failed", e); - } - } - private void handleServiceException(WrappedPortletRequest request, WrappedPortletResponse response, Application application, Throwable e) throws IOException, PortletException { diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index ba19072503..8f33382110 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -603,7 +603,7 @@ public class VaadinServlet extends HttpServlet implements Constants { if (restartApplication) { closeApplication(application, request.getSession(false)); - return createApplication(request); + return createAndRegisterApplication(request); } else if (closeApplication) { closeApplication(application, request.getSession(false)); return null; @@ -619,7 +619,7 @@ public class VaadinServlet extends HttpServlet implements Constants { * If the request is such that it should create a new application if * one as not found, we do that. */ - return createApplication(request); + return createAndRegisterApplication(request); } else { /* * The application was not found and a new one should not be @@ -630,6 +630,24 @@ public class VaadinServlet extends HttpServlet implements Constants { } + private Application createAndRegisterApplication(HttpServletRequest request) + throws ServletException { + Application newApplication = createApplication(request); + + try { + ServletPortletHelper.checkUiProviders(newApplication); + } catch (ApplicationClassException e) { + throw new ServletException(e); + } + + final ServletApplicationContext context = getApplicationContext(request + .getSession()); + context.setApplication(newApplication, + createCommunicationManager(newApplication)); + + return newApplication; + } + /** * Check if the request should create an application if an existing * application is not found. @@ -699,14 +717,16 @@ public class VaadinServlet extends HttpServlet implements Constants { * @throws ServletException * @throws MalformedURLException */ - private Application createApplication(HttpServletRequest request) - throws ServletException, MalformedURLException { - Application newApplication = getNewApplication(request); + protected Application createApplication(HttpServletRequest request) + throws ServletException { + Application newApplication = new Application(); - final ServletApplicationContext context = getApplicationContext(request - .getSession()); - context.setApplication(newApplication, - createCommunicationManager(newApplication)); + try { + ServletPortletHelper.initDefaultUIProvider(newApplication, + getDeploymentConfiguration()); + } catch (ApplicationClassException e) { + throw new ServletException(e); + } return newApplication; } @@ -848,35 +868,6 @@ public class VaadinServlet extends HttpServlet implements Constants { log("Invalid security key received from " + request.getRemoteHost()); } - /** - * Creates a new application for the given request. - * - * @param request - * the HTTP request. - * @return A new Application instance. - * @throws ServletException - */ - protected Application getNewApplication(HttpServletRequest request) - throws ServletException { - - // Creates a new application instance - try { - Class applicationClass = ServletPortletHelper - .getApplicationClass(getDeploymentConfiguration()); - - final Application application = applicationClass.newInstance(); - application.addUIProvider(new DefaultUIProvider()); - - return application; - } catch (final IllegalAccessException e) { - throw new ServletException("getNewApplication failed", e); - } catch (final InstantiationException e) { - throw new ServletException("getNewApplication failed", e); - } catch (ApplicationClassException e) { - throw new ServletException("getNewApplication failed", e); - } - } - /** * Starts the application if it is not already running. * diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java index 3d63c7dfb9..3372651e5c 100644 --- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java +++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java @@ -30,16 +30,18 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.vaadin.Application; +import com.vaadin.Application.LegacyApplication; import com.vaadin.server.AbstractUIProvider; import com.vaadin.server.ApplicationConfiguration; -import com.vaadin.server.VaadinServlet; +import com.vaadin.server.LegacyVaadinServlet; +import com.vaadin.server.UIProvider; import com.vaadin.server.WrappedHttpServletRequest; import com.vaadin.server.WrappedRequest; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.UI; @SuppressWarnings("serial") -public class ApplicationRunnerServlet extends VaadinServlet { +public class ApplicationRunnerServlet extends LegacyVaadinServlet { /** * The name of the application class currently used. Only valid within one @@ -104,10 +106,14 @@ public class ApplicationRunnerServlet extends VaadinServlet { } @Override - protected Application getNewApplication(HttpServletRequest request) - throws ServletException { + protected Class getApplicationClass() + throws ClassNotFoundException { + return getClassToRun().asSubclass(LegacyApplication.class); + } - // Creates a new application instance + @Override + protected Application createApplication(HttpServletRequest request) + throws ServletException { try { final Class classToRun = getClassToRun(); if (UI.class.isAssignableFrom(classToRun)) { @@ -121,8 +127,13 @@ public class ApplicationRunnerServlet extends VaadinServlet { } }); return application; - } else if (Application.class.isAssignableFrom(classToRun)) { - return (Application) classToRun.newInstance(); + } else if (LegacyApplication.class.isAssignableFrom(classToRun)) { + return super.createApplication(request); + } else if (UIProvider.class.isAssignableFrom(classToRun)) { + Application application = new Application(); + application + .addUIProvider((UIProvider) classToRun.newInstance()); + return application; } else { throw new ServletException(classToRun.getCanonicalName() + " is neither an Application nor a UI"); diff --git a/uitest/src/com/vaadin/tests/Parameters.java b/uitest/src/com/vaadin/tests/Parameters.java index b16d4ef65b..f5ab18cfe3 100644 --- a/uitest/src/com/vaadin/tests/Parameters.java +++ b/uitest/src/com/vaadin/tests/Parameters.java @@ -30,8 +30,8 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Layout.MarginHandler; import com.vaadin.ui.Link; import com.vaadin.ui.Panel; -import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; +import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; /** @@ -56,7 +56,7 @@ public class Parameters extends com.vaadin.Application.LegacyApplication setMainWindow(main); // This class acts both as URI handler and parameter handler - addRequestHandler(this); + Application.getCurrent().addRequestHandler(this); final VerticalLayout layout = new VerticalLayout(); final Label info = new Label("To test URI and Parameter Handlers, " diff --git a/uitest/src/com/vaadin/tests/TestBench.java b/uitest/src/com/vaadin/tests/TestBench.java index 67e1180d75..bae677001a 100644 --- a/uitest/src/com/vaadin/tests/TestBench.java +++ b/uitest/src/com/vaadin/tests/TestBench.java @@ -37,8 +37,8 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Layout; import com.vaadin.ui.Link; import com.vaadin.ui.Panel; -import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Tree; +import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; /** @@ -225,7 +225,7 @@ public class TestBench extends com.vaadin.Application.LegacyApplication try { final Application.LegacyApplication app = (Application.LegacyApplication) c .newInstance(); - app.init(); + app.doInit(); Layout lo = (Layout) app.getMainWindow().getContent(); lo.setParent(null); return lo; diff --git a/uitest/src/com/vaadin/tests/TreeFilesystem.java b/uitest/src/com/vaadin/tests/TreeFilesystem.java index f2a0d97b08..2e7b215ad7 100644 --- a/uitest/src/com/vaadin/tests/TreeFilesystem.java +++ b/uitest/src/com/vaadin/tests/TreeFilesystem.java @@ -18,14 +18,15 @@ package com.vaadin.tests; import java.io.File; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.util.SampleDirectory; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; -import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Tree; import com.vaadin.ui.Tree.ExpandEvent; +import com.vaadin.ui.UI.LegacyWindow; /** * Browsable file explorer using Vaadin Tree component. Demonstrates: how to add @@ -61,7 +62,8 @@ public class TreeFilesystem extends com.vaadin.Application.LegacyApplication tree.addListener(this); // Get sample directory - final File sampleDir = SampleDirectory.getDirectory(this, main); + final File sampleDir = SampleDirectory.getDirectory( + Application.getCurrent(), main); // populate tree's root node with example directory if (sampleDir != null) { populateNode(sampleDir.getAbsolutePath(), null); diff --git a/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java b/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java index 672c518ea8..8107ea702d 100644 --- a/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java +++ b/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java @@ -18,6 +18,7 @@ package com.vaadin.tests; import java.io.File; +import com.vaadin.Application; import com.vaadin.data.util.FilesystemContainer; import com.vaadin.data.util.FilesystemContainer.FileItem; import com.vaadin.tests.util.SampleDirectory; @@ -26,8 +27,8 @@ import com.vaadin.ui.Component.Listener; import com.vaadin.ui.Field; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; -import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Tree; +import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; /** @@ -77,7 +78,8 @@ public class TreeFilesystemContainer extends propertyPanel.setEnabled(false); // Get sample directory - final File sampleDir = SampleDirectory.getDirectory(this, w); + final File sampleDir = SampleDirectory.getDirectory( + Application.getCurrent(), w); // Populate tree with FilesystemContainer final FilesystemContainer fsc = new FilesystemContainer(sampleDir, true); filesystem.setContainerDataSource(fsc); diff --git a/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java b/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java index a7d2b03415..2f81c08ae6 100644 --- a/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java +++ b/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java @@ -2,6 +2,7 @@ package com.vaadin.tests.appengine; import com.google.apphosting.api.DeadlineExceededException; import com.vaadin.Application; +import com.vaadin.Application.LegacyApplication; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.server.ClassResource; @@ -50,10 +51,10 @@ public class GAESyncTest extends Application.LegacyApplication { private static final long serialVersionUID = -6521351715072191625l; TextField tf; Label l; - Application app; + LegacyApplication app; GridLayout gl; - private IntrWindow(Application app) { + private IntrWindow(LegacyApplication app) { this.app = app; tf = new TextField("Echo thingie"); diff --git a/uitest/src/com/vaadin/tests/application/RefreshStatePreserve.html b/uitest/src/com/vaadin/tests/application/RefreshStatePreserve.html index 47e766e76a..ea8c0c93b6 100644 --- a/uitest/src/com/vaadin/tests/application/RefreshStatePreserve.html +++ b/uitest/src/com/vaadin/tests/application/RefreshStatePreserve.html @@ -18,7 +18,7 @@ assertText - vaadin=runcomvaadintestsapplicationRefreshStatePreserve::/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0] + vaadin=runcomvaadintestsapplicationRefreshStatePreserve::/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[1] UI id: 0 @@ -28,7 +28,7 @@ assertText - vaadin=runcomvaadintestsapplicationRefreshStatePreserve::/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0] + vaadin=runcomvaadintestsapplicationRefreshStatePreserve::/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[1] UI id: 0 @@ -43,10 +43,9 @@ assertText - vaadin=runcomvaadintestsapplicationRefreshStatePreserve::/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0] + vaadin=runcomvaadintestsapplicationRefreshStatePreserve::/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[1] UI id: 0 - diff --git a/uitest/src/com/vaadin/tests/application/RefreshStatePreserve.java b/uitest/src/com/vaadin/tests/application/RefreshStatePreserve.java index 8962f5de9a..13ceceab6c 100644 --- a/uitest/src/com/vaadin/tests/application/RefreshStatePreserve.java +++ b/uitest/src/com/vaadin/tests/application/RefreshStatePreserve.java @@ -1,35 +1,18 @@ package com.vaadin.tests.application; -import com.vaadin.Application; import com.vaadin.annotations.PreserveOnRefresh; -import com.vaadin.server.AbstractUIProvider; import com.vaadin.server.WrappedRequest; -import com.vaadin.tests.components.AbstractTestApplication; +import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Label; -import com.vaadin.ui.UI; -public class RefreshStatePreserve extends AbstractTestApplication { - @PreserveOnRefresh - public static class RefreshStateUI extends UI { - @Override - public void init(WrappedRequest request) { - getContent().addComponent( - new Label("window.name: " - + request.getBrowserDetails().getWindowName())); - getContent().addComponent(new Label("UI id: " + getUIId())); - } - } +@PreserveOnRefresh +public class RefreshStatePreserve extends AbstractTestUI { @Override - public void init() { - super.init(); - addUIProvider(new AbstractUIProvider() { - @Override - public Class getUIClass(Application application, - WrappedRequest request) { - return RefreshStateUI.class; - } - }); + protected void setup(WrappedRequest request) { + addComponent(new Label("window.name: " + + request.getBrowserDetails().getWindowName())); + addComponent(new Label("UI id: " + getUIId())); } @Override diff --git a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.html b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.html index b7fbca4c04..0d3a746152 100644 --- a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.html +++ b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.html @@ -29,7 +29,7 @@ assertText vaadin=runcomvaadintestsapplicationThreadLocalInstances::PID_SLog_row_15 - 1. null app in class init + 1. some app in class init assertText @@ -39,7 +39,7 @@ assertText vaadin=runcomvaadintestsapplicationThreadLocalInstances::PID_SLog_row_13 - 3. null app in app constructor + 3. some app in app constructor assertText @@ -49,7 +49,7 @@ assertText vaadin=runcomvaadintestsapplicationThreadLocalInstances::PID_SLog_row_11 - 5. this app in app init + 5. some app in app init assertText @@ -59,7 +59,7 @@ assertText vaadin=runcomvaadintestsapplicationThreadLocalInstances::PID_SLog_row_9 - 7. this app in root init + 7. some app in root init assertText @@ -69,7 +69,7 @@ assertText vaadin=runcomvaadintestsapplicationThreadLocalInstances::PID_SLog_row_7 - 9. this app in root paint + 9. some app in root paint assertText @@ -79,7 +79,7 @@ assertText vaadin=runcomvaadintestsapplicationThreadLocalInstances::PID_SLog_row_5 - 11. this app in background thread + 11. some app in background thread assertText @@ -89,7 +89,7 @@ assertText vaadin=runcomvaadintestsapplicationThreadLocalInstances::PID_SLog_row_3 - 13. this app in resource handler + 13. some app in resource handler assertText @@ -99,7 +99,7 @@ assertText vaadin=runcomvaadintestsapplicationThreadLocalInstances::PID_SLog_row_1 - 15. this app in button listener + 15. some app in button listener assertText diff --git a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java index bad5b53478..1eda9e54fe 100644 --- a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java +++ b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java @@ -1,24 +1,24 @@ package com.vaadin.tests.application; import com.vaadin.Application; -import com.vaadin.server.AbstractUIProvider; import com.vaadin.server.DownloadStream; import com.vaadin.server.PaintException; import com.vaadin.server.WrappedRequest; -import com.vaadin.tests.components.AbstractTestApplication; +import com.vaadin.tests.components.AbstractTestCase; import com.vaadin.tests.integration.FlagSeResource; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Embedded; import com.vaadin.ui.UI; +import com.vaadin.ui.UI.LegacyWindow; -public class ThreadLocalInstances extends AbstractTestApplication { +public class ThreadLocalInstances extends AbstractTestCase { private static final Application staticInitApplication = Application .getCurrent(); private static final UI staticInitRoot = UI.getCurrent(); - private final UI mainWindow = new UI() { + private final LegacyWindow mainWindow = new LegacyWindow() { boolean paintReported = false; @Override @@ -71,25 +71,13 @@ public class ThreadLocalInstances extends AbstractTestApplication { } @Override - public void init() { + protected void init() { reportCurrentStatus("app init"); - addUIProvider(new AbstractUIProvider() { - @Override - public UI createInstance(Application application, - Class type, WrappedRequest request) { - return mainWindow; - } - - @Override - public Class getUIClass(Application application, - WrappedRequest request) { - return mainWindow.getClass(); - } - }); + setMainWindow(mainWindow); } @Override - protected String getTestDescription() { + protected String getDescription() { return "Tests the precence of Application.getCurrentApplication() and UI.getCurrentRoot() from different contexts"; } @@ -113,7 +101,7 @@ public class ThreadLocalInstances extends AbstractTestApplication { } else if (value == reference) { return "this"; } else { - return value.toString(); + return "some"; } } diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestApplication.java b/uitest/src/com/vaadin/tests/components/AbstractTestApplication.java deleted file mode 100644 index db17c67fdd..0000000000 --- a/uitest/src/com/vaadin/tests/components/AbstractTestApplication.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.vaadin.tests.components; - -import com.vaadin.Application; -import com.vaadin.server.ApplicationContext; -import com.vaadin.server.WebBrowser; - -public abstract class AbstractTestApplication extends Application { - protected abstract String getTestDescription(); - - protected abstract Integer getTicketNumber(); - - protected WebBrowser getBrowser() { - ApplicationContext context = getContext(); - WebBrowser webBrowser = context.getBrowser(); - return webBrowser; - } -} diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java b/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java new file mode 100644 index 0000000000..3d380c7835 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java @@ -0,0 +1,18 @@ +package com.vaadin.tests.components; + +import com.vaadin.Application; +import com.vaadin.server.AbstractUIProvider; +import com.vaadin.server.ApplicationContext; +import com.vaadin.server.WebBrowser; + +public abstract class AbstractTestUIProvider extends AbstractUIProvider { + protected abstract String getTestDescription(); + + protected abstract Integer getTicketNumber(); + + protected WebBrowser getBrowser() { + ApplicationContext context = Application.getCurrent().getContext(); + WebBrowser webBrowser = context.getBrowser(); + return webBrowser; + } +} diff --git a/uitest/src/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java b/uitest/src/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java index 9b29ae1bab..327ed0f86b 100644 --- a/uitest/src/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java +++ b/uitest/src/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java @@ -4,6 +4,7 @@ import java.util.HashSet; import java.util.Locale; import java.util.Set; +import com.vaadin.Application; import com.vaadin.data.Container; import com.vaadin.data.Item; import com.vaadin.data.Property.ValueChangeEvent; @@ -54,7 +55,7 @@ public abstract class AbstractComponentDataBindingTest extends TestBase } protected void updateLocale(Locale locale) { - setLocale(locale); + Application.getCurrent().setLocale(locale); for (Component c : fields) { removeComponent(c); } diff --git a/uitest/src/com/vaadin/tests/components/loginform/LoginFormWithMultipleWindows.java b/uitest/src/com/vaadin/tests/components/loginform/LoginFormWithMultipleWindows.java index 84c14763ab..f640b3f9c4 100644 --- a/uitest/src/com/vaadin/tests/components/loginform/LoginFormWithMultipleWindows.java +++ b/uitest/src/com/vaadin/tests/components/loginform/LoginFormWithMultipleWindows.java @@ -1,26 +1,17 @@ package com.vaadin.tests.components.loginform; -import com.vaadin.Application; -import com.vaadin.server.AbstractUIProvider; -import com.vaadin.server.WrappedRequest; +import com.vaadin.Application.LegacyApplication; import com.vaadin.ui.LoginForm; import com.vaadin.ui.LoginForm.LoginEvent; import com.vaadin.ui.LoginForm.LoginListener; -import com.vaadin.ui.UI; import com.vaadin.ui.UI.LegacyWindow; @SuppressWarnings("serial") -public class LoginFormWithMultipleWindows extends Application { +public class LoginFormWithMultipleWindows extends LegacyApplication { @Override public void init() { - addUIProvider(new AbstractUIProvider() { - @Override - public Class getUIClass(Application application, - WrappedRequest request) { - return LoginFormWindow.class; - } - }); + setMainWindow(new LoginFormWindow()); } public static class LoginFormWindow extends LegacyWindow { diff --git a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java index f33037f171..b141dc0990 100644 --- a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java +++ b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java @@ -1,16 +1,15 @@ package com.vaadin.tests.components.ui; import com.vaadin.Application; -import com.vaadin.server.AbstractUIProvider; import com.vaadin.server.ExternalResource; import com.vaadin.server.WrappedRequest; import com.vaadin.shared.ui.label.ContentMode; -import com.vaadin.tests.components.AbstractTestApplication; +import com.vaadin.tests.components.AbstractTestUIProvider; import com.vaadin.ui.Label; import com.vaadin.ui.Link; import com.vaadin.ui.UI; -public class LazyInitUIs extends AbstractTestApplication { +public class LazyInitUIs extends AbstractTestUIProvider { // @EagerInit private static class EagerInitUI extends UI { @@ -21,21 +20,15 @@ public class LazyInitUIs extends AbstractTestApplication { } @Override - public void init() { - addUIProvider(new AbstractUIProvider() { - - @Override - public UI createInstance(Application application, - Class type, WrappedRequest request) { - return getUI(request); - } + public UI createInstance(Application application, Class type, + WrappedRequest request) { + return getUI(request); + } - @Override - public Class getUIClass(Application application, - WrappedRequest request) { - return getUI(request).getClass(); - } - }); + @Override + public Class getUIClass(Application application, + WrappedRequest request) { + return getUI(request).getClass(); } private UI getUI(WrappedRequest request) { @@ -59,14 +52,14 @@ public class LazyInitUIs extends AbstractTestApplication { addComponent(getRequestInfo("NormalUI", request)); Link lazyCreateLink = new Link("Open lazyCreate UI", - new ExternalResource(getURL() - + "?lazyCreate#lazyCreate")); + new ExternalResource(Application.getCurrent() + .getURL() + "?lazyCreate#lazyCreate")); lazyCreateLink.setTargetName("_blank"); addComponent(lazyCreateLink); Link lazyInitLink = new Link("Open eagerInit UI", - new ExternalResource(getURL() - + "?eagerInit#eagerInit")); + new ExternalResource(Application.getCurrent() + .getURL() + "?eagerInit#eagerInit")); lazyInitLink.setTargetName("_blank"); addComponent(lazyInitLink); } diff --git a/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java b/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java index fe2fe16d93..9a66e9ad0a 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java +++ b/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java @@ -1,34 +1,40 @@ package com.vaadin.tests.components.ui; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; + import com.vaadin.Application; -import com.vaadin.server.AbstractUIProvider; import com.vaadin.server.WrappedRequest; -import com.vaadin.tests.components.AbstractTestApplication; +import com.vaadin.tests.components.AbstractTestUIProvider; import com.vaadin.ui.Label; import com.vaadin.ui.UI; -public class UIsInMultipleTabs extends AbstractTestApplication { - private int numberOfUIsOpened; +public class UIsInMultipleTabs extends AbstractTestUIProvider { + // No cleanup -> will leak, but shouldn't matter for tests + private static ConcurrentHashMap numberOfUIsOpened = new ConcurrentHashMap(); public static class TabUI extends UI { @Override protected void init(WrappedRequest request) { - UIsInMultipleTabs application = (UIsInMultipleTabs) getApplication(); - String message = "This is UI number " - + ++application.numberOfUIsOpened; + Application application = Application.getCurrent(); + AtomicInteger count = numberOfUIsOpened.get(application); + if (count == null) { + numberOfUIsOpened.putIfAbsent(application, new AtomicInteger()); + // Get our added instance or another instance that was added by + // another thread between previous get and putIfAbsent + count = numberOfUIsOpened.get(application); + } + int currentCount = count.incrementAndGet(); + String message = "This is UI number " + currentCount; addComponent(new Label(message)); } } - public UIsInMultipleTabs() { - addUIProvider(new AbstractUIProvider() { - @Override - public Class getUIClass(Application application, - WrappedRequest request) { - return TabUI.class; - } - }); + @Override + public Class getUIClass(Application application, + WrappedRequest request) { + return TabUI.class; } @Override diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java index 8da94feb7f..4470404105 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java @@ -2,7 +2,7 @@ package com.vaadin.tests.layouts.layouttester; import java.util.Date; -import com.vaadin.Application; +import com.vaadin.Application.LegacyApplication; import com.vaadin.server.Resource; import com.vaadin.server.SystemError; import com.vaadin.server.ThemeResource; @@ -32,7 +32,7 @@ public class GridLayoutTests extends AbstractLayoutTests { private AbstractComponent rc1, col1, col2, col3, row1, row2, row3, x3, x22; - public GridLayoutTests(Application application) { + public GridLayoutTests(LegacyApplication application) { super(); } diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java index 0042f0ba11..eb0976dfb9 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java @@ -1,6 +1,6 @@ package com.vaadin.tests.layouts.layouttester; -import com.vaadin.Application; +import com.vaadin.Application.LegacyApplication; import com.vaadin.server.Resource; import com.vaadin.server.SystemError; import com.vaadin.server.ThemeResource; @@ -26,7 +26,7 @@ import com.vaadin.ui.themes.Reindeer; public class HorizontalLayoutTests extends AbstractLayoutTests { - public HorizontalLayoutTests(Application application) { + public HorizontalLayoutTests(LegacyApplication application) { super(); } diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java index 3e668289fe..f6cf3a4bae 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java @@ -1,6 +1,6 @@ package com.vaadin.tests.layouts.layouttester; -import com.vaadin.Application; +import com.vaadin.Application.LegacyApplication; import com.vaadin.server.Resource; import com.vaadin.server.SystemError; import com.vaadin.server.ThemeResource; @@ -26,7 +26,7 @@ import com.vaadin.ui.VerticalLayout; public class VerticalLayoutTests extends AbstractLayoutTests { - public VerticalLayoutTests(Application application) { + public VerticalLayoutTests(LegacyApplication application) { super(); } diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java index 8c2a816e1c..05da2506e8 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java @@ -31,35 +31,29 @@ import com.vaadin.ui.UI; * @author Vaadin Ltd * @since 7.0.0 */ -public class DifferentFeaturesForDifferentClients extends Application { +public class DifferentFeaturesForDifferentClients extends AbstractUIProvider { @Override - public void init() { - super.init(); - addUIProvider(new AbstractUIProvider() { - @Override - public Class getUIClass(Application application, - WrappedRequest request) { - // could also use browser version etc. - if (request.getHeader("user-agent").contains("mobile")) { - return TouchRoot.class; - } else { - return DefaultRoot.class; - } - } + public Class getUIClass(Application application, + WrappedRequest request) { + // could also use browser version etc. + if (request.getHeader("user-agent").contains("mobile")) { + return TouchRoot.class; + } else { + return DefaultRoot.class; + } + } - // Must override as default implementation isn't allowed to - // instantiate our non-public classes - @Override - public UI createInstance(Application application, - Class type, WrappedRequest request) { - try { - return type.newInstance(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }); + // Must override as default implementation isn't allowed to + // instantiate our non-public classes + @Override + public UI createInstance(Application application, Class type, + WrappedRequest request) { + try { + return type.newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } } } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1589.java b/uitest/src/com/vaadin/tests/tickets/Ticket1589.java index 37f9197285..7cbe8cb6cf 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1589.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1589.java @@ -28,7 +28,7 @@ public class Ticket1589 extends Application.LegacyApplication { MyDynamicResource res = new MyDynamicResource(); - addRequestHandler(res); + Application.getCurrent().addRequestHandler(res); w.addComponent(new Link( "Test (without Content-Disposition, should suggest generatedFile.png when saving, browser default for actual disposition)", diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1921.java b/uitest/src/com/vaadin/tests/tickets/Ticket1921.java index ac5f990915..17314c3fb6 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1921.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1921.java @@ -42,7 +42,7 @@ public class Ticket1921 extends Application.LegacyApplication implements newState(); - addRequestHandler(this); + Application.getCurrent().addRequestHandler(this); } public void newState() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2292.java b/uitest/src/com/vaadin/tests/tickets/Ticket2292.java index ce7960a169..f3b5b68491 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2292.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2292.java @@ -44,7 +44,7 @@ public class Ticket2292 extends com.vaadin.Application.LegacyApplication Link l = new Link("l", icon); main.addComponent(l); - addRequestHandler(this); + Application.getCurrent().addRequestHandler(this); } @Override -- cgit v1.2.3 From 3ddaf280d61642742dff3f4a63376d0eedca5abf Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 5 Sep 2012 15:45:16 +0300 Subject: Move LegacyApplication to its own file (#9402) --- server/src/com/vaadin/Application.java | 278 ------------------- server/src/com/vaadin/LegacyApplication.java | 306 +++++++++++++++++++++ .../src/com/vaadin/server/LegacyVaadinPortlet.java | 2 +- .../src/com/vaadin/server/LegacyVaadinServlet.java | 2 +- .../com/vaadin/server/ServletPortletHelper.java | 2 +- server/src/com/vaadin/ui/UI.java | 3 +- .../component/window/AddRemoveSubWindow.java | 4 +- .../vaadin/launcher/ApplicationRunnerServlet.java | 2 +- uitest/src/com/vaadin/tests/Components.java | 4 +- uitest/src/com/vaadin/tests/CustomLayoutDemo.java | 3 +- uitest/src/com/vaadin/tests/LayoutDemo.java | 3 +- uitest/src/com/vaadin/tests/ListenerOrder.java | 3 +- uitest/src/com/vaadin/tests/ModalWindow.java | 3 +- uitest/src/com/vaadin/tests/NativeWindowing.java | 4 +- uitest/src/com/vaadin/tests/Parameters.java | 3 +- .../src/com/vaadin/tests/RandomLayoutStress.java | 3 +- .../src/com/vaadin/tests/ScrollbarStressTest.java | 4 +- uitest/src/com/vaadin/tests/TestBench.java | 6 +- ...ApplicationLayoutThatUsesWholeBrosersSpace.java | 4 +- .../com/vaadin/tests/TestForNativeWindowing.java | 4 +- .../src/com/vaadin/tests/TestForStyledUpload.java | 4 +- .../com/vaadin/tests/TestSetVisibleAndCaching.java | 3 +- .../com/vaadin/tests/TestSizeableIncomponents.java | 4 +- uitest/src/com/vaadin/tests/TestSplitPanel.java | 3 +- uitest/src/com/vaadin/tests/TreeFilesystem.java | 3 +- .../com/vaadin/tests/TreeFilesystemContainer.java | 3 +- .../src/com/vaadin/tests/UsingObjectsInSelect.java | 3 +- .../com/vaadin/tests/appengine/GAESyncTest.java | 5 +- .../vaadin/tests/components/AbstractTestCase.java | 4 +- .../combobox/ComboBoxReapperingOldValue.java | 4 +- .../UndefinedWideFormWithRelativeWideFooter.java | 4 +- .../loginform/LoginFormWithMultipleWindows.java | 2 +- .../components/table/TableFirstRowFlicker.java | 2 +- .../textfield/TextFieldInLayoutInTable.java | 4 +- .../sqlcontainer/CheckboxUpdateProblem.java | 4 +- .../sqlcontainer/ComboBoxUpdateProblem.java | 4 +- .../sqlcontainer/MassInsertMemoryLeakTestApp.java | 4 +- .../integration/IntegrationTestApplication.java | 4 +- .../integration/JSR286PortletApplication.java | 4 +- .../vaadin/tests/integration/LiferayThemeDemo.java | 4 +- ...tletSizeInLiferayFreeformLayoutApplication.java | 2 +- .../tests/layouts/GridLayoutInsidePanel2.java | 4 +- .../layouts/layouttester/GridLayoutTests.java | 2 +- .../layouttester/HorizontalLayoutTests.java | 2 +- .../layouts/layouttester/VerticalLayoutTests.java | 2 +- .../src/com/vaadin/tests/themes/ButtonsTest.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1225.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1230.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket124.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1245.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1365.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1368.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1397.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1435.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1444.java | 4 +- .../tests/tickets/Ticket1465ModalNotification.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1519.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1572.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1581.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1589.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1598.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket161.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1632.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1659.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1663.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1673.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1710.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1737.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1767.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1772.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1775.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1804.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1805.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1806.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1811.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1819.java | 3 +- .../tests/tickets/Ticket1834PanelScrolling.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1857.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1868.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1869.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1878.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1900.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1904.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1916.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1919.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1921.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1923.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1925.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1939.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1940.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1953.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1966.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1966_2.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1966_3.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1969.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1970.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1972.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1973.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1973_2.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1975.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1982.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1983.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1986.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1991.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket1995.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket20.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2001.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2002.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2007.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2009.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket2011.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2014.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2021.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2022.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2023.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket2024.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2026.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2029.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2037.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket2038.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2040.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket2042.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2043.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2048.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2051.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2053.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2060.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2061.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2061b.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2061c.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2062.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2083.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2090.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2095.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2098.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2099.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2101.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2103.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2104.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2106.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2107.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2117.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2119.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2125.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2126.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket2151.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2157.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2178.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2179.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2180.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2181.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2186.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2204.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2208.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2209.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2209OL.java | 4 +- .../com/vaadin/tests/tickets/Ticket2209OL2.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2215.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2221.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2222.java | 4 +- .../tickets/Ticket2227OrderedlayoutInTable.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2231.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2232.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2234.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2235.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2240.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2242.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2244.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2245.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2267.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2271.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2282.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2283.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2289.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2292.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket2294.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2296.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2303.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2304.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2310.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2319.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2323.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2325.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2329.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2337.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2339.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2341.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket2344.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2347.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2364.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2365.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2398.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2404.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2405.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2406.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2407.java | 3 +- .../src/com/vaadin/tests/tickets/Ticket2411.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2415.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2420.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2425.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2426.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2431.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2432.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2434.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2436.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2526.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2742.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2901.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2998.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket3146.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket34.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket5053.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket5157.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket5952.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket677.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket695.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket736.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket846.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket932.java | 4 +- 219 files changed, 731 insertions(+), 658 deletions(-) create mode 100644 server/src/com/vaadin/LegacyApplication.java (limited to 'uitest/src') diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java index 634f96bfe1..2baf252a62 100644 --- a/server/src/com/vaadin/Application.java +++ b/server/src/com/vaadin/Application.java @@ -31,19 +31,15 @@ import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Map.Entry; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import com.vaadin.data.util.converter.Converter; import com.vaadin.data.util.converter.ConverterFactory; import com.vaadin.data.util.converter.DefaultConverterFactory; import com.vaadin.event.EventRouter; import com.vaadin.server.AbstractErrorMessage; -import com.vaadin.server.AbstractUIProvider; import com.vaadin.server.ApplicationConfiguration; import com.vaadin.server.ApplicationContext; import com.vaadin.server.BootstrapFragmentResponse; @@ -58,8 +54,6 @@ import com.vaadin.server.GlobalResourceHandler; import com.vaadin.server.RequestHandler; import com.vaadin.server.ServletApplicationContext; import com.vaadin.server.Terminal; -import com.vaadin.server.Terminal.ErrorEvent; -import com.vaadin.server.Terminal.ErrorListener; import com.vaadin.server.UIProvider; import com.vaadin.server.VaadinServlet; import com.vaadin.server.VariableOwner; @@ -142,278 +136,6 @@ public class Application implements Terminal.ErrorListener, Serializable { .findMethod(BootstrapListener.class, "modifyBootstrapPage", BootstrapPageResponse.class); - /** - * A special application designed to help migrating applications from Vaadin - * 6 to Vaadin 7. The legacy application supports setting a main window, - * adding additional browser level windows and defining the theme for the - * entire application. - * - * @deprecated This class is only intended to ease migration and should not - * be used for new projects. - * - * @since 7.0 - */ - @Deprecated - public static abstract class LegacyApplication extends AbstractUIProvider - implements ErrorListener { - /** - * Ignore initial / and then get everything up to the next / - */ - private static final Pattern WINDOW_NAME_PATTERN = Pattern - .compile("^/?([^/]+).*"); - - private UI.LegacyWindow mainWindow; - private String theme; - - private Map legacyUINames = new HashMap(); - - /** - * Sets the main window of this application. Setting window as a main - * window of this application also adds the window to this application. - * - * @param mainWindow - * the UI to set as the default window - */ - public void setMainWindow(UI.LegacyWindow mainWindow) { - if (this.mainWindow != null) { - throw new IllegalStateException( - "mainWindow has already been set"); - } - if (mainWindow.getApplication() == null) { - mainWindow.setApplication(Application.getCurrent()); - } else if (mainWindow.getApplication() != Application.getCurrent()) { - throw new IllegalStateException( - "mainWindow is attached to another application"); - } - if (UI.getCurrent() == null) { - // Assume setting a main window from Application.init if there's - // no current UI -> set the main window as the current UI - UI.setCurrent(mainWindow); - } - this.mainWindow = mainWindow; - } - - public void doInit() { - Application.getCurrent().setErrorHandler(this); - init(); - } - - protected abstract void init(); - - @Override - public Class getUIClass(Application application, - WrappedRequest request) { - UI uiInstance = getUIInstance(request); - if (uiInstance != null) { - return uiInstance.getClass(); - } - return null; - } - - @Override - public UI createInstance(Application application, - Class type, WrappedRequest request) { - return getUIInstance(request); - } - - @Override - public String getThemeForUI(WrappedRequest request, - Class uiClass) { - return theme; - } - - @Override - public String getPageTitleForUI(WrappedRequest request, - Class uiClass) { - UI uiInstance = getUIInstance(request); - if (uiInstance != null) { - return uiInstance.getCaption(); - } else { - return super.getPageTitleForUI(request, uiClass); - } - } - - /** - * Gets the mainWindow of the application. - * - *

- * The main window is the window attached to the application URL ( - * {@link #getURL()}) and thus which is show by default to the user. - *

- *

- * Note that each application must have at least one main window. - *

- * - * @return the UI used as the default window - */ - public UI.LegacyWindow getMainWindow() { - return mainWindow; - } - - private UI getUIInstance(WrappedRequest request) { - String pathInfo = request.getRequestPathInfo(); - String name = null; - if (pathInfo != null && pathInfo.length() > 0) { - Matcher matcher = WINDOW_NAME_PATTERN.matcher(pathInfo); - if (matcher.matches()) { - // Skip the initial slash - name = matcher.group(1); - } - } - UI.LegacyWindow window = getWindow(name); - if (window != null) { - return window; - } - return mainWindow; - } - - /** - * This implementation simulates the way of finding a window for a - * request by extracting a window name from the requested path and - * passes that name to {@link #getWindow(String)}. - *

- * {@inheritDoc} - */ - @Override - public UI getExistingUI(WrappedRequest request) { - UI uiInstance = getUIInstance(request); - if (uiInstance.getUIId() == -1) { - // Not initialized -> Let go through createUIInstance to make it - // initialized - return null; - } else { - UI.setCurrent(uiInstance); - return uiInstance; - } - } - - /** - * Sets the application's theme. - *

- * Note that this theme can be overridden for a specific UI with - * {@link Application#getThemeForUI(UI)}. Setting theme to be - * null selects the default theme. For the available theme - * names, see the contents of the VAADIN/themes directory. - *

- * - * @param theme - * the new theme for this application. - */ - public void setTheme(String theme) { - this.theme = theme; - } - - /** - * Gets the application's theme. The application's theme is the default - * theme used by all the uIs for which a theme is not explicitly - * defined. If the application theme is not explicitly set, - * null is returned. - * - * @return the name of the application's theme. - */ - public String getTheme() { - return theme; - } - - /** - *

- * Gets a UI by name. Returns null if the application is - * not running or it does not contain a window corresponding to the - * name. - *

- * - * @param name - * the name of the requested window - * @return a UI corresponding to the name, or null to use - * the default window - */ - public UI.LegacyWindow getWindow(String name) { - return legacyUINames.get(name); - } - - /** - * Counter to get unique names for windows with no explicit name - */ - private int namelessUIIndex = 0; - - /** - * Adds a new browser level window to this application. Please note that - * UI doesn't have a name that is used in the URL - to add a named - * window you should instead use {@link #addWindow(UI, String)} - * - * @param uI - * the UI window to add to the application - * @return returns the name that has been assigned to the window - * - * @see #addWindow(UI, String) - */ - public void addWindow(UI.LegacyWindow uI) { - if (uI.getName() == null) { - String name = Integer.toString(namelessUIIndex++); - uI.setName(name); - } - - legacyUINames.put(uI.getName(), uI); - uI.setApplication(Application.getCurrent()); - } - - /** - * Removes the specified window from the application. This also removes - * all name mappings for the window (see {@link #addWindow(UI, String) - * and #getWindowName(UI)}. - * - *

- * Note that removing window from the application does not close the - * browser window - the window is only removed from the server-side. - *

- * - * @param uI - * the UI to remove - */ - public void removeWindow(UI.LegacyWindow uI) { - for (Entry entry : legacyUINames - .entrySet()) { - if (entry.getValue() == uI) { - legacyUINames.remove(entry.getKey()); - } - } - } - - /** - * Gets the set of windows contained by the application. - * - *

- * Note that the returned set of windows can not be modified. - *

- * - * @return the unmodifiable collection of windows. - */ - public Collection getWindows() { - return Collections.unmodifiableCollection(legacyUINames.values()); - } - - @Override - public void terminalError(ErrorEvent event) { - Application.getCurrent().terminalError(event); - } - - public ApplicationContext getContext() { - return Application.getCurrent().getContext(); - } - - protected void close() { - Application.getCurrent().close(); - } - - public boolean isRunning() { - return Application.getCurrent().isRunning(); - } - - public URL getURL() { - return Application.getCurrent().getURL(); - } - } - /** * An event sent to {@link #start(ApplicationStartEvent)} when a new * Application is being started. diff --git a/server/src/com/vaadin/LegacyApplication.java b/server/src/com/vaadin/LegacyApplication.java new file mode 100644 index 0000000000..5bfc466fa4 --- /dev/null +++ b/server/src/com/vaadin/LegacyApplication.java @@ -0,0 +1,306 @@ +/* + * 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; + +import java.net.URL; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.vaadin.server.AbstractUIProvider; +import com.vaadin.server.ApplicationContext; +import com.vaadin.server.WrappedRequest; +import com.vaadin.server.Terminal.ErrorEvent; +import com.vaadin.server.Terminal.ErrorListener; +import com.vaadin.ui.UI; +import com.vaadin.ui.UI.LegacyWindow; + +/** + * A special application designed to help migrating applications from Vaadin + * 6 to Vaadin 7. The legacy application supports setting a main window, + * adding additional browser level windows and defining the theme for the + * entire application. + * + * @deprecated This class is only intended to ease migration and should not + * be used for new projects. + * + * @since 7.0 + */ +@Deprecated +public abstract class LegacyApplication extends AbstractUIProvider + implements ErrorListener { + /** + * Ignore initial / and then get everything up to the next / + */ + private static final Pattern WINDOW_NAME_PATTERN = Pattern + .compile("^/?([^/]+).*"); + + private UI.LegacyWindow mainWindow; + private String theme; + + private Map legacyUINames = new HashMap(); + + /** + * Sets the main window of this application. Setting window as a main + * window of this application also adds the window to this application. + * + * @param mainWindow + * the UI to set as the default window + */ + public void setMainWindow(UI.LegacyWindow mainWindow) { + if (this.mainWindow != null) { + throw new IllegalStateException( + "mainWindow has already been set"); + } + if (mainWindow.getApplication() == null) { + mainWindow.setApplication(Application.getCurrent()); + } else if (mainWindow.getApplication() != Application.getCurrent()) { + throw new IllegalStateException( + "mainWindow is attached to another application"); + } + if (UI.getCurrent() == null) { + // Assume setting a main window from Application.init if there's + // no current UI -> set the main window as the current UI + UI.setCurrent(mainWindow); + } + this.mainWindow = mainWindow; + } + + public void doInit() { + Application.getCurrent().setErrorHandler(this); + init(); + } + + protected abstract void init(); + + @Override + public Class getUIClass(Application application, + WrappedRequest request) { + UI uiInstance = getUIInstance(request); + if (uiInstance != null) { + return uiInstance.getClass(); + } + return null; + } + + @Override + public UI createInstance(Application application, + Class type, WrappedRequest request) { + return getUIInstance(request); + } + + @Override + public String getThemeForUI(WrappedRequest request, + Class uiClass) { + return theme; + } + + @Override + public String getPageTitleForUI(WrappedRequest request, + Class uiClass) { + UI uiInstance = getUIInstance(request); + if (uiInstance != null) { + return uiInstance.getCaption(); + } else { + return super.getPageTitleForUI(request, uiClass); + } + } + + /** + * Gets the mainWindow of the application. + * + *

+ * The main window is the window attached to the application URL ( + * {@link #getURL()}) and thus which is show by default to the user. + *

+ *

+ * Note that each application must have at least one main window. + *

+ * + * @return the UI used as the default window + */ + public UI.LegacyWindow getMainWindow() { + return mainWindow; + } + + private UI getUIInstance(WrappedRequest request) { + String pathInfo = request.getRequestPathInfo(); + String name = null; + if (pathInfo != null && pathInfo.length() > 0) { + Matcher matcher = WINDOW_NAME_PATTERN.matcher(pathInfo); + if (matcher.matches()) { + // Skip the initial slash + name = matcher.group(1); + } + } + UI.LegacyWindow window = getWindow(name); + if (window != null) { + return window; + } + return mainWindow; + } + + /** + * This implementation simulates the way of finding a window for a + * request by extracting a window name from the requested path and + * passes that name to {@link #getWindow(String)}. + *

+ * {@inheritDoc} + */ + @Override + public UI getExistingUI(WrappedRequest request) { + UI uiInstance = getUIInstance(request); + if (uiInstance.getUIId() == -1) { + // Not initialized -> Let go through createUIInstance to make it + // initialized + return null; + } else { + UI.setCurrent(uiInstance); + return uiInstance; + } + } + + /** + * Sets the application's theme. + *

+ * Note that this theme can be overridden for a specific UI with + * {@link Application#getThemeForUI(UI)}. Setting theme to be + * null selects the default theme. For the available theme + * names, see the contents of the VAADIN/themes directory. + *

+ * + * @param theme + * the new theme for this application. + */ + public void setTheme(String theme) { + this.theme = theme; + } + + /** + * Gets the application's theme. The application's theme is the default + * theme used by all the uIs for which a theme is not explicitly + * defined. If the application theme is not explicitly set, + * null is returned. + * + * @return the name of the application's theme. + */ + public String getTheme() { + return theme; + } + + /** + *

+ * Gets a UI by name. Returns null if the application is + * not running or it does not contain a window corresponding to the + * name. + *

+ * + * @param name + * the name of the requested window + * @return a UI corresponding to the name, or null to use + * the default window + */ + public UI.LegacyWindow getWindow(String name) { + return legacyUINames.get(name); + } + + /** + * Counter to get unique names for windows with no explicit name + */ + private int namelessUIIndex = 0; + + /** + * Adds a new browser level window to this application. Please note that + * UI doesn't have a name that is used in the URL - to add a named + * window you should instead use {@link #addWindow(UI, String)} + * + * @param uI + * the UI window to add to the application + * @return returns the name that has been assigned to the window + * + * @see #addWindow(UI, String) + */ + public void addWindow(UI.LegacyWindow uI) { + if (uI.getName() == null) { + String name = Integer.toString(namelessUIIndex++); + uI.setName(name); + } + + legacyUINames.put(uI.getName(), uI); + uI.setApplication(Application.getCurrent()); + } + + /** + * Removes the specified window from the application. This also removes + * all name mappings for the window (see {@link #addWindow(UI, String) + * and #getWindowName(UI)}. + * + *

+ * Note that removing window from the application does not close the + * browser window - the window is only removed from the server-side. + *

+ * + * @param uI + * the UI to remove + */ + public void removeWindow(UI.LegacyWindow uI) { + for (Entry entry : legacyUINames + .entrySet()) { + if (entry.getValue() == uI) { + legacyUINames.remove(entry.getKey()); + } + } + } + + /** + * Gets the set of windows contained by the application. + * + *

+ * Note that the returned set of windows can not be modified. + *

+ * + * @return the unmodifiable collection of windows. + */ + public Collection getWindows() { + return Collections.unmodifiableCollection(legacyUINames.values()); + } + + @Override + public void terminalError(ErrorEvent event) { + Application.getCurrent().terminalError(event); + } + + public ApplicationContext getContext() { + return Application.getCurrent().getContext(); + } + + protected void close() { + Application.getCurrent().close(); + } + + public boolean isRunning() { + return Application.getCurrent().isRunning(); + } + + public URL getURL() { + return Application.getCurrent().getURL(); + } +} \ No newline at end of file diff --git a/server/src/com/vaadin/server/LegacyVaadinPortlet.java b/server/src/com/vaadin/server/LegacyVaadinPortlet.java index 036242a0c2..7de38eaf94 100644 --- a/server/src/com/vaadin/server/LegacyVaadinPortlet.java +++ b/server/src/com/vaadin/server/LegacyVaadinPortlet.java @@ -20,7 +20,7 @@ import javax.portlet.PortletException; import javax.portlet.PortletRequest; import com.vaadin.Application; -import com.vaadin.Application.LegacyApplication; +import com.vaadin.LegacyApplication; import com.vaadin.server.ServletPortletHelper.ApplicationClassException; public class LegacyVaadinPortlet extends VaadinPortlet { diff --git a/server/src/com/vaadin/server/LegacyVaadinServlet.java b/server/src/com/vaadin/server/LegacyVaadinServlet.java index f53e9d4bf0..21419a2e33 100644 --- a/server/src/com/vaadin/server/LegacyVaadinServlet.java +++ b/server/src/com/vaadin/server/LegacyVaadinServlet.java @@ -20,7 +20,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import com.vaadin.Application; -import com.vaadin.Application.LegacyApplication; +import com.vaadin.LegacyApplication; import com.vaadin.server.ServletPortletHelper.ApplicationClassException; public class LegacyVaadinServlet extends VaadinServlet { diff --git a/server/src/com/vaadin/server/ServletPortletHelper.java b/server/src/com/vaadin/server/ServletPortletHelper.java index 18fbb66114..28a63fe35b 100644 --- a/server/src/com/vaadin/server/ServletPortletHelper.java +++ b/server/src/com/vaadin/server/ServletPortletHelper.java @@ -4,7 +4,7 @@ import java.io.Serializable; import java.util.Properties; import com.vaadin.Application; -import com.vaadin.Application.LegacyApplication; +import com.vaadin.LegacyApplication; import com.vaadin.shared.ApplicationConstants; import com.vaadin.ui.UI; diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index e016e9432c..7389a898eb 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -28,6 +28,7 @@ import java.util.LinkedHashSet; import java.util.Map; import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; import com.vaadin.event.ActionManager; @@ -89,7 +90,7 @@ public abstract class UI extends AbstractComponentContainer implements /** * Helper class to emulate the main window from Vaadin 6 using UIs. This * class should be used in the same way as Window used as a browser level - * window in Vaadin 6 with {@link com.vaadin.Application.LegacyApplication} + * window in Vaadin 6 with {@link com.vaadin.LegacyApplication} */ @Deprecated public static class LegacyWindow extends UI { diff --git a/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java b/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java index 88bc28bbc8..9ee4ffe6e7 100644 --- a/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java +++ b/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java @@ -6,14 +6,14 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.UI; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Window; public class AddRemoveSubWindow { - public class TestApp extends Application.LegacyApplication { + public class TestApp extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java index 3372651e5c..a9a988f296 100644 --- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java +++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java @@ -30,7 +30,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.vaadin.Application; -import com.vaadin.Application.LegacyApplication; +import com.vaadin.LegacyApplication; import com.vaadin.server.AbstractUIProvider; import com.vaadin.server.ApplicationConfiguration; import com.vaadin.server.LegacyVaadinServlet; diff --git a/uitest/src/com/vaadin/tests/Components.java b/uitest/src/com/vaadin/tests/Components.java index 7ac1b55d35..5d534a4dd8 100644 --- a/uitest/src/com/vaadin/tests/Components.java +++ b/uitest/src/com/vaadin/tests/Components.java @@ -9,7 +9,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.data.util.DefaultItemSorter; import com.vaadin.data.util.HierarchicalContainer; @@ -30,7 +30,7 @@ import com.vaadin.ui.Tree.ItemStyleGenerator; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Components extends Application.LegacyApplication { +public class Components extends LegacyApplication { private static final Object CAPTION = "c"; private Map, String> tests = new HashMap, String>(); diff --git a/uitest/src/com/vaadin/tests/CustomLayoutDemo.java b/uitest/src/com/vaadin/tests/CustomLayoutDemo.java index 833340f678..8f11233f38 100644 --- a/uitest/src/com/vaadin/tests/CustomLayoutDemo.java +++ b/uitest/src/com/vaadin/tests/CustomLayoutDemo.java @@ -16,6 +16,7 @@ package com.vaadin.tests; +import com.vaadin.LegacyApplication; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -43,7 +44,7 @@ import com.vaadin.ui.Tree; * @since 4.0.0 * */ -public class CustomLayoutDemo extends com.vaadin.Application.LegacyApplication +public class CustomLayoutDemo extends com.vaadin.LegacyApplication implements Listener { private CustomLayout mainLayout = null; diff --git a/uitest/src/com/vaadin/tests/LayoutDemo.java b/uitest/src/com/vaadin/tests/LayoutDemo.java index a5331b94af..28cf4a922b 100644 --- a/uitest/src/com/vaadin/tests/LayoutDemo.java +++ b/uitest/src/com/vaadin/tests/LayoutDemo.java @@ -16,6 +16,7 @@ package com.vaadin.tests; +import com.vaadin.LegacyApplication; import com.vaadin.server.ClassResource; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Component; @@ -37,7 +38,7 @@ import com.vaadin.ui.VerticalLayout; * @since 4.0.0 * */ -public class LayoutDemo extends com.vaadin.Application.LegacyApplication { +public class LayoutDemo extends com.vaadin.LegacyApplication { /** * Initialize Application. Demo components are added to main window. diff --git a/uitest/src/com/vaadin/tests/ListenerOrder.java b/uitest/src/com/vaadin/tests/ListenerOrder.java index ab364a8781..c58fa17373 100644 --- a/uitest/src/com/vaadin/tests/ListenerOrder.java +++ b/uitest/src/com/vaadin/tests/ListenerOrder.java @@ -3,6 +3,7 @@ package com.vaadin.tests; import java.util.HashMap; import java.util.Iterator; +import com.vaadin.LegacyApplication; import com.vaadin.data.Container.ItemSetChangeEvent; import com.vaadin.data.Container.ItemSetChangeListener; import com.vaadin.data.Container.PropertySetChangeEvent; @@ -16,7 +17,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Select; -public class ListenerOrder extends com.vaadin.Application.LegacyApplication +public class ListenerOrder extends com.vaadin.LegacyApplication implements Button.ClickListener, PropertySetChangeListener, ItemSetChangeListener, ValueChangeListener { diff --git a/uitest/src/com/vaadin/tests/ModalWindow.java b/uitest/src/com/vaadin/tests/ModalWindow.java index 6153f14285..558989e069 100644 --- a/uitest/src/com/vaadin/tests/ModalWindow.java +++ b/uitest/src/com/vaadin/tests/ModalWindow.java @@ -16,6 +16,7 @@ package com.vaadin.tests; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -34,7 +35,7 @@ import com.vaadin.ui.Window; * @see com.vaadin.ui.Window * @see com.vaadin.ui.Label */ -public class ModalWindow extends com.vaadin.Application.LegacyApplication +public class ModalWindow extends com.vaadin.LegacyApplication implements ClickListener { private Window test; diff --git a/uitest/src/com/vaadin/tests/NativeWindowing.java b/uitest/src/com/vaadin/tests/NativeWindowing.java index 2418c74db8..95b42b7ce5 100644 --- a/uitest/src/com/vaadin/tests/NativeWindowing.java +++ b/uitest/src/com/vaadin/tests/NativeWindowing.java @@ -19,7 +19,7 @@ package com.vaadin.tests; import java.net.MalformedURLException; import java.net.URL; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -27,7 +27,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Window; -public class NativeWindowing extends Application.LegacyApplication { +public class NativeWindowing extends LegacyApplication { LegacyWindow main = new LegacyWindow("Windowing test"); diff --git a/uitest/src/com/vaadin/tests/Parameters.java b/uitest/src/com/vaadin/tests/Parameters.java index f5ab18cfe3..901b0a6dd7 100644 --- a/uitest/src/com/vaadin/tests/Parameters.java +++ b/uitest/src/com/vaadin/tests/Parameters.java @@ -22,6 +22,7 @@ import java.util.Iterator; import java.util.Map; import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.ExternalResource; import com.vaadin.server.RequestHandler; import com.vaadin.server.WrappedRequest; @@ -41,7 +42,7 @@ import com.vaadin.ui.VerticalLayout; * * @since 3.1.1 */ -public class Parameters extends com.vaadin.Application.LegacyApplication +public class Parameters extends com.vaadin.LegacyApplication implements RequestHandler { private final Label context = new Label(); diff --git a/uitest/src/com/vaadin/tests/RandomLayoutStress.java b/uitest/src/com/vaadin/tests/RandomLayoutStress.java index 0b6b0cf8ba..1bbb35b9e3 100644 --- a/uitest/src/com/vaadin/tests/RandomLayoutStress.java +++ b/uitest/src/com/vaadin/tests/RandomLayoutStress.java @@ -18,6 +18,7 @@ package com.vaadin.tests; import java.util.Random; +import com.vaadin.LegacyApplication; import com.vaadin.server.ExternalResource; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.Button; @@ -43,7 +44,7 @@ import com.vaadin.ui.VerticalLayout; * */ public class RandomLayoutStress extends - com.vaadin.Application.LegacyApplication { + com.vaadin.LegacyApplication { private final Random seededRandom = new Random(1); diff --git a/uitest/src/com/vaadin/tests/ScrollbarStressTest.java b/uitest/src/com/vaadin/tests/ScrollbarStressTest.java index 7436bfc539..831a863d5b 100644 --- a/uitest/src/com/vaadin/tests/ScrollbarStressTest.java +++ b/uitest/src/com/vaadin/tests/ScrollbarStressTest.java @@ -1,6 +1,6 @@ package com.vaadin.tests; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Accordion; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -17,7 +17,7 @@ import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalSplitPanel; import com.vaadin.ui.Window; -public class ScrollbarStressTest extends Application.LegacyApplication { +public class ScrollbarStressTest extends LegacyApplication { final LegacyWindow main = new LegacyWindow("Scrollbar Stress Test"); diff --git a/uitest/src/com/vaadin/tests/TestBench.java b/uitest/src/com/vaadin/tests/TestBench.java index bae677001a..d5b603db39 100644 --- a/uitest/src/com/vaadin/tests/TestBench.java +++ b/uitest/src/com/vaadin/tests/TestBench.java @@ -24,7 +24,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property; import com.vaadin.data.util.HierarchicalContainer; import com.vaadin.server.ExternalResource; @@ -51,7 +51,7 @@ import com.vaadin.ui.VerticalLayout; * @author Vaadin Ltd. * */ -public class TestBench extends com.vaadin.Application.LegacyApplication +public class TestBench extends com.vaadin.LegacyApplication implements Property.ValueChangeListener { // Add here packages which are used for finding testable classes @@ -223,7 +223,7 @@ public class TestBench extends com.vaadin.Application.LegacyApplication private Component createTestable(Class c) { try { - final Application.LegacyApplication app = (Application.LegacyApplication) c + final LegacyApplication app = (LegacyApplication) c .newInstance(); app.doInit(); Layout lo = (Layout) app.getMainWindow().getContent(); diff --git a/uitest/src/com/vaadin/tests/TestForApplicationLayoutThatUsesWholeBrosersSpace.java b/uitest/src/com/vaadin/tests/TestForApplicationLayoutThatUsesWholeBrosersSpace.java index c3fa269fba..99ae361471 100644 --- a/uitest/src/com/vaadin/tests/TestForApplicationLayoutThatUsesWholeBrosersSpace.java +++ b/uitest/src/com/vaadin/tests/TestForApplicationLayoutThatUsesWholeBrosersSpace.java @@ -16,7 +16,7 @@ package com.vaadin.tests; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.HorizontalSplitPanel; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; @@ -25,7 +25,7 @@ import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalSplitPanel; public class TestForApplicationLayoutThatUsesWholeBrosersSpace extends - Application.LegacyApplication { + LegacyApplication { LegacyWindow main = new LegacyWindow("Windowing test"); diff --git a/uitest/src/com/vaadin/tests/TestForNativeWindowing.java b/uitest/src/com/vaadin/tests/TestForNativeWindowing.java index cef9269b53..f7bad7cd19 100644 --- a/uitest/src/com/vaadin/tests/TestForNativeWindowing.java +++ b/uitest/src/com/vaadin/tests/TestForNativeWindowing.java @@ -19,7 +19,7 @@ package com.vaadin.tests; import java.net.MalformedURLException; import java.net.URL; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -27,7 +27,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Window; -public class TestForNativeWindowing extends Application.LegacyApplication { +public class TestForNativeWindowing extends LegacyApplication { LegacyWindow main = new LegacyWindow("Windowing test"); diff --git a/uitest/src/com/vaadin/tests/TestForStyledUpload.java b/uitest/src/com/vaadin/tests/TestForStyledUpload.java index 14fe7902aa..53bb6d37c2 100644 --- a/uitest/src/com/vaadin/tests/TestForStyledUpload.java +++ b/uitest/src/com/vaadin/tests/TestForStyledUpload.java @@ -26,7 +26,7 @@ import java.io.OutputStream; import java.lang.management.ManagementFactory; import java.lang.management.MemoryMXBean; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.StreamResource; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Button; @@ -48,7 +48,7 @@ import com.vaadin.ui.Upload.SucceededEvent; import com.vaadin.ui.Upload.SucceededListener; import com.vaadin.ui.VerticalLayout; -public class TestForStyledUpload extends Application.LegacyApplication +public class TestForStyledUpload extends LegacyApplication implements Upload.FinishedListener, FailedListener, SucceededListener, StartedListener { diff --git a/uitest/src/com/vaadin/tests/TestSetVisibleAndCaching.java b/uitest/src/com/vaadin/tests/TestSetVisibleAndCaching.java index 6bb8bac200..1edf7b2d88 100644 --- a/uitest/src/com/vaadin/tests/TestSetVisibleAndCaching.java +++ b/uitest/src/com/vaadin/tests/TestSetVisibleAndCaching.java @@ -16,6 +16,7 @@ package com.vaadin.tests; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -24,7 +25,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; public class TestSetVisibleAndCaching extends - com.vaadin.Application.LegacyApplication { + com.vaadin.LegacyApplication { Panel panelA = new Panel("Panel A"); Panel panelB = new Panel("Panel B"); diff --git a/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java b/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java index 6121647bc1..b9de56e35c 100644 --- a/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java +++ b/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java @@ -21,7 +21,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Iterator; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Container; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.util.IndexedContainer; @@ -41,7 +41,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class TestSizeableIncomponents extends Application.LegacyApplication { +public class TestSizeableIncomponents extends LegacyApplication { private IndexedContainer cont; private ComboBox select; diff --git a/uitest/src/com/vaadin/tests/TestSplitPanel.java b/uitest/src/com/vaadin/tests/TestSplitPanel.java index 4b0b47ed74..52f2538343 100644 --- a/uitest/src/com/vaadin/tests/TestSplitPanel.java +++ b/uitest/src/com/vaadin/tests/TestSplitPanel.java @@ -16,11 +16,12 @@ package com.vaadin.tests; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalSplitPanel; -public class TestSplitPanel extends com.vaadin.Application.LegacyApplication { +public class TestSplitPanel extends com.vaadin.LegacyApplication { VerticalSplitPanel verticalSplit = new VerticalSplitPanel(); diff --git a/uitest/src/com/vaadin/tests/TreeFilesystem.java b/uitest/src/com/vaadin/tests/TreeFilesystem.java index 2e7b215ad7..096952c74c 100644 --- a/uitest/src/com/vaadin/tests/TreeFilesystem.java +++ b/uitest/src/com/vaadin/tests/TreeFilesystem.java @@ -19,6 +19,7 @@ package com.vaadin.tests; import java.io.File; import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.util.SampleDirectory; @@ -37,7 +38,7 @@ import com.vaadin.ui.UI.LegacyWindow; * @since 4.0.0 * */ -public class TreeFilesystem extends com.vaadin.Application.LegacyApplication +public class TreeFilesystem extends com.vaadin.LegacyApplication implements Tree.ExpandListener { // Filesystem explorer panel and it's components diff --git a/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java b/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java index 8107ea702d..baf73b4383 100644 --- a/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java +++ b/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java @@ -19,6 +19,7 @@ package com.vaadin.tests; import java.io.File; import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.util.FilesystemContainer; import com.vaadin.data.util.FilesystemContainer.FileItem; import com.vaadin.tests.util.SampleDirectory; @@ -42,7 +43,7 @@ import com.vaadin.ui.VerticalLayout; * */ public class TreeFilesystemContainer extends - com.vaadin.Application.LegacyApplication implements Listener { + com.vaadin.LegacyApplication implements Listener { // Filesystem explorer panel and it's components private final Panel explorerPanel = new Panel("Filesystem explorer"); diff --git a/uitest/src/com/vaadin/tests/UsingObjectsInSelect.java b/uitest/src/com/vaadin/tests/UsingObjectsInSelect.java index c5a836b4f1..1b0fc93a55 100644 --- a/uitest/src/com/vaadin/tests/UsingObjectsInSelect.java +++ b/uitest/src/com/vaadin/tests/UsingObjectsInSelect.java @@ -19,6 +19,7 @@ package com.vaadin.tests; import java.util.LinkedList; import java.util.Random; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.shared.ui.label.ContentMode; @@ -28,7 +29,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Select; public class UsingObjectsInSelect extends - com.vaadin.Application.LegacyApplication implements ValueChangeListener { + com.vaadin.LegacyApplication implements ValueChangeListener { private final Select select = new Select(); private final Label selectedTask = new Label("Selected task", diff --git a/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java b/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java index 2f81c08ae6..19b872cb2f 100644 --- a/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java +++ b/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java @@ -1,8 +1,7 @@ package com.vaadin.tests.appengine; import com.google.apphosting.api.DeadlineExceededException; -import com.vaadin.Application; -import com.vaadin.Application.LegacyApplication; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.server.ClassResource; @@ -16,7 +15,7 @@ import com.vaadin.ui.Notification; import com.vaadin.ui.TextField; import com.vaadin.ui.UI.LegacyWindow; -public class GAESyncTest extends Application.LegacyApplication { +public class GAESyncTest extends LegacyApplication { /** * diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestCase.java b/uitest/src/com/vaadin/tests/components/AbstractTestCase.java index f51c74d4a8..6f539af016 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestCase.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestCase.java @@ -1,10 +1,10 @@ package com.vaadin.tests.components; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.ApplicationContext; import com.vaadin.server.WebBrowser; -public abstract class AbstractTestCase extends Application.LegacyApplication { +public abstract class AbstractTestCase extends LegacyApplication { protected abstract String getDescription(); diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxReapperingOldValue.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxReapperingOldValue.java index 10afb05ae3..cba699b701 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxReapperingOldValue.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxReapperingOldValue.java @@ -1,6 +1,6 @@ package com.vaadin.tests.components.combobox; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Container; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; @@ -12,7 +12,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; @SuppressWarnings("serial") -public class ComboBoxReapperingOldValue extends Application.LegacyApplication +public class ComboBoxReapperingOldValue extends LegacyApplication implements ValueChangeListener { ComboBox cbox1 = new ComboBox(); diff --git a/uitest/src/com/vaadin/tests/components/form/UndefinedWideFormWithRelativeWideFooter.java b/uitest/src/com/vaadin/tests/components/form/UndefinedWideFormWithRelativeWideFooter.java index b34db2170e..9608db5772 100644 --- a/uitest/src/com/vaadin/tests/components/form/UndefinedWideFormWithRelativeWideFooter.java +++ b/uitest/src/com/vaadin/tests/components/form/UndefinedWideFormWithRelativeWideFooter.java @@ -1,6 +1,6 @@ package com.vaadin.tests.components.form; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; import com.vaadin.ui.Form; @@ -10,7 +10,7 @@ import com.vaadin.ui.TextField; @SuppressWarnings("serial") public class UndefinedWideFormWithRelativeWideFooter extends - Application.LegacyApplication { + LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/components/loginform/LoginFormWithMultipleWindows.java b/uitest/src/com/vaadin/tests/components/loginform/LoginFormWithMultipleWindows.java index f640b3f9c4..e469d13e07 100644 --- a/uitest/src/com/vaadin/tests/components/loginform/LoginFormWithMultipleWindows.java +++ b/uitest/src/com/vaadin/tests/components/loginform/LoginFormWithMultipleWindows.java @@ -1,6 +1,6 @@ package com.vaadin.tests.components.loginform; -import com.vaadin.Application.LegacyApplication; +import com.vaadin.LegacyApplication; import com.vaadin.ui.LoginForm; import com.vaadin.ui.LoginForm.LoginEvent; import com.vaadin.ui.LoginForm.LoginListener; diff --git a/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java b/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java index 90df5610eb..30b878b7eb 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java +++ b/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java @@ -1,6 +1,6 @@ package com.vaadin.tests.components.table; -import com.vaadin.Application.LegacyApplication; +import com.vaadin.LegacyApplication; import com.vaadin.data.Container; import com.vaadin.data.util.IndexedContainer; import com.vaadin.ui.Label; diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java b/uitest/src/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java index 903226c87c..135c00182e 100644 --- a/uitest/src/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java +++ b/uitest/src/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java @@ -1,6 +1,6 @@ package com.vaadin.tests.components.textfield; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Component; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; @@ -8,7 +8,7 @@ import com.vaadin.ui.Table; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class TextFieldInLayoutInTable extends Application.LegacyApplication { +public class TextFieldInLayoutInTable extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/containers/sqlcontainer/CheckboxUpdateProblem.java b/uitest/src/com/vaadin/tests/containers/sqlcontainer/CheckboxUpdateProblem.java index 0c1fdc23f6..9c2a6f387c 100644 --- a/uitest/src/com/vaadin/tests/containers/sqlcontainer/CheckboxUpdateProblem.java +++ b/uitest/src/com/vaadin/tests/containers/sqlcontainer/CheckboxUpdateProblem.java @@ -2,7 +2,7 @@ package com.vaadin.tests.containers.sqlcontainer; import java.sql.SQLException; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Container.ItemSetChangeEvent; import com.vaadin.data.Container.ItemSetChangeListener; import com.vaadin.data.Item; @@ -15,7 +15,7 @@ import com.vaadin.ui.HorizontalSplitPanel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; -public class CheckboxUpdateProblem extends Application.LegacyApplication +public class CheckboxUpdateProblem extends LegacyApplication implements Property.ValueChangeListener { private final DatabaseHelper databaseHelper = new DatabaseHelper(); private Table testList; diff --git a/uitest/src/com/vaadin/tests/containers/sqlcontainer/ComboBoxUpdateProblem.java b/uitest/src/com/vaadin/tests/containers/sqlcontainer/ComboBoxUpdateProblem.java index aec0f0e28e..edaefeb0c3 100644 --- a/uitest/src/com/vaadin/tests/containers/sqlcontainer/ComboBoxUpdateProblem.java +++ b/uitest/src/com/vaadin/tests/containers/sqlcontainer/ComboBoxUpdateProblem.java @@ -1,6 +1,6 @@ package com.vaadin.tests.containers.sqlcontainer; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.AbstractSelect.Filtering; import com.vaadin.ui.ComboBox; import com.vaadin.ui.UI; @@ -8,7 +8,7 @@ import com.vaadin.ui.UI; /** * See http://dev.vaadin.com/ticket/9155 . */ -public class ComboBoxUpdateProblem extends Application.LegacyApplication { +public class ComboBoxUpdateProblem extends LegacyApplication { private final DatabaseHelper databaseHelper = new DatabaseHelper(); @Override diff --git a/uitest/src/com/vaadin/tests/containers/sqlcontainer/MassInsertMemoryLeakTestApp.java b/uitest/src/com/vaadin/tests/containers/sqlcontainer/MassInsertMemoryLeakTestApp.java index 8bb2ba1092..3a07a89302 100644 --- a/uitest/src/com/vaadin/tests/containers/sqlcontainer/MassInsertMemoryLeakTestApp.java +++ b/uitest/src/com/vaadin/tests/containers/sqlcontainer/MassInsertMemoryLeakTestApp.java @@ -2,7 +2,7 @@ package com.vaadin.tests.containers.sqlcontainer; import java.sql.SQLException; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.util.sqlcontainer.SQLContainer; import com.vaadin.data.util.sqlcontainer.connection.JDBCConnectionPool; import com.vaadin.data.util.sqlcontainer.connection.SimpleJDBCConnectionPool; @@ -25,7 +25,7 @@ import com.vaadin.ui.VerticalLayout; // +-------------+-------------+------+-----+---------+----------------+ @SuppressWarnings("serial") -public class MassInsertMemoryLeakTestApp extends Application.LegacyApplication { +public class MassInsertMemoryLeakTestApp extends LegacyApplication { ProgressIndicator proggress = new ProgressIndicator(); Button process = new Button("Mass insert"); diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestApplication.java b/uitest/src/com/vaadin/tests/integration/IntegrationTestApplication.java index 9c7225b510..03af8bbd52 100644 --- a/uitest/src/com/vaadin/tests/integration/IntegrationTestApplication.java +++ b/uitest/src/com/vaadin/tests/integration/IntegrationTestApplication.java @@ -1,6 +1,6 @@ package com.vaadin.tests.integration; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; @@ -10,7 +10,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Table; import com.vaadin.ui.UI.LegacyWindow; -public class IntegrationTestApplication extends Application.LegacyApplication { +public class IntegrationTestApplication extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java b/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java index 50de6b4882..a296d912bc 100644 --- a/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java +++ b/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java @@ -18,7 +18,7 @@ import javax.portlet.ResourceRequest; import javax.portlet.ResourceResponse; import javax.portlet.WindowState; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.annotations.StyleSheet; import com.vaadin.server.ExternalResource; import com.vaadin.server.PortletApplicationContext2; @@ -37,7 +37,7 @@ import com.vaadin.ui.Upload.Receiver; /** * Adapted from old PortletDemo to support integration testing. */ -public class JSR286PortletApplication extends Application.LegacyApplication { +public class JSR286PortletApplication extends LegacyApplication { @StyleSheet("PortletConnectorResource.css") public final class LegacyWindowWithStylesheet extends LegacyWindow { diff --git a/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java b/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java index 0cbf50ae1b..d4b9d3e4af 100644 --- a/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java +++ b/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java @@ -4,7 +4,7 @@ import java.util.Date; import java.util.Iterator; import java.util.Locale; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.event.Action; @@ -57,7 +57,7 @@ import com.vaadin.ui.Window; import com.vaadin.ui.themes.LiferayTheme; @SuppressWarnings("serial") -public class LiferayThemeDemo extends Application.LegacyApplication { +public class LiferayThemeDemo extends LegacyApplication { @SuppressWarnings("deprecation") private static final Date DATE = new Date(2009 - 1900, 6 - 1, 2); diff --git a/uitest/src/com/vaadin/tests/integration/PortletSizeInLiferayFreeformLayoutApplication.java b/uitest/src/com/vaadin/tests/integration/PortletSizeInLiferayFreeformLayoutApplication.java index fc54547890..897649fcc2 100644 --- a/uitest/src/com/vaadin/tests/integration/PortletSizeInLiferayFreeformLayoutApplication.java +++ b/uitest/src/com/vaadin/tests/integration/PortletSizeInLiferayFreeformLayoutApplication.java @@ -1,6 +1,6 @@ package com.vaadin.tests.integration; -import com.vaadin.Application.LegacyApplication; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel2.java b/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel2.java index 6273b92838..df34dc2f66 100644 --- a/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel2.java +++ b/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel2.java @@ -1,12 +1,12 @@ package com.vaadin.tests.layouts; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Layout; import com.vaadin.ui.UI.LegacyWindow; -public class GridLayoutInsidePanel2 extends Application.LegacyApplication { +public class GridLayoutInsidePanel2 extends LegacyApplication { private Layout layout; diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java index 4470404105..ddf79989f1 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java @@ -2,7 +2,7 @@ package com.vaadin.tests.layouts.layouttester; import java.util.Date; -import com.vaadin.Application.LegacyApplication; +import com.vaadin.LegacyApplication; import com.vaadin.server.Resource; import com.vaadin.server.SystemError; import com.vaadin.server.ThemeResource; diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java index eb0976dfb9..2525a5e620 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java @@ -1,6 +1,6 @@ package com.vaadin.tests.layouts.layouttester; -import com.vaadin.Application.LegacyApplication; +import com.vaadin.LegacyApplication; import com.vaadin.server.Resource; import com.vaadin.server.SystemError; import com.vaadin.server.ThemeResource; diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java index f6cf3a4bae..0322178ac8 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java @@ -1,6 +1,6 @@ package com.vaadin.tests.layouts.layouttester; -import com.vaadin.Application.LegacyApplication; +import com.vaadin.LegacyApplication; import com.vaadin.server.Resource; import com.vaadin.server.SystemError; import com.vaadin.server.ThemeResource; diff --git a/uitest/src/com/vaadin/tests/themes/ButtonsTest.java b/uitest/src/com/vaadin/tests/themes/ButtonsTest.java index 39b43f3516..551f9d8fbf 100644 --- a/uitest/src/com/vaadin/tests/themes/ButtonsTest.java +++ b/uitest/src/com/vaadin/tests/themes/ButtonsTest.java @@ -1,5 +1,6 @@ package com.vaadin.tests.themes; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.server.ThemeResource; @@ -14,7 +15,7 @@ import com.vaadin.ui.UI; import com.vaadin.ui.UI.LegacyWindow; @SuppressWarnings("serial") -public class ButtonsTest extends com.vaadin.Application.LegacyApplication { +public class ButtonsTest extends com.vaadin.LegacyApplication { final UI.LegacyWindow main = new LegacyWindow("Button states & themes"); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1225.java b/uitest/src/com/vaadin/tests/tickets/Ticket1225.java index 8c99fe6ebb..8f0edb3116 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1225.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1225.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; import com.vaadin.ui.Alignment; @@ -16,7 +16,7 @@ import com.vaadin.ui.VerticalSplitPanel; * properly. Scrollbars will disappear if "shaking" content a bit, like * selecting tests in area. */ -public class Ticket1225 extends Application.LegacyApplication { +public class Ticket1225 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1230.java b/uitest/src/com/vaadin/tests/tickets/Ticket1230.java index e11d6ea024..860f0ec8c4 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1230.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1230.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -9,7 +9,7 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Select; -public class Ticket1230 extends Application.LegacyApplication { +public class Ticket1230 extends LegacyApplication { private static final Object PROPERTY_ID = new Object(); private static final Object NULL_ITEM_ID = new Object(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket124.java b/uitest/src/com/vaadin/tests/tickets/Ticket124.java index 4bcf31a366..b63f453ada 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket124.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket124.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -10,7 +10,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket124 extends Application.LegacyApplication { +public class Ticket124 extends LegacyApplication { private TextField tf; private GridLayout gl; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1245.java b/uitest/src/com/vaadin/tests/tickets/Ticket1245.java index 6aa1c1752a..bf7be0f291 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1245.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1245.java @@ -1,5 +1,6 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.data.Property; import com.vaadin.ui.AbstractSelect; @@ -11,7 +12,7 @@ import com.vaadin.ui.Tree; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.themes.Reindeer; -public class Ticket1245 extends com.vaadin.Application.LegacyApplication { +public class Ticket1245 extends com.vaadin.LegacyApplication { TextField f = new TextField(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1365.java b/uitest/src/com/vaadin/tests/tickets/Ticket1365.java index c617b07248..1306e95af9 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1365.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1365.java @@ -1,5 +1,6 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; import com.vaadin.event.ShortcutAction; @@ -7,7 +8,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket1365 extends com.vaadin.Application.LegacyApplication +public class Ticket1365 extends com.vaadin.LegacyApplication implements Handler { TextField f = new TextField(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1368.java b/uitest/src/com/vaadin/tests/tickets/Ticket1368.java index 16b47a1f31..2ac04ebcaf 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1368.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1368.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; import com.vaadin.ui.ComboBox; import com.vaadin.ui.UI.LegacyWindow; @@ -8,7 +8,7 @@ import com.vaadin.ui.Table; /** */ -public class Ticket1368 extends Application.LegacyApplication { +public class Ticket1368 extends LegacyApplication { private Table t; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1397.java b/uitest/src/com/vaadin/tests/tickets/Ticket1397.java index e162e96bfa..8c5b9ffcf4 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1397.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1397.java @@ -2,7 +2,7 @@ package com.vaadin.tests.tickets; import java.util.Date; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.util.ObjectProperty; import com.vaadin.ui.Button; import com.vaadin.ui.Component; @@ -14,7 +14,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.TextField; -public class Ticket1397 extends Application.LegacyApplication { +public class Ticket1397 extends LegacyApplication { LegacyWindow main; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1435.java b/uitest/src/com/vaadin/tests/tickets/Ticket1435.java index d46a56f73a..a31b421bf2 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1435.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1435.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -16,7 +16,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket1435 extends Application.LegacyApplication { +public class Ticket1435 extends LegacyApplication { private static final boolean useWorkaround = true; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1444.java b/uitest/src/com/vaadin/tests/tickets/Ticket1444.java index 1da3b5c290..70fc394f62 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1444.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1444.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1444 extends Application.LegacyApplication { +public class Ticket1444 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java b/uitest/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java index 3c766ef985..e57eb0962a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; @@ -8,7 +8,7 @@ import com.vaadin.ui.Notification; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Window; -public class Ticket1465ModalNotification extends Application.LegacyApplication { +public class Ticket1465ModalNotification extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1519.java b/uitest/src/com/vaadin/tests/tickets/Ticket1519.java index 8b1736637b..fea7725e66 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1519.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1519.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.CustomLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TabSheet; -public class Ticket1519 extends Application.LegacyApplication { +public class Ticket1519 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1572.java b/uitest/src/com/vaadin/tests/tickets/Ticket1572.java index a511bae6d9..44ef87f428 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1572.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1572.java @@ -1,5 +1,6 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.shared.ui.MarginInfo; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -9,7 +10,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1572 extends com.vaadin.Application.LegacyApplication { +public class Ticket1572 extends com.vaadin.LegacyApplication { private Label state; private GridLayout gl; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1581.java b/uitest/src/com/vaadin/tests/tickets/Ticket1581.java index 5025605413..0ee53004e8 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1581.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1581.java @@ -2,6 +2,7 @@ package com.vaadin.tests.tickets; import java.util.Date; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -9,7 +10,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.ProgressIndicator; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1581 extends com.vaadin.Application.LegacyApplication { +public class Ticket1581 extends com.vaadin.LegacyApplication { private Label time; private ProgressIndicator poller; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1589.java b/uitest/src/com/vaadin/tests/tickets/Ticket1589.java index 7cbe8cb6cf..580aa3f7a6 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1589.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1589.java @@ -11,6 +11,7 @@ import java.util.Date; import javax.imageio.ImageIO; import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.DownloadStream; import com.vaadin.server.ExternalResource; import com.vaadin.server.RequestHandler; @@ -19,7 +20,7 @@ import com.vaadin.server.WrappedResponse; import com.vaadin.ui.Link; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1589 extends Application.LegacyApplication { +public class Ticket1589 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1598.java b/uitest/src/com/vaadin/tests/tickets/Ticket1598.java index 2f845a2264..cbb1f88043 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1598.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1598.java @@ -3,14 +3,14 @@ package com.vaadin.tests.tickets; import java.util.ArrayList; import java.util.List; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.ThemeResource; import com.vaadin.ui.MenuBar; import com.vaadin.ui.MenuBar.Command; import com.vaadin.ui.MenuBar.MenuItem; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1598 extends Application.LegacyApplication { +public class Ticket1598 extends LegacyApplication { LegacyWindow main = new LegacyWindow("MenuBar test"); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket161.java b/uitest/src/com/vaadin/tests/tickets/Ticket161.java index 4da1b3a6b4..6a6f95a9b5 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket161.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket161.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Container; import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; import com.vaadin.ui.Button; @@ -10,7 +10,7 @@ import com.vaadin.ui.Table; /** */ -public class Ticket161 extends Application.LegacyApplication { +public class Ticket161 extends LegacyApplication { private Table t; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1632.java b/uitest/src/com/vaadin/tests/tickets/Ticket1632.java index bca902a73f..9ecdff39d5 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1632.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1632.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -9,7 +9,7 @@ import com.vaadin.ui.Table; /** */ -public class Ticket1632 extends Application.LegacyApplication { +public class Ticket1632 extends LegacyApplication { private Table t; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1659.java b/uitest/src/com/vaadin/tests/tickets/Ticket1659.java index 57d2ad73e5..a587aa5a94 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1659.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1659.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.ExternalResource; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1659 extends Application.LegacyApplication { +public class Ticket1659 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1663.java b/uitest/src/com/vaadin/tests/tickets/Ticket1663.java index 1ef16afe95..9a08dc8502 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1663.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1663.java @@ -1,10 +1,11 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.server.SystemError; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket1663 extends com.vaadin.Application.LegacyApplication { +public class Ticket1663 extends com.vaadin.LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1673.java b/uitest/src/com/vaadin/tests/tickets/Ticket1673.java index bf95001464..663d955e77 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1673.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1673.java @@ -1,12 +1,13 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.server.CustomizedSystemMessages; import com.vaadin.server.SystemMessages; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1673 extends com.vaadin.Application.LegacyApplication { +public class Ticket1673 extends com.vaadin.LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1710.java b/uitest/src/com/vaadin/tests/tickets/Ticket1710.java index c00e2f32eb..b4258dff61 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1710.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1710.java @@ -2,6 +2,7 @@ package com.vaadin.tests.tickets; import java.util.Iterator; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.util.MethodProperty; @@ -28,7 +29,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket1710 extends com.vaadin.Application.LegacyApplication { +public class Ticket1710 extends com.vaadin.LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1737.java b/uitest/src/com/vaadin/tests/tickets/Ticket1737.java index caf44865f9..4384215943 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1737.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1737.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.ClassResource; import com.vaadin.server.DownloadStream; import com.vaadin.server.Resource; @@ -10,7 +10,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1737 extends Application.LegacyApplication { +public class Ticket1737 extends LegacyApplication { Resource slowRes = new ClassResource(Ticket1737.class, "m-bullet-blue.gif") { @Override diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1767.java b/uitest/src/com/vaadin/tests/tickets/Ticket1767.java index eca0c0f833..f2e2dd32b8 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1767.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1767.java @@ -1,9 +1,10 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.ui.ComboBox; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1767 extends com.vaadin.Application.LegacyApplication { +public class Ticket1767 extends com.vaadin.LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1772.java b/uitest/src/com/vaadin/tests/tickets/Ticket1772.java index a269acc1e0..648fa4e598 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1772.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1772.java @@ -1,12 +1,13 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket1772 extends com.vaadin.Application.LegacyApplication { +public class Ticket1772 extends com.vaadin.LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1775.java b/uitest/src/com/vaadin/tests/tickets/Ticket1775.java index ec28a957bb..3d9165e491 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1775.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1775.java @@ -1,12 +1,13 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.CustomLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1775 extends com.vaadin.Application.LegacyApplication { +public class Ticket1775 extends com.vaadin.LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1804.java b/uitest/src/com/vaadin/tests/tickets/Ticket1804.java index a77e6e843a..196a4863db 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1804.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1804.java @@ -3,6 +3,7 @@ package com.vaadin.tests.tickets; import java.util.Iterator; import java.util.LinkedList; +import com.vaadin.LegacyApplication; import com.vaadin.data.Validator; import com.vaadin.data.util.MethodProperty; import com.vaadin.server.SystemError; @@ -15,7 +16,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Select; import com.vaadin.ui.Window; -public class Ticket1804 extends com.vaadin.Application.LegacyApplication { +public class Ticket1804 extends com.vaadin.LegacyApplication { LinkedList(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1805.java b/uitest/src/com/vaadin/tests/tickets/Ticket1805.java index 7f5c684479..329bfeaa38 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1805.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1805.java @@ -1,5 +1,6 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.ui.Alignment; @@ -10,7 +11,7 @@ import com.vaadin.ui.Layout.MarginHandler; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket1805 extends com.vaadin.Application.LegacyApplication { +public class Ticket1805 extends com.vaadin.LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1806.java b/uitest/src/com/vaadin/tests/tickets/Ticket1806.java index 8359b024aa..333350f94e 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1806.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1806.java @@ -1,12 +1,13 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.data.util.ObjectProperty; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket1806 extends com.vaadin.Application.LegacyApplication { +public class Ticket1806 extends com.vaadin.LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1811.java b/uitest/src/com/vaadin/tests/tickets/Ticket1811.java index 824c58436f..066587e349 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1811.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1811.java @@ -3,6 +3,7 @@ package com.vaadin.tests.tickets; import java.util.Iterator; import java.util.LinkedList; +import com.vaadin.LegacyApplication; import com.vaadin.data.Validator; import com.vaadin.data.validator.StringLengthValidator; import com.vaadin.shared.ui.label.ContentMode; @@ -13,7 +14,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.Window; -public class Ticket1811 extends com.vaadin.Application.LegacyApplication { +public class Ticket1811 extends com.vaadin.LegacyApplication { LinkedList listOfAllFields = new LinkedList(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1819.java b/uitest/src/com/vaadin/tests/tickets/Ticket1819.java index e16b2c2774..1ff918b676 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1819.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1819.java @@ -3,6 +3,7 @@ package com.vaadin.tests.tickets; import java.util.Iterator; import java.util.LinkedList; +import com.vaadin.LegacyApplication; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.AbstractField; import com.vaadin.ui.Button; @@ -12,7 +13,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Select; import com.vaadin.ui.Window; -public class Ticket1819 extends com.vaadin.Application.LegacyApplication { +public class Ticket1819 extends com.vaadin.LegacyApplication { LinkedList(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java b/uitest/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java index f7329037cc..614d3aff62 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java @@ -1,5 +1,6 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -9,7 +10,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; public class Ticket1834PanelScrolling extends - com.vaadin.Application.LegacyApplication { + com.vaadin.LegacyApplication { private static final int ROWS = 50; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1857.java b/uitest/src/com/vaadin/tests/tickets/Ticket1857.java index be0158e0fb..dd304a14aa 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1857.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1857.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.event.Action; @@ -11,7 +11,7 @@ import com.vaadin.ui.Table; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1857 extends Application.LegacyApplication implements +public class Ticket1857 extends LegacyApplication implements Handler { @Override diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1868.java b/uitest/src/com/vaadin/tests/tickets/Ticket1868.java index 8bd4a77204..ff8c512339 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1868.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1868.java @@ -1,9 +1,10 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1868 extends com.vaadin.Application.LegacyApplication { +public class Ticket1868 extends com.vaadin.LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1869.java b/uitest/src/com/vaadin/tests/tickets/Ticket1869.java index 741adecae4..cd1be102ec 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1869.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1869.java @@ -1,5 +1,6 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; @@ -7,7 +8,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1869 extends com.vaadin.Application.LegacyApplication { +public class Ticket1869 extends com.vaadin.LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1878.java b/uitest/src/com/vaadin/tests/tickets/Ticket1878.java index 90a96ba0f1..5d8074d553 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1878.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1878.java @@ -4,7 +4,7 @@ import java.util.Date; import java.util.Iterator; import java.util.Random; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.util.BeanItem; import com.vaadin.data.validator.StringLengthValidator; import com.vaadin.server.Resource; @@ -27,7 +27,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket1878 extends Application.LegacyApplication { +public class Ticket1878 extends LegacyApplication { private Layout orderedLayout; private Layout gridLayout; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1900.java b/uitest/src/com/vaadin/tests/tickets/Ticket1900.java index 136af23474..573634d61b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1900.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1900.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Validator; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket1900 extends Application.LegacyApplication { +public class Ticket1900 extends LegacyApplication { TextField f[] = new TextField[5]; LegacyWindow main = new LegacyWindow("#1900 test"); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1904.java b/uitest/src/com/vaadin/tests/tickets/Ticket1904.java index f35463f6a8..ee6a9fe638 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1904.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1904.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; import com.vaadin.ui.HorizontalLayout; @@ -8,7 +8,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1904 extends Application.LegacyApplication { +public class Ticket1904 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1916.java b/uitest/src/com/vaadin/tests/tickets/Ticket1916.java index 92102426ca..03efef3b2c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1916.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1916.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.UserError; import com.vaadin.ui.Alignment; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket1916 extends Application.LegacyApplication { +public class Ticket1916 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1919.java b/uitest/src/com/vaadin/tests/tickets/Ticket1919.java index 8e9e0cb0ba..6c0fa581ac 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1919.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1919.java @@ -1,5 +1,6 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Component; @@ -7,7 +8,7 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1919 extends com.vaadin.Application.LegacyApplication { +public class Ticket1919 extends com.vaadin.LegacyApplication { private GridLayout lo; private boolean on = true; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1921.java b/uitest/src/com/vaadin/tests/tickets/Ticket1921.java index 17314c3fb6..165f4a8d0d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1921.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1921.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.util.Map; import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.RequestHandler; import com.vaadin.server.WrappedRequest; import com.vaadin.server.WrappedResponse; @@ -13,7 +14,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1921 extends Application.LegacyApplication implements +public class Ticket1921 extends LegacyApplication implements RequestHandler { int state = -1; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1923.java b/uitest/src/com/vaadin/tests/tickets/Ticket1923.java index 2bde4c95ec..fde8fa0638 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1923.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1923.java @@ -1,11 +1,12 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1923 extends com.vaadin.Application.LegacyApplication { +public class Ticket1923 extends com.vaadin.LegacyApplication { private static final int ROWS = 50; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1925.java b/uitest/src/com/vaadin/tests/tickets/Ticket1925.java index b5d938dbed..ccf21c7206 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1925.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1925.java @@ -1,9 +1,9 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1925 extends Application.LegacyApplication { +public class Ticket1925 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1939.java b/uitest/src/com/vaadin/tests/tickets/Ticket1939.java index f65fbf9852..6abfc730b6 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1939.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1939.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket1939 extends Application.LegacyApplication { +public class Ticket1939 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1940.java b/uitest/src/com/vaadin/tests/tickets/Ticket1940.java index 1a27e1ad28..11f4cfe40d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1940.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1940.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket1940 extends Application.LegacyApplication { +public class Ticket1940 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1953.java b/uitest/src/com/vaadin/tests/tickets/Ticket1953.java index 9bf4ddee51..3824f1f662 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1953.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1953.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1953 extends Application.LegacyApplication { +public class Ticket1953 extends LegacyApplication { public static final String cellStyle = "test-cell"; public static final String colHeadStyle = "test-col-head"; public static final String headingStyle = "test-heading"; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1966.java b/uitest/src/com/vaadin/tests/tickets/Ticket1966.java index 9440855bbe..461923da9c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1966.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1966.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; @@ -12,7 +12,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1966 extends Application.LegacyApplication { +public class Ticket1966 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1966_2.java b/uitest/src/com/vaadin/tests/tickets/Ticket1966_2.java index c5442e6473..8a5641d05c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1966_2.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1966_2.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; @@ -12,7 +12,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1966_2 extends Application.LegacyApplication { +public class Ticket1966_2 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1966_3.java b/uitest/src/com/vaadin/tests/tickets/Ticket1966_3.java index 7258971f50..c27e81f0c7 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1966_3.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1966_3.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.ThemeResource; import com.vaadin.server.UserError; import com.vaadin.ui.Alignment; @@ -10,7 +10,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket1966_3 extends Application.LegacyApplication { +public class Ticket1966_3 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1969.java b/uitest/src/com/vaadin/tests/tickets/Ticket1969.java index 78c09d8914..df1e40e1eb 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1969.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1969.java @@ -1,5 +1,6 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.server.UserError; import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; import com.vaadin.ui.Button; @@ -10,7 +11,7 @@ import com.vaadin.ui.TabSheet; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket1969 extends com.vaadin.Application.LegacyApplication { +public class Ticket1969 extends com.vaadin.LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1970.java b/uitest/src/com/vaadin/tests/tickets/Ticket1970.java index b07a997f8f..135d21ca36 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1970.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1970.java @@ -2,14 +2,14 @@ package com.vaadin.tests.tickets; import java.util.Iterator; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1970 extends Application.LegacyApplication { +public class Ticket1970 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1972.java b/uitest/src/com/vaadin/tests/tickets/Ticket1972.java index 6b406a2f89..2d73edf487 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1972.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1972.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1972 extends Application.LegacyApplication { +public class Ticket1972 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1973.java b/uitest/src/com/vaadin/tests/tickets/Ticket1973.java index a3365bedcb..2e77e0e594 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1973.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1973.java @@ -1,5 +1,6 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.data.util.IndexedContainer; import com.vaadin.ui.Button; @@ -8,7 +9,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket1973 extends com.vaadin.Application.LegacyApplication { +public class Ticket1973 extends com.vaadin.LegacyApplication { LegacyWindow main = new LegacyWindow(); Table table = new Table(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1973_2.java b/uitest/src/com/vaadin/tests/tickets/Ticket1973_2.java index 27c3d4a8a7..eca5e69a69 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1973_2.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1973_2.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.data.util.IndexedContainer; import com.vaadin.ui.Button; @@ -9,7 +9,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket1973_2 extends Application.LegacyApplication { +public class Ticket1973_2 extends LegacyApplication { LegacyWindow main = new LegacyWindow(); Table table = new Table(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java index 4fa3470f0b..117f99883c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java @@ -4,7 +4,7 @@ import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.WrappedRequest; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -14,7 +14,7 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.util.CurrentInstance; -public class Ticket1975 extends Application.LegacyApplication { +public class Ticket1975 extends LegacyApplication { private CustomLayout cl1; private CustomLayout cl2; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1982.java b/uitest/src/com/vaadin/tests/tickets/Ticket1982.java index a5953d22af..55e95f0eb3 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1982.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1982.java @@ -3,7 +3,7 @@ package com.vaadin.tests.tickets; import java.util.ArrayList; import java.util.List; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -12,7 +12,7 @@ import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1982 extends Application.LegacyApplication { +public class Ticket1982 extends LegacyApplication { private List components = new ArrayList(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1983.java b/uitest/src/com/vaadin/tests/tickets/Ticket1983.java index 7b544ec9b0..7f728b2ab5 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1983.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1983.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.data.util.IndexedContainer; @@ -16,7 +16,7 @@ import com.vaadin.ui.VerticalLayout; /** * Test class for ticket 1983 */ -public class Ticket1983 extends Application.LegacyApplication { +public class Ticket1983 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1986.java b/uitest/src/com/vaadin/tests/tickets/Ticket1986.java index fd6665b2fe..df1c640795 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1986.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1986.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.ComboBox; import com.vaadin.ui.DateField; @@ -12,7 +12,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.TwinColSelect; -public class Ticket1986 extends Application.LegacyApplication { +public class Ticket1986 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1991.java b/uitest/src/com/vaadin/tests/tickets/Ticket1991.java index ed60c89c16..1dad9e0b55 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1991.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1991.java @@ -1,10 +1,11 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.ui.CheckBox; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; -public class Ticket1991 extends com.vaadin.Application.LegacyApplication { +public class Ticket1991 extends com.vaadin.LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1995.java b/uitest/src/com/vaadin/tests/tickets/Ticket1995.java index 04ce9c712d..21ccc28d55 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1995.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1995.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Container; import com.vaadin.data.Container.Filterable; import com.vaadin.data.Item; @@ -10,7 +10,7 @@ import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; -public class Ticket1995 extends Application.LegacyApplication { +public class Ticket1995 extends LegacyApplication { private static final Object PROPERTY_1 = "Test"; private Table table; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket20.java b/uitest/src/com/vaadin/tests/tickets/Ticket20.java index ea610a3db8..cb391395b1 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket20.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket20.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Validator; import com.vaadin.data.util.MethodProperty; import com.vaadin.data.validator.CompositeValidator; @@ -11,7 +11,7 @@ import com.vaadin.ui.CheckBox; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket20 extends Application.LegacyApplication { +public class Ticket20 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2001.java b/uitest/src/com/vaadin/tests/tickets/Ticket2001.java index 8ff3d952c4..f8e9154c42 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2001.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2001.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.ui.CheckBox; @@ -8,7 +8,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2001 extends Application.LegacyApplication { +public class Ticket2001 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2002.java b/uitest/src/com/vaadin/tests/tickets/Ticket2002.java index aeaf3bfb33..4be6577aaa 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2002.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2002.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.util.MethodProperty; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2002 extends Application.LegacyApplication { +public class Ticket2002 extends LegacyApplication { private Long long1 = new Long(1L); private Long long2 = new Long(2L); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2007.java b/uitest/src/com/vaadin/tests/tickets/Ticket2007.java index fcffbc01bf..d97444d5c7 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2007.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2007.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.ExternalResource; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2007 extends Application.LegacyApplication { +public class Ticket2007 extends LegacyApplication { int childs = 0; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2009.java b/uitest/src/com/vaadin/tests/tickets/Ticket2009.java index e79ec8905e..1e79eaab39 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2009.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2009.java @@ -1,5 +1,6 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.data.Container; import com.vaadin.event.ItemClickEvent; import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; @@ -15,7 +16,7 @@ import com.vaadin.ui.Tree; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; -public class Ticket2009 extends com.vaadin.Application.LegacyApplication { +public class Ticket2009 extends com.vaadin.LegacyApplication { TextField f = new TextField(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2011.java b/uitest/src/com/vaadin/tests/tickets/Ticket2011.java index 754036cd5b..708b5758ad 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2011.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2011.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Select; -public class Ticket2011 extends Application.LegacyApplication { +public class Ticket2011 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2014.java b/uitest/src/com/vaadin/tests/tickets/Ticket2014.java index bf909acb35..1398feca2b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2014.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2014.java @@ -2,7 +2,7 @@ package com.vaadin.tests.tickets; import java.util.UUID; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -11,7 +11,7 @@ import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2014 extends Application.LegacyApplication { +public class Ticket2014 extends LegacyApplication { private HorizontalLayout innerLayout1; private Button b1; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2021.java b/uitest/src/com/vaadin/tests/tickets/Ticket2021.java index c23f031a91..7bbdc1637c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2021.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2021.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; @@ -15,7 +15,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextArea; import com.vaadin.ui.VerticalLayout; -public class Ticket2021 extends Application.LegacyApplication { +public class Ticket2021 extends LegacyApplication { private TextArea tf1, tf2, tf3; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2022.java b/uitest/src/com/vaadin/tests/tickets/Ticket2022.java index ea142b7e9e..a5737a0fbf 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2022.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2022.java @@ -1,10 +1,10 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.CustomLayout; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2022 extends Application.LegacyApplication { +public class Ticket2022 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2023.java b/uitest/src/com/vaadin/tests/tickets/Ticket2023.java index c6b2c0f28a..0e52b932b7 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2023.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2023.java @@ -1,12 +1,13 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2023 extends com.vaadin.Application.LegacyApplication +public class Ticket2023 extends com.vaadin.LegacyApplication implements Button.ClickListener { AbstractComponent c = new Button(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2024.java b/uitest/src/com/vaadin/tests/tickets/Ticket2024.java index b1a8b64931..e7201aaf89 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2024.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2024.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket2024 extends Application.LegacyApplication { +public class Ticket2024 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2026.java b/uitest/src/com/vaadin/tests/tickets/Ticket2026.java index 0b72073bec..c96404bf53 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2026.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2026.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2026 extends Application.LegacyApplication { +public class Ticket2026 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2029.java b/uitest/src/com/vaadin/tests/tickets/Ticket2029.java index 5900c76706..7859ccc642 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2029.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2029.java @@ -2,7 +2,7 @@ package com.vaadin.tests.tickets; import java.util.Random; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.server.UserError; @@ -16,7 +16,7 @@ import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket2029 extends Application.LegacyApplication { +public class Ticket2029 extends LegacyApplication { int COMPONENTS; int DIM1, DIM2; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2037.java b/uitest/src/com/vaadin/tests/tickets/Ticket2037.java index da47f796a5..a02432202e 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2037.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2037.java @@ -1,5 +1,6 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; @@ -7,7 +8,7 @@ import com.vaadin.ui.Layout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2037 extends com.vaadin.Application.LegacyApplication { +public class Ticket2037 extends com.vaadin.LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2038.java b/uitest/src/com/vaadin/tests/tickets/Ticket2038.java index c4714783a0..03e7861a90 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2038.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2038.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.ui.CheckBox; @@ -8,7 +8,7 @@ import com.vaadin.ui.Notification; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2038 extends Application.LegacyApplication { +public class Ticket2038 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2040.java b/uitest/src/com/vaadin/tests/tickets/Ticket2040.java index a7ca7b179f..be3e7b0c39 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2040.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2040.java @@ -1,5 +1,6 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Accordion; import com.vaadin.ui.Label; import com.vaadin.ui.Layout.MarginHandler; @@ -7,7 +8,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; -public class Ticket2040 extends com.vaadin.Application.LegacyApplication { +public class Ticket2040 extends com.vaadin.LegacyApplication { TextField f = new TextField(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2042.java b/uitest/src/com/vaadin/tests/tickets/Ticket2042.java index 49e999a601..c96dd52183 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2042.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2042.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -9,7 +9,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Notification; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2042 extends Application.LegacyApplication { +public class Ticket2042 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2043.java b/uitest/src/com/vaadin/tests/tickets/Ticket2043.java index 8a10067455..d3d984c8be 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2043.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2043.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.ExternalResource; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Link; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2043 extends Application.LegacyApplication { +public class Ticket2043 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2048.java b/uitest/src/com/vaadin/tests/tickets/Ticket2048.java index 5ac0480fe2..05ca9c4526 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2048.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2048.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.ThemeResource; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -13,7 +13,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2048 extends Application.LegacyApplication { +public class Ticket2048 extends LegacyApplication { private Embedded embedded; private Panel p; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2051.java b/uitest/src/com/vaadin/tests/tickets/Ticket2051.java index 1660f00d88..d536db0e14 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2051.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2051.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.ui.Button; import com.vaadin.ui.Component; @@ -11,7 +11,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.TextField; -public class Ticket2051 extends Application.LegacyApplication { +public class Ticket2051 extends LegacyApplication { private static final Object P1 = new Object(); private static final Object P2 = new Object(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2053.java b/uitest/src/com/vaadin/tests/tickets/Ticket2053.java index 31973e4c92..ae0ba0c315 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2053.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2053.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.server.ExternalResource; @@ -10,7 +10,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2053 extends Application.LegacyApplication { +public class Ticket2053 extends LegacyApplication { int childs = 0; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2060.java b/uitest/src/com/vaadin/tests/tickets/Ticket2060.java index c9e91930bf..a461264237 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2060.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2060.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -8,7 +8,7 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2060 extends Application.LegacyApplication { +public class Ticket2060 extends LegacyApplication { private Button button1; private Button button2; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2061.java b/uitest/src/com/vaadin/tests/tickets/Ticket2061.java index 4d6549bfbf..a2f599f139 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2061.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2061.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; @@ -13,7 +13,7 @@ import com.vaadin.ui.TabSheet; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket2061 extends Application.LegacyApplication { +public class Ticket2061 extends LegacyApplication { private LegacyWindow mainWindow; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2061b.java b/uitest/src/com/vaadin/tests/tickets/Ticket2061b.java index 87d92ad9f6..0b76d2e83a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2061b.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2061b.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; @@ -21,7 +21,7 @@ import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalSplitPanel; -public class Ticket2061b extends Application.LegacyApplication implements +public class Ticket2061b extends LegacyApplication implements SelectedTabChangeListener { private LegacyWindow mainWindow; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2061c.java b/uitest/src/com/vaadin/tests/tickets/Ticket2061c.java index 5cb041788b..2af686ced0 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2061c.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2061c.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; @@ -17,7 +17,7 @@ import com.vaadin.ui.TabSheet.SelectedTabChangeListener; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket2061c extends Application.LegacyApplication implements +public class Ticket2061c extends LegacyApplication implements SelectedTabChangeListener { private LegacyWindow mainWindow; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2062.java b/uitest/src/com/vaadin/tests/tickets/Ticket2062.java index 9b2fe05514..12149e6eda 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2062.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2062.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.HorizontalSplitPanel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TabSheet; import com.vaadin.ui.Table; import com.vaadin.ui.TextField; -public class Ticket2062 extends Application.LegacyApplication { +public class Ticket2062 extends LegacyApplication { private static final Object P1 = new Object(); @Override diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2083.java b/uitest/src/com/vaadin/tests/tickets/Ticket2083.java index 87bea00023..061fb47f76 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2083.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2083.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2083 extends Application.LegacyApplication { +public class Ticket2083 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2090.java b/uitest/src/com/vaadin/tests/tickets/Ticket2090.java index 2f311b9428..50deab7a8a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2090.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2090.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.server.UserError; @@ -9,7 +9,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2090 extends Application.LegacyApplication { +public class Ticket2090 extends LegacyApplication { Label label = new Label(); Button target = new Button(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2095.java b/uitest/src/com/vaadin/tests/tickets/Ticket2095.java index 53f2aac79e..701c306c19 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2095.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2095.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.ExternalResource; import com.vaadin.ui.Embedded; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2095 extends Application.LegacyApplication { +public class Ticket2095 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2098.java b/uitest/src/com/vaadin/tests/tickets/Ticket2098.java index a8a3e22d2b..6db08f5063 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2098.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2098.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TabSheet; -public class Ticket2098 extends Application.LegacyApplication { +public class Ticket2098 extends LegacyApplication { private static final String info = "First tab hidden, second should initially be selected"; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2099.java b/uitest/src/com/vaadin/tests/tickets/Ticket2099.java index 2bba0504a5..08acda39f2 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2099.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2099.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -11,7 +11,7 @@ import com.vaadin.ui.TabSheet; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; -public class Ticket2099 extends Application.LegacyApplication { +public class Ticket2099 extends LegacyApplication { private Label l1, l2, l3; private VerticalLayout ol1, ol2, ol3; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2101.java b/uitest/src/com/vaadin/tests/tickets/Ticket2101.java index c29eaaf453..c4c6b7320d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2101.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2101.java @@ -1,10 +1,10 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2101 extends Application.LegacyApplication { +public class Ticket2101 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2103.java b/uitest/src/com/vaadin/tests/tickets/Ticket2103.java index 576fe03d87..43c86efd9d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2103.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2103.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.data.util.HierarchicalContainer; import com.vaadin.ui.Accordion; @@ -9,7 +9,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket2103 extends Application.LegacyApplication { +public class Ticket2103 extends LegacyApplication { private LegacyWindow mainWindow; @Override diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2104.java b/uitest/src/com/vaadin/tests/tickets/Ticket2104.java index 0dba639712..cb1173d6e9 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2104.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2104.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.data.util.MethodProperty; @@ -15,7 +15,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.Tree; -public class Ticket2104 extends Application.LegacyApplication { +public class Ticket2104 extends LegacyApplication { private static final Label info = new Label( "Click event should _always_ come trough. Switching features on/off should immediatly affect the tree (verify w/ debug window)", diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2106.java b/uitest/src/com/vaadin/tests/tickets/Ticket2106.java index a57a20cdc3..569d4fe30f 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2106.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2106.java @@ -2,7 +2,7 @@ package com.vaadin.tests.tickets; import java.util.Date; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.CustomizedSystemMessages; import com.vaadin.server.SystemMessages; import com.vaadin.ui.Button; @@ -10,7 +10,7 @@ import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2106 extends Application.LegacyApplication { +public class Ticket2106 extends LegacyApplication { private static CustomizedSystemMessages msgs = new CustomizedSystemMessages(); static { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2107.java b/uitest/src/com/vaadin/tests/tickets/Ticket2107.java index 37d570546b..553221a874 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2107.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2107.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Validator; @@ -9,7 +9,7 @@ import com.vaadin.ui.Notification; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2107 extends Application.LegacyApplication { +public class Ticket2107 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2117.java b/uitest/src/com/vaadin/tests/tickets/Ticket2117.java index fb0d62ba85..24aec36422 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2117.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2117.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.ExternalResource; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Button; @@ -9,7 +9,7 @@ import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2117 extends Application.LegacyApplication { +public class Ticket2117 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2119.java b/uitest/src/com/vaadin/tests/tickets/Ticket2119.java index 38cc567295..81bba1d6c8 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2119.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2119.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property; import com.vaadin.data.util.ObjectProperty; import com.vaadin.server.ExternalResource; @@ -15,7 +15,7 @@ import com.vaadin.ui.VerticalLayout; /** * Test case for Ticket 2119. */ -public class Ticket2119 extends Application.LegacyApplication { +public class Ticket2119 extends LegacyApplication { private ObjectProperty globalValue; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2125.java b/uitest/src/com/vaadin/tests/tickets/Ticket2125.java index defd7f4a22..5101b6d46b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2125.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2125.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.util.MethodProperty; import com.vaadin.ui.CheckBox; import com.vaadin.ui.Component; @@ -10,7 +10,7 @@ import com.vaadin.ui.Table.CellStyleGenerator; import com.vaadin.ui.Table.ColumnGenerator; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2125 extends Application.LegacyApplication { +public class Ticket2125 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2126.java b/uitest/src/com/vaadin/tests/tickets/Ticket2126.java index d49c73ea5f..6121832da6 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2126.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2126.java @@ -1,5 +1,6 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.data.util.IndexedContainer; import com.vaadin.ui.Button; @@ -14,7 +15,7 @@ import com.vaadin.ui.Table; * client. * */ -public class Ticket2126 extends com.vaadin.Application.LegacyApplication { +public class Ticket2126 extends com.vaadin.LegacyApplication { LegacyWindow main = new LegacyWindow(); Table table = new Table(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2151.java b/uitest/src/com/vaadin/tests/tickets/Ticket2151.java index 721bdf3c9f..1606218b88 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2151.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2151.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.util.ObjectProperty; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.AbstractField; @@ -10,7 +10,7 @@ import com.vaadin.ui.CheckBox; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2151 extends Application.LegacyApplication { +public class Ticket2151 extends LegacyApplication { private Label status; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2157.java b/uitest/src/com/vaadin/tests/tickets/Ticket2157.java index b8f75fc279..bbd4dcf192 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2157.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2157.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.ComboBox; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2157 extends Application.LegacyApplication { +public class Ticket2157 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2178.java b/uitest/src/com/vaadin/tests/tickets/Ticket2178.java index e64db69ced..897ffaaf1b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2178.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2178.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.ComboBox; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2178 extends Application.LegacyApplication { +public class Ticket2178 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2179.java b/uitest/src/com/vaadin/tests/tickets/Ticket2179.java index 622488dc0f..1bfa5c2beb 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2179.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2179.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Validator; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2179 extends Application.LegacyApplication { +public class Ticket2179 extends LegacyApplication { TextField f = new TextField("Test fiel ( must contain 1 & 2 )"); LegacyWindow main = new LegacyWindow("Dual validator test"); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2180.java b/uitest/src/com/vaadin/tests/tickets/Ticket2180.java index fb9332d100..1629db4737 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2180.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2180.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TabSheet; -public class Ticket2180 extends Application.LegacyApplication { +public class Ticket2180 extends LegacyApplication { private LegacyWindow mainWindow; private TabSheet tabSheet; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2181.java b/uitest/src/com/vaadin/tests/tickets/Ticket2181.java index b67fad52c0..892505306a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2181.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2181.java @@ -5,7 +5,7 @@ import java.util.Date; import java.util.Random; import java.util.Set; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.ThemeResource; import com.vaadin.server.UserError; import com.vaadin.ui.Button; @@ -16,7 +16,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket2181 extends Application.LegacyApplication implements +public class Ticket2181 extends LegacyApplication implements Button.ClickListener { // private static final Object PROPERTY_VALUE = new Object(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2186.java b/uitest/src/com/vaadin/tests/tickets/Ticket2186.java index 50b8a1f113..27bec589d0 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2186.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2186.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; @@ -8,7 +8,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket2186 extends Application.LegacyApplication { +public class Ticket2186 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2204.java b/uitest/src/com/vaadin/tests/tickets/Ticket2204.java index 24c4d6e8b9..f9591d19fa 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2204.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2204.java @@ -5,7 +5,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.data.util.BeanItem; import com.vaadin.ui.AbstractOrderedLayout; @@ -31,7 +31,7 @@ import com.vaadin.ui.TabSheet; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalSplitPanel; -public class Ticket2204 extends Application.LegacyApplication { +public class Ticket2204 extends LegacyApplication { private final List textAreas = new ArrayList(); private TabSheet ts; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2208.java b/uitest/src/com/vaadin/tests/tickets/Ticket2208.java index 98cd6724d4..c517e50070 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2208.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2208.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.ui.Component; import com.vaadin.ui.Label; @@ -9,7 +9,7 @@ import com.vaadin.ui.Table.CellStyleGenerator; import com.vaadin.ui.Table.ColumnGenerator; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2208 extends Application.LegacyApplication { +public class Ticket2208 extends LegacyApplication { private Table t; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2209.java b/uitest/src/com/vaadin/tests/tickets/Ticket2209.java index ecad9a950a..6dc1e7bd71 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2209.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2209.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -9,7 +9,7 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2209 extends Application.LegacyApplication { +public class Ticket2209 extends LegacyApplication { private GridLayout gl; private ComboBox combo; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2209OL.java b/uitest/src/com/vaadin/tests/tickets/Ticket2209OL.java index 6eec0a7704..55b7a17c89 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2209OL.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2209OL.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -9,7 +9,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2209OL extends Application.LegacyApplication { +public class Ticket2209OL extends LegacyApplication { private VerticalLayout gl; private ComboBox combo; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2209OL2.java b/uitest/src/com/vaadin/tests/tickets/Ticket2209OL2.java index 7f4082d0f8..9615b6f249 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2209OL2.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2209OL2.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -9,7 +9,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2209OL2 extends Application.LegacyApplication { +public class Ticket2209OL2 extends LegacyApplication { private VerticalLayout gl; private ComboBox combo; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2215.java b/uitest/src/com/vaadin/tests/tickets/Ticket2215.java index f7099d88f4..6dfcf9d344 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2215.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2215.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.themes.Reindeer; -public class Ticket2215 extends Application.LegacyApplication { +public class Ticket2215 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2221.java b/uitest/src/com/vaadin/tests/tickets/Ticket2221.java index e3f1516fb8..8fc62800e0 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2221.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2221.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -13,7 +13,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket2221 extends Application.LegacyApplication { +public class Ticket2221 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2222.java b/uitest/src/com/vaadin/tests/tickets/Ticket2222.java index 14024fda8b..e46477e4de 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2222.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2222.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; @@ -8,7 +8,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2222 extends Application.LegacyApplication { +public class Ticket2222 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2227OrderedlayoutInTable.java b/uitest/src/com/vaadin/tests/tickets/Ticket2227OrderedlayoutInTable.java index f9c670708e..5ef06379e0 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2227OrderedlayoutInTable.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2227OrderedlayoutInTable.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.ui.Component; import com.vaadin.ui.Label; @@ -10,7 +10,7 @@ import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; public class Ticket2227OrderedlayoutInTable extends - Application.LegacyApplication { + LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2231.java b/uitest/src/com/vaadin/tests/tickets/Ticket2231.java index 21994bff60..935c34fec2 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2231.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2231.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2231 extends Application.LegacyApplication { +public class Ticket2231 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2232.java b/uitest/src/com/vaadin/tests/tickets/Ticket2232.java index d71134696f..4aa1b948a5 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2232.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2232.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; @@ -9,7 +9,7 @@ import com.vaadin.ui.Layout.SpacingHandler; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2232 extends Application.LegacyApplication { +public class Ticket2232 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2234.java b/uitest/src/com/vaadin/tests/tickets/Ticket2234.java index ccda59bb6a..dcc3f90696 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2234.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2234.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.ComboBox; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2234 extends Application.LegacyApplication { +public class Ticket2234 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2235.java b/uitest/src/com/vaadin/tests/tickets/Ticket2235.java index fba82956e0..2587937cbc 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2235.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2235.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextArea; -public class Ticket2235 extends Application.LegacyApplication { +public class Ticket2235 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2240.java b/uitest/src/com/vaadin/tests/tickets/Ticket2240.java index bb16a40cd7..27235c1afb 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2240.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2240.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2240 extends Application.LegacyApplication { +public class Ticket2240 extends LegacyApplication { public static final String txt = "

There are two main types of windows: application-level windows, and " + "\"sub windows\".

A sub window is rendered as a \"inline\" popup window" diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2242.java b/uitest/src/com/vaadin/tests/tickets/Ticket2242.java index 77fbfefe1a..d0191d3d13 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2242.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2242.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; @@ -13,7 +13,7 @@ import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; -public class Ticket2242 extends Application.LegacyApplication implements +public class Ticket2242 extends LegacyApplication implements ValueChangeListener { private Object tableValue = null; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2244.java b/uitest/src/com/vaadin/tests/tickets/Ticket2244.java index 495e3de26a..5b46e0332d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2244.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2244.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.util.BeanItem; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -10,7 +10,7 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2244 extends Application.LegacyApplication { +public class Ticket2244 extends LegacyApplication { Form form; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2245.java b/uitest/src/com/vaadin/tests/tickets/Ticket2245.java index ab474fe6f7..09d2e7a678 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2245.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2245.java @@ -1,10 +1,10 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.HorizontalSplitPanel; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2245 extends Application.LegacyApplication { +public class Ticket2245 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2267.java b/uitest/src/com/vaadin/tests/tickets/Ticket2267.java index 41843a9742..1a8e743f42 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2267.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2267.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -8,7 +8,7 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2267 extends Application.LegacyApplication { +public class Ticket2267 extends LegacyApplication { Label l = new Label("0"); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2271.java b/uitest/src/com/vaadin/tests/tickets/Ticket2271.java index 91fb51034b..71f47be1b3 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2271.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2271.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; import com.vaadin.ui.ComboBox; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2271 extends Application.LegacyApplication { +public class Ticket2271 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2282.java b/uitest/src/com/vaadin/tests/tickets/Ticket2282.java index 976b06fe32..8f6da9ffc5 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2282.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2282.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.FormLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2282 extends Application.LegacyApplication { +public class Ticket2282 extends LegacyApplication { private FormLayout layout1; private FormLayout layout2; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2283.java b/uitest/src/com/vaadin/tests/tickets/Ticket2283.java index 5576e48fba..daac9ae704 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2283.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2283.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Alignment; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2283 extends Application.LegacyApplication { +public class Ticket2283 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2289.java b/uitest/src/com/vaadin/tests/tickets/Ticket2289.java index c715fafd74..9d7bc32d2b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2289.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2289.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Accordion; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -11,7 +11,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TabSheet; import com.vaadin.ui.VerticalLayout; -public class Ticket2289 extends Application.LegacyApplication { +public class Ticket2289 extends LegacyApplication { TabSheet ts = null; Accordion acc = null; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2292.java b/uitest/src/com/vaadin/tests/tickets/Ticket2292.java index f3b5b68491..34f24276e5 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2292.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2292.java @@ -10,6 +10,7 @@ import java.io.IOException; import javax.imageio.ImageIO; import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.DownloadStream; import com.vaadin.server.ExternalResource; import com.vaadin.server.RequestHandler; @@ -21,7 +22,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Link; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2292 extends com.vaadin.Application.LegacyApplication +public class Ticket2292 extends com.vaadin.LegacyApplication implements RequestHandler { @Override diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2294.java b/uitest/src/com/vaadin/tests/tickets/Ticket2294.java index 053534191b..cfa5ecdd61 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2294.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2294.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Alignment; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2294 extends Application.LegacyApplication { +public class Ticket2294 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2296.java b/uitest/src/com/vaadin/tests/tickets/Ticket2296.java index d059b96953..2a19899425 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2296.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2296.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.CustomLayout; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2296 extends Application.LegacyApplication { +public class Ticket2296 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2303.java b/uitest/src/com/vaadin/tests/tickets/Ticket2303.java index fb1c5440ad..dd6a3886ac 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2303.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2303.java @@ -3,13 +3,13 @@ package com.vaadin.tests.tickets; import java.io.ByteArrayInputStream; import java.io.IOException; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.CustomLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2303 extends Application.LegacyApplication { +public class Ticket2303 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2304.java b/uitest/src/com/vaadin/tests/tickets/Ticket2304.java index ccef7a9a92..84321b88f3 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2304.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2304.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.themes.Reindeer; -public class Ticket2304 extends Application.LegacyApplication { +public class Ticket2304 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2310.java b/uitest/src/com/vaadin/tests/tickets/Ticket2310.java index 24fbd7a968..99d10ff36d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2310.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2310.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; @@ -8,7 +8,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.themes.Reindeer; -public class Ticket2310 extends Application.LegacyApplication { +public class Ticket2310 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2319.java b/uitest/src/com/vaadin/tests/tickets/Ticket2319.java index 438d2ff286..dd0a54dc63 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2319.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2319.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.HorizontalSplitPanel; @@ -10,7 +10,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalSplitPanel; -public class Ticket2319 extends Application.LegacyApplication { +public class Ticket2319 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2323.java b/uitest/src/com/vaadin/tests/tickets/Ticket2323.java index d7b8db86bd..eba7f2b06d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2323.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2323.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.RichTextArea; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Window; -public class Ticket2323 extends Application.LegacyApplication { +public class Ticket2323 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2325.java b/uitest/src/com/vaadin/tests/tickets/Ticket2325.java index ecc897d4ba..f63226d465 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2325.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2325.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextArea; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; -public class Ticket2325 extends Application.LegacyApplication { +public class Ticket2325 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2329.java b/uitest/src/com/vaadin/tests/tickets/Ticket2329.java index 2ce42376f9..c3daa680aa 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2329.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2329.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Component; import com.vaadin.ui.UI.LegacyWindow; @@ -8,7 +8,7 @@ import com.vaadin.ui.Table; import com.vaadin.ui.Table.ColumnGenerator; import com.vaadin.ui.VerticalLayout; -public class Ticket2329 extends Application.LegacyApplication { +public class Ticket2329 extends LegacyApplication { private Table table; private VerticalLayout mainLo; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2337.java b/uitest/src/com/vaadin/tests/tickets/Ticket2337.java index 3ac381b2d1..b2ad360bf8 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2337.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2337.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2337 extends Application.LegacyApplication { +public class Ticket2337 extends LegacyApplication { GridLayout gl = new GridLayout(3, 1); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2339.java b/uitest/src/com/vaadin/tests/tickets/Ticket2339.java index ce884bada7..e1eb9ed5c4 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2339.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2339.java @@ -3,12 +3,12 @@ package com.vaadin.tests.tickets; import java.io.ByteArrayInputStream; import java.io.IOException; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.CustomLayout; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2339 extends Application.LegacyApplication { +public class Ticket2339 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2341.java b/uitest/src/com/vaadin/tests/tickets/Ticket2341.java index aa2eefcb7e..560b945479 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2341.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2341.java @@ -1,12 +1,13 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.data.Item; import com.vaadin.ui.Label; import com.vaadin.ui.Layout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; -public class Ticket2341 extends com.vaadin.Application.LegacyApplication { +public class Ticket2341 extends com.vaadin.LegacyApplication { @Override public void init() { LegacyWindow main = new LegacyWindow(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2344.java b/uitest/src/com/vaadin/tests/tickets/Ticket2344.java index befad78a73..bf1296ec73 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2344.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2344.java @@ -2,14 +2,14 @@ package com.vaadin.tests.tickets; import java.util.Random; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.themes.BaseTheme; -public class Ticket2344 extends Application.LegacyApplication { +public class Ticket2344 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2347.java b/uitest/src/com/vaadin/tests/tickets/Ticket2347.java index 582b9a95ee..393aebf2ad 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2347.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2347.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -8,7 +8,7 @@ import com.vaadin.ui.CustomLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2347 extends Application.LegacyApplication { +public class Ticket2347 extends LegacyApplication { private Button b1; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2364.java b/uitest/src/com/vaadin/tests/tickets/Ticket2364.java index f7d6f61110..e7d9e19ab4 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2364.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2364.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Form; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Select; import com.vaadin.ui.VerticalLayout; -public class Ticket2364 extends Application.LegacyApplication { +public class Ticket2364 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2365.java b/uitest/src/com/vaadin/tests/tickets/Ticket2365.java index b191901356..8361b0b308 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2365.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2365.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2365 extends Application.LegacyApplication { +public class Ticket2365 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2398.java b/uitest/src/com/vaadin/tests/tickets/Ticket2398.java index f5b68800e6..66fbcd0c96 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2398.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2398.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.util.IndexedContainer; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; -public class Ticket2398 extends Application.LegacyApplication { +public class Ticket2398 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2404.java b/uitest/src/com/vaadin/tests/tickets/Ticket2404.java index 30f9d04d3b..b26cfc027a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2404.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2404.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2404 extends Application.LegacyApplication { +public class Ticket2404 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2405.java b/uitest/src/com/vaadin/tests/tickets/Ticket2405.java index 8be6a13e9f..57ed8e86fe 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2405.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2405.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.ExternalResource; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; @@ -13,7 +13,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket2405 extends Application.LegacyApplication { +public class Ticket2405 extends LegacyApplication { private Label label; private HorizontalSplitPanel split; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2406.java b/uitest/src/com/vaadin/tests/tickets/Ticket2406.java index dd42727591..a6ef9be77a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2406.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2406.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -8,7 +8,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; -public class Ticket2406 extends Application.LegacyApplication { +public class Ticket2406 extends LegacyApplication { private Window w; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2407.java b/uitest/src/com/vaadin/tests/tickets/Ticket2407.java index df2ae47acd..91c92ac07a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2407.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2407.java @@ -1,11 +1,12 @@ package com.vaadin.tests.tickets; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Form; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket2407 extends com.vaadin.Application.LegacyApplication { +public class Ticket2407 extends com.vaadin.LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2411.java b/uitest/src/com/vaadin/tests/tickets/Ticket2411.java index 2c59493e0c..b9784d6941 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2411.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2411.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2411 extends Application.LegacyApplication { +public class Ticket2411 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2415.java b/uitest/src/com/vaadin/tests/tickets/Ticket2415.java index f52c1b1ccc..c5d1500876 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2415.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2415.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2415 extends Application.LegacyApplication { +public class Ticket2415 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2420.java b/uitest/src/com/vaadin/tests/tickets/Ticket2420.java index 5d15107053..d1ecfab9be 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2420.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2420.java @@ -1,10 +1,10 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.ProgressIndicator; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2420 extends Application.LegacyApplication { +public class Ticket2420 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2425.java b/uitest/src/com/vaadin/tests/tickets/Ticket2425.java index 140fa6f2b6..ba4c0b508b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2425.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2425.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TabSheet; -public class Ticket2425 extends Application.LegacyApplication { +public class Ticket2425 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2426.java b/uitest/src/com/vaadin/tests/tickets/Ticket2426.java index fee74b73f7..a8f2cf9e02 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2426.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2426.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2426 extends Application.LegacyApplication { +public class Ticket2426 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2431.java b/uitest/src/com/vaadin/tests/tickets/Ticket2431.java index cb9eb449bf..5db59ab45c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2431.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2431.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; import com.vaadin.event.ShortcutAction; @@ -9,7 +9,7 @@ import com.vaadin.event.ShortcutAction.ModifierKey; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2431 extends Application.LegacyApplication { +public class Ticket2431 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2432.java b/uitest/src/com/vaadin/tests/tickets/Ticket2432.java index f21e6a6752..4a1dfb33bb 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2432.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2432.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Alignment; import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; @@ -10,7 +10,7 @@ import com.vaadin.ui.Layout.AlignmentHandler; import com.vaadin.ui.Layout.SpacingHandler; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2432 extends Application.LegacyApplication { +public class Ticket2432 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2434.java b/uitest/src/com/vaadin/tests/tickets/Ticket2434.java index 6401a98763..7d8ba3ae47 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2434.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2434.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; -public class Ticket2434 extends Application.LegacyApplication { +public class Ticket2434 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2436.java b/uitest/src/com/vaadin/tests/tickets/Ticket2436.java index 5367c24b01..1445095b1e 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2436.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2436.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Component; import com.vaadin.ui.PopupView; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2436 extends Application.LegacyApplication { +public class Ticket2436 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2526.java b/uitest/src/com/vaadin/tests/tickets/Ticket2526.java index 998fe75f8c..f340dd7e80 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2526.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2526.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Window; -public class Ticket2526 extends Application.LegacyApplication { +public class Ticket2526 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2742.java b/uitest/src/com/vaadin/tests/tickets/Ticket2742.java index 733f6ac6f6..6e9dea0363 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2742.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2742.java @@ -3,7 +3,7 @@ */ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.NativeSelect; import com.vaadin.ui.UI.LegacyWindow; @@ -12,7 +12,7 @@ import com.vaadin.ui.UI.LegacyWindow; * @author Risto Yrjänä / Vaadin Ltd. * */ -public class Ticket2742 extends Application.LegacyApplication { +public class Ticket2742 extends LegacyApplication { /* * (non-Javadoc) diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2901.java b/uitest/src/com/vaadin/tests/tickets/Ticket2901.java index c4352abefe..23f875a747 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2901.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2901.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; @@ -11,7 +11,7 @@ import com.vaadin.ui.VerticalSplitPanel; * properly. Scrollbars will disappear if "shaking" content a bit, like * selecting tests in area. */ -public class Ticket2901 extends Application.LegacyApplication { +public class Ticket2901 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2998.java b/uitest/src/com/vaadin/tests/tickets/Ticket2998.java index 0cd43533fd..e089c25349 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2998.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2998.java @@ -8,7 +8,7 @@ import java.util.Map; import java.util.Random; import java.util.Set; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Container; import com.vaadin.data.Validator; import com.vaadin.data.util.BeanItemContainer; @@ -38,7 +38,7 @@ import com.vaadin.ui.themes.Reindeer; * * Other browsers are much faster. */ -public class Ticket2998 extends Application.LegacyApplication { +public class Ticket2998 extends LegacyApplication { private Table table; private VerticalLayout mainLayout; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket3146.java b/uitest/src/com/vaadin/tests/tickets/Ticket3146.java index 7973ffa496..fe91040f2f 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket3146.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket3146.java @@ -3,14 +3,14 @@ package com.vaadin.tests.tickets; import java.util.Collection; import java.util.HashSet; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.TextField; -public class Ticket3146 extends Application.LegacyApplication { +public class Ticket3146 extends LegacyApplication { Table table; TextField result; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket34.java b/uitest/src/com/vaadin/tests/tickets/Ticket34.java index fd5e9c6005..394ff0613e 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket34.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket34.java @@ -3,7 +3,7 @@ package com.vaadin.tests.tickets; import java.util.HashMap; import java.util.Map; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.server.Page; import com.vaadin.server.Page.FragmentChangedEvent; import com.vaadin.ui.Button; @@ -15,7 +15,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket34 extends Application.LegacyApplication { +public class Ticket34 extends LegacyApplication { private Map views = new HashMap(); private VerticalLayout mainLayout; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket5053.java b/uitest/src/com/vaadin/tests/tickets/Ticket5053.java index 6f8ade15c4..b055e63789 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket5053.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket5053.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.ComboBox; import com.vaadin.ui.UI.LegacyWindow; /** * #5053: Last ComboBox item may not be shown if null selection enabled */ -public class Ticket5053 extends Application.LegacyApplication { +public class Ticket5053 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket5157.java b/uitest/src/com/vaadin/tests/tickets/Ticket5157.java index 3102a0a56c..0bcd4e60bd 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket5157.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket5157.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.event.ShortcutAction.KeyCode; import com.vaadin.event.ShortcutListener; import com.vaadin.ui.Label; @@ -14,7 +14,7 @@ import com.vaadin.ui.TextField; * Therefore, registering e.g. F8 as a key code resulted in "w" being used as * the trigger and F8 being ignored. */ -public class Ticket5157 extends Application.LegacyApplication { +public class Ticket5157 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket5952.java b/uitest/src/com/vaadin/tests/tickets/Ticket5952.java index 92cd0290d6..c240d94f0c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket5952.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket5952.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket5952 extends Application.LegacyApplication { +public class Ticket5952 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket677.java b/uitest/src/com/vaadin/tests/tickets/Ticket677.java index 1c66f67ca1..6b0ffc02ed 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket677.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket677.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Container; import com.vaadin.data.Item; import com.vaadin.data.Property; @@ -21,7 +21,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.TextField; -public class Ticket677 extends Application.LegacyApplication { +public class Ticket677 extends LegacyApplication { private static final Label info = new Label( "

  • keep debug window open to see variable changes" diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket695.java b/uitest/src/com/vaadin/tests/tickets/Ticket695.java index e539f999b3..d5f3d74ef0 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket695.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket695.java @@ -4,13 +4,13 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; @SuppressWarnings("serial") -public class Ticket695 extends Application.LegacyApplication { +public class Ticket695 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket736.java b/uitest/src/com/vaadin/tests/tickets/Ticket736.java index 417ee86fac..865c5483dc 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket736.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket736.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.Validator; import com.vaadin.data.util.BeanItem; import com.vaadin.data.util.MethodProperty; @@ -17,7 +17,7 @@ import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket736 extends Application.LegacyApplication { +public class Ticket736 extends LegacyApplication { Address address = new Address(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket846.java b/uitest/src/com/vaadin/tests/tickets/Ticket846.java index 407663c6c6..d498797ef1 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket846.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket846.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.data.util.MethodProperty; import com.vaadin.data.validator.IntegerValidator; import com.vaadin.ui.Button; @@ -8,7 +8,7 @@ import com.vaadin.ui.CheckBox; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket846 extends Application.LegacyApplication { +public class Ticket846 extends LegacyApplication { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket932.java b/uitest/src/com/vaadin/tests/tickets/Ticket932.java index c12e2fcad3..d6d6304053 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket932.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket932.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.Application; +import com.vaadin.LegacyApplication; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; @@ -8,7 +8,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; -public class Ticket932 extends Application.LegacyApplication { +public class Ticket932 extends LegacyApplication { @Override public void init() { -- cgit v1.2.3 From 5ab35cc6080653a7e9b25712f637db6c95c183ce Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 5 Sep 2012 17:10:31 +0300 Subject: Combine ApplicationContext into Application (#9402) --- server/src/com/vaadin/Application.java | 185 ++++++++++++++------- server/src/com/vaadin/LegacyApplication.java | 75 ++++----- .../server/AbstractCommunicationManager.java | 4 +- .../src/com/vaadin/server/ApplicationContext.java | 182 -------------------- server/src/com/vaadin/server/CombinedRequest.java | 4 +- .../com/vaadin/server/CommunicationManager.java | 2 +- server/src/com/vaadin/server/GAEVaadinServlet.java | 14 +- .../src/com/vaadin/server/LegacyVaadinPortlet.java | 7 +- .../src/com/vaadin/server/LegacyVaadinServlet.java | 7 +- server/src/com/vaadin/server/Page.java | 2 +- .../vaadin/server/PortletApplicationContext2.java | 23 +-- .../vaadin/server/PortletCommunicationManager.java | 2 +- server/src/com/vaadin/server/RequestTimer.java | 3 +- .../vaadin/server/ServletApplicationContext.java | 32 +--- server/src/com/vaadin/server/VaadinPortlet.java | 83 +++------ server/src/com/vaadin/server/VaadinServlet.java | 106 ++++-------- .../vaadin/server/WrappedHttpServletRequest.java | 4 +- .../com/vaadin/server/WrappedPortletRequest.java | 2 +- .../src/com/vaadin/tests/server/TestMimeTypes.java | 9 - .../tests/server/TestStreamVariableMapping.java | 7 +- .../vaadin/launcher/ApplicationRunnerServlet.java | 9 +- .../src/com/vaadin/tests/VerifyBrowserVersion.java | 4 +- .../tests/application/ApplicationCloseTest.java | 4 +- .../vaadin/tests/components/AbstractTestCase.java | 5 +- .../vaadin/tests/components/AbstractTestUI.java | 6 +- .../tests/components/AbstractTestUIProvider.java | 4 +- 26 files changed, 260 insertions(+), 525 deletions(-) delete mode 100644 server/src/com/vaadin/server/ApplicationContext.java (limited to 'uitest/src') diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java index 2baf252a62..6d37fbd5ae 100644 --- a/server/src/com/vaadin/Application.java +++ b/server/src/com/vaadin/Application.java @@ -31,17 +31,19 @@ import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; +import javax.servlet.http.HttpSessionBindingEvent; +import javax.servlet.http.HttpSessionBindingListener; + import com.vaadin.data.util.converter.Converter; import com.vaadin.data.util.converter.ConverterFactory; import com.vaadin.data.util.converter.DefaultConverterFactory; import com.vaadin.event.EventRouter; +import com.vaadin.server.AbstractCommunicationManager; import com.vaadin.server.AbstractErrorMessage; import com.vaadin.server.ApplicationConfiguration; -import com.vaadin.server.ApplicationContext; import com.vaadin.server.BootstrapFragmentResponse; import com.vaadin.server.BootstrapListener; import com.vaadin.server.BootstrapPageResponse; @@ -52,14 +54,15 @@ import com.vaadin.server.CombinedRequest; import com.vaadin.server.DeploymentConfiguration; import com.vaadin.server.GlobalResourceHandler; import com.vaadin.server.RequestHandler; -import com.vaadin.server.ServletApplicationContext; import com.vaadin.server.Terminal; import com.vaadin.server.UIProvider; import com.vaadin.server.VaadinServlet; import com.vaadin.server.VariableOwner; +import com.vaadin.server.WebBrowser; import com.vaadin.server.WrappedRequest; import com.vaadin.server.WrappedRequest.BrowserDetails; import com.vaadin.server.WrappedResponse; +import com.vaadin.server.WrappedSession; import com.vaadin.shared.ui.ui.UIConstants; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.AbstractField; @@ -121,7 +124,8 @@ import com.vaadin.util.ReflectTools; * @since 3.0 */ @SuppressWarnings("serial") -public class Application implements Terminal.ErrorListener, Serializable { +public class Application implements Terminal.ErrorListener, + HttpSessionBindingListener, Serializable { /** * The name of the parameter that is by default used in e.g. web.xml to @@ -147,22 +151,22 @@ public class Application implements Terminal.ErrorListener, Serializable { private final ApplicationConfiguration configuration; - private final ApplicationContext context; + private final AbstractCommunicationManager communicationManager; /** * @param applicationUrl * the URL the application should respond to. * @param configuration * the application configuration for the application. - * @param context - * the context application will be running in. + * @param communicationManager + * the communication manager for the application. */ public ApplicationStartEvent(URL applicationUrl, ApplicationConfiguration configuration, - ApplicationContext context) { + AbstractCommunicationManager communicationManager) { this.applicationUrl = applicationUrl; this.configuration = configuration; - this.context = context; + this.communicationManager = communicationManager; } /** @@ -187,25 +191,20 @@ public class Application implements Terminal.ErrorListener, Serializable { } /** - * Gets the context application will be running in. + * Gets the communication manager for this application. * - * @return the context application will be running in. + * @return the communication manager for this application. * - * @see Application#getContext() + * @see Application#getCommunicationManager */ - public ApplicationContext getContext() { - return context; + public AbstractCommunicationManager getCommunicationManager() { + return communicationManager; } } private final static Logger logger = Logger.getLogger(Application.class .getName()); - /** - * Application context the application is running in. - */ - private ApplicationContext context; - /** * Configuration for the application. */ @@ -257,6 +256,87 @@ public class Application implements Terminal.ErrorListener, Serializable { private GlobalResourceHandler globalResourceHandler; + protected WebBrowser browser = new WebBrowser(); + + private AbstractCommunicationManager communicationManager; + + private long totalSessionTime = 0; + + private long lastRequestTime = -1; + + private transient WrappedSession session; + + /** + * @see javax.servlet.http.HttpSessionBindingListener#valueBound(HttpSessionBindingEvent) + */ + @Override + public void valueBound(HttpSessionBindingEvent arg0) { + // We are not interested in bindings + } + + /** + * @see javax.servlet.http.HttpSessionBindingListener#valueUnbound(HttpSessionBindingEvent) + */ + @Override + public void valueUnbound(HttpSessionBindingEvent event) { + // If we are going to be unbound from the session, the session must be + // closing + close(); + } + + /** + * Get the web browser associated with this application context. + * + * Because application context is related to the http session and server + * maintains one session per browser-instance, each context has exactly one + * web browser associated with it. + * + * @return + */ + public WebBrowser getBrowser() { + return browser; + } + + /** + * @return The total time spent servicing requests in this session. + */ + public long getTotalSessionTime() { + return totalSessionTime; + } + + /** + * Sets the time spent servicing the last request in the session and updates + * the total time spent servicing requests in this session. + * + * @param time + * the time spent in the last request. + */ + public void setLastRequestTime(long time) { + lastRequestTime = time; + totalSessionTime += time; + } + + /** + * @return the time spent servicing the last request in this session. + */ + public long getLastRequestTime() { + return lastRequestTime; + } + + /** + * Gets the session to which this application context is currently + * associated. + * + * @return the wrapped session for this context + */ + public WrappedSession getSession() { + return session; + } + + public AbstractCommunicationManager getApplicationManager() { + return communicationManager; + } + /** * Gets the URL of the application. * @@ -291,6 +371,28 @@ public class Application implements Terminal.ErrorListener, Serializable { } } + public static Application getForSession(WrappedSession session) { + Object attribute = session.getAttribute(Application.class.getName()); + if (attribute instanceof Application) { + Application application = (Application) attribute; + application.session = session; + return application; + } + + return null; + } + + public void removeFromSession() { + assert (getForSession(session) == this); + + session.setAttribute(Application.class.getName(), null); + } + + public void storeInSession(WrappedSession session) { + session.setAttribute(Application.class.getName(), this); + this.session = session; + } + /** * Starts the application on the given URL. * @@ -316,8 +418,7 @@ public class Application implements Terminal.ErrorListener, Serializable { public void start(ApplicationStartEvent event) { applicationUrl = event.getApplicationUrl(); configuration = event.getConfiguration(); - context = event.getContext(); - init(); + communicationManager = event.getCommunicationManager(); applicationIsRunning = true; } @@ -325,9 +426,8 @@ public class Application implements Terminal.ErrorListener, Serializable { * Tests if the application is running or if it has been finished. * *

    - * Application starts running when its - * {@link #start(URL, Properties, ApplicationContext)} method has been - * called and stops when the {@link #close()} is called. + * Application starts running when its {@link #start(ApplicationStartEvent)} + * method has been called and stops when the {@link #close()} is called. *

    * * @return true if the application is running, @@ -337,17 +437,6 @@ public class Application implements Terminal.ErrorListener, Serializable { return applicationIsRunning; } - /** - *

    - * Main initializer of the application. The init method is - * called by the framework when the application is started, and it should - * perform whatever initialization operations the application needs. - *

    - */ - public void init() { - // Default implementation does nothing - } - /** * Gets the configuration for this application * @@ -574,28 +663,6 @@ public class Application implements Terminal.ErrorListener, Serializable { getLogger().log(Level.SEVERE, "Terminal error:", t); } - /** - * Gets the application context. - *

    - * The application context is the environment where the application is - * running in. The actual implementation class of may contains quite a lot - * more functionality than defined in the {@link ApplicationContext} - * interface. - *

    - *

    - * By default, when you are deploying your application to a servlet - * container, the implementation class is {@link ServletApplicationContext} - * - you can safely cast to this class and use the methods from there. When - * you are deploying your application as a portlet, context implementation - * is {@link PortletApplicationContext}. - *

    - * - * @return the application context. - */ - public ApplicationContext getContext() { - return context; - } - /** * Gets the application error handler. * @@ -1871,8 +1938,8 @@ public class Application implements Terminal.ErrorListener, Serializable { * timeout never occurs. */ protected int getUidlRequestTimeout() { - return configuration.isIdleUICleanupEnabled() ? getContext() - .getSession().getMaxInactiveInterval() : -1; + return configuration.isIdleUICleanupEnabled() ? getSession() + .getMaxInactiveInterval() : -1; } /** diff --git a/server/src/com/vaadin/LegacyApplication.java b/server/src/com/vaadin/LegacyApplication.java index 5bfc466fa4..b884136767 100644 --- a/server/src/com/vaadin/LegacyApplication.java +++ b/server/src/com/vaadin/LegacyApplication.java @@ -26,27 +26,25 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import com.vaadin.server.AbstractUIProvider; -import com.vaadin.server.ApplicationContext; -import com.vaadin.server.WrappedRequest; import com.vaadin.server.Terminal.ErrorEvent; import com.vaadin.server.Terminal.ErrorListener; +import com.vaadin.server.WrappedRequest; import com.vaadin.ui.UI; -import com.vaadin.ui.UI.LegacyWindow; /** - * A special application designed to help migrating applications from Vaadin - * 6 to Vaadin 7. The legacy application supports setting a main window, - * adding additional browser level windows and defining the theme for the - * entire application. + * A special application designed to help migrating applications from Vaadin 6 + * to Vaadin 7. The legacy application supports setting a main window, adding + * additional browser level windows and defining the theme for the entire + * application. * - * @deprecated This class is only intended to ease migration and should not - * be used for new projects. + * @deprecated This class is only intended to ease migration and should not be + * used for new projects. * * @since 7.0 */ @Deprecated -public abstract class LegacyApplication extends AbstractUIProvider - implements ErrorListener { +public abstract class LegacyApplication extends AbstractUIProvider implements + ErrorListener { /** * Ignore initial / and then get everything up to the next / */ @@ -59,16 +57,15 @@ public abstract class LegacyApplication extends AbstractUIProvider private Map legacyUINames = new HashMap(); /** - * Sets the main window of this application. Setting window as a main - * window of this application also adds the window to this application. + * Sets the main window of this application. Setting window as a main window + * of this application also adds the window to this application. * * @param mainWindow * the UI to set as the default window */ public void setMainWindow(UI.LegacyWindow mainWindow) { if (this.mainWindow != null) { - throw new IllegalStateException( - "mainWindow has already been set"); + throw new IllegalStateException("mainWindow has already been set"); } if (mainWindow.getApplication() == null) { mainWindow.setApplication(Application.getCurrent()); @@ -102,8 +99,8 @@ public abstract class LegacyApplication extends AbstractUIProvider } @Override - public UI createInstance(Application application, - Class type, WrappedRequest request) { + public UI createInstance(Application application, Class type, + WrappedRequest request) { return getUIInstance(request); } @@ -159,9 +156,9 @@ public abstract class LegacyApplication extends AbstractUIProvider } /** - * This implementation simulates the way of finding a window for a - * request by extracting a window name from the requested path and - * passes that name to {@link #getWindow(String)}. + * This implementation simulates the way of finding a window for a request + * by extracting a window name from the requested path and passes that name + * to {@link #getWindow(String)}. *

    * {@inheritDoc} */ @@ -196,9 +193,9 @@ public abstract class LegacyApplication extends AbstractUIProvider /** * Gets the application's theme. The application's theme is the default - * theme used by all the uIs for which a theme is not explicitly - * defined. If the application theme is not explicitly set, - * null is returned. + * theme used by all the uIs for which a theme is not explicitly defined. If + * the application theme is not explicitly set, null is + * returned. * * @return the name of the application's theme. */ @@ -208,15 +205,14 @@ public abstract class LegacyApplication extends AbstractUIProvider /** *

    - * Gets a UI by name. Returns null if the application is - * not running or it does not contain a window corresponding to the - * name. + * Gets a UI by name. Returns null if the application is not + * running or it does not contain a window corresponding to the name. *

    * * @param name * the name of the requested window - * @return a UI corresponding to the name, or null to use - * the default window + * @return a UI corresponding to the name, or null to use the + * default window */ public UI.LegacyWindow getWindow(String name) { return legacyUINames.get(name); @@ -228,9 +224,9 @@ public abstract class LegacyApplication extends AbstractUIProvider private int namelessUIIndex = 0; /** - * Adds a new browser level window to this application. Please note that - * UI doesn't have a name that is used in the URL - to add a named - * window you should instead use {@link #addWindow(UI, String)} + * Adds a new browser level window to this application. Please note that UI + * doesn't have a name that is used in the URL - to add a named window you + * should instead use {@link #addWindow(UI, String)} * * @param uI * the UI window to add to the application @@ -249,21 +245,20 @@ public abstract class LegacyApplication extends AbstractUIProvider } /** - * Removes the specified window from the application. This also removes - * all name mappings for the window (see {@link #addWindow(UI, String) - * and #getWindowName(UI)}. + * Removes the specified window from the application. This also removes all + * name mappings for the window (see {@link #addWindow(UI, String) and + * #getWindowName(UI)}. * *

    - * Note that removing window from the application does not close the - * browser window - the window is only removed from the server-side. + * Note that removing window from the application does not close the browser + * window - the window is only removed from the server-side. *

    * * @param uI * the UI to remove */ public void removeWindow(UI.LegacyWindow uI) { - for (Entry entry : legacyUINames - .entrySet()) { + for (Entry entry : legacyUINames.entrySet()) { if (entry.getValue() == uI) { legacyUINames.remove(entry.getKey()); } @@ -288,8 +283,8 @@ public abstract class LegacyApplication extends AbstractUIProvider Application.getCurrent().terminalError(event); } - public ApplicationContext getContext() { - return Application.getCurrent().getContext(); + public Application getContext() { + return Application.getCurrent(); } protected void close() { diff --git a/server/src/com/vaadin/server/AbstractCommunicationManager.java b/server/src/com/vaadin/server/AbstractCommunicationManager.java index 3d27dd18b9..47bf652a3a 100644 --- a/server/src/com/vaadin/server/AbstractCommunicationManager.java +++ b/server/src/com/vaadin/server/AbstractCommunicationManager.java @@ -1313,9 +1313,9 @@ public abstract class AbstractCommunicationManager implements Serializable { * response. */ private void writePerformanceData(final PrintWriter outWriter) { - ApplicationContext ctx = application.getContext(); outWriter.write(String.format(", \"timings\":[%d, %d]", - ctx.getTotalSessionTime(), ctx.getLastRequestTime())); + application.getTotalSessionTime(), + application.getLastRequestTime())); } private void legacyPaint(PaintTarget paintTarget, diff --git a/server/src/com/vaadin/server/ApplicationContext.java b/server/src/com/vaadin/server/ApplicationContext.java deleted file mode 100644 index 0b317486e4..0000000000 --- a/server/src/com/vaadin/server/ApplicationContext.java +++ /dev/null @@ -1,182 +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.server; - -import java.io.Serializable; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.servlet.http.HttpSessionBindingEvent; -import javax.servlet.http.HttpSessionBindingListener; - -import com.vaadin.Application; - -/** - * ApplicationContext provides information about the running - * context of the application. Each context is shared by all applications that - * are open for one user. In a web-environment this corresponds to a - * HttpSession. - *

    - * Base class for web application contexts (including portlet contexts) that - * handles the common tasks. - * - * @author Vaadin Ltd. - * @since 3.1 - */ -public abstract class ApplicationContext implements HttpSessionBindingListener, - Serializable { - - private Application application; - - protected WebBrowser browser = new WebBrowser(); - - private AbstractCommunicationManager communicationManager; - - private long totalSessionTime = 0; - - private long lastRequestTime = -1; - - private transient WrappedSession session; - - /** - * @see javax.servlet.http.HttpSessionBindingListener#valueBound(HttpSessionBindingEvent) - */ - @Override - public void valueBound(HttpSessionBindingEvent arg0) { - // We are not interested in bindings - } - - /** - * @see javax.servlet.http.HttpSessionBindingListener#valueUnbound(HttpSessionBindingEvent) - */ - @Override - public void valueUnbound(HttpSessionBindingEvent event) { - // If we are going to be unbound from the session, the session must be - // closing - removeApplication(); - } - - /** - * Get the web browser associated with this application context. - * - * Because application context is related to the http session and server - * maintains one session per browser-instance, each context has exactly one - * web browser associated with it. - * - * @return - */ - public WebBrowser getBrowser() { - return browser; - } - - /** - * Returns the applications in this context. - * - * Each application context contains the application for one user. - * - * @return The application of this context, or null if there is - * no application - */ - public Application getApplication() { - return application; - } - - public void removeApplication() { - if (application == null) { - return; - } - try { - application.close(); - } catch (Exception e) { - // This should never happen but is possible with rare - // configurations (e.g. robustness tests). If you have one - // thread doing HTTP socket write and another thread trying to - // remove same application here. Possible if you got e.g. session - // lifetime 1 min but socket write may take longer than 1 min. - // FIXME: Handle exception - getLogger().log(Level.SEVERE, - "Could not close application, leaking memory.", e); - } finally { - application = null; - communicationManager = null; - } - } - - /** - * @return The total time spent servicing requests in this session. - */ - public long getTotalSessionTime() { - return totalSessionTime; - } - - /** - * Sets the time spent servicing the last request in the session and updates - * the total time spent servicing requests in this session. - * - * @param time - * the time spent in the last request. - */ - public void setLastRequestTime(long time) { - lastRequestTime = time; - totalSessionTime += time; - } - - /** - * @return the time spent servicing the last request in this session. - */ - public long getLastRequestTime() { - return lastRequestTime; - } - - private Logger getLogger() { - return Logger.getLogger(ApplicationContext.class.getName()); - } - - /** - * Gets the session to which this application context is currently - * associated. - * - * @return the wrapped session for this context - */ - public WrappedSession getSession() { - return session; - } - - /** - * Sets the session to which this application context is currently - * associated. - * - * @param session - * the wrapped session for this context - */ - public void setSession(WrappedSession session) { - this.session = session; - } - - public AbstractCommunicationManager getApplicationManager() { - return communicationManager; - } - - public void setApplication(Application application, - AbstractCommunicationManager communicationManager) { - if (this.application != null) { - removeApplication(); - } - this.application = application; - this.communicationManager = communicationManager; - } - -} \ No newline at end of file diff --git a/server/src/com/vaadin/server/CombinedRequest.java b/server/src/com/vaadin/server/CombinedRequest.java index 3432cda942..9176754d93 100644 --- a/server/src/com/vaadin/server/CombinedRequest.java +++ b/server/src/com/vaadin/server/CombinedRequest.java @@ -143,9 +143,7 @@ public class CombinedRequest implements WrappedRequest { @Override public WebBrowser getWebBrowser() { - ApplicationContext context = Application.getCurrent() - .getContext(); - return context.getBrowser(); + return Application.getCurrent().getBrowser(); } }; } diff --git a/server/src/com/vaadin/server/CommunicationManager.java b/server/src/com/vaadin/server/CommunicationManager.java index cc92023919..beea884aae 100644 --- a/server/src/com/vaadin/server/CommunicationManager.java +++ b/server/src/com/vaadin/server/CommunicationManager.java @@ -113,7 +113,7 @@ public class CommunicationManager extends AbstractCommunicationManager { protected InputStream getThemeResourceAsStream(UI uI, String themeName, String resource) { ServletApplicationContext context = (ServletApplicationContext) uI - .getApplication().getContext(); + .getApplication(); ServletContext servletContext = context.getHttpSession() .getServletContext(); return servletContext.getResourceAsStream("/" diff --git a/server/src/com/vaadin/server/GAEVaadinServlet.java b/server/src/com/vaadin/server/GAEVaadinServlet.java index 642737f73b..1175d6a960 100644 --- a/server/src/com/vaadin/server/GAEVaadinServlet.java +++ b/server/src/com/vaadin/server/GAEVaadinServlet.java @@ -47,6 +47,7 @@ import com.google.appengine.api.memcache.Expiration; import com.google.appengine.api.memcache.MemcacheService; import com.google.appengine.api.memcache.MemcacheServiceFactory; import com.google.apphosting.api.DeadlineExceededException; +import com.vaadin.Application; /** * ApplicationServlet to be used when deploying to Google App Engine, in @@ -241,7 +242,7 @@ public class GAEVaadinServlet extends VaadinServlet { } // de-serialize or create application context, store in session - ApplicationContext ctx = getApplicationContext(request, memcache); + Application ctx = getApplicationContext(request, memcache); super.service(request, response); @@ -291,8 +292,8 @@ public class GAEVaadinServlet extends VaadinServlet { } } - protected ApplicationContext getApplicationContext( - HttpServletRequest request, MemcacheService memcache) { + protected Application getApplicationContext(HttpServletRequest request, + MemcacheService memcache) { HttpSession session = request.getSession(); String id = AC_BASE + session.getId(); byte[] serializedAC = (byte[]) memcache.get(id); @@ -320,10 +321,9 @@ public class GAEVaadinServlet extends VaadinServlet { ObjectInputStream ois; try { ois = new ObjectInputStream(bais); - ApplicationContext applicationContext = (ApplicationContext) ois - .readObject(); - session.setAttribute(ServletApplicationContext.class.getName(), - applicationContext); + Application applicationContext = (Application) ois.readObject(); + applicationContext.storeInSession(new WrappedHttpSession( + session)); } catch (IOException e) { getLogger().log( Level.WARNING, diff --git a/server/src/com/vaadin/server/LegacyVaadinPortlet.java b/server/src/com/vaadin/server/LegacyVaadinPortlet.java index 7de38eaf94..77a94e4d0a 100644 --- a/server/src/com/vaadin/server/LegacyVaadinPortlet.java +++ b/server/src/com/vaadin/server/LegacyVaadinPortlet.java @@ -46,9 +46,10 @@ public class LegacyVaadinPortlet extends VaadinPortlet { } @Override - protected Application createApplication(PortletRequest request) - throws PortletException { - Application application = super.createApplication(request); + protected PortletApplicationContext2 createApplication( + PortletRequest request) throws PortletException { + PortletApplicationContext2 application = super + .createApplication(request); // Must set current before running init() Application.setCurrent(application); diff --git a/server/src/com/vaadin/server/LegacyVaadinServlet.java b/server/src/com/vaadin/server/LegacyVaadinServlet.java index 21419a2e33..aa78c401f5 100644 --- a/server/src/com/vaadin/server/LegacyVaadinServlet.java +++ b/server/src/com/vaadin/server/LegacyVaadinServlet.java @@ -46,9 +46,10 @@ public class LegacyVaadinServlet extends VaadinServlet { } @Override - protected Application createApplication(HttpServletRequest request) - throws ServletException { - Application application = super.createApplication(request); + protected ServletApplicationContext createApplication( + HttpServletRequest request) throws ServletException { + ServletApplicationContext application = super + .createApplication(request); // Must set current before running init() Application.setCurrent(application); diff --git a/server/src/com/vaadin/server/Page.java b/server/src/com/vaadin/server/Page.java index 015c6c907f..a1c181dcb9 100644 --- a/server/src/com/vaadin/server/Page.java +++ b/server/src/com/vaadin/server/Page.java @@ -391,7 +391,7 @@ public class Page implements Serializable { } public WebBrowser getWebBrowser() { - return uI.getApplication().getContext().getBrowser(); + return uI.getApplication().getBrowser(); } public void setBrowserWindowSize(int width, int height) { diff --git a/server/src/com/vaadin/server/PortletApplicationContext2.java b/server/src/com/vaadin/server/PortletApplicationContext2.java index a7b6d5b40a..ff23d12f4c 100644 --- a/server/src/com/vaadin/server/PortletApplicationContext2.java +++ b/server/src/com/vaadin/server/PortletApplicationContext2.java @@ -41,6 +41,7 @@ import javax.portlet.StateAwareResponse; import javax.servlet.http.HttpSessionBindingListener; import javax.xml.namespace.QName; +import com.vaadin.Application; import com.vaadin.ui.UI; import com.vaadin.util.CurrentInstance; @@ -53,7 +54,7 @@ import com.vaadin.util.CurrentInstance; * @author peholmst */ @SuppressWarnings("serial") -public class PortletApplicationContext2 extends ApplicationContext { +public class PortletApplicationContext2 extends Application { private final Set portletListeners = new LinkedHashSet(); @@ -63,26 +64,6 @@ public class PortletApplicationContext2 extends ApplicationContext { private final Map sharedParameterActionNameMap = new HashMap(); private final Map sharedParameterActionValueMap = new HashMap(); - public static PortletApplicationContext2 getApplicationContext( - PortletSession session) { - Object cxattr = session.getAttribute(PortletApplicationContext2.class - .getName()); - PortletApplicationContext2 cx = null; - // can be false also e.g. if old context comes from another - // classloader when using - // false - // and redeploying the portlet - see #7461 - if (cxattr instanceof PortletApplicationContext2) { - cx = (PortletApplicationContext2) cxattr; - } - if (cx == null) { - cx = new PortletApplicationContext2(); - session.setAttribute(PortletApplicationContext2.class.getName(), cx); - } - cx.setSession(new WrappedPortletSession(session)); - return cx; - } - public PortletSession getPortletSession() { WrappedSession wrappedSession = getSession(); PortletSession session = ((WrappedPortletSession) wrappedSession) diff --git a/server/src/com/vaadin/server/PortletCommunicationManager.java b/server/src/com/vaadin/server/PortletCommunicationManager.java index f7214f108c..ada42140c6 100644 --- a/server/src/com/vaadin/server/PortletCommunicationManager.java +++ b/server/src/com/vaadin/server/PortletCommunicationManager.java @@ -158,7 +158,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { protected InputStream getThemeResourceAsStream(UI uI, String themeName, String resource) { PortletApplicationContext2 context = (PortletApplicationContext2) uI - .getApplication().getContext(); + .getApplication(); PortletContext portletContext = context.getPortletSession() .getPortletContext(); return portletContext.getResourceAsStream("/" diff --git a/server/src/com/vaadin/server/RequestTimer.java b/server/src/com/vaadin/server/RequestTimer.java index 470677e331..afff901d2f 100644 --- a/server/src/com/vaadin/server/RequestTimer.java +++ b/server/src/com/vaadin/server/RequestTimer.java @@ -18,6 +18,7 @@ package com.vaadin.server; import java.io.Serializable; +import com.vaadin.Application; /** * Times the handling of requests and stores the information as an attribute in @@ -44,7 +45,7 @@ public class RequestTimer implements Serializable { * * @param context */ - public void stop(ApplicationContext context) { + public void stop(Application context) { // Measure and store the total handling time. This data can be // used in TestBench 3 tests. long time = (System.nanoTime() - requestStartTime) / 1000000; diff --git a/server/src/com/vaadin/server/ServletApplicationContext.java b/server/src/com/vaadin/server/ServletApplicationContext.java index a1f5a81624..0945de6cb5 100644 --- a/server/src/com/vaadin/server/ServletApplicationContext.java +++ b/server/src/com/vaadin/server/ServletApplicationContext.java @@ -23,6 +23,7 @@ import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionBindingListener; +import com.vaadin.Application; import com.vaadin.util.CurrentInstance; /** @@ -35,18 +36,10 @@ import com.vaadin.util.CurrentInstance; * @since 3.1 */ @SuppressWarnings("serial") -public class ServletApplicationContext extends ApplicationContext { +public class ServletApplicationContext extends Application { private transient boolean reinitializingSession = false; - /** - * Creates a new Web Application Context. - * - */ - protected ServletApplicationContext() { - - } - @Override public void valueUnbound(HttpSessionBindingEvent event) { if (!reinitializingSession) { @@ -62,7 +55,6 @@ public class ServletApplicationContext extends ApplicationContext { * contents. The purpose of this is to introduce a new session key in order * to avoid session fixation attacks. */ - @SuppressWarnings("unchecked") public void reinitializeSession() { HttpSession oldSession = getHttpSession(); @@ -93,7 +85,7 @@ public class ServletApplicationContext extends ApplicationContext { } // Update the "current session" variable - setSession(new WrappedHttpSession(newSession)); + storeInSession(new WrappedHttpSession(newSession)); } /** @@ -106,22 +98,4 @@ public class ServletApplicationContext extends ApplicationContext { return ((WrappedHttpSession) session).getHttpSession(); } - /** - * Gets the application context for an HttpSession. - * - * @param session - * the HTTP session. - * @return the application context for HttpSession. - */ - static public ServletApplicationContext getApplicationContext( - HttpSession session) { - ServletApplicationContext cx = (ServletApplicationContext) session - .getAttribute(ServletApplicationContext.class.getName()); - if (cx == null) { - cx = new ServletApplicationContext(); - session.setAttribute(ServletApplicationContext.class.getName(), cx); - } - cx.setSession(new WrappedHttpSession(session)); - return cx; - } } diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index eae01e9369..e69a635b76 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -474,8 +474,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { * Get or create an application context and an application * manager for the session */ - PortletApplicationContext2 applicationContext = getApplicationContext(request - .getPortletSession()); + PortletApplicationContext2 applicationContext = (PortletApplicationContext2) application; PortletCommunicationManager applicationManager = (PortletCommunicationManager) applicationContext .getApplicationManager(); @@ -494,8 +493,6 @@ public class VaadinPortlet extends GenericPortlet implements Constants { applicationContext.getBrowser().updateRequestDetails( wrappedRequest); - /* Start the newly created application */ - startApplication(request, application, applicationContext); applicationRunning = true; /* Notify listeners */ @@ -596,9 +593,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants { CurrentInstance.clearAll(); - PortletSession session = request.getPortletSession(false); - if (session != null) { - requestTimer.stop(getApplicationContext(session)); + if (application != null) { + requestTimer.stop(application); } } } @@ -764,27 +760,10 @@ public class VaadinPortlet extends GenericPortlet implements Constants { && (request.getParameter(URL_PARAMETER_REPAINT_ALL).equals("1")); } - private void startApplication(PortletRequest request, - Application application, PortletApplicationContext2 context) - throws PortletException, MalformedURLException { - if (!application.isRunning()) { - Locale locale = request.getLocale(); - application.setLocale(locale); - // No application URL when running inside a portlet - application.start(new ApplicationStartEvent(null, - getDeploymentConfiguration().getApplicationConfiguration(), - context)); - addonContext.fireApplicationStarted(application); - } - } - private void endApplication(PortletRequest request, PortletResponse response, Application application) throws IOException { - final PortletSession session = request.getPortletSession(); - if (session != null) { - getApplicationContext(session).removeApplication(); - } + application.removeFromSession(); // Do not send any redirects when running inside a portlet. } @@ -839,10 +818,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { } application.close(); - if (session != null) { - PortletApplicationContext2 context = getApplicationContext(session); - context.removeApplication(); - } + application.removeFromSession(); } private Application createAndRegisterApplication(PortletRequest request) @@ -855,16 +831,23 @@ public class VaadinPortlet extends GenericPortlet implements Constants { throw new PortletException(e); } - final PortletApplicationContext2 context = getApplicationContext(request - .getPortletSession()); - context.setApplication(newApplication, new PortletCommunicationManager( - newApplication)); + newApplication.storeInSession(new WrappedPortletSession(request + .getPortletSession())); + + Locale locale = request.getLocale(); + newApplication.setLocale(locale); + // No application URL when running inside a portlet + newApplication.start(new ApplicationStartEvent(null, + getDeploymentConfiguration().getApplicationConfiguration(), + new PortletCommunicationManager(newApplication))); + addonContext.fireApplicationStarted(newApplication); + return newApplication; } - protected Application createApplication(PortletRequest request) - throws PortletException { - Application application = new Application(); + protected PortletApplicationContext2 createApplication( + PortletRequest request) throws PortletException { + PortletApplicationContext2 application = new PortletApplicationContext2(); try { ServletPortletHelper.initDefaultUIProvider(application, @@ -887,18 +870,17 @@ public class VaadinPortlet extends GenericPortlet implements Constants { throw new SessionExpiredException(); } - PortletApplicationContext2 context = getApplicationContext(session); - Application application = context.getApplication(); + Application application = Application + .getForSession(new WrappedPortletSession(session)); if (application == null) { return null; } - if (application.isRunning()) { - return application; + if (!application.isRunning()) { + application.removeFromSession(); + return null; } - // application found but not running - context.removeApplication(); - return null; + return application; } private void handleServiceException(WrappedPortletRequest request, @@ -1003,21 +985,6 @@ public class VaadinPortlet extends GenericPortlet implements Constants { outWriter.close(); } - /** - * - * Gets the application context for a PortletSession. If no context is - * currently stored in a session a new context is created and stored in the - * session. - * - * @param portletSession - * the portlet session. - * @return the application context for the session. - */ - protected PortletApplicationContext2 getApplicationContext( - PortletSession portletSession) { - return PortletApplicationContext2.getApplicationContext(portletSession); - } - private static final Logger getLogger() { return Logger.getLogger(VaadinPortlet.class.getName()); } diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 8f33382110..eb21096c9b 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -318,8 +318,7 @@ public class VaadinServlet extends HttpServlet implements Constants { * Get or create a WebApplicationContext and an ApplicationManager * for the session */ - ServletApplicationContext webApplicationContext = getApplicationContext(request - .getSession()); + ServletApplicationContext webApplicationContext = (ServletApplicationContext) application; CommunicationManager applicationManager = (CommunicationManager) webApplicationContext .getApplicationManager(); @@ -335,8 +334,6 @@ public class VaadinServlet extends HttpServlet implements Constants { /* Update browser information from the request */ webApplicationContext.getBrowser().updateRequestDetails(request); - // Start the application if it's newly created - startApplication(request, application, webApplicationContext); applicationRunning = true; /* Handle the request */ @@ -388,9 +385,8 @@ public class VaadinServlet extends HttpServlet implements Constants { CurrentInstance.clearAll(); - HttpSession session = request.getSession(false); - if (session != null) { - requestTimer.stop(getApplicationContext(session)); + if (application != null) { + requestTimer.stop(application); } } } @@ -631,7 +627,7 @@ public class VaadinServlet extends HttpServlet implements Constants { } private Application createAndRegisterApplication(HttpServletRequest request) - throws ServletException { + throws ServletException, MalformedURLException { Application newApplication = createApplication(request); try { @@ -640,10 +636,19 @@ public class VaadinServlet extends HttpServlet implements Constants { throw new ServletException(e); } - final ServletApplicationContext context = getApplicationContext(request - .getSession()); - context.setApplication(newApplication, - createCommunicationManager(newApplication)); + newApplication.storeInSession(new WrappedHttpSession(request + .getSession())); + + final URL applicationUrl = getApplicationUrl(request); + + // Initial locale comes from the request + Locale locale = request.getLocale(); + newApplication.setLocale(locale); + newApplication.start(new ApplicationStartEvent(applicationUrl, + getDeploymentConfiguration().getApplicationConfiguration(), + createCommunicationManager(newApplication))); + + addonContext.fireApplicationStarted(newApplication); return newApplication; } @@ -717,9 +722,9 @@ public class VaadinServlet extends HttpServlet implements Constants { * @throws ServletException * @throws MalformedURLException */ - protected Application createApplication(HttpServletRequest request) - throws ServletException { - Application newApplication = new Application(); + protected ServletApplicationContext createApplication( + HttpServletRequest request) throws ServletException { + ServletApplicationContext newApplication = new ServletApplicationContext(); try { ServletPortletHelper.initDefaultUIProvider(newApplication, @@ -868,34 +873,6 @@ public class VaadinServlet extends HttpServlet implements Constants { log("Invalid security key received from " + request.getRemoteHost()); } - /** - * Starts the application if it is not already running. - * - * @param request - * @param application - * @param webApplicationContext - * @throws ServletException - * @throws MalformedURLException - */ - private void startApplication(HttpServletRequest request, - Application application, - ServletApplicationContext webApplicationContext) - throws ServletException, MalformedURLException { - - if (!application.isRunning()) { - // Create application - final URL applicationUrl = getApplicationUrl(request); - - // Initial locale comes from the request - Locale locale = request.getLocale(); - application.setLocale(locale); - application.start(new ApplicationStartEvent(applicationUrl, - getDeploymentConfiguration().getApplicationConfiguration(), - webApplicationContext)); - addonContext.fireApplicationStarted(application); - } - } - /** * Check if this is a request for a static resource and, if it is, serve the * resource to the client. @@ -1303,24 +1280,18 @@ public class VaadinServlet extends HttpServlet implements Constants { throw new SessionExpiredException(); } - ServletApplicationContext context = getApplicationContext(session); - - Application sessionApplication = context.getApplication(); + Application sessionApplication = getApplicationContext(session); if (sessionApplication == null) { return null; } - if (sessionApplication.isRunning()) { - // Found a running application - return sessionApplication; + if (!sessionApplication.isRunning()) { + sessionApplication.removeFromSession(); + return null; } - // Application has stopped, so remove it before creating a new - // application - getApplicationContext(session).removeApplication(); - // Existing application not found - return null; + return sessionApplication; } /** @@ -1346,7 +1317,7 @@ public class VaadinServlet extends HttpServlet implements Constants { final HttpSession session = request.getSession(); if (session != null) { - getApplicationContext(session).removeApplication(); + application.removeFromSession(); } response.sendRedirect(response.encodeRedirectURL(logoutUrl)); @@ -1398,29 +1369,14 @@ public class VaadinServlet extends HttpServlet implements Constants { application.close(); if (session != null) { - ServletApplicationContext context = getApplicationContext(session); - context.removeApplication(); + application.removeFromSession(); } } - /** - * - * Gets the application context from an HttpSession. If no context is - * currently stored in a session a new context is created and stored in the - * session. - * - * @param session - * the HTTP session. - * @return the application context for HttpSession. - */ - protected ServletApplicationContext getApplicationContext( - HttpSession session) { - /* - * TODO the ApplicationContext.getApplicationContext() should be removed - * and logic moved here. Now overriding context type is possible, but - * the whole creation logic should be here. MT 1101 - */ - return ServletApplicationContext.getApplicationContext(session); + protected Application getApplicationContext(final HttpSession session) { + Application sessionApplication = Application + .getForSession(new WrappedHttpSession(session)); + return sessionApplication; } public class RequestError implements Terminal.ErrorEvent, Serializable { diff --git a/server/src/com/vaadin/server/WrappedHttpServletRequest.java b/server/src/com/vaadin/server/WrappedHttpServletRequest.java index 9285f92035..05d9b13736 100644 --- a/server/src/com/vaadin/server/WrappedHttpServletRequest.java +++ b/server/src/com/vaadin/server/WrappedHttpServletRequest.java @@ -89,9 +89,7 @@ public class WrappedHttpServletRequest extends HttpServletRequestWrapper @Override public WebBrowser getWebBrowser() { - ApplicationContext context = Application.getCurrent() - .getContext(); - return context.getBrowser(); + return Application.getCurrent().getBrowser(); } }; } diff --git a/server/src/com/vaadin/server/WrappedPortletRequest.java b/server/src/com/vaadin/server/WrappedPortletRequest.java index 2d444d86ca..dffbebb379 100644 --- a/server/src/com/vaadin/server/WrappedPortletRequest.java +++ b/server/src/com/vaadin/server/WrappedPortletRequest.java @@ -152,7 +152,7 @@ public class WrappedPortletRequest implements WrappedRequest { @Override public WebBrowser getWebBrowser() { PortletApplicationContext2 context = (PortletApplicationContext2) Application - .getCurrent().getContext(); + .getCurrent(); return context.getBrowser(); } }; diff --git a/server/tests/src/com/vaadin/tests/server/TestMimeTypes.java b/server/tests/src/com/vaadin/tests/server/TestMimeTypes.java index dc730f6cc4..12e5b09632 100644 --- a/server/tests/src/com/vaadin/tests/server/TestMimeTypes.java +++ b/server/tests/src/com/vaadin/tests/server/TestMimeTypes.java @@ -2,21 +2,12 @@ package com.vaadin.tests.server; import junit.framework.TestCase; -import com.vaadin.Application; import com.vaadin.server.ClassResource; import com.vaadin.ui.Embedded; public class TestMimeTypes extends TestCase { public void testEmbeddedPDF() { - Application app = new Application() { - - @Override - public void init() { - // TODO Auto-generated method stub - - } - }; Embedded e = new Embedded("A pdf", new ClassResource("file.pddf")); assertEquals("Invalid mimetype", "application/octet-stream", e.getMimeType()); diff --git a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java index f3b367483a..775348fb5c 100644 --- a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java +++ b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java @@ -66,12 +66,7 @@ public class TestStreamVariableMapping extends TestCase { } private CommunicationManager createCommunicationManager() { - return new CommunicationManager(new Application() { - @Override - public void init() { - // TODO Auto-generated method stub - } - }); + return new CommunicationManager(new Application()); } } diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java index a9a988f296..34c1cc1fce 100644 --- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java +++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java @@ -34,6 +34,7 @@ import com.vaadin.LegacyApplication; import com.vaadin.server.AbstractUIProvider; import com.vaadin.server.ApplicationConfiguration; import com.vaadin.server.LegacyVaadinServlet; +import com.vaadin.server.ServletApplicationContext; import com.vaadin.server.UIProvider; import com.vaadin.server.WrappedHttpServletRequest; import com.vaadin.server.WrappedRequest; @@ -112,12 +113,12 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { } @Override - protected Application createApplication(HttpServletRequest request) - throws ServletException { + protected ServletApplicationContext createApplication( + HttpServletRequest request) throws ServletException { try { final Class classToRun = getClassToRun(); if (UI.class.isAssignableFrom(classToRun)) { - Application application = new Application(); + ServletApplicationContext application = new ServletApplicationContext(); application.addUIProvider(new AbstractUIProvider() { @Override @@ -130,7 +131,7 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { } else if (LegacyApplication.class.isAssignableFrom(classToRun)) { return super.createApplication(request); } else if (UIProvider.class.isAssignableFrom(classToRun)) { - Application application = new Application(); + ServletApplicationContext application = new ServletApplicationContext(); application .addUIProvider((UIProvider) classToRun.newInstance()); return application; diff --git a/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java b/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java index f4cf236a24..022a343196 100644 --- a/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java +++ b/uitest/src/com/vaadin/tests/VerifyBrowserVersion.java @@ -1,6 +1,5 @@ package com.vaadin.tests; -import com.vaadin.server.ApplicationContext; import com.vaadin.server.WebBrowser; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Label; @@ -9,8 +8,7 @@ public class VerifyBrowserVersion extends TestBase { @Override protected void setup() { - ApplicationContext context = getContext(); - WebBrowser browser = context.getBrowser(); + WebBrowser browser = getBrowser(); addComponent(new Label(browser.getBrowserApplication())); addComponent(new Label("Touch device? " + (browser.isTouchDevice() ? "YES" : "No"))); diff --git a/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java b/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java index f2fe90f4b1..7250ba3cfb 100644 --- a/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java +++ b/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java @@ -14,9 +14,9 @@ public class ApplicationCloseTest extends TestBase { protected void setup() { Label applications = new Label("Applications in session:
    ", ContentMode.XHTML); - if (getContext().getApplication() != null) { + if (getContext() != null) { applications.setValue(applications.getValue() + "App: " - + getContext().getApplication() + "
    "); + + getContext() + "
    "); } applications.setValue(applications.getValue() + "

    "); diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestCase.java b/uitest/src/com/vaadin/tests/components/AbstractTestCase.java index 6f539af016..5dc5fd7128 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestCase.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestCase.java @@ -1,7 +1,7 @@ package com.vaadin.tests.components; +import com.vaadin.Application; import com.vaadin.LegacyApplication; -import com.vaadin.server.ApplicationContext; import com.vaadin.server.WebBrowser; public abstract class AbstractTestCase extends LegacyApplication { @@ -11,8 +11,7 @@ public abstract class AbstractTestCase extends LegacyApplication { protected abstract Integer getTicketNumber(); protected WebBrowser getBrowser() { - ApplicationContext context = getContext(); - WebBrowser webBrowser = context.getBrowser(); + WebBrowser webBrowser = Application.getCurrent().getBrowser(); return webBrowser; } diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java index 21eda56891..92ac336df7 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java @@ -1,7 +1,5 @@ package com.vaadin.tests.components; -import com.vaadin.Application; -import com.vaadin.server.ApplicationContext; import com.vaadin.server.WebBrowser; import com.vaadin.server.WrappedRequest; import com.vaadin.shared.ui.label.ContentMode; @@ -56,9 +54,7 @@ public abstract class AbstractTestUI extends UI { protected abstract Integer getTicketNumber(); protected WebBrowser getBrowser() { - ApplicationContext context = Application.getCurrent().getContext(); - ApplicationContext webContext = context; - return webContext.getBrowser(); + return getApplication().getBrowser(); } } diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java b/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java index 3d380c7835..4311cd6a0f 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java @@ -2,7 +2,6 @@ package com.vaadin.tests.components; import com.vaadin.Application; import com.vaadin.server.AbstractUIProvider; -import com.vaadin.server.ApplicationContext; import com.vaadin.server.WebBrowser; public abstract class AbstractTestUIProvider extends AbstractUIProvider { @@ -11,8 +10,7 @@ public abstract class AbstractTestUIProvider extends AbstractUIProvider { protected abstract Integer getTicketNumber(); protected WebBrowser getBrowser() { - ApplicationContext context = Application.getCurrent().getContext(); - WebBrowser webBrowser = context.getBrowser(); + WebBrowser webBrowser = Application.getCurrent().getBrowser(); return webBrowser; } } -- cgit v1.2.3 From d1c361e251800c6f7d596ddf79ed1c7569196856 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 5 Sep 2012 19:04:20 +0300 Subject: Rename Application to VaadinSession (#9402) --- server/src/com/vaadin/Application.java | 1999 -------------------- server/src/com/vaadin/LegacyApplication.java | 27 +- .../vaadin/data/util/converter/ConverterUtil.java | 8 +- .../util/converter/DefaultConverterFactory.java | 4 +- .../com/vaadin/server/AbstractClientConnector.java | 3 +- .../server/AbstractCommunicationManager.java | 31 +- .../src/com/vaadin/server/AbstractUIProvider.java | 3 +- server/src/com/vaadin/server/AddonContext.java | 9 +- .../com/vaadin/server/ApplicationStartedEvent.java | 7 +- .../vaadin/server/ApplicationStartedListener.java | 5 +- .../vaadin/server/BootstrapFragmentResponse.java | 5 +- server/src/com/vaadin/server/BootstrapHandler.java | 11 +- .../com/vaadin/server/BootstrapPageResponse.java | 5 +- .../src/com/vaadin/server/BootstrapResponse.java | 7 +- server/src/com/vaadin/server/ClassResource.java | 3 +- server/src/com/vaadin/server/CombinedRequest.java | 3 +- .../com/vaadin/server/CommunicationManager.java | 11 +- .../vaadin/server/ConnectorResourceHandler.java | 5 +- .../src/com/vaadin/server/DefaultUIProvider.java | 5 +- server/src/com/vaadin/server/FileResource.java | 3 +- server/src/com/vaadin/server/GAEVaadinServlet.java | 9 +- .../com/vaadin/server/GlobalResourceHandler.java | 3 +- .../src/com/vaadin/server/LegacyVaadinPortlet.java | 7 +- .../src/com/vaadin/server/LegacyVaadinServlet.java | 7 +- .../vaadin/server/PortletApplicationContext2.java | 308 --- .../vaadin/server/PortletCommunicationManager.java | 7 +- server/src/com/vaadin/server/RequestHandler.java | 5 +- server/src/com/vaadin/server/RequestTimer.java | 3 +- .../vaadin/server/RestrictedRenderResponse.java | 2 +- .../vaadin/server/ServletApplicationContext.java | 101 - .../com/vaadin/server/ServletPortletHelper.java | 11 +- server/src/com/vaadin/server/StreamVariable.java | 3 +- server/src/com/vaadin/server/SystemMessages.java | 3 +- server/src/com/vaadin/server/UIProvider.java | 5 +- .../vaadin/server/UnsupportedBrowserHandler.java | 3 +- server/src/com/vaadin/server/VaadinPortlet.java | 35 +- .../com/vaadin/server/VaadinPortletSession.java | 307 +++ server/src/com/vaadin/server/VaadinServlet.java | 41 +- .../com/vaadin/server/VaadinServletSession.java | 100 + server/src/com/vaadin/server/VaadinSession.java | 1978 +++++++++++++++++++ .../vaadin/server/WrappedHttpServletRequest.java | 3 +- .../com/vaadin/server/WrappedPortletRequest.java | 3 +- server/src/com/vaadin/ui/AbstractComponent.java | 8 +- server/src/com/vaadin/ui/Component.java | 6 +- server/src/com/vaadin/ui/LoginForm.java | 4 +- server/src/com/vaadin/ui/UI.java | 28 +- .../tests/src/com/vaadin/tests/VaadinClasses.java | 4 +- .../tests/data/converter/ConverterFactory.java | 18 +- .../tests/server/TestStreamVariableMapping.java | 8 +- .../AbstractFieldValueConversions.java | 8 +- .../abstractfield/DefaultConverterFactory.java | 6 +- .../abstractfield/RemoveListenersOnDetach.java | 8 +- .../server/component/label/LabelConverters.java | 4 +- .../server/component/root/CustomUIClassLoader.java | 14 +- .../component/window/AttachDetachWindow.java | 6 +- .../vaadin/launcher/ApplicationRunnerServlet.java | 12 +- uitest/src/com/vaadin/tests/ModalWindow.java | 2 +- uitest/src/com/vaadin/tests/Parameters.java | 6 +- uitest/src/com/vaadin/tests/TestBench.java | 2 +- uitest/src/com/vaadin/tests/TreeFilesystem.java | 4 +- .../com/vaadin/tests/TreeFilesystemContainer.java | 4 +- .../tests/application/ThreadLocalInstances.java | 8 +- .../tests/applicationcontext/ChangeSessionId.java | 6 +- .../vaadin/tests/components/AbstractTestCase.java | 4 +- .../tests/components/AbstractTestUIProvider.java | 4 +- .../AbstractComponentDataBindingTest.java | 4 +- .../vaadin/tests/components/ui/LazyInitUIs.java | 10 +- .../tests/components/ui/UIsInMultipleTabs.java | 8 +- .../integration/JSR286PortletApplication.java | 8 +- .../v7a1/DifferentFeaturesForDifferentClients.java | 6 +- .../tests/minitutorials/v7a1/DynamicImageUI.java | 4 +- .../tests/minitutorials/v7a1/FindCurrentUI.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1589.java | 6 +- .../src/com/vaadin/tests/tickets/Ticket1921.java | 6 +- .../src/com/vaadin/tests/tickets/Ticket2292.java | 6 +- .../src/com/vaadin/tests/util/SampleDirectory.java | 4 +- 76 files changed, 2642 insertions(+), 2696 deletions(-) delete mode 100644 server/src/com/vaadin/Application.java delete mode 100644 server/src/com/vaadin/server/PortletApplicationContext2.java delete mode 100644 server/src/com/vaadin/server/ServletApplicationContext.java create mode 100644 server/src/com/vaadin/server/VaadinPortletSession.java create mode 100644 server/src/com/vaadin/server/VaadinServletSession.java create mode 100644 server/src/com/vaadin/server/VaadinSession.java (limited to 'uitest/src') diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java deleted file mode 100644 index 6d37fbd5ae..0000000000 --- a/server/src/com/vaadin/Application.java +++ /dev/null @@ -1,1999 +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; - -import java.io.IOException; -import java.io.Serializable; -import java.lang.reflect.Method; -import java.net.SocketException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.EventObject; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.servlet.http.HttpSessionBindingEvent; -import javax.servlet.http.HttpSessionBindingListener; - -import com.vaadin.data.util.converter.Converter; -import com.vaadin.data.util.converter.ConverterFactory; -import com.vaadin.data.util.converter.DefaultConverterFactory; -import com.vaadin.event.EventRouter; -import com.vaadin.server.AbstractCommunicationManager; -import com.vaadin.server.AbstractErrorMessage; -import com.vaadin.server.ApplicationConfiguration; -import com.vaadin.server.BootstrapFragmentResponse; -import com.vaadin.server.BootstrapListener; -import com.vaadin.server.BootstrapPageResponse; -import com.vaadin.server.BootstrapResponse; -import com.vaadin.server.ChangeVariablesErrorEvent; -import com.vaadin.server.ClientConnector; -import com.vaadin.server.CombinedRequest; -import com.vaadin.server.DeploymentConfiguration; -import com.vaadin.server.GlobalResourceHandler; -import com.vaadin.server.RequestHandler; -import com.vaadin.server.Terminal; -import com.vaadin.server.UIProvider; -import com.vaadin.server.VaadinServlet; -import com.vaadin.server.VariableOwner; -import com.vaadin.server.WebBrowser; -import com.vaadin.server.WrappedRequest; -import com.vaadin.server.WrappedRequest.BrowserDetails; -import com.vaadin.server.WrappedResponse; -import com.vaadin.server.WrappedSession; -import com.vaadin.shared.ui.ui.UIConstants; -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.AbstractField; -import com.vaadin.ui.Table; -import com.vaadin.ui.UI; -import com.vaadin.ui.Window; -import com.vaadin.util.CurrentInstance; -import com.vaadin.util.ReflectTools; - -/** - *

    - * Base class required for all Vaadin applications. This class provides all the - * basic services required by Vaadin. These services allow external discovery - * and manipulation of the user, {@link com.vaadin.ui.Window windows} and - * themes, and starting and stopping the application. - *

    - * - *

    - * As mentioned, all Vaadin applications must inherit this class. However, this - * is almost all of what one needs to do to create a fully functional - * application. The only thing a class inheriting the Application - * needs to do is implement the init method where it creates the - * windows it needs to perform its function. Note that all applications must - * have at least one window: the main window. The first unnamed window - * constructed by an application automatically becomes the main window which - * behaves just like other windows with one exception: when accessing windows - * using URLs the main window corresponds to the application URL whereas other - * windows correspond to a URL gotten by catenating the window's name to the - * application URL. - *

    - * - *

    - * See the class com.vaadin.demo.HelloWorld for a simple example of - * a fully working application. - *

    - * - *

    - * Window access. Application provides methods to - * list, add and remove the windows it contains. - *

    - * - *

    - * Execution control. This class includes method to start and - * finish the execution of the application. Being finished means basically that - * no windows will be available from the application anymore. - *

    - * - *

    - * Theme selection. The theme selection process allows a theme - * to be specified at three different levels. When a window's theme needs to be - * found out, the window itself is queried for a preferred theme. If the window - * does not prefer a specific theme, the application containing the window is - * queried. If neither the application prefers a theme, the default theme for - * the {@link com.vaadin.server.Terminal terminal} is used. The terminal always - * defines a default theme. - *

    - * - * @author Vaadin Ltd. - * @since 3.0 - */ -@SuppressWarnings("serial") -public class Application implements Terminal.ErrorListener, - HttpSessionBindingListener, Serializable { - - /** - * The name of the parameter that is by default used in e.g. web.xml to - * define the name of the default {@link UI} class. - */ - public static final String UI_PARAMETER = "UI"; - - private static final Method BOOTSTRAP_FRAGMENT_METHOD = ReflectTools - .findMethod(BootstrapListener.class, "modifyBootstrapFragment", - BootstrapFragmentResponse.class); - private static final Method BOOTSTRAP_PAGE_METHOD = ReflectTools - .findMethod(BootstrapListener.class, "modifyBootstrapPage", - BootstrapPageResponse.class); - - /** - * An event sent to {@link #start(ApplicationStartEvent)} when a new - * Application is being started. - * - * @since 7.0 - */ - public static class ApplicationStartEvent implements Serializable { - private final URL applicationUrl; - - private final ApplicationConfiguration configuration; - - private final AbstractCommunicationManager communicationManager; - - /** - * @param applicationUrl - * the URL the application should respond to. - * @param configuration - * the application configuration for the application. - * @param communicationManager - * the communication manager for the application. - */ - public ApplicationStartEvent(URL applicationUrl, - ApplicationConfiguration configuration, - AbstractCommunicationManager communicationManager) { - this.applicationUrl = applicationUrl; - this.configuration = configuration; - this.communicationManager = communicationManager; - } - - /** - * Gets the URL the application should respond to. - * - * @return the URL the application should respond to or - * null if the URL is not defined. - * - * @see Application#getURL() - */ - public URL getApplicationUrl() { - return applicationUrl; - } - - /** - * Returns the application configuration used by this application. - * - * @return the deployment configuration. - */ - public ApplicationConfiguration getConfiguration() { - return configuration; - } - - /** - * Gets the communication manager for this application. - * - * @return the communication manager for this application. - * - * @see Application#getCommunicationManager - */ - public AbstractCommunicationManager getCommunicationManager() { - return communicationManager; - } - } - - private final static Logger logger = Logger.getLogger(Application.class - .getName()); - - /** - * Configuration for the application. - */ - private ApplicationConfiguration configuration; - - /** - * The application's URL. - */ - private URL applicationUrl; - - /** - * Application status. - */ - private volatile boolean applicationIsRunning = false; - - /** - * Default locale of the application. - */ - private Locale locale; - - /** - * URL where the user is redirected to on application close, or null if - * application is just closed without redirection. - */ - private String logoutURL = null; - - /** - * Application wide error handler which is used by default if an error is - * left unhandled. - */ - private Terminal.ErrorListener errorHandler = this; - - /** - * The converter factory that is used to provide default converters for the - * application. - */ - private ConverterFactory converterFactory = new DefaultConverterFactory(); - - private LinkedList requestHandlers = new LinkedList(); - - private int nextUIId = 0; - private Map uIs = new HashMap(); - - private final Map retainOnRefreshUIs = new HashMap(); - - private final EventRouter eventRouter = new EventRouter(); - - private List uiProviders = new LinkedList(); - - private GlobalResourceHandler globalResourceHandler; - - protected WebBrowser browser = new WebBrowser(); - - private AbstractCommunicationManager communicationManager; - - private long totalSessionTime = 0; - - private long lastRequestTime = -1; - - private transient WrappedSession session; - - /** - * @see javax.servlet.http.HttpSessionBindingListener#valueBound(HttpSessionBindingEvent) - */ - @Override - public void valueBound(HttpSessionBindingEvent arg0) { - // We are not interested in bindings - } - - /** - * @see javax.servlet.http.HttpSessionBindingListener#valueUnbound(HttpSessionBindingEvent) - */ - @Override - public void valueUnbound(HttpSessionBindingEvent event) { - // If we are going to be unbound from the session, the session must be - // closing - close(); - } - - /** - * Get the web browser associated with this application context. - * - * Because application context is related to the http session and server - * maintains one session per browser-instance, each context has exactly one - * web browser associated with it. - * - * @return - */ - public WebBrowser getBrowser() { - return browser; - } - - /** - * @return The total time spent servicing requests in this session. - */ - public long getTotalSessionTime() { - return totalSessionTime; - } - - /** - * Sets the time spent servicing the last request in the session and updates - * the total time spent servicing requests in this session. - * - * @param time - * the time spent in the last request. - */ - public void setLastRequestTime(long time) { - lastRequestTime = time; - totalSessionTime += time; - } - - /** - * @return the time spent servicing the last request in this session. - */ - public long getLastRequestTime() { - return lastRequestTime; - } - - /** - * Gets the session to which this application context is currently - * associated. - * - * @return the wrapped session for this context - */ - public WrappedSession getSession() { - return session; - } - - public AbstractCommunicationManager getApplicationManager() { - return communicationManager; - } - - /** - * Gets the URL of the application. - * - *

    - * This is the URL what can be entered to a browser window to start the - * application. Navigating to the application URL shows the main window ( - * {@link #getMainWindow()}) of the application. Note that the main window - * can also be shown by navigating to the window url ( - * {@link com.vaadin.ui.Window#getURL()}). - *

    - * - * @return the application's URL. - */ - public URL getURL() { - return applicationUrl; - } - - /** - * Ends the Application. - *

    - * In effect this will cause the application stop returning any windows when - * asked. When the application is closed, close events are fired for its - * UIs, its state is removed from the session, and the browser window is - * redirected to the application logout url set with - * {@link #setLogoutURL(String)}. If the logout url has not been set, the - * browser window is reloaded and the application is restarted. - */ - public void close() { - applicationIsRunning = false; - for (UI ui : getUIs()) { - ui.fireCloseEvent(); - } - } - - public static Application getForSession(WrappedSession session) { - Object attribute = session.getAttribute(Application.class.getName()); - if (attribute instanceof Application) { - Application application = (Application) attribute; - application.session = session; - return application; - } - - return null; - } - - public void removeFromSession() { - assert (getForSession(session) == this); - - session.setAttribute(Application.class.getName(), null); - } - - public void storeInSession(WrappedSession session) { - session.setAttribute(Application.class.getName(), this); - this.session = session; - } - - /** - * Starts the application on the given URL. - * - *

    - * This method is called by Vaadin framework when a user navigates to the - * application. After this call the application corresponds to the given URL - * and it will return windows when asked for them. There is no need to call - * this method directly. - *

    - * - *

    - * Application properties are defined by servlet configuration object - * {@link javax.servlet.ServletConfig} and they are overridden by - * context-wide initialization parameters - * {@link javax.servlet.ServletContext}. - *

    - * - * @param event - * the application start event containing details required for - * starting the application. - * - */ - public void start(ApplicationStartEvent event) { - applicationUrl = event.getApplicationUrl(); - configuration = event.getConfiguration(); - communicationManager = event.getCommunicationManager(); - applicationIsRunning = true; - } - - /** - * Tests if the application is running or if it has been finished. - * - *

    - * Application starts running when its {@link #start(ApplicationStartEvent)} - * method has been called and stops when the {@link #close()} is called. - *

    - * - * @return true if the application is running, - * false if not. - */ - public boolean isRunning() { - return applicationIsRunning; - } - - /** - * Gets the configuration for this application - * - * @return the application configuration - */ - public ApplicationConfiguration getConfiguration() { - return configuration; - } - - /** - * Gets the default locale for this application. - * - * By default this is the preferred locale of the user using the - * application. In most cases it is read from the browser defaults. - * - * @return the locale of this application. - */ - public Locale getLocale() { - if (locale != null) { - return locale; - } - return Locale.getDefault(); - } - - /** - * Sets the default locale for this application. - * - * By default this is the preferred locale of the user using the - * application. In most cases it is read from the browser defaults. - * - * @param locale - * the Locale object. - * - */ - public void setLocale(Locale locale) { - this.locale = locale; - } - - /** - * Window detach event. - * - * This event is sent each time a window is removed from the application - * with {@link com.vaadin.Application#removeWindow(Window)}. - */ - public static class WindowDetachEvent extends EventObject { - - private final Window window; - - /** - * Creates a event. - * - * @param application - * the application to which the detached window belonged. - * @param window - * the Detached window. - */ - public WindowDetachEvent(Application application, Window window) { - super(application); - this.window = window; - } - - /** - * Gets the detached window. - * - * @return the detached window. - */ - public Window getWindow() { - return window; - } - - /** - * Gets the application from which the window was detached. - * - * @return the Application. - */ - public Application getApplication() { - return (Application) getSource(); - } - } - - /** - * Window attach event. - * - * This event is sent each time a window is attached tothe application with - * {@link com.vaadin.Application#addWindow(Window)}. - */ - public static class WindowAttachEvent extends EventObject { - - private final Window window; - - /** - * Creates a event. - * - * @param application - * the application to which the detached window belonged. - * @param window - * the Attached window. - */ - public WindowAttachEvent(Application application, Window window) { - super(application); - this.window = window; - } - - /** - * Gets the attached window. - * - * @return the attached window. - */ - public Window getWindow() { - return window; - } - - /** - * Gets the application to which the window was attached. - * - * @return the Application. - */ - public Application getApplication() { - return (Application) getSource(); - } - } - - /** - * Window attach listener interface. - */ - public interface WindowAttachListener extends Serializable { - - /** - * Window attached - * - * @param event - * the window attach event. - */ - public void windowAttached(WindowAttachEvent event); - } - - /** - * Window detach listener interface. - */ - public interface WindowDetachListener extends Serializable { - - /** - * Window detached. - * - * @param event - * the window detach event. - */ - public void windowDetached(WindowDetachEvent event); - } - - /** - * Returns the URL user is redirected to on application close. If the URL is - * null, the application is closed normally as defined by the - * application running environment. - *

    - * Desktop application just closes the application window and - * web-application redirects the browser to application main URL. - *

    - * - * @return the URL. - */ - public String getLogoutURL() { - return logoutURL; - } - - /** - * Sets the URL user is redirected to on application close. If the URL is - * null, the application is closed normally as defined by the - * application running environment: Desktop application just closes the - * application window and web-application redirects the browser to - * application main URL. - * - * @param logoutURL - * the logoutURL to set. - */ - public void setLogoutURL(String logoutURL) { - this.logoutURL = logoutURL; - } - - /** - *

    - * Invoked by the terminal on any exception that occurs in application and - * is thrown by the setVariable to the terminal. The default - * implementation sets the exceptions as ComponentErrors to the - * component that initiated the exception and prints stack trace to standard - * error stream. - *

    - *

    - * You can safely override this method in your application in order to - * direct the errors to some other destination (for example log). - *

    - * - * @param event - * the change event. - * @see com.vaadin.server.Terminal.ErrorListener#terminalError(com.vaadin.server.Terminal.ErrorEvent) - */ - - @Override - public void terminalError(Terminal.ErrorEvent event) { - final Throwable t = event.getThrowable(); - if (t instanceof SocketException) { - // Most likely client browser closed socket - getLogger().info( - "SocketException in CommunicationManager." - + " Most likely client (browser) closed socket."); - return; - } - - // Finds the original source of the error/exception - Object owner = null; - if (event instanceof VariableOwner.ErrorEvent) { - owner = ((VariableOwner.ErrorEvent) event).getVariableOwner(); - } else if (event instanceof ChangeVariablesErrorEvent) { - owner = ((ChangeVariablesErrorEvent) event).getComponent(); - } - - // Shows the error in AbstractComponent - if (owner instanceof AbstractComponent) { - ((AbstractComponent) owner).setComponentError(AbstractErrorMessage - .getErrorMessageForException(t)); - } - - // also print the error on console - getLogger().log(Level.SEVERE, "Terminal error:", t); - } - - /** - * Gets the application error handler. - * - * The default error handler is the application itself. - * - * @return Application error handler - */ - public Terminal.ErrorListener getErrorHandler() { - return errorHandler; - } - - /** - * Sets the application error handler. - * - * The default error handler is the application itself. By overriding this, - * you can redirect the error messages to your selected target (log for - * example). - * - * @param errorHandler - */ - public void setErrorHandler(Terminal.ErrorListener errorHandler) { - this.errorHandler = errorHandler; - } - - /** - * Gets the {@link ConverterFactory} used to locate a suitable - * {@link Converter} for fields in the application. - * - * See {@link #setConverterFactory(ConverterFactory)} for more details - * - * @return The converter factory used in the application - */ - public ConverterFactory getConverterFactory() { - return converterFactory; - } - - /** - * Sets the {@link ConverterFactory} used to locate a suitable - * {@link Converter} for fields in the application. - *

    - * The {@link ConverterFactory} is used to find a suitable converter when - * binding data to a UI component and the data type does not match the UI - * component type, e.g. binding a Double to a TextField (which is based on a - * String). - *

    - *

    - * The {@link Converter} for an individual field can be overridden using - * {@link AbstractField#setConverter(Converter)} and for individual property - * ids in a {@link Table} using - * {@link Table#setConverter(Object, Converter)}. - *

    - *

    - * The converter factory must never be set to null. - * - * @param converterFactory - * The converter factory used in the application - */ - public void setConverterFactory(ConverterFactory converterFactory) { - this.converterFactory = converterFactory; - } - - /** - * Contains the system messages used to notify the user about various - * critical situations that can occur. - *

    - * Customize by overriding the static - * {@link Application#getSystemMessages()} and returning - * {@link CustomizedSystemMessages}. - *

    - *

    - * The defaults defined in this class are: - *

      - *
    • sessionExpiredURL = null
    • - *
    • sessionExpiredNotificationEnabled = true
    • - *
    • sessionExpiredCaption = ""
    • - *
    • sessionExpiredMessage = - * "Take note of any unsaved data, and click here to continue."
    • - *
    • communicationErrorURL = null
    • - *
    • communicationErrorNotificationEnabled = true
    • - *
    • communicationErrorCaption = "Communication problem"
    • - *
    • communicationErrorMessage = - * "Take note of any unsaved data, and click here to continue."
    • - *
    • internalErrorURL = null
    • - *
    • internalErrorNotificationEnabled = true
    • - *
    • internalErrorCaption = "Internal error"
    • - *
    • internalErrorMessage = "Please notify the administrator.
      - * Take note of any unsaved data, and click here to continue."
    • - *
    • outOfSyncURL = null
    • - *
    • outOfSyncNotificationEnabled = true
    • - *
    • outOfSyncCaption = "Out of sync"
    • - *
    • outOfSyncMessage = "Something has caused us to be out of sync - * with the server.
      - * Take note of any unsaved data, and click here to re-sync."
    • - *
    • cookiesDisabledURL = null
    • - *
    • cookiesDisabledNotificationEnabled = true
    • - *
    • cookiesDisabledCaption = "Cookies disabled"
    • - *
    • cookiesDisabledMessage = "This application requires cookies to - * function.
      - * Please enable cookies in your browser and click here to try again. - *
    • - *
    - *

    - * - */ - public static class SystemMessages implements Serializable { - protected String sessionExpiredURL = null; - protected boolean sessionExpiredNotificationEnabled = true; - protected String sessionExpiredCaption = "Session Expired"; - protected String sessionExpiredMessage = "Take note of any unsaved data, and click here to continue."; - - protected String communicationErrorURL = null; - protected boolean communicationErrorNotificationEnabled = true; - protected String communicationErrorCaption = "Communication problem"; - protected String communicationErrorMessage = "Take note of any unsaved data, and click here to continue."; - - protected String authenticationErrorURL = null; - protected boolean authenticationErrorNotificationEnabled = true; - protected String authenticationErrorCaption = "Authentication problem"; - protected String authenticationErrorMessage = "Take note of any unsaved data, and click here to continue."; - - protected String internalErrorURL = null; - protected boolean internalErrorNotificationEnabled = true; - protected String internalErrorCaption = "Internal error"; - protected String internalErrorMessage = "Please notify the administrator.
    Take note of any unsaved data, and click here to continue."; - - protected String outOfSyncURL = null; - protected boolean outOfSyncNotificationEnabled = true; - protected String outOfSyncCaption = "Out of sync"; - protected String outOfSyncMessage = "Something has caused us to be out of sync with the server.
    Take note of any unsaved data, and click here to re-sync."; - - protected String cookiesDisabledURL = null; - protected boolean cookiesDisabledNotificationEnabled = true; - protected String cookiesDisabledCaption = "Cookies disabled"; - protected String cookiesDisabledMessage = "This application requires cookies to function.
    Please enable cookies in your browser and click here to try again."; - - /** - * Use {@link CustomizedSystemMessages} to customize - */ - private SystemMessages() { - - } - - /** - * @return null to indicate that the application will be restarted after - * session expired message has been shown. - */ - public String getSessionExpiredURL() { - return sessionExpiredURL; - } - - /** - * @return true to show session expiration message. - */ - public boolean isSessionExpiredNotificationEnabled() { - return sessionExpiredNotificationEnabled; - } - - /** - * @return "" to show no caption. - */ - public String getSessionExpiredCaption() { - return (sessionExpiredNotificationEnabled ? sessionExpiredCaption - : null); - } - - /** - * @return - * "Take note of any unsaved data, and click here to continue." - */ - public String getSessionExpiredMessage() { - return (sessionExpiredNotificationEnabled ? sessionExpiredMessage - : null); - } - - /** - * @return null to reload the application after communication error - * message. - */ - public String getCommunicationErrorURL() { - return communicationErrorURL; - } - - /** - * @return true to show the communication error message. - */ - public boolean isCommunicationErrorNotificationEnabled() { - return communicationErrorNotificationEnabled; - } - - /** - * @return "Communication problem" - */ - public String getCommunicationErrorCaption() { - return (communicationErrorNotificationEnabled ? communicationErrorCaption - : null); - } - - /** - * @return - * "Take note of any unsaved data, and click here to continue." - */ - public String getCommunicationErrorMessage() { - return (communicationErrorNotificationEnabled ? communicationErrorMessage - : null); - } - - /** - * @return null to reload the application after authentication error - * message. - */ - public String getAuthenticationErrorURL() { - return authenticationErrorURL; - } - - /** - * @return true to show the authentication error message. - */ - public boolean isAuthenticationErrorNotificationEnabled() { - return authenticationErrorNotificationEnabled; - } - - /** - * @return "Authentication problem" - */ - public String getAuthenticationErrorCaption() { - return (authenticationErrorNotificationEnabled ? authenticationErrorCaption - : null); - } - - /** - * @return - * "Take note of any unsaved data, and click here to continue." - */ - public String getAuthenticationErrorMessage() { - return (authenticationErrorNotificationEnabled ? authenticationErrorMessage - : null); - } - - /** - * @return null to reload the current URL after internal error message - * has been shown. - */ - public String getInternalErrorURL() { - return internalErrorURL; - } - - /** - * @return true to enable showing of internal error message. - */ - public boolean isInternalErrorNotificationEnabled() { - return internalErrorNotificationEnabled; - } - - /** - * @return "Internal error" - */ - public String getInternalErrorCaption() { - return (internalErrorNotificationEnabled ? internalErrorCaption - : null); - } - - /** - * @return "Please notify the administrator.
    - * Take note of any unsaved data, and click here to - * continue." - */ - public String getInternalErrorMessage() { - return (internalErrorNotificationEnabled ? internalErrorMessage - : null); - } - - /** - * @return null to reload the application after out of sync message. - */ - public String getOutOfSyncURL() { - return outOfSyncURL; - } - - /** - * @return true to enable showing out of sync message - */ - public boolean isOutOfSyncNotificationEnabled() { - return outOfSyncNotificationEnabled; - } - - /** - * @return "Out of sync" - */ - public String getOutOfSyncCaption() { - return (outOfSyncNotificationEnabled ? outOfSyncCaption : null); - } - - /** - * @return "Something has caused us to be out of sync with the server.
    - * Take note of any unsaved data, and click here to - * re-sync." - */ - public String getOutOfSyncMessage() { - return (outOfSyncNotificationEnabled ? outOfSyncMessage : null); - } - - /** - * Returns the URL the user should be redirected to after dismissing the - * "you have to enable your cookies" message. Typically null. - * - * @return A URL the user should be redirected to after dismissing the - * message or null to reload the current URL. - */ - public String getCookiesDisabledURL() { - return cookiesDisabledURL; - } - - /** - * Determines if "cookies disabled" messages should be shown to the end - * user or not. If the notification is disabled the user will be - * immediately redirected to the URL returned by - * {@link #getCookiesDisabledURL()}. - * - * @return true to show "cookies disabled" messages to the end user, - * false to redirect to the given URL directly - */ - public boolean isCookiesDisabledNotificationEnabled() { - return cookiesDisabledNotificationEnabled; - } - - /** - * Returns the caption of the message shown to the user when cookies are - * disabled in the browser. - * - * @return The caption of the "cookies disabled" message - */ - public String getCookiesDisabledCaption() { - return (cookiesDisabledNotificationEnabled ? cookiesDisabledCaption - : null); - } - - /** - * Returns the message shown to the user when cookies are disabled in - * the browser. - * - * @return The "cookies disabled" message - */ - public String getCookiesDisabledMessage() { - return (cookiesDisabledNotificationEnabled ? cookiesDisabledMessage - : null); - } - - } - - /** - * Contains the system messages used to notify the user about various - * critical situations that can occur. - *

    - * Vaadin gets the SystemMessages from your application by calling a static - * getSystemMessages() method. By default the - * Application.getSystemMessages() is used. You can customize this by - * defining a static MyApplication.getSystemMessages() and returning - * CustomizedSystemMessages. Note that getSystemMessages() is static - - * changing the system messages will by default change the message for all - * users of the application. - *

    - *

    - * The default behavior is to show a notification, and restart the - * application the the user clicks the message.
    - * Instead of restarting the application, you can set a specific URL that - * the user is taken to.
    - * Setting both caption and message to null will restart the application (or - * go to the specified URL) without displaying a notification. - * set*NotificationEnabled(false) will achieve the same thing. - *

    - *

    - * The situations are: - *

  • Session expired: the user session has expired, usually due to - * inactivity.
  • - *
  • Communication error: the client failed to contact the server, or the - * server returned and invalid response.
  • - *
  • Internal error: unhandled critical server error (e.g out of memory, - * database crash) - *
  • Out of sync: the client is not in sync with the server. E.g the user - * opens two windows showing the same application, but the application does - * not support this and uses the same Window instance. When the user makes - * changes in one of the windows - the other window is no longer in sync, - * and (for instance) pressing a button that is no longer present in the UI - * will cause a out-of-sync -situation. - *

    - */ - - public static class CustomizedSystemMessages extends SystemMessages - implements Serializable { - - /** - * Sets the URL to go to when the session has expired. - * - * @param sessionExpiredURL - * the URL to go to, or null to reload current - */ - public void setSessionExpiredURL(String sessionExpiredURL) { - this.sessionExpiredURL = sessionExpiredURL; - } - - /** - * Enables or disables the notification. If disabled, the set URL (or - * current) is loaded directly when next transaction between server and - * client happens. - * - * @param sessionExpiredNotificationEnabled - * true = enabled, false = disabled - */ - public void setSessionExpiredNotificationEnabled( - boolean sessionExpiredNotificationEnabled) { - this.sessionExpiredNotificationEnabled = sessionExpiredNotificationEnabled; - } - - /** - * Sets the caption of the notification. Set to null for no caption. If - * both caption and message are null, client automatically forwards to - * sessionExpiredUrl after timeout timer expires. Timer uses value read - * from HTTPSession.getMaxInactiveInterval() - * - * @param sessionExpiredCaption - * the caption - */ - public void setSessionExpiredCaption(String sessionExpiredCaption) { - this.sessionExpiredCaption = sessionExpiredCaption; - } - - /** - * Sets the message of the notification. Set to null for no message. If - * both caption and message are null, client automatically forwards to - * sessionExpiredUrl after timeout timer expires. Timer uses value read - * from HTTPSession.getMaxInactiveInterval() - * - * @param sessionExpiredMessage - * the message - */ - public void setSessionExpiredMessage(String sessionExpiredMessage) { - this.sessionExpiredMessage = sessionExpiredMessage; - } - - /** - * Sets the URL to go to when there is a authentication error. - * - * @param authenticationErrorURL - * the URL to go to, or null to reload current - */ - public void setAuthenticationErrorURL(String authenticationErrorURL) { - this.authenticationErrorURL = authenticationErrorURL; - } - - /** - * Enables or disables the notification. If disabled, the set URL (or - * current) is loaded directly. - * - * @param authenticationErrorNotificationEnabled - * true = enabled, false = disabled - */ - public void setAuthenticationErrorNotificationEnabled( - boolean authenticationErrorNotificationEnabled) { - this.authenticationErrorNotificationEnabled = authenticationErrorNotificationEnabled; - } - - /** - * Sets the caption of the notification. Set to null for no caption. If - * both caption and message is null, the notification is disabled; - * - * @param authenticationErrorCaption - * the caption - */ - public void setAuthenticationErrorCaption( - String authenticationErrorCaption) { - this.authenticationErrorCaption = authenticationErrorCaption; - } - - /** - * Sets the message of the notification. Set to null for no message. If - * both caption and message is null, the notification is disabled; - * - * @param authenticationErrorMessage - * the message - */ - public void setAuthenticationErrorMessage( - String authenticationErrorMessage) { - this.authenticationErrorMessage = authenticationErrorMessage; - } - - /** - * Sets the URL to go to when there is a communication error. - * - * @param communicationErrorURL - * the URL to go to, or null to reload current - */ - public void setCommunicationErrorURL(String communicationErrorURL) { - this.communicationErrorURL = communicationErrorURL; - } - - /** - * Enables or disables the notification. If disabled, the set URL (or - * current) is loaded directly. - * - * @param communicationErrorNotificationEnabled - * true = enabled, false = disabled - */ - public void setCommunicationErrorNotificationEnabled( - boolean communicationErrorNotificationEnabled) { - this.communicationErrorNotificationEnabled = communicationErrorNotificationEnabled; - } - - /** - * Sets the caption of the notification. Set to null for no caption. If - * both caption and message is null, the notification is disabled; - * - * @param communicationErrorCaption - * the caption - */ - public void setCommunicationErrorCaption( - String communicationErrorCaption) { - this.communicationErrorCaption = communicationErrorCaption; - } - - /** - * Sets the message of the notification. Set to null for no message. If - * both caption and message is null, the notification is disabled; - * - * @param communicationErrorMessage - * the message - */ - public void setCommunicationErrorMessage( - String communicationErrorMessage) { - this.communicationErrorMessage = communicationErrorMessage; - } - - /** - * Sets the URL to go to when an internal error occurs. - * - * @param internalErrorURL - * the URL to go to, or null to reload current - */ - public void setInternalErrorURL(String internalErrorURL) { - this.internalErrorURL = internalErrorURL; - } - - /** - * Enables or disables the notification. If disabled, the set URL (or - * current) is loaded directly. - * - * @param internalErrorNotificationEnabled - * true = enabled, false = disabled - */ - public void setInternalErrorNotificationEnabled( - boolean internalErrorNotificationEnabled) { - this.internalErrorNotificationEnabled = internalErrorNotificationEnabled; - } - - /** - * Sets the caption of the notification. Set to null for no caption. If - * both caption and message is null, the notification is disabled; - * - * @param internalErrorCaption - * the caption - */ - public void setInternalErrorCaption(String internalErrorCaption) { - this.internalErrorCaption = internalErrorCaption; - } - - /** - * Sets the message of the notification. Set to null for no message. If - * both caption and message is null, the notification is disabled; - * - * @param internalErrorMessage - * the message - */ - public void setInternalErrorMessage(String internalErrorMessage) { - this.internalErrorMessage = internalErrorMessage; - } - - /** - * Sets the URL to go to when the client is out-of-sync. - * - * @param outOfSyncURL - * the URL to go to, or null to reload current - */ - public void setOutOfSyncURL(String outOfSyncURL) { - this.outOfSyncURL = outOfSyncURL; - } - - /** - * Enables or disables the notification. If disabled, the set URL (or - * current) is loaded directly. - * - * @param outOfSyncNotificationEnabled - * true = enabled, false = disabled - */ - public void setOutOfSyncNotificationEnabled( - boolean outOfSyncNotificationEnabled) { - this.outOfSyncNotificationEnabled = outOfSyncNotificationEnabled; - } - - /** - * Sets the caption of the notification. Set to null for no caption. If - * both caption and message is null, the notification is disabled; - * - * @param outOfSyncCaption - * the caption - */ - public void setOutOfSyncCaption(String outOfSyncCaption) { - this.outOfSyncCaption = outOfSyncCaption; - } - - /** - * Sets the message of the notification. Set to null for no message. If - * both caption and message is null, the notification is disabled; - * - * @param outOfSyncMessage - * the message - */ - public void setOutOfSyncMessage(String outOfSyncMessage) { - this.outOfSyncMessage = outOfSyncMessage; - } - - /** - * Sets the URL to redirect to when the browser has cookies disabled. - * - * @param cookiesDisabledURL - * the URL to redirect to, or null to reload the current URL - */ - public void setCookiesDisabledURL(String cookiesDisabledURL) { - this.cookiesDisabledURL = cookiesDisabledURL; - } - - /** - * Enables or disables the notification for "cookies disabled" messages. - * If disabled, the URL returned by {@link #getCookiesDisabledURL()} is - * loaded directly. - * - * @param cookiesDisabledNotificationEnabled - * true to enable "cookies disabled" messages, false - * otherwise - */ - public void setCookiesDisabledNotificationEnabled( - boolean cookiesDisabledNotificationEnabled) { - this.cookiesDisabledNotificationEnabled = cookiesDisabledNotificationEnabled; - } - - /** - * Sets the caption of the "cookies disabled" notification. Set to null - * for no caption. If both caption and message is null, the notification - * is disabled. - * - * @param cookiesDisabledCaption - * the caption for the "cookies disabled" notification - */ - public void setCookiesDisabledCaption(String cookiesDisabledCaption) { - this.cookiesDisabledCaption = cookiesDisabledCaption; - } - - /** - * Sets the message of the "cookies disabled" notification. Set to null - * for no message. If both caption and message is null, the notification - * is disabled. - * - * @param cookiesDisabledMessage - * the message for the "cookies disabled" notification - */ - public void setCookiesDisabledMessage(String cookiesDisabledMessage) { - this.cookiesDisabledMessage = cookiesDisabledMessage; - } - - } - - /** - * Application error is an error message defined on the application level. - * - * When an error occurs on the application level, this error message type - * should be used. This indicates that the problem is caused by the - * application - not by the user. - */ - public class ApplicationError implements Terminal.ErrorEvent { - private final Throwable throwable; - - public ApplicationError(Throwable throwable) { - this.throwable = throwable; - } - - @Override - public Throwable getThrowable() { - return throwable; - } - - } - - /** - * Gets the UI class for a request for which no UI is already known. This - * method is called when the framework processes a request that does not - * originate from an existing UI instance. This typically happens when a - * host page is requested. - *

    - * Subclasses of Application may override this method to provide custom - * logic for choosing what kind of UI to use. - *

    - * The default implementation in {@link Application} uses the - * {@value #UI_PARAMETER} parameter from web.xml for finding the name of the - * UI class. If {@link DeploymentConfiguration#getClassLoader()} does not - * return null, the returned {@link ClassLoader} is used for - * loading the UI class. Otherwise the {@link ClassLoader} used to load this - * class is used. - * - *

    - * - * @param request - * the wrapped request for which a UI is needed - * @return a UI instance to use for the request - * - * @see UI - * @see WrappedRequest#getBrowserDetails() - * - * @since 7.0 - */ - public Class getUIClass(WrappedRequest request) { - UIProvider uiProvider = getUiProvider(request, null); - return uiProvider.getUIClass(this, request); - } - - /** - * Creates an UI instance for a request for which no UI is already known. - * This method is called when the framework processes a request that does - * not originate from an existing UI instance. This typically happens when a - * host page is requested. - *

    - * Subclasses of Application may override this method to provide custom - * logic for choosing how to create a suitable UI or for picking an already - * created UI. If an existing UI is picked, care should be taken to avoid - * keeping the same UI open in multiple browser windows, as that will cause - * the states to go out of sync. - *

    - * - * @param request - * @param uiClass - * @return - */ - protected T createUIInstance(WrappedRequest request, - Class uiClass) { - UIProvider uiProvider = getUiProvider(request, uiClass); - return uiClass.cast(uiProvider.createInstance(this, uiClass, request)); - } - - /** - * Gets the {@link UIProvider} that should be used for a request. The - * selection can further be restricted by also requiring the UI provider to - * support a specific UI class. - * - * @see UIProvider - * @see #addUIProvider(UIProvider) - * - * @param request - * the request for which to get an UI provider - * @param uiClass - * the UI class for which a provider is required, or - * null to use the first UI provider supporting the - * request. - * @return an UI provider supporting the request (and the UI class if - * provided). - * - * @since 7.0.0 - */ - public UIProvider getUiProvider(WrappedRequest request, Class uiClass) { - UIProvider provider = (UIProvider) request - .getAttribute(UIProvider.class.getName()); - if (provider != null) { - // Cached provider found, verify that it's a sensible selection - Class providerClass = provider.getUIClass(this, - request); - if (uiClass == null && providerClass != null) { - // Use it if it gives any answer if no specific class is - // required - return provider; - } else if (uiClass == providerClass) { - // Use it if it gives the expected UI class - return provider; - } else { - // Don't keep it cached if it doesn't match the expectations - request.setAttribute(UIProvider.class.getName(), null); - } - } - - // Iterate all current providers if no matching cached provider found - provider = doGetUiProvider(request, uiClass); - - // Cache the found provider - request.setAttribute(UIProvider.class.getName(), provider); - - return provider; - } - - private UIProvider doGetUiProvider(WrappedRequest request, Class uiClass) { - int providersSize = uiProviders.size(); - if (providersSize == 0) { - throw new IllegalStateException("There are no UI providers"); - } - - for (int i = providersSize - 1; i >= 0; i--) { - UIProvider provider = uiProviders.get(i); - - Class providerClass = provider.getUIClass(this, - request); - // If we found something - if (providerClass != null) { - if (uiClass == null) { - // Not looking for anything particular -> anything is ok - return provider; - } else if (providerClass == uiClass) { - // Looking for a specific provider -> only use if matching - return provider; - } else { - getLogger().warning( - "Mismatching UI classes. Expected " + uiClass - + " but got " + providerClass + " from " - + provider); - // Continue looking - } - } - } - - throw new RuntimeException("No UI provider found for request"); - } - - /** - * Handles a request by passing it to each registered {@link RequestHandler} - * in turn until one produces a response. This method is used for requests - * that have not been handled by any specific functionality in the terminal - * implementation (e.g. {@link VaadinServlet}). - *

    - * The request handlers are invoked in the revere order in which they were - * added to the application until a response has been produced. This means - * that the most recently added handler is used first and the first request - * handler that was added to the application is invoked towards the end - * unless any previous handler has already produced a response. - *

    - * - * @param request - * the wrapped request to get information from - * @param response - * the response to which data can be written - * @return returns true if a {@link RequestHandler} has - * produced a response and false if no response has - * been written. - * @throws IOException - * - * @see #addRequestHandler(RequestHandler) - * @see RequestHandler - * - * @since 7.0 - */ - public boolean handleRequest(WrappedRequest request, - WrappedResponse response) throws IOException { - // Use a copy to avoid ConcurrentModificationException - for (RequestHandler handler : new ArrayList( - requestHandlers)) { - if (handler.handleRequest(this, request, response)) { - return true; - } - } - // If not handled - return false; - } - - /** - * Adds a request handler to this application. Request handlers can be added - * to provide responses to requests that are not handled by the default - * functionality of the framework. - *

    - * Handlers are called in reverse order of addition, so the most recently - * added handler will be called first. - *

    - * - * @param handler - * the request handler to add - * - * @see #handleRequest(WrappedRequest, WrappedResponse) - * @see #removeRequestHandler(RequestHandler) - * - * @since 7.0 - */ - public void addRequestHandler(RequestHandler handler) { - requestHandlers.addFirst(handler); - } - - /** - * Removes a request handler from the application. - * - * @param handler - * the request handler to remove - * - * @since 7.0 - */ - public void removeRequestHandler(RequestHandler handler) { - requestHandlers.remove(handler); - } - - /** - * Gets the request handlers that are registered to the application. The - * iteration order of the returned collection is the same as the order in - * which the request handlers will be invoked when a request is handled. - * - * @return a collection of request handlers, with the iteration order - * according to the order they would be invoked - * - * @see #handleRequest(WrappedRequest, WrappedResponse) - * @see #addRequestHandler(RequestHandler) - * @see #removeRequestHandler(RequestHandler) - * - * @since 7.0 - */ - public Collection getRequestHandlers() { - return Collections.unmodifiableCollection(requestHandlers); - } - - /** - * Gets the currently used application. The current application is - * automatically defined when processing requests to the server. In other - * cases, (e.g. from background threads), the current application is not - * automatically defined. - * - * @return the current application instance if available, otherwise - * null - * - * @see #setCurrent(Application) - * - * @since 7.0 - */ - public static Application getCurrent() { - return CurrentInstance.get(Application.class); - } - - /** - * Sets the thread local for the current application. This method is used by - * the framework to set the current application whenever a new request is - * processed and it is cleared when the request has been processed. - *

    - * The application developer can also use this method to define the current - * application outside the normal request handling, e.g. when initiating - * custom background threads. - *

    - * - * @param application - * - * @see #getCurrent() - * @see ThreadLocal - * - * @since 7.0 - */ - public static void setCurrent(Application application) { - CurrentInstance.setInheritable(Application.class, application); - } - - /** - * Check whether this application is in production mode. If an application - * is in production mode, certain debugging facilities are not available. - * - * @return the status of the production mode flag - * - * @since 7.0 - */ - public boolean isProductionMode() { - return configuration.isProductionMode(); - } - - public void addUIProvider(UIProvider uIProvider) { - uiProviders.add(uIProvider); - } - - public void removeUIProvider(UIProvider uIProvider) { - uiProviders.remove(uIProvider); - } - - /** - * Finds the {@link UI} to which a particular request belongs. If the - * request originates from an existing UI, that UI is returned. In other - * cases, the method attempts to create and initialize a new UI and might - * throw a {@link UIRequiresMoreInformationException} if all required - * information is not available. - *

    - * Please note that this method can also return a newly created - * UI which has not yet been initialized. You can use - * {@link #isUIInitPending(int)} with the UI's id ( {@link UI#getUIId()} to - * check whether the initialization is still pending. - *

    - * - * @param request - * the request for which a UI is desired - * @return a UI belonging to the request - * - * @see #createUI(WrappedRequest) - * - * @since 7.0 - */ - public UI getUIForRequest(WrappedRequest request) { - UI uI = UI.getCurrent(); - if (uI != null) { - return uI; - } - Integer uiId = getUIId(request); - - synchronized (this) { - uI = uIs.get(uiId); - - if (uI == null) { - uI = findExistingUi(request); - } - - } // end synchronized block - - UI.setCurrent(uI); - - return uI; - } - - private UI findExistingUi(WrappedRequest request) { - // Check if some UI provider has an existing UI available - for (int i = uiProviders.size() - 1; i >= 0; i--) { - UIProvider provider = uiProviders.get(i); - UI existingUi = provider.getExistingUI(request); - if (existingUi != null) { - return existingUi; - } - } - - BrowserDetails browserDetails = request.getBrowserDetails(); - boolean hasBrowserDetails = browserDetails != null - && browserDetails.getUriFragment() != null; - - if (hasBrowserDetails && !retainOnRefreshUIs.isEmpty()) { - // Check for a known UI - - @SuppressWarnings("null") - String windowName = browserDetails.getWindowName(); - Integer retainedUIId = retainOnRefreshUIs.get(windowName); - - if (retainedUIId != null) { - Class expectedUIClass = getUIClass(request); - UI retainedUI = uIs.get(retainedUIId); - // We've had the same UI instance in a window with this - // name, but should we still use it? - if (retainedUI.getClass() == expectedUIClass) { - return retainedUI; - } else { - getLogger().info( - "Not using retained UI in " + windowName - + " because retained UI was of type " - + retainedUIId.getClass() + " but " - + expectedUIClass - + " is expected for the request."); - } - } - } - - return null; - } - - public UI createUI(WrappedRequest request) { - Class uiClass = getUIClass(request); - - UI ui = createUIInstance(request, uiClass); - - // Initialize some fields for a newly created UI - if (ui.getApplication() == null) { - ui.setApplication(this); - } - // Get the next id - Integer uiId = Integer.valueOf(nextUIId++); - - uIs.put(uiId, ui); - - // Set thread local here so it is available in init - UI.setCurrent(ui); - - ui.doInit(request, uiId.intValue()); - - if (getUiProvider(request, uiClass).isUiPreserved(request, uiClass)) { - // Remember this UI - String windowName = request.getBrowserDetails().getWindowName(); - if (windowName == null) { - getLogger().warning( - "There is no window.name available for UI " + uiClass - + " that should be preserved."); - } else { - retainOnRefreshUIs.put(windowName, uiId); - } - } - - return ui; - } - - /** - * Internal helper to finds the UI id for a request. - * - * @param request - * the request to get the UI id for - * @return a UI id, or null if no UI id is defined - * - * @since 7.0 - */ - private static Integer getUIId(WrappedRequest request) { - if (request instanceof CombinedRequest) { - // Combined requests has the uiId parameter in the second request - CombinedRequest combinedRequest = (CombinedRequest) request; - request = combinedRequest.getSecondRequest(); - } - String uiIdString = request.getParameter(UIConstants.UI_ID_PARAMETER); - Integer uiId = uiIdString == null ? null : new Integer(uiIdString); - return uiId; - } - - /** - * Gets all the uIs of this application. This includes uIs that have been - * requested but not yet initialized. Please note, that uIs are not - * automatically removed e.g. if the browser window is closed and that there - * is no way to manually remove a UI. Inactive uIs will thus not be released - * for GC until the entire application is released when the session has - * timed out (unless there are dangling references). Improved support for - * releasing unused uIs is planned for an upcoming alpha release of Vaadin - * 7. - * - * @return a collection of uIs belonging to this application - * - * @since 7.0 - */ - public Collection getUIs() { - return Collections.unmodifiableCollection(uIs.values()); - } - - private int connectorIdSequence = 0; - - /** - * Generate an id for the given Connector. Connectors must not call this - * method more than once, the first time they need an id. - * - * @param connector - * A connector that has not yet been assigned an id. - * @return A new id for the connector - */ - public String createConnectorId(ClientConnector connector) { - return String.valueOf(connectorIdSequence++); - } - - private static final Logger getLogger() { - return Logger.getLogger(Application.class.getName()); - } - - /** - * Returns a UI with the given id. - *

    - * This is meant for framework internal use. - *

    - * - * @param uiId - * The UI id - * @return The UI with the given id or null if not found - */ - public UI getUIById(int uiId) { - return uIs.get(uiId); - } - - /** - * Adds a listener that will be invoked when the bootstrap HTML is about to - * be generated. This can be used to modify the contents of the HTML that - * loads the Vaadin application in the browser and the HTTP headers that are - * included in the response serving the HTML. - * - * @see BootstrapListener#modifyBootstrapFragment(BootstrapFragmentResponse) - * @see BootstrapListener#modifyBootstrapPage(BootstrapPageResponse) - * - * @param listener - * the bootstrap listener to add - */ - public void addBootstrapListener(BootstrapListener listener) { - eventRouter.addListener(BootstrapFragmentResponse.class, listener, - BOOTSTRAP_FRAGMENT_METHOD); - eventRouter.addListener(BootstrapPageResponse.class, listener, - BOOTSTRAP_PAGE_METHOD); - } - - /** - * Remove a bootstrap listener that was previously added. - * - * @see #addBootstrapListener(BootstrapListener) - * - * @param listener - * the bootstrap listener to remove - */ - public void removeBootstrapListener(BootstrapListener listener) { - eventRouter.removeListener(BootstrapFragmentResponse.class, listener, - BOOTSTRAP_FRAGMENT_METHOD); - eventRouter.removeListener(BootstrapPageResponse.class, listener, - BOOTSTRAP_PAGE_METHOD); - } - - /** - * Fires a bootstrap event to all registered listeners. There are currently - * two supported events, both inheriting from {@link BootstrapResponse}: - * {@link BootstrapFragmentResponse} and {@link BootstrapPageResponse}. - * - * @param response - * the bootstrap response event for which listeners should be - * fired - */ - public void modifyBootstrapResponse(BootstrapResponse response) { - eventRouter.fireEvent(response); - } - - /** - * Removes all those UIs from the application for which {@link #isUIAlive} - * returns false. Close events are fired for the removed UIs. - *

    - * Called by the framework at the end of every request. - * - * @see UI.CloseEvent - * @see UI.CloseListener - * @see #isUIAlive(UI) - * - * @since 7.0.0 - */ - public void closeInactiveUIs() { - for (Iterator i = uIs.values().iterator(); i.hasNext();) { - UI ui = i.next(); - if (!isUIAlive(ui)) { - i.remove(); - retainOnRefreshUIs.values().remove(ui.getUIId()); - ui.fireCloseEvent(); - getLogger().info( - "Closed UI #" + ui.getUIId() + " due to inactivity"); - } - } - } - - /** - * Returns the number of seconds that must pass without a valid heartbeat or - * UIDL request being received from a UI before that UI is removed from the - * application. This is a lower bound; it might take longer to close an - * inactive UI. Returns a negative number if heartbeat is disabled and - * timeout never occurs. - * - * @see #getUidlRequestTimeout() - * @see #closeInactiveUIs() - * @see DeploymentConfiguration#getHeartbeatInterval() - * - * @since 7.0.0 - * - * @return The heartbeat timeout in seconds or a negative number if timeout - * never occurs. - */ - protected int getHeartbeatTimeout() { - // Permit three missed heartbeats before closing the UI - return (int) (configuration.getHeartbeatInterval() * (3.1)); - } - - /** - * Returns the number of seconds that must pass without a valid UIDL request - * being received from a UI before the UI is removed from the application, - * even though heartbeat requests are received. This is a lower bound; it - * might take longer to close an inactive UI. Returns a negative number if - *

    - * This timeout only has effect if cleanup of inactive UIs is enabled; - * otherwise heartbeat requests are enough to extend UI lifetime - * indefinitely. - * - * @see DeploymentConfiguration#isIdleUICleanupEnabled() - * @see #getHeartbeatTimeout() - * @see #closeInactiveUIs() - * - * @since 7.0.0 - * - * @return The UIDL request timeout in seconds, or a negative number if - * timeout never occurs. - */ - protected int getUidlRequestTimeout() { - return configuration.isIdleUICleanupEnabled() ? getSession() - .getMaxInactiveInterval() : -1; - } - - /** - * Returns whether the given UI is alive (the client-side actively - * communicates with the server) or whether it can be removed from the - * application and eventually collected. - * - * @since 7.0.0 - * - * @param ui - * The UI whose status to check - * @return true if the UI is alive, false if it could be removed. - */ - protected boolean isUIAlive(UI ui) { - long now = System.currentTimeMillis(); - if (getHeartbeatTimeout() >= 0 - && now - ui.getLastHeartbeatTime() > 1000 * getHeartbeatTimeout()) { - return false; - } - if (getUidlRequestTimeout() >= 0 - && now - ui.getLastUidlRequestTime() > 1000 * getUidlRequestTimeout()) { - return false; - } - return true; - } - - /** - * Gets this application's global resource handler that takes care of - * serving connector resources that are not served by any single connector - * because e.g. because they are served with strong caching or because of - * legacy reasons. - * - * @param createOnDemand - * true if a resource handler should be initialized - * if there is no handler associated with this application. - * false if null should be returned - * if there is no registered handler. - * @return this application's global resource handler, or null - * if there is no handler and the createOnDemand parameter is - * false. - * - * @since 7.0.0 - */ - public GlobalResourceHandler getGlobalResourceHandler(boolean createOnDemand) { - if (globalResourceHandler == null && createOnDemand) { - globalResourceHandler = new GlobalResourceHandler(); - addRequestHandler(globalResourceHandler); - } - - return globalResourceHandler; - } - - public Collection getUIProviders() { - return Collections.unmodifiableCollection(uiProviders); - } - -} diff --git a/server/src/com/vaadin/LegacyApplication.java b/server/src/com/vaadin/LegacyApplication.java index b884136767..9f02a2d588 100644 --- a/server/src/com/vaadin/LegacyApplication.java +++ b/server/src/com/vaadin/LegacyApplication.java @@ -26,6 +26,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import com.vaadin.server.AbstractUIProvider; +import com.vaadin.server.VaadinSession; import com.vaadin.server.Terminal.ErrorEvent; import com.vaadin.server.Terminal.ErrorListener; import com.vaadin.server.WrappedRequest; @@ -68,8 +69,8 @@ public abstract class LegacyApplication extends AbstractUIProvider implements throw new IllegalStateException("mainWindow has already been set"); } if (mainWindow.getApplication() == null) { - mainWindow.setApplication(Application.getCurrent()); - } else if (mainWindow.getApplication() != Application.getCurrent()) { + mainWindow.setApplication(VaadinSession.getCurrent()); + } else if (mainWindow.getApplication() != VaadinSession.getCurrent()) { throw new IllegalStateException( "mainWindow is attached to another application"); } @@ -82,14 +83,14 @@ public abstract class LegacyApplication extends AbstractUIProvider implements } public void doInit() { - Application.getCurrent().setErrorHandler(this); + VaadinSession.getCurrent().setErrorHandler(this); init(); } protected abstract void init(); @Override - public Class getUIClass(Application application, + public Class getUIClass(VaadinSession application, WrappedRequest request) { UI uiInstance = getUIInstance(request); if (uiInstance != null) { @@ -99,7 +100,7 @@ public abstract class LegacyApplication extends AbstractUIProvider implements } @Override - public UI createInstance(Application application, Class type, + public UI createInstance(VaadinSession application, Class type, WrappedRequest request) { return getUIInstance(request); } @@ -179,7 +180,7 @@ public abstract class LegacyApplication extends AbstractUIProvider implements * Sets the application's theme. *

    * Note that this theme can be overridden for a specific UI with - * {@link Application#getThemeForUI(UI)}. Setting theme to be + * {@link VaadinSession#getThemeForUI(UI)}. Setting theme to be * null selects the default theme. For the available theme * names, see the contents of the VAADIN/themes directory. *

    @@ -241,7 +242,7 @@ public abstract class LegacyApplication extends AbstractUIProvider implements } legacyUINames.put(uI.getName(), uI); - uI.setApplication(Application.getCurrent()); + uI.setApplication(VaadinSession.getCurrent()); } /** @@ -280,22 +281,22 @@ public abstract class LegacyApplication extends AbstractUIProvider implements @Override public void terminalError(ErrorEvent event) { - Application.getCurrent().terminalError(event); + VaadinSession.getCurrent().terminalError(event); } - public Application getContext() { - return Application.getCurrent(); + public VaadinSession getContext() { + return VaadinSession.getCurrent(); } protected void close() { - Application.getCurrent().close(); + VaadinSession.getCurrent().close(); } public boolean isRunning() { - return Application.getCurrent().isRunning(); + return VaadinSession.getCurrent().isRunning(); } public URL getURL() { - return Application.getCurrent().getURL(); + return VaadinSession.getCurrent().getURL(); } } \ No newline at end of file diff --git a/server/src/com/vaadin/data/util/converter/ConverterUtil.java b/server/src/com/vaadin/data/util/converter/ConverterUtil.java index 36cd6d0859..a6014bb3eb 100644 --- a/server/src/com/vaadin/data/util/converter/ConverterUtil.java +++ b/server/src/com/vaadin/data/util/converter/ConverterUtil.java @@ -18,7 +18,7 @@ package com.vaadin.data.util.converter; import java.io.Serializable; import java.util.Locale; -import com.vaadin.Application; +import com.vaadin.server.VaadinSession; public class ConverterUtil implements Serializable { @@ -26,7 +26,7 @@ public class ConverterUtil implements Serializable { * Finds a converter that can convert from the given presentation type to * the given model type and back. Uses the given application to find a * {@link ConverterFactory} or, if application is null, uses the - * {@link Application#getCurrent()}. + * {@link VaadinSession#getCurrent()}. * * @param * The presentation type @@ -44,10 +44,10 @@ public class ConverterUtil implements Serializable { */ public static Converter getConverter( Class presentationType, - Class modelType, Application application) { + Class modelType, VaadinSession application) { Converter converter = null; if (application == null) { - application = Application.getCurrent(); + application = VaadinSession.getCurrent(); } if (application != null) { diff --git a/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java b/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java index ffd432076f..17b89ccb20 100644 --- a/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java +++ b/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java @@ -19,14 +19,14 @@ package com.vaadin.data.util.converter; import java.util.Date; import java.util.logging.Logger; -import com.vaadin.Application; +import com.vaadin.server.VaadinSession; /** * Default implementation of {@link ConverterFactory}. Provides converters for * standard types like {@link String}, {@link Double} and {@link Date}.

    *

    * Custom converters can be provided by extending this class and using - * {@link Application#setConverterFactory(ConverterFactory)}. + * {@link VaadinSession#setConverterFactory(ConverterFactory)}. *

    * * @author Vaadin Ltd diff --git a/server/src/com/vaadin/server/AbstractClientConnector.java b/server/src/com/vaadin/server/AbstractClientConnector.java index 09e366260b..82a154d4e5 100644 --- a/server/src/com/vaadin/server/AbstractClientConnector.java +++ b/server/src/com/vaadin/server/AbstractClientConnector.java @@ -31,7 +31,6 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.logging.Logger; -import com.vaadin.Application; import com.vaadin.external.json.JSONException; import com.vaadin.external.json.JSONObject; import com.vaadin.shared.communication.ClientRpc; @@ -358,7 +357,7 @@ public abstract class AbstractClientConnector implements ClientConnector { * * @return The connector's application, or null if not attached */ - protected Application getApplication() { + protected VaadinSession getApplication() { UI uI = getUI(); if (uI == null) { return null; diff --git a/server/src/com/vaadin/server/AbstractCommunicationManager.java b/server/src/com/vaadin/server/AbstractCommunicationManager.java index 47bf652a3a..71f5a07d77 100644 --- a/server/src/com/vaadin/server/AbstractCommunicationManager.java +++ b/server/src/com/vaadin/server/AbstractCommunicationManager.java @@ -56,7 +56,6 @@ import java.util.logging.Logger; import javax.servlet.http.HttpServletResponse; -import com.vaadin.Application; import com.vaadin.annotations.JavaScript; import com.vaadin.annotations.StyleSheet; import com.vaadin.external.json.JSONArray; @@ -143,7 +142,7 @@ public abstract class AbstractCommunicationManager implements Serializable { /** * The application this communication manager is used for */ - private final Application application; + private final VaadinSession application; private List locales; @@ -170,7 +169,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * * @param application */ - public AbstractCommunicationManager(Application application) { + public AbstractCommunicationManager(VaadinSession application) { this.application = application; application.addRequestHandler(getBootstrapHandler()); application.addRequestHandler(UNSUPPORTED_BROWSER_HANDLER); @@ -178,7 +177,7 @@ public abstract class AbstractCommunicationManager implements Serializable { requireLocale(application.getLocale().toString()); } - protected Application getApplication() { + protected VaadinSession getApplication() { return application; } @@ -366,7 +365,7 @@ public abstract class AbstractCommunicationManager implements Serializable { "StreamVariable for the post not found"); } - final Application application = getApplication(); + final VaadinSession application = getApplication(); OutputStream out = null; int totalBytes = 0; @@ -491,7 +490,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * Internally process a UIDL request from the client. * * This method calls - * {@link #handleVariables(WrappedRequest, WrappedResponse, Callback, Application, UI)} + * {@link #handleVariables(WrappedRequest, WrappedResponse, Callback, VaadinSession, UI)} * to process any changes to variables by the client and then repaints * affected components using {@link #paintAfterVariableChanges()}. * @@ -677,7 +676,7 @@ public abstract class AbstractCommunicationManager implements Serializable { } sb.append("\nComponent hierarchy:\n"); - Application application2 = component.getApplication(); + VaadinSession application2 = component.getApplication(); sb.append(application2.getClass().getName()); sb.append("."); sb.append(application2.getClass().getSimpleName()); @@ -790,7 +789,7 @@ public abstract class AbstractCommunicationManager implements Serializable { final PrintWriter outWriter, UI ui, boolean analyzeLayouts) throws PaintException, JSONException { ArrayList dirtyVisibleConnectors = new ArrayList(); - Application application = ui.getApplication(); + VaadinSession application = ui.getApplication(); // Paints components ConnectorTracker uiConnectorTracker = ui.getConnectorTracker(); getLogger().log(Level.FINE, "* Creating response to client"); @@ -1521,7 +1520,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * @param application * @return false if the XSRF is turned off, true otherwise */ - public boolean isXSRFEnabled(Application application) { + public boolean isXSRFEnabled(VaadinSession application) { return application.getConfiguration().isXsrfProtectionEnabled(); } @@ -1536,7 +1535,7 @@ public abstract class AbstractCommunicationManager implements Serializable { */ private boolean handleVariables(WrappedRequest request, WrappedResponse response, Callback callback, - Application application2, UI uI) throws IOException, + VaadinSession application2, UI uI) throws IOException, InvalidUIDLSecurityKeyException, JSONException { boolean success = true; @@ -1943,7 +1942,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * @param m * map from variable names to values */ - private void handleChangeVariablesError(Application application, + private void handleChangeVariablesError(VaadinSession application, Component owner, Throwable t, Map m) { boolean handled = false; ChangeVariablesErrorEvent errorEvent = new ChangeVariablesErrorEvent( @@ -2155,7 +2154,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * Ends the Application. * * The browser is redirected to the Application logout URL set with - * {@link Application#setLogoutURL(String)}, or to the application URL if no + * {@link VaadinSession#setLogoutURL(String)}, or to the application URL if no * logout URL is given. * * @param request @@ -2168,7 +2167,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * if the writing failed due to input/output error. */ private void endApplication(WrappedRequest request, - WrappedResponse response, Application application) + WrappedResponse response, VaadinSession application) throws IOException { String logoutUrl = application.getLogoutURL(); @@ -2394,7 +2393,7 @@ public abstract class AbstractCommunicationManager implements Serializable { } public void handleBrowserDetailsRequest(WrappedRequest request, - WrappedResponse response, Application application) + WrappedResponse response, VaadinSession application) throws IOException { assert UI.getCurrent() == null; @@ -2572,7 +2571,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * @throws IOException * @throws InvalidUIDLSecurityKeyException */ - public void handleFileUpload(Application application, + public void handleFileUpload(VaadinSession application, WrappedRequest request, WrappedResponse response) throws IOException, InvalidUIDLSecurityKeyException { @@ -2634,7 +2633,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * @throws IOException */ public void handleHeartbeatRequest(WrappedRequest request, - WrappedResponse response, Application application) + WrappedResponse response, VaadinSession application) throws IOException { UI ui = null; try { diff --git a/server/src/com/vaadin/server/AbstractUIProvider.java b/server/src/com/vaadin/server/AbstractUIProvider.java index c7a137ebbd..ee8ebd2745 100644 --- a/server/src/com/vaadin/server/AbstractUIProvider.java +++ b/server/src/com/vaadin/server/AbstractUIProvider.java @@ -18,7 +18,6 @@ package com.vaadin.server; import java.lang.annotation.Annotation; -import com.vaadin.Application; import com.vaadin.annotations.PreserveOnRefresh; import com.vaadin.annotations.Theme; import com.vaadin.annotations.Title; @@ -28,7 +27,7 @@ import com.vaadin.ui.UI; public abstract class AbstractUIProvider implements UIProvider { @Override - public UI createInstance(Application application, Class type, + public UI createInstance(VaadinSession application, Class type, WrappedRequest request) { try { return type.newInstance(); diff --git a/server/src/com/vaadin/server/AddonContext.java b/server/src/com/vaadin/server/AddonContext.java index c9f2ac07eb..ca8c837a2e 100644 --- a/server/src/com/vaadin/server/AddonContext.java +++ b/server/src/com/vaadin/server/AddonContext.java @@ -22,7 +22,6 @@ import java.util.Iterator; import java.util.List; import java.util.ServiceLoader; -import com.vaadin.Application; import com.vaadin.event.EventRouter; import com.vaadin.util.ReflectTools; @@ -116,7 +115,7 @@ public class AddonContext { * application. * * @see #addApplicationStartedListener(ApplicationStartedListener) - * @see Application#addBootstrapListener(BootstrapListener) + * @see VaadinSession#addBootstrapListener(BootstrapListener) * * @param listener * the bootstrap listener that should be added to all new @@ -136,7 +135,7 @@ public class AddonContext { * @param application * the newly started application */ - public void fireApplicationStarted(Application application) { + public void fireApplicationStarted(VaadinSession application) { eventRouter.fireEvent(new ApplicationStartedEvent(this, application)); for (BootstrapListener l : bootstrapListeners) { application.addBootstrapListener(l); @@ -144,9 +143,9 @@ public class AddonContext { } /** - * Adds a listener that will be notified any time a new {@link Application} + * Adds a listener that will be notified any time a new {@link VaadinSession} * instance is started or more precisely directly after - * {@link Application#init()} has been invoked. + * {@link VaadinSession#init()} has been invoked. * * @param applicationStartListener * the application start listener that should be added diff --git a/server/src/com/vaadin/server/ApplicationStartedEvent.java b/server/src/com/vaadin/server/ApplicationStartedEvent.java index d06744ae40..9ecab4d477 100644 --- a/server/src/com/vaadin/server/ApplicationStartedEvent.java +++ b/server/src/com/vaadin/server/ApplicationStartedEvent.java @@ -18,7 +18,6 @@ package com.vaadin.server; import java.util.EventObject; -import com.vaadin.Application; /** * Event used by @@ -29,7 +28,7 @@ import com.vaadin.Application; * @since 7.0.0 */ public class ApplicationStartedEvent extends EventObject { - private final Application application; + private final VaadinSession application; /** * Creates a new event. @@ -39,7 +38,7 @@ public class ApplicationStartedEvent extends EventObject { * @param application * the application that has been started */ - public ApplicationStartedEvent(AddonContext context, Application application) { + public ApplicationStartedEvent(AddonContext context, VaadinSession application) { super(context); this.application = application; } @@ -58,7 +57,7 @@ public class ApplicationStartedEvent extends EventObject { * * @return the newly created application */ - public Application getApplication() { + public VaadinSession getApplication() { return application; } diff --git a/server/src/com/vaadin/server/ApplicationStartedListener.java b/server/src/com/vaadin/server/ApplicationStartedListener.java index c54132d875..b7858447df 100644 --- a/server/src/com/vaadin/server/ApplicationStartedListener.java +++ b/server/src/com/vaadin/server/ApplicationStartedListener.java @@ -18,10 +18,9 @@ package com.vaadin.server; import java.util.EventListener; -import com.vaadin.Application; /** - * Listener that gets notified when a new {@link Application} has been started. + * Listener that gets notified when a new {@link VaadinSession} has been started. * Add-ons can use this listener to automatically integrate with API tied to the * Application API. * @@ -33,7 +32,7 @@ import com.vaadin.Application; public interface ApplicationStartedListener extends EventListener { /** * Tells the listener that an application has been started (meaning that - * {@link Application#init()} has been invoked. + * {@link VaadinSession#init()} has been invoked. * * @param event * details about the event diff --git a/server/src/com/vaadin/server/BootstrapFragmentResponse.java b/server/src/com/vaadin/server/BootstrapFragmentResponse.java index 149f59e7a5..4b960263e7 100644 --- a/server/src/com/vaadin/server/BootstrapFragmentResponse.java +++ b/server/src/com/vaadin/server/BootstrapFragmentResponse.java @@ -20,7 +20,6 @@ import java.util.List; import org.jsoup.nodes.Node; -import com.vaadin.Application; import com.vaadin.ui.UI; /** @@ -38,7 +37,7 @@ public class BootstrapFragmentResponse extends BootstrapResponse { * Crate a new bootstrap fragment response. * * @see BootstrapResponse#BootstrapResponse(BootstrapHandler, - * WrappedRequest, Application, Class) + * WrappedRequest, VaadinSession, Class) * * @param handler * the bootstrap handler that is firing the event @@ -55,7 +54,7 @@ public class BootstrapFragmentResponse extends BootstrapResponse { * application HTML */ public BootstrapFragmentResponse(BootstrapHandler handler, - WrappedRequest request, Application application, + WrappedRequest request, VaadinSession application, Class uiClass, List fragmentNodes) { super(handler, request, application, uiClass); this.fragmentNodes = fragmentNodes; diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java index a793214942..6b8fb1952a 100644 --- a/server/src/com/vaadin/server/BootstrapHandler.java +++ b/server/src/com/vaadin/server/BootstrapHandler.java @@ -36,7 +36,6 @@ import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; import org.jsoup.parser.Tag; -import com.vaadin.Application; import com.vaadin.external.json.JSONException; import com.vaadin.external.json.JSONObject; import com.vaadin.shared.ApplicationConstants; @@ -68,7 +67,7 @@ public abstract class BootstrapHandler implements RequestHandler { return bootstrapResponse.getRequest(); } - public Application getApplication() { + public VaadinSession getApplication() { return bootstrapResponse.getApplication(); } @@ -104,7 +103,7 @@ public abstract class BootstrapHandler implements RequestHandler { } @Override - public boolean handleRequest(Application application, + public boolean handleRequest(VaadinSession application, WrappedRequest request, WrappedResponse response) throws IOException { @@ -246,7 +245,7 @@ public abstract class BootstrapHandler implements RequestHandler { } private BootstrapContext createContext(WrappedRequest request, - WrappedResponse response, Application application, + WrappedResponse response, VaadinSession application, Class uiClass) { BootstrapContext context = new BootstrapContext(response, new BootstrapFragmentResponse(this, request, application, @@ -392,7 +391,7 @@ public abstract class BootstrapHandler implements RequestHandler { protected JSONObject getApplicationParameters(BootstrapContext context) throws JSONException, PaintException { - Application application = context.getApplication(); + VaadinSession application = context.getApplication(); JSONObject appConfig = new JSONObject(); @@ -421,7 +420,7 @@ public abstract class BootstrapHandler implements RequestHandler { JSONObject defaults = new JSONObject(); WrappedRequest request = context.getRequest(); - Application application = context.getApplication(); + VaadinSession application = context.getApplication(); DeploymentConfiguration deploymentConfiguration = request .getDeploymentConfiguration(); diff --git a/server/src/com/vaadin/server/BootstrapPageResponse.java b/server/src/com/vaadin/server/BootstrapPageResponse.java index a5fdfe4707..8f56042f8f 100644 --- a/server/src/com/vaadin/server/BootstrapPageResponse.java +++ b/server/src/com/vaadin/server/BootstrapPageResponse.java @@ -20,7 +20,6 @@ import java.util.Map; import org.jsoup.nodes.Document; -import com.vaadin.Application; import com.vaadin.ui.UI; /** @@ -40,7 +39,7 @@ public class BootstrapPageResponse extends BootstrapResponse { * Crate a new bootstrap page response. * * @see BootstrapResponse#BootstrapResponse(BootstrapHandler, - * WrappedRequest, Application, Class) + * WrappedRequest, VaadinSession, Class) * * @param handler * the bootstrap handler that is firing the event @@ -58,7 +57,7 @@ public class BootstrapPageResponse extends BootstrapResponse { * a map into which header data can be added */ public BootstrapPageResponse(BootstrapHandler handler, - WrappedRequest request, Application application, + WrappedRequest request, VaadinSession application, Class uiClass, Document document, Map headers) { super(handler, request, application, uiClass); diff --git a/server/src/com/vaadin/server/BootstrapResponse.java b/server/src/com/vaadin/server/BootstrapResponse.java index 3173569059..b75544a87c 100644 --- a/server/src/com/vaadin/server/BootstrapResponse.java +++ b/server/src/com/vaadin/server/BootstrapResponse.java @@ -18,7 +18,6 @@ package com.vaadin.server; import java.util.EventObject; -import com.vaadin.Application; import com.vaadin.ui.UI; /** @@ -30,7 +29,7 @@ import com.vaadin.ui.UI; */ public abstract class BootstrapResponse extends EventObject { private final WrappedRequest request; - private final Application application; + private final VaadinSession application; private final Class uiClass; /** @@ -48,7 +47,7 @@ public abstract class BootstrapResponse extends EventObject { * the class of the UI that will be displayed on the page */ public BootstrapResponse(BootstrapHandler handler, WrappedRequest request, - Application application, Class uiClass) { + VaadinSession application, Class uiClass) { super(handler); this.request = request; this.application = application; @@ -83,7 +82,7 @@ public abstract class BootstrapResponse extends EventObject { * * @return the application */ - public Application getApplication() { + public VaadinSession getApplication() { return application; } diff --git a/server/src/com/vaadin/server/ClassResource.java b/server/src/com/vaadin/server/ClassResource.java index 2f05115fd4..27643eda13 100644 --- a/server/src/com/vaadin/server/ClassResource.java +++ b/server/src/com/vaadin/server/ClassResource.java @@ -18,7 +18,6 @@ package com.vaadin.server; import java.io.Serializable; -import com.vaadin.Application; import com.vaadin.service.FileTypeResolver; import com.vaadin.ui.UI; import com.vaadin.ui.UI.LegacyWindow; @@ -115,7 +114,7 @@ public class ClassResource implements ConnectorResource, Serializable { if (associatedClass == null) { Class associatedClass = UI.getCurrent().getClass(); if (associatedClass == LegacyWindow.class) { - return Application.getCurrent().getClass(); + return VaadinSession.getCurrent().getClass(); } return associatedClass; } diff --git a/server/src/com/vaadin/server/CombinedRequest.java b/server/src/com/vaadin/server/CombinedRequest.java index 9176754d93..cc336ffa73 100644 --- a/server/src/com/vaadin/server/CombinedRequest.java +++ b/server/src/com/vaadin/server/CombinedRequest.java @@ -24,7 +24,6 @@ import java.util.Iterator; import java.util.Locale; import java.util.Map; -import com.vaadin.Application; import com.vaadin.external.json.JSONArray; import com.vaadin.external.json.JSONException; import com.vaadin.external.json.JSONObject; @@ -143,7 +142,7 @@ public class CombinedRequest implements WrappedRequest { @Override public WebBrowser getWebBrowser() { - return Application.getCurrent().getBrowser(); + return VaadinSession.getCurrent().getBrowser(); } }; } diff --git a/server/src/com/vaadin/server/CommunicationManager.java b/server/src/com/vaadin/server/CommunicationManager.java index beea884aae..3cc8831901 100644 --- a/server/src/com/vaadin/server/CommunicationManager.java +++ b/server/src/com/vaadin/server/CommunicationManager.java @@ -21,7 +21,6 @@ import java.net.URL; import javax.servlet.ServletContext; -import com.vaadin.Application; import com.vaadin.ui.UI; /** @@ -39,12 +38,12 @@ import com.vaadin.ui.UI; public class CommunicationManager extends AbstractCommunicationManager { /** - * @deprecated use {@link #CommunicationManager(Application)} instead + * @deprecated use {@link #CommunicationManager(VaadinSession)} instead * @param application * @param applicationServlet */ @Deprecated - public CommunicationManager(Application application, + public CommunicationManager(VaadinSession application, VaadinServlet applicationServlet) { super(application); } @@ -54,7 +53,7 @@ public class CommunicationManager extends AbstractCommunicationManager { * * @param application */ - public CommunicationManager(Application application) { + public CommunicationManager(VaadinSession application) { super(application); } @@ -88,7 +87,7 @@ public class CommunicationManager extends AbstractCommunicationManager { // don't use server and port in uri. It may cause problems with // some // virtual server configurations which lose the server name - Application application = context.getApplication(); + VaadinSession application = context.getApplication(); URL url = application.getURL(); String appUrl = url.getPath(); if (appUrl.endsWith("/")) { @@ -112,7 +111,7 @@ public class CommunicationManager extends AbstractCommunicationManager { @Override protected InputStream getThemeResourceAsStream(UI uI, String themeName, String resource) { - ServletApplicationContext context = (ServletApplicationContext) uI + VaadinServletSession context = (VaadinServletSession) uI .getApplication(); ServletContext servletContext = context.getHttpSession() .getServletContext(); diff --git a/server/src/com/vaadin/server/ConnectorResourceHandler.java b/server/src/com/vaadin/server/ConnectorResourceHandler.java index b988510b8e..80d3a60a1a 100644 --- a/server/src/com/vaadin/server/ConnectorResourceHandler.java +++ b/server/src/com/vaadin/server/ConnectorResourceHandler.java @@ -8,7 +8,6 @@ import java.util.regex.Pattern; import javax.servlet.http.HttpServletResponse; -import com.vaadin.Application; import com.vaadin.shared.ApplicationConstants; import com.vaadin.ui.UI; @@ -25,7 +24,7 @@ public class ConnectorResourceHandler implements RequestHandler { } @Override - public boolean handleRequest(Application application, + public boolean handleRequest(VaadinSession application, WrappedRequest request, WrappedResponse response) throws IOException { String requestPath = request.getRequestPathInfo(); @@ -45,7 +44,7 @@ public class ConnectorResourceHandler implements RequestHandler { } UI.setCurrent(ui); - Application.setCurrent(ui.getApplication()); + VaadinSession.setCurrent(ui.getApplication()); ClientConnector connector = ui.getConnectorTracker().getConnector( cid); diff --git a/server/src/com/vaadin/server/DefaultUIProvider.java b/server/src/com/vaadin/server/DefaultUIProvider.java index b326e3229e..9babf4704e 100644 --- a/server/src/com/vaadin/server/DefaultUIProvider.java +++ b/server/src/com/vaadin/server/DefaultUIProvider.java @@ -16,16 +16,15 @@ package com.vaadin.server; -import com.vaadin.Application; import com.vaadin.ui.UI; public class DefaultUIProvider extends AbstractUIProvider { @Override - public Class getUIClass(Application application, + public Class getUIClass(VaadinSession application, WrappedRequest request) { Object uiClassNameObj = application.getConfiguration() - .getInitParameters().getProperty(Application.UI_PARAMETER); + .getInitParameters().getProperty(VaadinSession.UI_PARAMETER); if (uiClassNameObj instanceof String) { String uiClassName = uiClassNameObj.toString(); diff --git a/server/src/com/vaadin/server/FileResource.java b/server/src/com/vaadin/server/FileResource.java index fbf353362e..2dd5b7f589 100644 --- a/server/src/com/vaadin/server/FileResource.java +++ b/server/src/com/vaadin/server/FileResource.java @@ -20,7 +20,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; -import com.vaadin.Application; import com.vaadin.server.Terminal.ErrorEvent; import com.vaadin.service.FileTypeResolver; @@ -74,7 +73,7 @@ public class FileResource implements ConnectorResource { return ds; } catch (final FileNotFoundException e) { // Log the exception using the application error handler - Application.getCurrent().getErrorHandler() + VaadinSession.getCurrent().getErrorHandler() .terminalError(new ErrorEvent() { @Override diff --git a/server/src/com/vaadin/server/GAEVaadinServlet.java b/server/src/com/vaadin/server/GAEVaadinServlet.java index 1175d6a960..4ea1dff7f4 100644 --- a/server/src/com/vaadin/server/GAEVaadinServlet.java +++ b/server/src/com/vaadin/server/GAEVaadinServlet.java @@ -47,7 +47,6 @@ import com.google.appengine.api.memcache.Expiration; import com.google.appengine.api.memcache.MemcacheService; import com.google.appengine.api.memcache.MemcacheServiceFactory; import com.google.apphosting.api.DeadlineExceededException; -import com.vaadin.Application; /** * ApplicationServlet to be used when deploying to Google App Engine, in @@ -242,7 +241,7 @@ public class GAEVaadinServlet extends VaadinServlet { } // de-serialize or create application context, store in session - Application ctx = getApplicationContext(request, memcache); + VaadinSession ctx = getApplicationContext(request, memcache); super.service(request, response); @@ -292,7 +291,7 @@ public class GAEVaadinServlet extends VaadinServlet { } } - protected Application getApplicationContext(HttpServletRequest request, + protected VaadinSession getApplicationContext(HttpServletRequest request, MemcacheService memcache) { HttpSession session = request.getSession(); String id = AC_BASE + session.getId(); @@ -321,7 +320,7 @@ public class GAEVaadinServlet extends VaadinServlet { ObjectInputStream ois; try { ois = new ObjectInputStream(bais); - Application applicationContext = (Application) ois.readObject(); + VaadinSession applicationContext = (VaadinSession) ois.readObject(); applicationContext.storeInSession(new WrappedHttpSession( session)); } catch (IOException e) { @@ -360,7 +359,7 @@ public class GAEVaadinServlet extends VaadinServlet { private void cleanSession(HttpServletRequest request) { HttpSession session = request.getSession(false); if (session != null) { - session.removeAttribute(ServletApplicationContext.class.getName()); + session.removeAttribute(VaadinServletSession.class.getName()); } } diff --git a/server/src/com/vaadin/server/GlobalResourceHandler.java b/server/src/com/vaadin/server/GlobalResourceHandler.java index 441d884f58..03dab9817d 100644 --- a/server/src/com/vaadin/server/GlobalResourceHandler.java +++ b/server/src/com/vaadin/server/GlobalResourceHandler.java @@ -28,7 +28,6 @@ import java.util.regex.Pattern; import javax.servlet.http.HttpServletResponse; -import com.vaadin.Application; import com.vaadin.shared.ApplicationConstants; import com.vaadin.ui.UI; @@ -66,7 +65,7 @@ public class GlobalResourceHandler implements RequestHandler { ""); @Override - public boolean handleRequest(Application application, + public boolean handleRequest(VaadinSession application, WrappedRequest request, WrappedResponse response) throws IOException { String pathInfo = request.getRequestPathInfo(); diff --git a/server/src/com/vaadin/server/LegacyVaadinPortlet.java b/server/src/com/vaadin/server/LegacyVaadinPortlet.java index 77a94e4d0a..6efd9b29b3 100644 --- a/server/src/com/vaadin/server/LegacyVaadinPortlet.java +++ b/server/src/com/vaadin/server/LegacyVaadinPortlet.java @@ -19,7 +19,6 @@ package com.vaadin.server; import javax.portlet.PortletException; import javax.portlet.PortletRequest; -import com.vaadin.Application; import com.vaadin.LegacyApplication; import com.vaadin.server.ServletPortletHelper.ApplicationClassException; @@ -46,13 +45,13 @@ public class LegacyVaadinPortlet extends VaadinPortlet { } @Override - protected PortletApplicationContext2 createApplication( + protected VaadinPortletSession createApplication( PortletRequest request) throws PortletException { - PortletApplicationContext2 application = super + VaadinPortletSession application = super .createApplication(request); // Must set current before running init() - Application.setCurrent(application); + VaadinSession.setCurrent(application); LegacyApplication legacyApplication = getNewApplication(request); legacyApplication.doInit(); diff --git a/server/src/com/vaadin/server/LegacyVaadinServlet.java b/server/src/com/vaadin/server/LegacyVaadinServlet.java index aa78c401f5..d853e55099 100644 --- a/server/src/com/vaadin/server/LegacyVaadinServlet.java +++ b/server/src/com/vaadin/server/LegacyVaadinServlet.java @@ -19,7 +19,6 @@ package com.vaadin.server; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; -import com.vaadin.Application; import com.vaadin.LegacyApplication; import com.vaadin.server.ServletPortletHelper.ApplicationClassException; @@ -46,13 +45,13 @@ public class LegacyVaadinServlet extends VaadinServlet { } @Override - protected ServletApplicationContext createApplication( + protected VaadinServletSession createApplication( HttpServletRequest request) throws ServletException { - ServletApplicationContext application = super + VaadinServletSession application = super .createApplication(request); // Must set current before running init() - Application.setCurrent(application); + VaadinSession.setCurrent(application); LegacyApplication legacyApplication = getNewApplication(request); legacyApplication.doInit(); diff --git a/server/src/com/vaadin/server/PortletApplicationContext2.java b/server/src/com/vaadin/server/PortletApplicationContext2.java deleted file mode 100644 index ff23d12f4c..0000000000 --- a/server/src/com/vaadin/server/PortletApplicationContext2.java +++ /dev/null @@ -1,308 +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.server; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; - -import javax.portlet.ActionRequest; -import javax.portlet.ActionResponse; -import javax.portlet.EventRequest; -import javax.portlet.EventResponse; -import javax.portlet.MimeResponse; -import javax.portlet.PortletConfig; -import javax.portlet.PortletMode; -import javax.portlet.PortletModeException; -import javax.portlet.PortletResponse; -import javax.portlet.PortletSession; -import javax.portlet.PortletURL; -import javax.portlet.RenderRequest; -import javax.portlet.RenderResponse; -import javax.portlet.ResourceRequest; -import javax.portlet.ResourceResponse; -import javax.portlet.StateAwareResponse; -import javax.servlet.http.HttpSessionBindingListener; -import javax.xml.namespace.QName; - -import com.vaadin.Application; -import com.vaadin.ui.UI; -import com.vaadin.util.CurrentInstance; - -/** - * TODO Write documentation, fix JavaDoc tags. - * - * This is automatically registered as a {@link HttpSessionBindingListener} when - * {@link PortletSession#setAttribute()} is called with the context as value. - * - * @author peholmst - */ -@SuppressWarnings("serial") -public class PortletApplicationContext2 extends Application { - - private final Set portletListeners = new LinkedHashSet(); - - private final Map eventActionDestinationMap = new HashMap(); - private final Map eventActionValueMap = new HashMap(); - - private final Map sharedParameterActionNameMap = new HashMap(); - private final Map sharedParameterActionValueMap = new HashMap(); - - public PortletSession getPortletSession() { - WrappedSession wrappedSession = getSession(); - PortletSession session = ((WrappedPortletSession) wrappedSession) - .getPortletSession(); - return session; - } - - private PortletResponse getCurrentResponse() { - WrappedPortletResponse currentResponse = (WrappedPortletResponse) CurrentInstance - .get(WrappedResponse.class); - - if (currentResponse != null) { - return currentResponse.getPortletResponse(); - } else { - return null; - } - } - - public PortletConfig getPortletConfig() { - WrappedPortletResponse response = (WrappedPortletResponse) CurrentInstance - .get(WrappedResponse.class); - return response.getDeploymentConfiguration().getPortlet() - .getPortletConfig(); - } - - public void addPortletListener(PortletListener listener) { - portletListeners.add(listener); - } - - public void removePortletListener(PortletListener listener) { - portletListeners.remove(listener); - } - - public void firePortletRenderRequest(UI uI, RenderRequest request, - RenderResponse response) { - for (PortletListener l : new ArrayList( - portletListeners)) { - l.handleRenderRequest(request, new RestrictedRenderResponse( - response), uI); - } - } - - public void firePortletActionRequest(UI uI, ActionRequest request, - ActionResponse response) { - String key = request.getParameter(ActionRequest.ACTION_NAME); - if (eventActionDestinationMap.containsKey(key)) { - // this action request is only to send queued portlet events - response.setEvent(eventActionDestinationMap.get(key), - eventActionValueMap.get(key)); - // cleanup - eventActionDestinationMap.remove(key); - eventActionValueMap.remove(key); - } else if (sharedParameterActionNameMap.containsKey(key)) { - // this action request is only to set shared render parameters - response.setRenderParameter(sharedParameterActionNameMap.get(key), - sharedParameterActionValueMap.get(key)); - // cleanup - sharedParameterActionNameMap.remove(key); - sharedParameterActionValueMap.remove(key); - } else { - // normal action request, notify listeners - for (PortletListener l : new ArrayList( - portletListeners)) { - l.handleActionRequest(request, response, uI); - } - } - } - - public void firePortletEventRequest(UI uI, EventRequest request, - EventResponse response) { - for (PortletListener l : new ArrayList( - portletListeners)) { - l.handleEventRequest(request, response, uI); - } - } - - public void firePortletResourceRequest(UI uI, ResourceRequest request, - ResourceResponse response) { - for (PortletListener l : new ArrayList( - portletListeners)) { - l.handleResourceRequest(request, response, uI); - } - } - - public interface PortletListener extends Serializable { - - public void handleRenderRequest(RenderRequest request, - RenderResponse response, UI uI); - - public void handleActionRequest(ActionRequest request, - ActionResponse response, UI uI); - - public void handleEventRequest(EventRequest request, - EventResponse response, UI uI); - - public void handleResourceRequest(ResourceRequest request, - ResourceResponse response, UI uI); - } - - /** - * Creates a new action URL. - * - * @param action - * @return action URL or null if called outside a MimeRequest (outside a - * UIDL request or similar) - */ - public PortletURL generateActionURL(String action) { - PortletURL url = null; - PortletResponse response = getCurrentResponse(); - if (response instanceof MimeResponse) { - url = ((MimeResponse) response).createActionURL(); - url.setParameter("javax.portlet.action", action); - } else { - return null; - } - return url; - } - - /** - * Sends a portlet event to the indicated destination. - * - * Internally, an action may be created and opened, as an event cannot be - * sent directly from all types of requests. - * - * The event destinations and values need to be kept in the context until - * sent. Any memory leaks if the action fails are limited to the session. - * - * Event names for events sent and received by a portlet need to be declared - * in portlet.xml . - * - * @param uI - * a window in which a temporary action URL can be opened if - * necessary - * @param name - * event name - * @param value - * event value object that is Serializable and, if appropriate, - * has a valid JAXB annotation - */ - public void sendPortletEvent(UI uI, QName name, Serializable value) - throws IllegalStateException { - PortletResponse response = getCurrentResponse(); - if (response instanceof MimeResponse) { - String actionKey = "" + System.currentTimeMillis(); - while (eventActionDestinationMap.containsKey(actionKey)) { - actionKey = actionKey + "."; - } - PortletURL actionUrl = generateActionURL(actionKey); - if (actionUrl != null) { - eventActionDestinationMap.put(actionKey, name); - eventActionValueMap.put(actionKey, value); - uI.getPage().open(new ExternalResource(actionUrl.toString())); - } else { - // this should never happen as we already know the response is a - // MimeResponse - throw new IllegalStateException( - "Portlet events can only be sent from a portlet request"); - } - } else if (response instanceof StateAwareResponse) { - ((StateAwareResponse) response).setEvent(name, value); - } else { - throw new IllegalStateException( - "Portlet events can only be sent from a portlet request"); - } - } - - /** - * Sets a shared portlet parameter. - * - * Internally, an action may be created and opened, as shared parameters - * cannot be set directly from all types of requests. - * - * The parameters and values need to be kept in the context until sent. Any - * memory leaks if the action fails are limited to the session. - * - * Shared parameters set or read by a portlet need to be declared in - * portlet.xml . - * - * @param uI - * a window in which a temporary action URL can be opened if - * necessary - * @param name - * parameter identifier - * @param value - * parameter value - */ - public void setSharedRenderParameter(UI uI, String name, String value) - throws IllegalStateException { - PortletResponse response = getCurrentResponse(); - if (response instanceof MimeResponse) { - String actionKey = "" + System.currentTimeMillis(); - while (sharedParameterActionNameMap.containsKey(actionKey)) { - actionKey = actionKey + "."; - } - PortletURL actionUrl = generateActionURL(actionKey); - if (actionUrl != null) { - sharedParameterActionNameMap.put(actionKey, name); - sharedParameterActionValueMap.put(actionKey, value); - uI.getPage().open(new ExternalResource(actionUrl.toString())); - } else { - // this should never happen as we already know the response is a - // MimeResponse - throw new IllegalStateException( - "Shared parameters can only be set from a portlet request"); - } - } else if (response instanceof StateAwareResponse) { - ((StateAwareResponse) response).setRenderParameter(name, value); - } else { - throw new IllegalStateException( - "Shared parameters can only be set from a portlet request"); - } - } - - /** - * Sets the portlet mode. This may trigger a new render request. - * - * Portlet modes used by a portlet need to be declared in portlet.xml . - * - * @param uI - * a window in which the render URL can be opened if necessary - * @param portletMode - * the portlet mode to switch to - * @throws PortletModeException - * if the portlet mode is not allowed for some reason - * (configuration, permissions etc.) - */ - public void setPortletMode(UI uI, PortletMode portletMode) - throws IllegalStateException, PortletModeException { - PortletResponse response = getCurrentResponse(); - if (response instanceof MimeResponse) { - PortletURL url = ((MimeResponse) response).createRenderURL(); - url.setPortletMode(portletMode); - throw new RuntimeException("UI.open has not yet been implemented"); - // UI.open(new ExternalResource(url.toString())); - } else if (response instanceof StateAwareResponse) { - ((StateAwareResponse) response).setPortletMode(portletMode); - } else { - throw new IllegalStateException( - "Portlet mode can only be changed from a portlet request"); - } - } -} diff --git a/server/src/com/vaadin/server/PortletCommunicationManager.java b/server/src/com/vaadin/server/PortletCommunicationManager.java index ada42140c6..6eccfa6084 100644 --- a/server/src/com/vaadin/server/PortletCommunicationManager.java +++ b/server/src/com/vaadin/server/PortletCommunicationManager.java @@ -26,7 +26,6 @@ import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import javax.portlet.ResourceURL; -import com.vaadin.Application; import com.vaadin.external.json.JSONException; import com.vaadin.external.json.JSONObject; import com.vaadin.shared.ApplicationConstants; @@ -41,7 +40,7 @@ import com.vaadin.ui.UI; @SuppressWarnings("serial") public class PortletCommunicationManager extends AbstractCommunicationManager { - public PortletCommunicationManager(Application application) { + public PortletCommunicationManager(VaadinSession application) { super(application); } @@ -49,7 +48,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { protected BootstrapHandler createBootstrapHandler() { return new BootstrapHandler() { @Override - public boolean handleRequest(Application application, + public boolean handleRequest(VaadinSession application, WrappedRequest request, WrappedResponse response) throws IOException { PortletRequest portletRequest = WrappedPortletRequest.cast( @@ -157,7 +156,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { @Override protected InputStream getThemeResourceAsStream(UI uI, String themeName, String resource) { - PortletApplicationContext2 context = (PortletApplicationContext2) uI + VaadinPortletSession context = (VaadinPortletSession) uI .getApplication(); PortletContext portletContext = context.getPortletSession() .getPortletContext(); diff --git a/server/src/com/vaadin/server/RequestHandler.java b/server/src/com/vaadin/server/RequestHandler.java index fcc506cc54..0557c06378 100644 --- a/server/src/com/vaadin/server/RequestHandler.java +++ b/server/src/com/vaadin/server/RequestHandler.java @@ -19,11 +19,10 @@ package com.vaadin.server; import java.io.IOException; import java.io.Serializable; -import com.vaadin.Application; /** * Handler for producing a response to non-UIDL requests. Handlers can be added - * to applications using {@link Application#addRequestHandler(RequestHandler)} + * to applications using {@link VaadinSession#addRequestHandler(RequestHandler)} */ public interface RequestHandler extends Serializable { @@ -42,7 +41,7 @@ public interface RequestHandler extends Serializable { * handlers should be called, otherwise false * @throws IOException */ - boolean handleRequest(Application application, WrappedRequest request, + boolean handleRequest(VaadinSession application, WrappedRequest request, WrappedResponse response) throws IOException; } diff --git a/server/src/com/vaadin/server/RequestTimer.java b/server/src/com/vaadin/server/RequestTimer.java index afff901d2f..149a1499e7 100644 --- a/server/src/com/vaadin/server/RequestTimer.java +++ b/server/src/com/vaadin/server/RequestTimer.java @@ -18,7 +18,6 @@ package com.vaadin.server; import java.io.Serializable; -import com.vaadin.Application; /** * Times the handling of requests and stores the information as an attribute in @@ -45,7 +44,7 @@ public class RequestTimer implements Serializable { * * @param context */ - public void stop(Application context) { + public void stop(VaadinSession context) { // Measure and store the total handling time. This data can be // used in TestBench 3 tests. long time = (System.nanoTime() - requestStartTime) / 1000000; diff --git a/server/src/com/vaadin/server/RestrictedRenderResponse.java b/server/src/com/vaadin/server/RestrictedRenderResponse.java index 6923a042d6..206c5f349c 100644 --- a/server/src/com/vaadin/server/RestrictedRenderResponse.java +++ b/server/src/com/vaadin/server/RestrictedRenderResponse.java @@ -36,7 +36,7 @@ import org.w3c.dom.Element; * Read-only wrapper for a {@link RenderResponse}. * * Only for use by {@link PortletApplicationContext} and - * {@link PortletApplicationContext2}. + * {@link VaadinPortletSession}. */ class RestrictedRenderResponse implements RenderResponse, Serializable { diff --git a/server/src/com/vaadin/server/ServletApplicationContext.java b/server/src/com/vaadin/server/ServletApplicationContext.java deleted file mode 100644 index 0945de6cb5..0000000000 --- a/server/src/com/vaadin/server/ServletApplicationContext.java +++ /dev/null @@ -1,101 +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.server; - -import java.util.Enumeration; -import java.util.HashMap; - -import javax.servlet.http.HttpSession; -import javax.servlet.http.HttpSessionBindingEvent; -import javax.servlet.http.HttpSessionBindingListener; - -import com.vaadin.Application; -import com.vaadin.util.CurrentInstance; - -/** - * Web application context for Vaadin applications. - * - * This is automatically added as a {@link HttpSessionBindingListener} when - * added to a {@link HttpSession}. - * - * @author Vaadin Ltd. - * @since 3.1 - */ -@SuppressWarnings("serial") -public class ServletApplicationContext extends Application { - - private transient boolean reinitializingSession = false; - - @Override - public void valueUnbound(HttpSessionBindingEvent event) { - if (!reinitializingSession) { - // Avoid closing the application if we are only reinitializing the - // session. Closing the application would cause the state to be lost - // and a new application to be created, which is not what we want. - super.valueUnbound(event); - } - } - - /** - * Discards the current session and creates a new session with the same - * contents. The purpose of this is to introduce a new session key in order - * to avoid session fixation attacks. - */ - public void reinitializeSession() { - - HttpSession oldSession = getHttpSession(); - - // Stores all attributes (security key, reference to this context - // instance) so they can be added to the new session - HashMap attrs = new HashMap(); - for (Enumeration e = oldSession.getAttributeNames(); e - .hasMoreElements();) { - String name = e.nextElement(); - attrs.put(name, oldSession.getAttribute(name)); - } - - // Invalidate the current session, set flag to avoid call to - // valueUnbound - reinitializingSession = true; - oldSession.invalidate(); - reinitializingSession = false; - - // Create a new session - HttpSession newSession = WrappedHttpServletRequest.cast( - CurrentInstance.get(WrappedRequest.class)).getSession(); - - // Restores all attributes (security key, reference to this context - // instance) - for (String name : attrs.keySet()) { - newSession.setAttribute(name, attrs.get(name)); - } - - // Update the "current session" variable - storeInSession(new WrappedHttpSession(newSession)); - } - - /** - * Gets the http-session application is running in. - * - * @return HttpSession this application context resides in. - */ - public HttpSession getHttpSession() { - WrappedSession session = getSession(); - return ((WrappedHttpSession) session).getHttpSession(); - } - -} diff --git a/server/src/com/vaadin/server/ServletPortletHelper.java b/server/src/com/vaadin/server/ServletPortletHelper.java index 28a63fe35b..068a9f9192 100644 --- a/server/src/com/vaadin/server/ServletPortletHelper.java +++ b/server/src/com/vaadin/server/ServletPortletHelper.java @@ -3,7 +3,6 @@ package com.vaadin.server; import java.io.Serializable; import java.util.Properties; -import com.vaadin.Application; import com.vaadin.LegacyApplication; import com.vaadin.shared.ApplicationConstants; import com.vaadin.ui.UI; @@ -68,7 +67,7 @@ class ServletPortletHelper implements Serializable { private static void verifyUIClass(String className, ClassLoader classLoader) throws ApplicationClassException { if (className == null) { - throw new ApplicationClassException(Application.UI_PARAMETER + throw new ApplicationClassException(VaadinSession.UI_PARAMETER + " init parameter not defined"); } @@ -133,24 +132,24 @@ class ServletPortletHelper implements Serializable { ApplicationConstants.HEARTBEAT_REQUEST_PATH); } - public static void initDefaultUIProvider(Application application, + public static void initDefaultUIProvider(VaadinSession application, DeploymentConfiguration deploymentConfiguration) throws ApplicationClassException { String uiProperty = deploymentConfiguration .getApplicationConfiguration().getInitParameters() - .getProperty(Application.UI_PARAMETER); + .getProperty(VaadinSession.UI_PARAMETER); if (uiProperty != null) { verifyUIClass(uiProperty, deploymentConfiguration.getClassLoader()); application.addUIProvider(new DefaultUIProvider()); } } - public static void checkUiProviders(Application newApplication) + public static void checkUiProviders(VaadinSession newApplication) throws ApplicationClassException { if (newApplication.getUIProviders().isEmpty()) { throw new ApplicationClassException( "No UIProvider has been added to the application and there is no \"" - + Application.UI_PARAMETER + "\" init parameter."); + + VaadinSession.UI_PARAMETER + "\" init parameter."); } } diff --git a/server/src/com/vaadin/server/StreamVariable.java b/server/src/com/vaadin/server/StreamVariable.java index f289e7612a..a75cc2f0d7 100644 --- a/server/src/com/vaadin/server/StreamVariable.java +++ b/server/src/com/vaadin/server/StreamVariable.java @@ -18,7 +18,6 @@ package com.vaadin.server; import java.io.OutputStream; import java.io.Serializable; -import com.vaadin.Application; import com.vaadin.server.StreamVariable.StreamingEndEvent; import com.vaadin.server.StreamVariable.StreamingErrorEvent; import com.vaadin.server.StreamVariable.StreamingStartEvent; @@ -152,7 +151,7 @@ public interface StreamVariable extends Serializable { * the streaming ended before the end of the input. The streaming may fail * due an interruption by {@link } or due an other unknown exception in * communication. In the latter case the exception is also passed to - * {@link Application#terminalError(com.vaadin.server.Terminal.ErrorEvent)} + * {@link VaadinSession#terminalError(com.vaadin.server.Terminal.ErrorEvent)} * . */ public interface StreamingErrorEvent extends StreamingEvent { diff --git a/server/src/com/vaadin/server/SystemMessages.java b/server/src/com/vaadin/server/SystemMessages.java index 17aed0003e..3f6a0f9a68 100644 --- a/server/src/com/vaadin/server/SystemMessages.java +++ b/server/src/com/vaadin/server/SystemMessages.java @@ -18,7 +18,6 @@ package com.vaadin.server; import java.io.Serializable; -import com.vaadin.Application; /** @@ -26,7 +25,7 @@ import com.vaadin.Application; * critical situations that can occur. *

    * Customize by overriding the static - * {@link Application#getSystemMessages()} and returning + * {@link VaadinSession#getSystemMessages()} and returning * {@link CustomizedSystemMessages}. *

    *

    diff --git a/server/src/com/vaadin/server/UIProvider.java b/server/src/com/vaadin/server/UIProvider.java index 6a45b06c63..b2908a04d6 100644 --- a/server/src/com/vaadin/server/UIProvider.java +++ b/server/src/com/vaadin/server/UIProvider.java @@ -16,15 +16,14 @@ package com.vaadin.server; -import com.vaadin.Application; import com.vaadin.annotations.Widgetset; import com.vaadin.ui.UI; public interface UIProvider { - public Class getUIClass(Application application, + public Class getUIClass(VaadinSession application, WrappedRequest request); - public UI createInstance(Application application, Class type, + public UI createInstance(VaadinSession application, Class type, WrappedRequest request); public String getPageTitleForUI(WrappedRequest request, diff --git a/server/src/com/vaadin/server/UnsupportedBrowserHandler.java b/server/src/com/vaadin/server/UnsupportedBrowserHandler.java index 325edb5d61..dccbf7ba7b 100644 --- a/server/src/com/vaadin/server/UnsupportedBrowserHandler.java +++ b/server/src/com/vaadin/server/UnsupportedBrowserHandler.java @@ -18,7 +18,6 @@ package com.vaadin.server; import java.io.IOException; import java.io.Writer; -import com.vaadin.Application; /** * A {@link RequestHandler} that presents an informative page if the browser in @@ -36,7 +35,7 @@ public class UnsupportedBrowserHandler implements RequestHandler { public static final String FORCE_LOAD_COOKIE = "vaadinforceload=1"; @Override - public boolean handleRequest(Application application, + public boolean handleRequest(VaadinSession application, WrappedRequest request, WrappedResponse response) throws IOException { diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java index e69a635b76..941d96ea25 100644 --- a/server/src/com/vaadin/server/VaadinPortlet.java +++ b/server/src/com/vaadin/server/VaadinPortlet.java @@ -55,11 +55,10 @@ import javax.servlet.http.HttpServletResponse; import com.liferay.portal.kernel.util.PortalClassInvoker; import com.liferay.portal.kernel.util.PropsUtil; -import com.vaadin.Application; -import com.vaadin.Application.ApplicationStartEvent; import com.vaadin.DefaultApplicationConfiguration; import com.vaadin.server.AbstractCommunicationManager.Callback; import com.vaadin.server.ServletPortletHelper.ApplicationClassException; +import com.vaadin.server.VaadinSession.ApplicationStartEvent; import com.vaadin.ui.UI; import com.vaadin.util.CurrentInstance; @@ -456,7 +455,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { serveStaticResources((ResourceRequest) request, (ResourceResponse) response); } else { - Application application = null; + VaadinSession application = null; boolean applicationRunning = false; try { @@ -468,13 +467,13 @@ public class VaadinPortlet extends GenericPortlet implements Constants { if (application == null) { return; } - Application.setCurrent(application); + VaadinSession.setCurrent(application); /* * Get or create an application context and an application * manager for the session */ - PortletApplicationContext2 applicationContext = (PortletApplicationContext2) application; + VaadinPortletSession applicationContext = (VaadinPortletSession) application; PortletCommunicationManager applicationManager = (PortletCommunicationManager) applicationContext .getApplicationManager(); @@ -652,8 +651,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants { */ private void handleOtherRequest(WrappedPortletRequest request, WrappedResponse response, RequestType requestType, - Application application, - PortletApplicationContext2 applicationContext, + VaadinSession application, + VaadinPortletSession applicationContext, PortletCommunicationManager applicationManager) throws PortletException, IOException, MalformedURLException { if (requestType == RequestType.APPLICATION_RESOURCE @@ -761,13 +760,13 @@ public class VaadinPortlet extends GenericPortlet implements Constants { } private void endApplication(PortletRequest request, - PortletResponse response, Application application) + PortletResponse response, VaadinSession application) throws IOException { application.removeFromSession(); // Do not send any redirects when running inside a portlet. } - private Application findApplicationInstance( + private VaadinSession findApplicationInstance( WrappedPortletRequest wrappedRequest, RequestType requestType) throws PortletException, SessionExpiredException, MalformedURLException { @@ -777,7 +776,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { request, requestType); /* Find an existing application for this request. */ - Application application = getExistingApplication(request, + VaadinSession application = getExistingApplication(request, requestCanCreateApplication); if (application != null) { @@ -811,7 +810,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { } } - private void closeApplication(Application application, + private void closeApplication(VaadinSession application, PortletSession session) { if (application == null) { return; @@ -821,9 +820,9 @@ public class VaadinPortlet extends GenericPortlet implements Constants { application.removeFromSession(); } - private Application createAndRegisterApplication(PortletRequest request) + private VaadinSession createAndRegisterApplication(PortletRequest request) throws PortletException { - Application newApplication = createApplication(request); + VaadinSession newApplication = createApplication(request); try { ServletPortletHelper.checkUiProviders(newApplication); @@ -845,9 +844,9 @@ public class VaadinPortlet extends GenericPortlet implements Constants { return newApplication; } - protected PortletApplicationContext2 createApplication( + protected VaadinPortletSession createApplication( PortletRequest request) throws PortletException { - PortletApplicationContext2 application = new PortletApplicationContext2(); + VaadinPortletSession application = new VaadinPortletSession(); try { ServletPortletHelper.initDefaultUIProvider(application, @@ -859,7 +858,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { return application; } - private Application getExistingApplication(PortletRequest request, + private VaadinSession getExistingApplication(PortletRequest request, boolean allowSessionCreation) throws MalformedURLException, SessionExpiredException { @@ -870,7 +869,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { throw new SessionExpiredException(); } - Application application = Application + VaadinSession application = VaadinSession .getForSession(new WrappedPortletSession(session)); if (application == null) { return null; @@ -884,7 +883,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants { } private void handleServiceException(WrappedPortletRequest request, - WrappedPortletResponse response, Application application, + WrappedPortletResponse response, VaadinSession application, Throwable e) throws IOException, PortletException { // TODO Check that this error handler is working when running inside a // portlet diff --git a/server/src/com/vaadin/server/VaadinPortletSession.java b/server/src/com/vaadin/server/VaadinPortletSession.java new file mode 100644 index 0000000000..8d1ae84fca --- /dev/null +++ b/server/src/com/vaadin/server/VaadinPortletSession.java @@ -0,0 +1,307 @@ +/* + * 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.server; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; + +import javax.portlet.ActionRequest; +import javax.portlet.ActionResponse; +import javax.portlet.EventRequest; +import javax.portlet.EventResponse; +import javax.portlet.MimeResponse; +import javax.portlet.PortletConfig; +import javax.portlet.PortletMode; +import javax.portlet.PortletModeException; +import javax.portlet.PortletResponse; +import javax.portlet.PortletSession; +import javax.portlet.PortletURL; +import javax.portlet.RenderRequest; +import javax.portlet.RenderResponse; +import javax.portlet.ResourceRequest; +import javax.portlet.ResourceResponse; +import javax.portlet.StateAwareResponse; +import javax.servlet.http.HttpSessionBindingListener; +import javax.xml.namespace.QName; + +import com.vaadin.ui.UI; +import com.vaadin.util.CurrentInstance; + +/** + * TODO Write documentation, fix JavaDoc tags. + * + * This is automatically registered as a {@link HttpSessionBindingListener} when + * {@link PortletSession#setAttribute()} is called with the context as value. + * + * @author peholmst + */ +@SuppressWarnings("serial") +public class VaadinPortletSession extends VaadinSession { + + private final Set portletListeners = new LinkedHashSet(); + + private final Map eventActionDestinationMap = new HashMap(); + private final Map eventActionValueMap = new HashMap(); + + private final Map sharedParameterActionNameMap = new HashMap(); + private final Map sharedParameterActionValueMap = new HashMap(); + + public PortletSession getPortletSession() { + WrappedSession wrappedSession = getSession(); + PortletSession session = ((WrappedPortletSession) wrappedSession) + .getPortletSession(); + return session; + } + + private PortletResponse getCurrentResponse() { + WrappedPortletResponse currentResponse = (WrappedPortletResponse) CurrentInstance + .get(WrappedResponse.class); + + if (currentResponse != null) { + return currentResponse.getPortletResponse(); + } else { + return null; + } + } + + public PortletConfig getPortletConfig() { + WrappedPortletResponse response = (WrappedPortletResponse) CurrentInstance + .get(WrappedResponse.class); + return response.getDeploymentConfiguration().getPortlet() + .getPortletConfig(); + } + + public void addPortletListener(PortletListener listener) { + portletListeners.add(listener); + } + + public void removePortletListener(PortletListener listener) { + portletListeners.remove(listener); + } + + public void firePortletRenderRequest(UI uI, RenderRequest request, + RenderResponse response) { + for (PortletListener l : new ArrayList( + portletListeners)) { + l.handleRenderRequest(request, new RestrictedRenderResponse( + response), uI); + } + } + + public void firePortletActionRequest(UI uI, ActionRequest request, + ActionResponse response) { + String key = request.getParameter(ActionRequest.ACTION_NAME); + if (eventActionDestinationMap.containsKey(key)) { + // this action request is only to send queued portlet events + response.setEvent(eventActionDestinationMap.get(key), + eventActionValueMap.get(key)); + // cleanup + eventActionDestinationMap.remove(key); + eventActionValueMap.remove(key); + } else if (sharedParameterActionNameMap.containsKey(key)) { + // this action request is only to set shared render parameters + response.setRenderParameter(sharedParameterActionNameMap.get(key), + sharedParameterActionValueMap.get(key)); + // cleanup + sharedParameterActionNameMap.remove(key); + sharedParameterActionValueMap.remove(key); + } else { + // normal action request, notify listeners + for (PortletListener l : new ArrayList( + portletListeners)) { + l.handleActionRequest(request, response, uI); + } + } + } + + public void firePortletEventRequest(UI uI, EventRequest request, + EventResponse response) { + for (PortletListener l : new ArrayList( + portletListeners)) { + l.handleEventRequest(request, response, uI); + } + } + + public void firePortletResourceRequest(UI uI, ResourceRequest request, + ResourceResponse response) { + for (PortletListener l : new ArrayList( + portletListeners)) { + l.handleResourceRequest(request, response, uI); + } + } + + public interface PortletListener extends Serializable { + + public void handleRenderRequest(RenderRequest request, + RenderResponse response, UI uI); + + public void handleActionRequest(ActionRequest request, + ActionResponse response, UI uI); + + public void handleEventRequest(EventRequest request, + EventResponse response, UI uI); + + public void handleResourceRequest(ResourceRequest request, + ResourceResponse response, UI uI); + } + + /** + * Creates a new action URL. + * + * @param action + * @return action URL or null if called outside a MimeRequest (outside a + * UIDL request or similar) + */ + public PortletURL generateActionURL(String action) { + PortletURL url = null; + PortletResponse response = getCurrentResponse(); + if (response instanceof MimeResponse) { + url = ((MimeResponse) response).createActionURL(); + url.setParameter("javax.portlet.action", action); + } else { + return null; + } + return url; + } + + /** + * Sends a portlet event to the indicated destination. + * + * Internally, an action may be created and opened, as an event cannot be + * sent directly from all types of requests. + * + * The event destinations and values need to be kept in the context until + * sent. Any memory leaks if the action fails are limited to the session. + * + * Event names for events sent and received by a portlet need to be declared + * in portlet.xml . + * + * @param uI + * a window in which a temporary action URL can be opened if + * necessary + * @param name + * event name + * @param value + * event value object that is Serializable and, if appropriate, + * has a valid JAXB annotation + */ + public void sendPortletEvent(UI uI, QName name, Serializable value) + throws IllegalStateException { + PortletResponse response = getCurrentResponse(); + if (response instanceof MimeResponse) { + String actionKey = "" + System.currentTimeMillis(); + while (eventActionDestinationMap.containsKey(actionKey)) { + actionKey = actionKey + "."; + } + PortletURL actionUrl = generateActionURL(actionKey); + if (actionUrl != null) { + eventActionDestinationMap.put(actionKey, name); + eventActionValueMap.put(actionKey, value); + uI.getPage().open(new ExternalResource(actionUrl.toString())); + } else { + // this should never happen as we already know the response is a + // MimeResponse + throw new IllegalStateException( + "Portlet events can only be sent from a portlet request"); + } + } else if (response instanceof StateAwareResponse) { + ((StateAwareResponse) response).setEvent(name, value); + } else { + throw new IllegalStateException( + "Portlet events can only be sent from a portlet request"); + } + } + + /** + * Sets a shared portlet parameter. + * + * Internally, an action may be created and opened, as shared parameters + * cannot be set directly from all types of requests. + * + * The parameters and values need to be kept in the context until sent. Any + * memory leaks if the action fails are limited to the session. + * + * Shared parameters set or read by a portlet need to be declared in + * portlet.xml . + * + * @param uI + * a window in which a temporary action URL can be opened if + * necessary + * @param name + * parameter identifier + * @param value + * parameter value + */ + public void setSharedRenderParameter(UI uI, String name, String value) + throws IllegalStateException { + PortletResponse response = getCurrentResponse(); + if (response instanceof MimeResponse) { + String actionKey = "" + System.currentTimeMillis(); + while (sharedParameterActionNameMap.containsKey(actionKey)) { + actionKey = actionKey + "."; + } + PortletURL actionUrl = generateActionURL(actionKey); + if (actionUrl != null) { + sharedParameterActionNameMap.put(actionKey, name); + sharedParameterActionValueMap.put(actionKey, value); + uI.getPage().open(new ExternalResource(actionUrl.toString())); + } else { + // this should never happen as we already know the response is a + // MimeResponse + throw new IllegalStateException( + "Shared parameters can only be set from a portlet request"); + } + } else if (response instanceof StateAwareResponse) { + ((StateAwareResponse) response).setRenderParameter(name, value); + } else { + throw new IllegalStateException( + "Shared parameters can only be set from a portlet request"); + } + } + + /** + * Sets the portlet mode. This may trigger a new render request. + * + * Portlet modes used by a portlet need to be declared in portlet.xml . + * + * @param uI + * a window in which the render URL can be opened if necessary + * @param portletMode + * the portlet mode to switch to + * @throws PortletModeException + * if the portlet mode is not allowed for some reason + * (configuration, permissions etc.) + */ + public void setPortletMode(UI uI, PortletMode portletMode) + throws IllegalStateException, PortletModeException { + PortletResponse response = getCurrentResponse(); + if (response instanceof MimeResponse) { + PortletURL url = ((MimeResponse) response).createRenderURL(); + url.setPortletMode(portletMode); + throw new RuntimeException("UI.open has not yet been implemented"); + // UI.open(new ExternalResource(url.toString())); + } else if (response instanceof StateAwareResponse) { + ((StateAwareResponse) response).setPortletMode(portletMode); + } else { + throw new IllegalStateException( + "Portlet mode can only be changed from a portlet request"); + } + } +} diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index eb21096c9b..d2e04da2e9 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -44,11 +44,10 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import com.vaadin.Application; -import com.vaadin.Application.ApplicationStartEvent; import com.vaadin.DefaultApplicationConfiguration; import com.vaadin.server.AbstractCommunicationManager.Callback; import com.vaadin.server.ServletPortletHelper.ApplicationClassException; +import com.vaadin.server.VaadinSession.ApplicationStartEvent; import com.vaadin.shared.ApplicationConstants; import com.vaadin.ui.UI; import com.vaadin.util.CurrentInstance; @@ -285,7 +284,7 @@ public class VaadinServlet extends HttpServlet implements Constants { return; } - Application application = null; + VaadinSession application = null; boolean applicationRunning = false; try { @@ -312,13 +311,13 @@ public class VaadinServlet extends HttpServlet implements Constants { if (application == null) { return; } - Application.setCurrent(application); + VaadinSession.setCurrent(application); /* * Get or create a WebApplicationContext and an ApplicationManager * for the session */ - ServletApplicationContext webApplicationContext = (ServletApplicationContext) application; + VaadinServletSession webApplicationContext = (VaadinServletSession) application; CommunicationManager applicationManager = (CommunicationManager) webApplicationContext .getApplicationManager(); @@ -575,7 +574,7 @@ public class VaadinServlet extends HttpServlet implements Constants { * @throws ServletException * @throws SessionExpiredException */ - private Application findApplicationInstance(HttpServletRequest request, + private VaadinSession findApplicationInstance(HttpServletRequest request, RequestType requestType) throws MalformedURLException, ServletException, SessionExpiredException { @@ -583,7 +582,7 @@ public class VaadinServlet extends HttpServlet implements Constants { request, requestType); /* Find an existing application for this request. */ - Application application = getExistingApplication(request, + VaadinSession application = getExistingApplication(request, requestCanCreateApplication); if (application != null) { @@ -626,9 +625,9 @@ public class VaadinServlet extends HttpServlet implements Constants { } - private Application createAndRegisterApplication(HttpServletRequest request) + private VaadinSession createAndRegisterApplication(HttpServletRequest request) throws ServletException, MalformedURLException { - Application newApplication = createApplication(request); + VaadinSession newApplication = createApplication(request); try { ServletPortletHelper.checkUiProviders(newApplication); @@ -722,9 +721,9 @@ public class VaadinServlet extends HttpServlet implements Constants { * @throws ServletException * @throws MalformedURLException */ - protected ServletApplicationContext createApplication( + protected VaadinServletSession createApplication( HttpServletRequest request) throws ServletException { - ServletApplicationContext newApplication = new ServletApplicationContext(); + VaadinServletSession newApplication = new VaadinServletSession(); try { ServletPortletHelper.initDefaultUIProvider(newApplication, @@ -737,7 +736,7 @@ public class VaadinServlet extends HttpServlet implements Constants { } private void handleServiceException(WrappedHttpServletRequest request, - WrappedHttpServletResponse response, Application application, + WrappedHttpServletResponse response, VaadinSession application, Throwable e) throws IOException, ServletException { // if this was an UIDL request, response UIDL back to client if (getRequestType(request) == RequestType.UIDL) { @@ -1270,7 +1269,7 @@ public class VaadinServlet extends HttpServlet implements Constants { * @throws InstantiationException * @throws SessionExpiredException */ - protected Application getExistingApplication(HttpServletRequest request, + protected VaadinSession getExistingApplication(HttpServletRequest request, boolean allowSessionCreation) throws MalformedURLException, SessionExpiredException { @@ -1280,7 +1279,7 @@ public class VaadinServlet extends HttpServlet implements Constants { throw new SessionExpiredException(); } - Application sessionApplication = getApplicationContext(session); + VaadinSession sessionApplication = getApplicationContext(session); if (sessionApplication == null) { return null; @@ -1307,7 +1306,7 @@ public class VaadinServlet extends HttpServlet implements Constants { * if the writing failed due to input/output error. */ private void endApplication(HttpServletRequest request, - HttpServletResponse response, Application application) + HttpServletResponse response, VaadinSession application) throws IOException { String logoutUrl = application.getLogoutURL(); @@ -1362,7 +1361,7 @@ public class VaadinServlet extends HttpServlet implements Constants { && (request.getParameter(URL_PARAMETER_REPAINT_ALL).equals("1")); } - private void closeApplication(Application application, HttpSession session) { + private void closeApplication(VaadinSession application, HttpSession session) { if (application == null) { return; } @@ -1373,8 +1372,8 @@ public class VaadinServlet extends HttpServlet implements Constants { } } - protected Application getApplicationContext(final HttpSession session) { - Application sessionApplication = Application + protected VaadinSession getApplicationContext(final HttpSession session) { + VaadinSession sessionApplication = VaadinSession .getForSession(new WrappedHttpSession(session)); return sessionApplication; } @@ -1399,11 +1398,11 @@ public class VaadinServlet extends HttpServlet implements Constants { * mananger implementation. * * @deprecated Instead of overriding this method, override - * {@link ServletApplicationContext} implementation via + * {@link VaadinServletSession} implementation via * {@link VaadinServlet#getApplicationContext(HttpSession)} * method and in that customized implementation return your * CommunicationManager in - * {@link ServletApplicationContext#getApplicationManager(Application, VaadinServlet)} + * {@link VaadinServletSession#getApplicationManager(VaadinSession, VaadinServlet)} * method. * * @param application @@ -1411,7 +1410,7 @@ public class VaadinServlet extends HttpServlet implements Constants { */ @Deprecated public CommunicationManager createCommunicationManager( - Application application) { + VaadinSession application) { return new CommunicationManager(application); } diff --git a/server/src/com/vaadin/server/VaadinServletSession.java b/server/src/com/vaadin/server/VaadinServletSession.java new file mode 100644 index 0000000000..72b744da72 --- /dev/null +++ b/server/src/com/vaadin/server/VaadinServletSession.java @@ -0,0 +1,100 @@ +/* + * 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.server; + +import java.util.Enumeration; +import java.util.HashMap; + +import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpSessionBindingEvent; +import javax.servlet.http.HttpSessionBindingListener; + +import com.vaadin.util.CurrentInstance; + +/** + * Web application context for Vaadin applications. + * + * This is automatically added as a {@link HttpSessionBindingListener} when + * added to a {@link HttpSession}. + * + * @author Vaadin Ltd. + * @since 3.1 + */ +@SuppressWarnings("serial") +public class VaadinServletSession extends VaadinSession { + + private transient boolean reinitializingSession = false; + + @Override + public void valueUnbound(HttpSessionBindingEvent event) { + if (!reinitializingSession) { + // Avoid closing the application if we are only reinitializing the + // session. Closing the application would cause the state to be lost + // and a new application to be created, which is not what we want. + super.valueUnbound(event); + } + } + + /** + * Discards the current session and creates a new session with the same + * contents. The purpose of this is to introduce a new session key in order + * to avoid session fixation attacks. + */ + public void reinitializeSession() { + + HttpSession oldSession = getHttpSession(); + + // Stores all attributes (security key, reference to this context + // instance) so they can be added to the new session + HashMap attrs = new HashMap(); + for (Enumeration e = oldSession.getAttributeNames(); e + .hasMoreElements();) { + String name = e.nextElement(); + attrs.put(name, oldSession.getAttribute(name)); + } + + // Invalidate the current session, set flag to avoid call to + // valueUnbound + reinitializingSession = true; + oldSession.invalidate(); + reinitializingSession = false; + + // Create a new session + HttpSession newSession = WrappedHttpServletRequest.cast( + CurrentInstance.get(WrappedRequest.class)).getSession(); + + // Restores all attributes (security key, reference to this context + // instance) + for (String name : attrs.keySet()) { + newSession.setAttribute(name, attrs.get(name)); + } + + // Update the "current session" variable + storeInSession(new WrappedHttpSession(newSession)); + } + + /** + * Gets the http-session application is running in. + * + * @return HttpSession this application context resides in. + */ + public HttpSession getHttpSession() { + WrappedSession session = getSession(); + return ((WrappedHttpSession) session).getHttpSession(); + } + +} diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java new file mode 100644 index 0000000000..10532559f0 --- /dev/null +++ b/server/src/com/vaadin/server/VaadinSession.java @@ -0,0 +1,1978 @@ +/* + * 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.server; + +import java.io.IOException; +import java.io.Serializable; +import java.lang.reflect.Method; +import java.net.SocketException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.EventObject; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.servlet.http.HttpSessionBindingEvent; +import javax.servlet.http.HttpSessionBindingListener; + +import com.vaadin.data.util.converter.Converter; +import com.vaadin.data.util.converter.ConverterFactory; +import com.vaadin.data.util.converter.DefaultConverterFactory; +import com.vaadin.event.EventRouter; +import com.vaadin.server.WrappedRequest.BrowserDetails; +import com.vaadin.shared.ui.ui.UIConstants; +import com.vaadin.ui.AbstractComponent; +import com.vaadin.ui.AbstractField; +import com.vaadin.ui.Table; +import com.vaadin.ui.UI; +import com.vaadin.ui.Window; +import com.vaadin.util.CurrentInstance; +import com.vaadin.util.ReflectTools; + +/** + *

    + * Base class required for all Vaadin applications. This class provides all the + * basic services required by Vaadin. These services allow external discovery + * and manipulation of the user, {@link com.vaadin.ui.Window windows} and + * themes, and starting and stopping the application. + *

    + * + *

    + * As mentioned, all Vaadin applications must inherit this class. However, this + * is almost all of what one needs to do to create a fully functional + * application. The only thing a class inheriting the Application + * needs to do is implement the init method where it creates the + * windows it needs to perform its function. Note that all applications must + * have at least one window: the main window. The first unnamed window + * constructed by an application automatically becomes the main window which + * behaves just like other windows with one exception: when accessing windows + * using URLs the main window corresponds to the application URL whereas other + * windows correspond to a URL gotten by catenating the window's name to the + * application URL. + *

    + * + *

    + * See the class com.vaadin.demo.HelloWorld for a simple example of + * a fully working application. + *

    + * + *

    + * Window access. Application provides methods to + * list, add and remove the windows it contains. + *

    + * + *

    + * Execution control. This class includes method to start and + * finish the execution of the application. Being finished means basically that + * no windows will be available from the application anymore. + *

    + * + *

    + * Theme selection. The theme selection process allows a theme + * to be specified at three different levels. When a window's theme needs to be + * found out, the window itself is queried for a preferred theme. If the window + * does not prefer a specific theme, the application containing the window is + * queried. If neither the application prefers a theme, the default theme for + * the {@link com.vaadin.server.Terminal terminal} is used. The terminal always + * defines a default theme. + *

    + * + * @author Vaadin Ltd. + * @since 3.0 + */ +@SuppressWarnings("serial") +public class VaadinSession implements Terminal.ErrorListener, + HttpSessionBindingListener, Serializable { + + /** + * The name of the parameter that is by default used in e.g. web.xml to + * define the name of the default {@link UI} class. + */ + public static final String UI_PARAMETER = "UI"; + + private static final Method BOOTSTRAP_FRAGMENT_METHOD = ReflectTools + .findMethod(BootstrapListener.class, "modifyBootstrapFragment", + BootstrapFragmentResponse.class); + private static final Method BOOTSTRAP_PAGE_METHOD = ReflectTools + .findMethod(BootstrapListener.class, "modifyBootstrapPage", + BootstrapPageResponse.class); + + /** + * An event sent to {@link #start(ApplicationStartEvent)} when a new + * Application is being started. + * + * @since 7.0 + */ + public static class ApplicationStartEvent implements Serializable { + private final URL applicationUrl; + + private final ApplicationConfiguration configuration; + + private final AbstractCommunicationManager communicationManager; + + /** + * @param applicationUrl + * the URL the application should respond to. + * @param configuration + * the application configuration for the application. + * @param communicationManager + * the communication manager for the application. + */ + public ApplicationStartEvent(URL applicationUrl, + ApplicationConfiguration configuration, + AbstractCommunicationManager communicationManager) { + this.applicationUrl = applicationUrl; + this.configuration = configuration; + this.communicationManager = communicationManager; + } + + /** + * Gets the URL the application should respond to. + * + * @return the URL the application should respond to or + * null if the URL is not defined. + * + * @see VaadinSession#getURL() + */ + public URL getApplicationUrl() { + return applicationUrl; + } + + /** + * Returns the application configuration used by this application. + * + * @return the deployment configuration. + */ + public ApplicationConfiguration getConfiguration() { + return configuration; + } + + /** + * Gets the communication manager for this application. + * + * @return the communication manager for this application. + * + * @see VaadinSession#getCommunicationManager + */ + public AbstractCommunicationManager getCommunicationManager() { + return communicationManager; + } + } + + private final static Logger logger = Logger.getLogger(VaadinSession.class + .getName()); + + /** + * Configuration for the application. + */ + private ApplicationConfiguration configuration; + + /** + * The application's URL. + */ + private URL applicationUrl; + + /** + * Application status. + */ + private volatile boolean applicationIsRunning = false; + + /** + * Default locale of the application. + */ + private Locale locale; + + /** + * URL where the user is redirected to on application close, or null if + * application is just closed without redirection. + */ + private String logoutURL = null; + + /** + * Application wide error handler which is used by default if an error is + * left unhandled. + */ + private Terminal.ErrorListener errorHandler = this; + + /** + * The converter factory that is used to provide default converters for the + * application. + */ + private ConverterFactory converterFactory = new DefaultConverterFactory(); + + private LinkedList requestHandlers = new LinkedList(); + + private int nextUIId = 0; + private Map uIs = new HashMap(); + + private final Map retainOnRefreshUIs = new HashMap(); + + private final EventRouter eventRouter = new EventRouter(); + + private List uiProviders = new LinkedList(); + + private GlobalResourceHandler globalResourceHandler; + + protected WebBrowser browser = new WebBrowser(); + + private AbstractCommunicationManager communicationManager; + + private long totalSessionTime = 0; + + private long lastRequestTime = -1; + + private transient WrappedSession session; + + /** + * @see javax.servlet.http.HttpSessionBindingListener#valueBound(HttpSessionBindingEvent) + */ + @Override + public void valueBound(HttpSessionBindingEvent arg0) { + // We are not interested in bindings + } + + /** + * @see javax.servlet.http.HttpSessionBindingListener#valueUnbound(HttpSessionBindingEvent) + */ + @Override + public void valueUnbound(HttpSessionBindingEvent event) { + // If we are going to be unbound from the session, the session must be + // closing + close(); + } + + /** + * Get the web browser associated with this application context. + * + * Because application context is related to the http session and server + * maintains one session per browser-instance, each context has exactly one + * web browser associated with it. + * + * @return + */ + public WebBrowser getBrowser() { + return browser; + } + + /** + * @return The total time spent servicing requests in this session. + */ + public long getTotalSessionTime() { + return totalSessionTime; + } + + /** + * Sets the time spent servicing the last request in the session and updates + * the total time spent servicing requests in this session. + * + * @param time + * the time spent in the last request. + */ + public void setLastRequestTime(long time) { + lastRequestTime = time; + totalSessionTime += time; + } + + /** + * @return the time spent servicing the last request in this session. + */ + public long getLastRequestTime() { + return lastRequestTime; + } + + /** + * Gets the session to which this application context is currently + * associated. + * + * @return the wrapped session for this context + */ + public WrappedSession getSession() { + return session; + } + + public AbstractCommunicationManager getApplicationManager() { + return communicationManager; + } + + /** + * Gets the URL of the application. + * + *

    + * This is the URL what can be entered to a browser window to start the + * application. Navigating to the application URL shows the main window ( + * {@link #getMainWindow()}) of the application. Note that the main window + * can also be shown by navigating to the window url ( + * {@link com.vaadin.ui.Window#getURL()}). + *

    + * + * @return the application's URL. + */ + public URL getURL() { + return applicationUrl; + } + + /** + * Ends the Application. + *

    + * In effect this will cause the application stop returning any windows when + * asked. When the application is closed, close events are fired for its + * UIs, its state is removed from the session, and the browser window is + * redirected to the application logout url set with + * {@link #setLogoutURL(String)}. If the logout url has not been set, the + * browser window is reloaded and the application is restarted. + */ + public void close() { + applicationIsRunning = false; + for (UI ui : getUIs()) { + ui.fireCloseEvent(); + } + } + + public static VaadinSession getForSession(WrappedSession session) { + Object attribute = session.getAttribute(VaadinSession.class.getName()); + if (attribute instanceof VaadinSession) { + VaadinSession application = (VaadinSession) attribute; + application.session = session; + return application; + } + + return null; + } + + public void removeFromSession() { + assert (getForSession(session) == this); + + session.setAttribute(VaadinSession.class.getName(), null); + } + + public void storeInSession(WrappedSession session) { + session.setAttribute(VaadinSession.class.getName(), this); + this.session = session; + } + + /** + * Starts the application on the given URL. + * + *

    + * This method is called by Vaadin framework when a user navigates to the + * application. After this call the application corresponds to the given URL + * and it will return windows when asked for them. There is no need to call + * this method directly. + *

    + * + *

    + * Application properties are defined by servlet configuration object + * {@link javax.servlet.ServletConfig} and they are overridden by + * context-wide initialization parameters + * {@link javax.servlet.ServletContext}. + *

    + * + * @param event + * the application start event containing details required for + * starting the application. + * + */ + public void start(ApplicationStartEvent event) { + applicationUrl = event.getApplicationUrl(); + configuration = event.getConfiguration(); + communicationManager = event.getCommunicationManager(); + applicationIsRunning = true; + } + + /** + * Tests if the application is running or if it has been finished. + * + *

    + * Application starts running when its {@link #start(ApplicationStartEvent)} + * method has been called and stops when the {@link #close()} is called. + *

    + * + * @return true if the application is running, + * false if not. + */ + public boolean isRunning() { + return applicationIsRunning; + } + + /** + * Gets the configuration for this application + * + * @return the application configuration + */ + public ApplicationConfiguration getConfiguration() { + return configuration; + } + + /** + * Gets the default locale for this application. + * + * By default this is the preferred locale of the user using the + * application. In most cases it is read from the browser defaults. + * + * @return the locale of this application. + */ + public Locale getLocale() { + if (locale != null) { + return locale; + } + return Locale.getDefault(); + } + + /** + * Sets the default locale for this application. + * + * By default this is the preferred locale of the user using the + * application. In most cases it is read from the browser defaults. + * + * @param locale + * the Locale object. + * + */ + public void setLocale(Locale locale) { + this.locale = locale; + } + + /** + * Window detach event. + * + * This event is sent each time a window is removed from the application + * with {@link com.vaadin.server.VaadinSession#removeWindow(Window)}. + */ + public static class WindowDetachEvent extends EventObject { + + private final Window window; + + /** + * Creates a event. + * + * @param application + * the application to which the detached window belonged. + * @param window + * the Detached window. + */ + public WindowDetachEvent(VaadinSession application, Window window) { + super(application); + this.window = window; + } + + /** + * Gets the detached window. + * + * @return the detached window. + */ + public Window getWindow() { + return window; + } + + /** + * Gets the application from which the window was detached. + * + * @return the Application. + */ + public VaadinSession getApplication() { + return (VaadinSession) getSource(); + } + } + + /** + * Window attach event. + * + * This event is sent each time a window is attached tothe application with + * {@link com.vaadin.server.VaadinSession#addWindow(Window)}. + */ + public static class WindowAttachEvent extends EventObject { + + private final Window window; + + /** + * Creates a event. + * + * @param application + * the application to which the detached window belonged. + * @param window + * the Attached window. + */ + public WindowAttachEvent(VaadinSession application, Window window) { + super(application); + this.window = window; + } + + /** + * Gets the attached window. + * + * @return the attached window. + */ + public Window getWindow() { + return window; + } + + /** + * Gets the application to which the window was attached. + * + * @return the Application. + */ + public VaadinSession getApplication() { + return (VaadinSession) getSource(); + } + } + + /** + * Window attach listener interface. + */ + public interface WindowAttachListener extends Serializable { + + /** + * Window attached + * + * @param event + * the window attach event. + */ + public void windowAttached(WindowAttachEvent event); + } + + /** + * Window detach listener interface. + */ + public interface WindowDetachListener extends Serializable { + + /** + * Window detached. + * + * @param event + * the window detach event. + */ + public void windowDetached(WindowDetachEvent event); + } + + /** + * Returns the URL user is redirected to on application close. If the URL is + * null, the application is closed normally as defined by the + * application running environment. + *

    + * Desktop application just closes the application window and + * web-application redirects the browser to application main URL. + *

    + * + * @return the URL. + */ + public String getLogoutURL() { + return logoutURL; + } + + /** + * Sets the URL user is redirected to on application close. If the URL is + * null, the application is closed normally as defined by the + * application running environment: Desktop application just closes the + * application window and web-application redirects the browser to + * application main URL. + * + * @param logoutURL + * the logoutURL to set. + */ + public void setLogoutURL(String logoutURL) { + this.logoutURL = logoutURL; + } + + /** + *

    + * Invoked by the terminal on any exception that occurs in application and + * is thrown by the setVariable to the terminal. The default + * implementation sets the exceptions as ComponentErrors to the + * component that initiated the exception and prints stack trace to standard + * error stream. + *

    + *

    + * You can safely override this method in your application in order to + * direct the errors to some other destination (for example log). + *

    + * + * @param event + * the change event. + * @see com.vaadin.server.Terminal.ErrorListener#terminalError(com.vaadin.server.Terminal.ErrorEvent) + */ + + @Override + public void terminalError(Terminal.ErrorEvent event) { + final Throwable t = event.getThrowable(); + if (t instanceof SocketException) { + // Most likely client browser closed socket + getLogger().info( + "SocketException in CommunicationManager." + + " Most likely client (browser) closed socket."); + return; + } + + // Finds the original source of the error/exception + Object owner = null; + if (event instanceof VariableOwner.ErrorEvent) { + owner = ((VariableOwner.ErrorEvent) event).getVariableOwner(); + } else if (event instanceof ChangeVariablesErrorEvent) { + owner = ((ChangeVariablesErrorEvent) event).getComponent(); + } + + // Shows the error in AbstractComponent + if (owner instanceof AbstractComponent) { + ((AbstractComponent) owner).setComponentError(AbstractErrorMessage + .getErrorMessageForException(t)); + } + + // also print the error on console + getLogger().log(Level.SEVERE, "Terminal error:", t); + } + + /** + * Gets the application error handler. + * + * The default error handler is the application itself. + * + * @return Application error handler + */ + public Terminal.ErrorListener getErrorHandler() { + return errorHandler; + } + + /** + * Sets the application error handler. + * + * The default error handler is the application itself. By overriding this, + * you can redirect the error messages to your selected target (log for + * example). + * + * @param errorHandler + */ + public void setErrorHandler(Terminal.ErrorListener errorHandler) { + this.errorHandler = errorHandler; + } + + /** + * Gets the {@link ConverterFactory} used to locate a suitable + * {@link Converter} for fields in the application. + * + * See {@link #setConverterFactory(ConverterFactory)} for more details + * + * @return The converter factory used in the application + */ + public ConverterFactory getConverterFactory() { + return converterFactory; + } + + /** + * Sets the {@link ConverterFactory} used to locate a suitable + * {@link Converter} for fields in the application. + *

    + * The {@link ConverterFactory} is used to find a suitable converter when + * binding data to a UI component and the data type does not match the UI + * component type, e.g. binding a Double to a TextField (which is based on a + * String). + *

    + *

    + * The {@link Converter} for an individual field can be overridden using + * {@link AbstractField#setConverter(Converter)} and for individual property + * ids in a {@link Table} using + * {@link Table#setConverter(Object, Converter)}. + *

    + *

    + * The converter factory must never be set to null. + * + * @param converterFactory + * The converter factory used in the application + */ + public void setConverterFactory(ConverterFactory converterFactory) { + this.converterFactory = converterFactory; + } + + /** + * Contains the system messages used to notify the user about various + * critical situations that can occur. + *

    + * Customize by overriding the static + * {@link VaadinSession#getSystemMessages()} and returning + * {@link CustomizedSystemMessages}. + *

    + *

    + * The defaults defined in this class are: + *

      + *
    • sessionExpiredURL = null
    • + *
    • sessionExpiredNotificationEnabled = true
    • + *
    • sessionExpiredCaption = ""
    • + *
    • sessionExpiredMessage = + * "Take note of any unsaved data, and click here to continue."
    • + *
    • communicationErrorURL = null
    • + *
    • communicationErrorNotificationEnabled = true
    • + *
    • communicationErrorCaption = "Communication problem"
    • + *
    • communicationErrorMessage = + * "Take note of any unsaved data, and click here to continue."
    • + *
    • internalErrorURL = null
    • + *
    • internalErrorNotificationEnabled = true
    • + *
    • internalErrorCaption = "Internal error"
    • + *
    • internalErrorMessage = "Please notify the administrator.
      + * Take note of any unsaved data, and click here to continue."
    • + *
    • outOfSyncURL = null
    • + *
    • outOfSyncNotificationEnabled = true
    • + *
    • outOfSyncCaption = "Out of sync"
    • + *
    • outOfSyncMessage = "Something has caused us to be out of sync + * with the server.
      + * Take note of any unsaved data, and click here to re-sync."
    • + *
    • cookiesDisabledURL = null
    • + *
    • cookiesDisabledNotificationEnabled = true
    • + *
    • cookiesDisabledCaption = "Cookies disabled"
    • + *
    • cookiesDisabledMessage = "This application requires cookies to + * function.
      + * Please enable cookies in your browser and click here to try again. + *
    • + *
    + *

    + * + */ + public static class SystemMessages implements Serializable { + protected String sessionExpiredURL = null; + protected boolean sessionExpiredNotificationEnabled = true; + protected String sessionExpiredCaption = "Session Expired"; + protected String sessionExpiredMessage = "Take note of any unsaved data, and click here to continue."; + + protected String communicationErrorURL = null; + protected boolean communicationErrorNotificationEnabled = true; + protected String communicationErrorCaption = "Communication problem"; + protected String communicationErrorMessage = "Take note of any unsaved data, and click here to continue."; + + protected String authenticationErrorURL = null; + protected boolean authenticationErrorNotificationEnabled = true; + protected String authenticationErrorCaption = "Authentication problem"; + protected String authenticationErrorMessage = "Take note of any unsaved data, and click here to continue."; + + protected String internalErrorURL = null; + protected boolean internalErrorNotificationEnabled = true; + protected String internalErrorCaption = "Internal error"; + protected String internalErrorMessage = "Please notify the administrator.
    Take note of any unsaved data, and click here to continue."; + + protected String outOfSyncURL = null; + protected boolean outOfSyncNotificationEnabled = true; + protected String outOfSyncCaption = "Out of sync"; + protected String outOfSyncMessage = "Something has caused us to be out of sync with the server.
    Take note of any unsaved data, and click here to re-sync."; + + protected String cookiesDisabledURL = null; + protected boolean cookiesDisabledNotificationEnabled = true; + protected String cookiesDisabledCaption = "Cookies disabled"; + protected String cookiesDisabledMessage = "This application requires cookies to function.
    Please enable cookies in your browser and click here to try again."; + + /** + * Use {@link CustomizedSystemMessages} to customize + */ + private SystemMessages() { + + } + + /** + * @return null to indicate that the application will be restarted after + * session expired message has been shown. + */ + public String getSessionExpiredURL() { + return sessionExpiredURL; + } + + /** + * @return true to show session expiration message. + */ + public boolean isSessionExpiredNotificationEnabled() { + return sessionExpiredNotificationEnabled; + } + + /** + * @return "" to show no caption. + */ + public String getSessionExpiredCaption() { + return (sessionExpiredNotificationEnabled ? sessionExpiredCaption + : null); + } + + /** + * @return + * "Take note of any unsaved data, and click here to continue." + */ + public String getSessionExpiredMessage() { + return (sessionExpiredNotificationEnabled ? sessionExpiredMessage + : null); + } + + /** + * @return null to reload the application after communication error + * message. + */ + public String getCommunicationErrorURL() { + return communicationErrorURL; + } + + /** + * @return true to show the communication error message. + */ + public boolean isCommunicationErrorNotificationEnabled() { + return communicationErrorNotificationEnabled; + } + + /** + * @return "Communication problem" + */ + public String getCommunicationErrorCaption() { + return (communicationErrorNotificationEnabled ? communicationErrorCaption + : null); + } + + /** + * @return + * "Take note of any unsaved data, and click here to continue." + */ + public String getCommunicationErrorMessage() { + return (communicationErrorNotificationEnabled ? communicationErrorMessage + : null); + } + + /** + * @return null to reload the application after authentication error + * message. + */ + public String getAuthenticationErrorURL() { + return authenticationErrorURL; + } + + /** + * @return true to show the authentication error message. + */ + public boolean isAuthenticationErrorNotificationEnabled() { + return authenticationErrorNotificationEnabled; + } + + /** + * @return "Authentication problem" + */ + public String getAuthenticationErrorCaption() { + return (authenticationErrorNotificationEnabled ? authenticationErrorCaption + : null); + } + + /** + * @return + * "Take note of any unsaved data, and click here to continue." + */ + public String getAuthenticationErrorMessage() { + return (authenticationErrorNotificationEnabled ? authenticationErrorMessage + : null); + } + + /** + * @return null to reload the current URL after internal error message + * has been shown. + */ + public String getInternalErrorURL() { + return internalErrorURL; + } + + /** + * @return true to enable showing of internal error message. + */ + public boolean isInternalErrorNotificationEnabled() { + return internalErrorNotificationEnabled; + } + + /** + * @return "Internal error" + */ + public String getInternalErrorCaption() { + return (internalErrorNotificationEnabled ? internalErrorCaption + : null); + } + + /** + * @return "Please notify the administrator.
    + * Take note of any unsaved data, and click here to + * continue." + */ + public String getInternalErrorMessage() { + return (internalErrorNotificationEnabled ? internalErrorMessage + : null); + } + + /** + * @return null to reload the application after out of sync message. + */ + public String getOutOfSyncURL() { + return outOfSyncURL; + } + + /** + * @return true to enable showing out of sync message + */ + public boolean isOutOfSyncNotificationEnabled() { + return outOfSyncNotificationEnabled; + } + + /** + * @return "Out of sync" + */ + public String getOutOfSyncCaption() { + return (outOfSyncNotificationEnabled ? outOfSyncCaption : null); + } + + /** + * @return "Something has caused us to be out of sync with the server.
    + * Take note of any unsaved data, and click here to + * re-sync." + */ + public String getOutOfSyncMessage() { + return (outOfSyncNotificationEnabled ? outOfSyncMessage : null); + } + + /** + * Returns the URL the user should be redirected to after dismissing the + * "you have to enable your cookies" message. Typically null. + * + * @return A URL the user should be redirected to after dismissing the + * message or null to reload the current URL. + */ + public String getCookiesDisabledURL() { + return cookiesDisabledURL; + } + + /** + * Determines if "cookies disabled" messages should be shown to the end + * user or not. If the notification is disabled the user will be + * immediately redirected to the URL returned by + * {@link #getCookiesDisabledURL()}. + * + * @return true to show "cookies disabled" messages to the end user, + * false to redirect to the given URL directly + */ + public boolean isCookiesDisabledNotificationEnabled() { + return cookiesDisabledNotificationEnabled; + } + + /** + * Returns the caption of the message shown to the user when cookies are + * disabled in the browser. + * + * @return The caption of the "cookies disabled" message + */ + public String getCookiesDisabledCaption() { + return (cookiesDisabledNotificationEnabled ? cookiesDisabledCaption + : null); + } + + /** + * Returns the message shown to the user when cookies are disabled in + * the browser. + * + * @return The "cookies disabled" message + */ + public String getCookiesDisabledMessage() { + return (cookiesDisabledNotificationEnabled ? cookiesDisabledMessage + : null); + } + + } + + /** + * Contains the system messages used to notify the user about various + * critical situations that can occur. + *

    + * Vaadin gets the SystemMessages from your application by calling a static + * getSystemMessages() method. By default the + * Application.getSystemMessages() is used. You can customize this by + * defining a static MyApplication.getSystemMessages() and returning + * CustomizedSystemMessages. Note that getSystemMessages() is static - + * changing the system messages will by default change the message for all + * users of the application. + *

    + *

    + * The default behavior is to show a notification, and restart the + * application the the user clicks the message.
    + * Instead of restarting the application, you can set a specific URL that + * the user is taken to.
    + * Setting both caption and message to null will restart the application (or + * go to the specified URL) without displaying a notification. + * set*NotificationEnabled(false) will achieve the same thing. + *

    + *

    + * The situations are: + *

  • Session expired: the user session has expired, usually due to + * inactivity.
  • + *
  • Communication error: the client failed to contact the server, or the + * server returned and invalid response.
  • + *
  • Internal error: unhandled critical server error (e.g out of memory, + * database crash) + *
  • Out of sync: the client is not in sync with the server. E.g the user + * opens two windows showing the same application, but the application does + * not support this and uses the same Window instance. When the user makes + * changes in one of the windows - the other window is no longer in sync, + * and (for instance) pressing a button that is no longer present in the UI + * will cause a out-of-sync -situation. + *

    + */ + + public static class CustomizedSystemMessages extends SystemMessages + implements Serializable { + + /** + * Sets the URL to go to when the session has expired. + * + * @param sessionExpiredURL + * the URL to go to, or null to reload current + */ + public void setSessionExpiredURL(String sessionExpiredURL) { + this.sessionExpiredURL = sessionExpiredURL; + } + + /** + * Enables or disables the notification. If disabled, the set URL (or + * current) is loaded directly when next transaction between server and + * client happens. + * + * @param sessionExpiredNotificationEnabled + * true = enabled, false = disabled + */ + public void setSessionExpiredNotificationEnabled( + boolean sessionExpiredNotificationEnabled) { + this.sessionExpiredNotificationEnabled = sessionExpiredNotificationEnabled; + } + + /** + * Sets the caption of the notification. Set to null for no caption. If + * both caption and message are null, client automatically forwards to + * sessionExpiredUrl after timeout timer expires. Timer uses value read + * from HTTPSession.getMaxInactiveInterval() + * + * @param sessionExpiredCaption + * the caption + */ + public void setSessionExpiredCaption(String sessionExpiredCaption) { + this.sessionExpiredCaption = sessionExpiredCaption; + } + + /** + * Sets the message of the notification. Set to null for no message. If + * both caption and message are null, client automatically forwards to + * sessionExpiredUrl after timeout timer expires. Timer uses value read + * from HTTPSession.getMaxInactiveInterval() + * + * @param sessionExpiredMessage + * the message + */ + public void setSessionExpiredMessage(String sessionExpiredMessage) { + this.sessionExpiredMessage = sessionExpiredMessage; + } + + /** + * Sets the URL to go to when there is a authentication error. + * + * @param authenticationErrorURL + * the URL to go to, or null to reload current + */ + public void setAuthenticationErrorURL(String authenticationErrorURL) { + this.authenticationErrorURL = authenticationErrorURL; + } + + /** + * Enables or disables the notification. If disabled, the set URL (or + * current) is loaded directly. + * + * @param authenticationErrorNotificationEnabled + * true = enabled, false = disabled + */ + public void setAuthenticationErrorNotificationEnabled( + boolean authenticationErrorNotificationEnabled) { + this.authenticationErrorNotificationEnabled = authenticationErrorNotificationEnabled; + } + + /** + * Sets the caption of the notification. Set to null for no caption. If + * both caption and message is null, the notification is disabled; + * + * @param authenticationErrorCaption + * the caption + */ + public void setAuthenticationErrorCaption( + String authenticationErrorCaption) { + this.authenticationErrorCaption = authenticationErrorCaption; + } + + /** + * Sets the message of the notification. Set to null for no message. If + * both caption and message is null, the notification is disabled; + * + * @param authenticationErrorMessage + * the message + */ + public void setAuthenticationErrorMessage( + String authenticationErrorMessage) { + this.authenticationErrorMessage = authenticationErrorMessage; + } + + /** + * Sets the URL to go to when there is a communication error. + * + * @param communicationErrorURL + * the URL to go to, or null to reload current + */ + public void setCommunicationErrorURL(String communicationErrorURL) { + this.communicationErrorURL = communicationErrorURL; + } + + /** + * Enables or disables the notification. If disabled, the set URL (or + * current) is loaded directly. + * + * @param communicationErrorNotificationEnabled + * true = enabled, false = disabled + */ + public void setCommunicationErrorNotificationEnabled( + boolean communicationErrorNotificationEnabled) { + this.communicationErrorNotificationEnabled = communicationErrorNotificationEnabled; + } + + /** + * Sets the caption of the notification. Set to null for no caption. If + * both caption and message is null, the notification is disabled; + * + * @param communicationErrorCaption + * the caption + */ + public void setCommunicationErrorCaption( + String communicationErrorCaption) { + this.communicationErrorCaption = communicationErrorCaption; + } + + /** + * Sets the message of the notification. Set to null for no message. If + * both caption and message is null, the notification is disabled; + * + * @param communicationErrorMessage + * the message + */ + public void setCommunicationErrorMessage( + String communicationErrorMessage) { + this.communicationErrorMessage = communicationErrorMessage; + } + + /** + * Sets the URL to go to when an internal error occurs. + * + * @param internalErrorURL + * the URL to go to, or null to reload current + */ + public void setInternalErrorURL(String internalErrorURL) { + this.internalErrorURL = internalErrorURL; + } + + /** + * Enables or disables the notification. If disabled, the set URL (or + * current) is loaded directly. + * + * @param internalErrorNotificationEnabled + * true = enabled, false = disabled + */ + public void setInternalErrorNotificationEnabled( + boolean internalErrorNotificationEnabled) { + this.internalErrorNotificationEnabled = internalErrorNotificationEnabled; + } + + /** + * Sets the caption of the notification. Set to null for no caption. If + * both caption and message is null, the notification is disabled; + * + * @param internalErrorCaption + * the caption + */ + public void setInternalErrorCaption(String internalErrorCaption) { + this.internalErrorCaption = internalErrorCaption; + } + + /** + * Sets the message of the notification. Set to null for no message. If + * both caption and message is null, the notification is disabled; + * + * @param internalErrorMessage + * the message + */ + public void setInternalErrorMessage(String internalErrorMessage) { + this.internalErrorMessage = internalErrorMessage; + } + + /** + * Sets the URL to go to when the client is out-of-sync. + * + * @param outOfSyncURL + * the URL to go to, or null to reload current + */ + public void setOutOfSyncURL(String outOfSyncURL) { + this.outOfSyncURL = outOfSyncURL; + } + + /** + * Enables or disables the notification. If disabled, the set URL (or + * current) is loaded directly. + * + * @param outOfSyncNotificationEnabled + * true = enabled, false = disabled + */ + public void setOutOfSyncNotificationEnabled( + boolean outOfSyncNotificationEnabled) { + this.outOfSyncNotificationEnabled = outOfSyncNotificationEnabled; + } + + /** + * Sets the caption of the notification. Set to null for no caption. If + * both caption and message is null, the notification is disabled; + * + * @param outOfSyncCaption + * the caption + */ + public void setOutOfSyncCaption(String outOfSyncCaption) { + this.outOfSyncCaption = outOfSyncCaption; + } + + /** + * Sets the message of the notification. Set to null for no message. If + * both caption and message is null, the notification is disabled; + * + * @param outOfSyncMessage + * the message + */ + public void setOutOfSyncMessage(String outOfSyncMessage) { + this.outOfSyncMessage = outOfSyncMessage; + } + + /** + * Sets the URL to redirect to when the browser has cookies disabled. + * + * @param cookiesDisabledURL + * the URL to redirect to, or null to reload the current URL + */ + public void setCookiesDisabledURL(String cookiesDisabledURL) { + this.cookiesDisabledURL = cookiesDisabledURL; + } + + /** + * Enables or disables the notification for "cookies disabled" messages. + * If disabled, the URL returned by {@link #getCookiesDisabledURL()} is + * loaded directly. + * + * @param cookiesDisabledNotificationEnabled + * true to enable "cookies disabled" messages, false + * otherwise + */ + public void setCookiesDisabledNotificationEnabled( + boolean cookiesDisabledNotificationEnabled) { + this.cookiesDisabledNotificationEnabled = cookiesDisabledNotificationEnabled; + } + + /** + * Sets the caption of the "cookies disabled" notification. Set to null + * for no caption. If both caption and message is null, the notification + * is disabled. + * + * @param cookiesDisabledCaption + * the caption for the "cookies disabled" notification + */ + public void setCookiesDisabledCaption(String cookiesDisabledCaption) { + this.cookiesDisabledCaption = cookiesDisabledCaption; + } + + /** + * Sets the message of the "cookies disabled" notification. Set to null + * for no message. If both caption and message is null, the notification + * is disabled. + * + * @param cookiesDisabledMessage + * the message for the "cookies disabled" notification + */ + public void setCookiesDisabledMessage(String cookiesDisabledMessage) { + this.cookiesDisabledMessage = cookiesDisabledMessage; + } + + } + + /** + * Application error is an error message defined on the application level. + * + * When an error occurs on the application level, this error message type + * should be used. This indicates that the problem is caused by the + * application - not by the user. + */ + public class ApplicationError implements Terminal.ErrorEvent { + private final Throwable throwable; + + public ApplicationError(Throwable throwable) { + this.throwable = throwable; + } + + @Override + public Throwable getThrowable() { + return throwable; + } + + } + + /** + * Gets the UI class for a request for which no UI is already known. This + * method is called when the framework processes a request that does not + * originate from an existing UI instance. This typically happens when a + * host page is requested. + *

    + * Subclasses of Application may override this method to provide custom + * logic for choosing what kind of UI to use. + *

    + * The default implementation in {@link VaadinSession} uses the + * {@value #UI_PARAMETER} parameter from web.xml for finding the name of the + * UI class. If {@link DeploymentConfiguration#getClassLoader()} does not + * return null, the returned {@link ClassLoader} is used for + * loading the UI class. Otherwise the {@link ClassLoader} used to load this + * class is used. + * + *

    + * + * @param request + * the wrapped request for which a UI is needed + * @return a UI instance to use for the request + * + * @see UI + * @see WrappedRequest#getBrowserDetails() + * + * @since 7.0 + */ + public Class getUIClass(WrappedRequest request) { + UIProvider uiProvider = getUiProvider(request, null); + return uiProvider.getUIClass(this, request); + } + + /** + * Creates an UI instance for a request for which no UI is already known. + * This method is called when the framework processes a request that does + * not originate from an existing UI instance. This typically happens when a + * host page is requested. + *

    + * Subclasses of Application may override this method to provide custom + * logic for choosing how to create a suitable UI or for picking an already + * created UI. If an existing UI is picked, care should be taken to avoid + * keeping the same UI open in multiple browser windows, as that will cause + * the states to go out of sync. + *

    + * + * @param request + * @param uiClass + * @return + */ + protected T createUIInstance(WrappedRequest request, + Class uiClass) { + UIProvider uiProvider = getUiProvider(request, uiClass); + return uiClass.cast(uiProvider.createInstance(this, uiClass, request)); + } + + /** + * Gets the {@link UIProvider} that should be used for a request. The + * selection can further be restricted by also requiring the UI provider to + * support a specific UI class. + * + * @see UIProvider + * @see #addUIProvider(UIProvider) + * + * @param request + * the request for which to get an UI provider + * @param uiClass + * the UI class for which a provider is required, or + * null to use the first UI provider supporting the + * request. + * @return an UI provider supporting the request (and the UI class if + * provided). + * + * @since 7.0.0 + */ + public UIProvider getUiProvider(WrappedRequest request, Class uiClass) { + UIProvider provider = (UIProvider) request + .getAttribute(UIProvider.class.getName()); + if (provider != null) { + // Cached provider found, verify that it's a sensible selection + Class providerClass = provider.getUIClass(this, + request); + if (uiClass == null && providerClass != null) { + // Use it if it gives any answer if no specific class is + // required + return provider; + } else if (uiClass == providerClass) { + // Use it if it gives the expected UI class + return provider; + } else { + // Don't keep it cached if it doesn't match the expectations + request.setAttribute(UIProvider.class.getName(), null); + } + } + + // Iterate all current providers if no matching cached provider found + provider = doGetUiProvider(request, uiClass); + + // Cache the found provider + request.setAttribute(UIProvider.class.getName(), provider); + + return provider; + } + + private UIProvider doGetUiProvider(WrappedRequest request, Class uiClass) { + int providersSize = uiProviders.size(); + if (providersSize == 0) { + throw new IllegalStateException("There are no UI providers"); + } + + for (int i = providersSize - 1; i >= 0; i--) { + UIProvider provider = uiProviders.get(i); + + Class providerClass = provider.getUIClass(this, + request); + // If we found something + if (providerClass != null) { + if (uiClass == null) { + // Not looking for anything particular -> anything is ok + return provider; + } else if (providerClass == uiClass) { + // Looking for a specific provider -> only use if matching + return provider; + } else { + getLogger().warning( + "Mismatching UI classes. Expected " + uiClass + + " but got " + providerClass + " from " + + provider); + // Continue looking + } + } + } + + throw new RuntimeException("No UI provider found for request"); + } + + /** + * Handles a request by passing it to each registered {@link RequestHandler} + * in turn until one produces a response. This method is used for requests + * that have not been handled by any specific functionality in the terminal + * implementation (e.g. {@link VaadinServlet}). + *

    + * The request handlers are invoked in the revere order in which they were + * added to the application until a response has been produced. This means + * that the most recently added handler is used first and the first request + * handler that was added to the application is invoked towards the end + * unless any previous handler has already produced a response. + *

    + * + * @param request + * the wrapped request to get information from + * @param response + * the response to which data can be written + * @return returns true if a {@link RequestHandler} has + * produced a response and false if no response has + * been written. + * @throws IOException + * + * @see #addRequestHandler(RequestHandler) + * @see RequestHandler + * + * @since 7.0 + */ + public boolean handleRequest(WrappedRequest request, + WrappedResponse response) throws IOException { + // Use a copy to avoid ConcurrentModificationException + for (RequestHandler handler : new ArrayList( + requestHandlers)) { + if (handler.handleRequest(this, request, response)) { + return true; + } + } + // If not handled + return false; + } + + /** + * Adds a request handler to this application. Request handlers can be added + * to provide responses to requests that are not handled by the default + * functionality of the framework. + *

    + * Handlers are called in reverse order of addition, so the most recently + * added handler will be called first. + *

    + * + * @param handler + * the request handler to add + * + * @see #handleRequest(WrappedRequest, WrappedResponse) + * @see #removeRequestHandler(RequestHandler) + * + * @since 7.0 + */ + public void addRequestHandler(RequestHandler handler) { + requestHandlers.addFirst(handler); + } + + /** + * Removes a request handler from the application. + * + * @param handler + * the request handler to remove + * + * @since 7.0 + */ + public void removeRequestHandler(RequestHandler handler) { + requestHandlers.remove(handler); + } + + /** + * Gets the request handlers that are registered to the application. The + * iteration order of the returned collection is the same as the order in + * which the request handlers will be invoked when a request is handled. + * + * @return a collection of request handlers, with the iteration order + * according to the order they would be invoked + * + * @see #handleRequest(WrappedRequest, WrappedResponse) + * @see #addRequestHandler(RequestHandler) + * @see #removeRequestHandler(RequestHandler) + * + * @since 7.0 + */ + public Collection getRequestHandlers() { + return Collections.unmodifiableCollection(requestHandlers); + } + + /** + * Gets the currently used application. The current application is + * automatically defined when processing requests to the server. In other + * cases, (e.g. from background threads), the current application is not + * automatically defined. + * + * @return the current application instance if available, otherwise + * null + * + * @see #setCurrent(VaadinSession) + * + * @since 7.0 + */ + public static VaadinSession getCurrent() { + return CurrentInstance.get(VaadinSession.class); + } + + /** + * Sets the thread local for the current application. This method is used by + * the framework to set the current application whenever a new request is + * processed and it is cleared when the request has been processed. + *

    + * The application developer can also use this method to define the current + * application outside the normal request handling, e.g. when initiating + * custom background threads. + *

    + * + * @param application + * + * @see #getCurrent() + * @see ThreadLocal + * + * @since 7.0 + */ + public static void setCurrent(VaadinSession application) { + CurrentInstance.setInheritable(VaadinSession.class, application); + } + + /** + * Check whether this application is in production mode. If an application + * is in production mode, certain debugging facilities are not available. + * + * @return the status of the production mode flag + * + * @since 7.0 + */ + public boolean isProductionMode() { + return configuration.isProductionMode(); + } + + public void addUIProvider(UIProvider uIProvider) { + uiProviders.add(uIProvider); + } + + public void removeUIProvider(UIProvider uIProvider) { + uiProviders.remove(uIProvider); + } + + /** + * Finds the {@link UI} to which a particular request belongs. If the + * request originates from an existing UI, that UI is returned. In other + * cases, the method attempts to create and initialize a new UI and might + * throw a {@link UIRequiresMoreInformationException} if all required + * information is not available. + *

    + * Please note that this method can also return a newly created + * UI which has not yet been initialized. You can use + * {@link #isUIInitPending(int)} with the UI's id ( {@link UI#getUIId()} to + * check whether the initialization is still pending. + *

    + * + * @param request + * the request for which a UI is desired + * @return a UI belonging to the request + * + * @see #createUI(WrappedRequest) + * + * @since 7.0 + */ + public UI getUIForRequest(WrappedRequest request) { + UI uI = UI.getCurrent(); + if (uI != null) { + return uI; + } + Integer uiId = getUIId(request); + + synchronized (this) { + uI = uIs.get(uiId); + + if (uI == null) { + uI = findExistingUi(request); + } + + } // end synchronized block + + UI.setCurrent(uI); + + return uI; + } + + private UI findExistingUi(WrappedRequest request) { + // Check if some UI provider has an existing UI available + for (int i = uiProviders.size() - 1; i >= 0; i--) { + UIProvider provider = uiProviders.get(i); + UI existingUi = provider.getExistingUI(request); + if (existingUi != null) { + return existingUi; + } + } + + BrowserDetails browserDetails = request.getBrowserDetails(); + boolean hasBrowserDetails = browserDetails != null + && browserDetails.getUriFragment() != null; + + if (hasBrowserDetails && !retainOnRefreshUIs.isEmpty()) { + // Check for a known UI + + @SuppressWarnings("null") + String windowName = browserDetails.getWindowName(); + Integer retainedUIId = retainOnRefreshUIs.get(windowName); + + if (retainedUIId != null) { + Class expectedUIClass = getUIClass(request); + UI retainedUI = uIs.get(retainedUIId); + // We've had the same UI instance in a window with this + // name, but should we still use it? + if (retainedUI.getClass() == expectedUIClass) { + return retainedUI; + } else { + getLogger().info( + "Not using retained UI in " + windowName + + " because retained UI was of type " + + retainedUIId.getClass() + " but " + + expectedUIClass + + " is expected for the request."); + } + } + } + + return null; + } + + public UI createUI(WrappedRequest request) { + Class uiClass = getUIClass(request); + + UI ui = createUIInstance(request, uiClass); + + // Initialize some fields for a newly created UI + if (ui.getApplication() == null) { + ui.setApplication(this); + } + // Get the next id + Integer uiId = Integer.valueOf(nextUIId++); + + uIs.put(uiId, ui); + + // Set thread local here so it is available in init + UI.setCurrent(ui); + + ui.doInit(request, uiId.intValue()); + + if (getUiProvider(request, uiClass).isUiPreserved(request, uiClass)) { + // Remember this UI + String windowName = request.getBrowserDetails().getWindowName(); + if (windowName == null) { + getLogger().warning( + "There is no window.name available for UI " + uiClass + + " that should be preserved."); + } else { + retainOnRefreshUIs.put(windowName, uiId); + } + } + + return ui; + } + + /** + * Internal helper to finds the UI id for a request. + * + * @param request + * the request to get the UI id for + * @return a UI id, or null if no UI id is defined + * + * @since 7.0 + */ + private static Integer getUIId(WrappedRequest request) { + if (request instanceof CombinedRequest) { + // Combined requests has the uiId parameter in the second request + CombinedRequest combinedRequest = (CombinedRequest) request; + request = combinedRequest.getSecondRequest(); + } + String uiIdString = request.getParameter(UIConstants.UI_ID_PARAMETER); + Integer uiId = uiIdString == null ? null : new Integer(uiIdString); + return uiId; + } + + /** + * Gets all the uIs of this application. This includes uIs that have been + * requested but not yet initialized. Please note, that uIs are not + * automatically removed e.g. if the browser window is closed and that there + * is no way to manually remove a UI. Inactive uIs will thus not be released + * for GC until the entire application is released when the session has + * timed out (unless there are dangling references). Improved support for + * releasing unused uIs is planned for an upcoming alpha release of Vaadin + * 7. + * + * @return a collection of uIs belonging to this application + * + * @since 7.0 + */ + public Collection getUIs() { + return Collections.unmodifiableCollection(uIs.values()); + } + + private int connectorIdSequence = 0; + + /** + * Generate an id for the given Connector. Connectors must not call this + * method more than once, the first time they need an id. + * + * @param connector + * A connector that has not yet been assigned an id. + * @return A new id for the connector + */ + public String createConnectorId(ClientConnector connector) { + return String.valueOf(connectorIdSequence++); + } + + private static final Logger getLogger() { + return Logger.getLogger(VaadinSession.class.getName()); + } + + /** + * Returns a UI with the given id. + *

    + * This is meant for framework internal use. + *

    + * + * @param uiId + * The UI id + * @return The UI with the given id or null if not found + */ + public UI getUIById(int uiId) { + return uIs.get(uiId); + } + + /** + * Adds a listener that will be invoked when the bootstrap HTML is about to + * be generated. This can be used to modify the contents of the HTML that + * loads the Vaadin application in the browser and the HTTP headers that are + * included in the response serving the HTML. + * + * @see BootstrapListener#modifyBootstrapFragment(BootstrapFragmentResponse) + * @see BootstrapListener#modifyBootstrapPage(BootstrapPageResponse) + * + * @param listener + * the bootstrap listener to add + */ + public void addBootstrapListener(BootstrapListener listener) { + eventRouter.addListener(BootstrapFragmentResponse.class, listener, + BOOTSTRAP_FRAGMENT_METHOD); + eventRouter.addListener(BootstrapPageResponse.class, listener, + BOOTSTRAP_PAGE_METHOD); + } + + /** + * Remove a bootstrap listener that was previously added. + * + * @see #addBootstrapListener(BootstrapListener) + * + * @param listener + * the bootstrap listener to remove + */ + public void removeBootstrapListener(BootstrapListener listener) { + eventRouter.removeListener(BootstrapFragmentResponse.class, listener, + BOOTSTRAP_FRAGMENT_METHOD); + eventRouter.removeListener(BootstrapPageResponse.class, listener, + BOOTSTRAP_PAGE_METHOD); + } + + /** + * Fires a bootstrap event to all registered listeners. There are currently + * two supported events, both inheriting from {@link BootstrapResponse}: + * {@link BootstrapFragmentResponse} and {@link BootstrapPageResponse}. + * + * @param response + * the bootstrap response event for which listeners should be + * fired + */ + public void modifyBootstrapResponse(BootstrapResponse response) { + eventRouter.fireEvent(response); + } + + /** + * Removes all those UIs from the application for which {@link #isUIAlive} + * returns false. Close events are fired for the removed UIs. + *

    + * Called by the framework at the end of every request. + * + * @see UI.CloseEvent + * @see UI.CloseListener + * @see #isUIAlive(UI) + * + * @since 7.0.0 + */ + public void closeInactiveUIs() { + for (Iterator i = uIs.values().iterator(); i.hasNext();) { + UI ui = i.next(); + if (!isUIAlive(ui)) { + i.remove(); + retainOnRefreshUIs.values().remove(ui.getUIId()); + ui.fireCloseEvent(); + getLogger().info( + "Closed UI #" + ui.getUIId() + " due to inactivity"); + } + } + } + + /** + * Returns the number of seconds that must pass without a valid heartbeat or + * UIDL request being received from a UI before that UI is removed from the + * application. This is a lower bound; it might take longer to close an + * inactive UI. Returns a negative number if heartbeat is disabled and + * timeout never occurs. + * + * @see #getUidlRequestTimeout() + * @see #closeInactiveUIs() + * @see DeploymentConfiguration#getHeartbeatInterval() + * + * @since 7.0.0 + * + * @return The heartbeat timeout in seconds or a negative number if timeout + * never occurs. + */ + protected int getHeartbeatTimeout() { + // Permit three missed heartbeats before closing the UI + return (int) (configuration.getHeartbeatInterval() * (3.1)); + } + + /** + * Returns the number of seconds that must pass without a valid UIDL request + * being received from a UI before the UI is removed from the application, + * even though heartbeat requests are received. This is a lower bound; it + * might take longer to close an inactive UI. Returns a negative number if + *

    + * This timeout only has effect if cleanup of inactive UIs is enabled; + * otherwise heartbeat requests are enough to extend UI lifetime + * indefinitely. + * + * @see DeploymentConfiguration#isIdleUICleanupEnabled() + * @see #getHeartbeatTimeout() + * @see #closeInactiveUIs() + * + * @since 7.0.0 + * + * @return The UIDL request timeout in seconds, or a negative number if + * timeout never occurs. + */ + protected int getUidlRequestTimeout() { + return configuration.isIdleUICleanupEnabled() ? getSession() + .getMaxInactiveInterval() : -1; + } + + /** + * Returns whether the given UI is alive (the client-side actively + * communicates with the server) or whether it can be removed from the + * application and eventually collected. + * + * @since 7.0.0 + * + * @param ui + * The UI whose status to check + * @return true if the UI is alive, false if it could be removed. + */ + protected boolean isUIAlive(UI ui) { + long now = System.currentTimeMillis(); + if (getHeartbeatTimeout() >= 0 + && now - ui.getLastHeartbeatTime() > 1000 * getHeartbeatTimeout()) { + return false; + } + if (getUidlRequestTimeout() >= 0 + && now - ui.getLastUidlRequestTime() > 1000 * getUidlRequestTimeout()) { + return false; + } + return true; + } + + /** + * Gets this application's global resource handler that takes care of + * serving connector resources that are not served by any single connector + * because e.g. because they are served with strong caching or because of + * legacy reasons. + * + * @param createOnDemand + * true if a resource handler should be initialized + * if there is no handler associated with this application. + * false if null should be returned + * if there is no registered handler. + * @return this application's global resource handler, or null + * if there is no handler and the createOnDemand parameter is + * false. + * + * @since 7.0.0 + */ + public GlobalResourceHandler getGlobalResourceHandler(boolean createOnDemand) { + if (globalResourceHandler == null && createOnDemand) { + globalResourceHandler = new GlobalResourceHandler(); + addRequestHandler(globalResourceHandler); + } + + return globalResourceHandler; + } + + public Collection getUIProviders() { + return Collections.unmodifiableCollection(uiProviders); + } + +} diff --git a/server/src/com/vaadin/server/WrappedHttpServletRequest.java b/server/src/com/vaadin/server/WrappedHttpServletRequest.java index 05d9b13736..4221551601 100644 --- a/server/src/com/vaadin/server/WrappedHttpServletRequest.java +++ b/server/src/com/vaadin/server/WrappedHttpServletRequest.java @@ -19,7 +19,6 @@ package com.vaadin.server; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; -import com.vaadin.Application; /** * Wrapper for {@link HttpServletRequest}. @@ -89,7 +88,7 @@ public class WrappedHttpServletRequest extends HttpServletRequestWrapper @Override public WebBrowser getWebBrowser() { - return Application.getCurrent().getBrowser(); + return VaadinSession.getCurrent().getBrowser(); } }; } diff --git a/server/src/com/vaadin/server/WrappedPortletRequest.java b/server/src/com/vaadin/server/WrappedPortletRequest.java index dffbebb379..65099add76 100644 --- a/server/src/com/vaadin/server/WrappedPortletRequest.java +++ b/server/src/com/vaadin/server/WrappedPortletRequest.java @@ -25,7 +25,6 @@ import javax.portlet.ClientDataRequest; import javax.portlet.PortletRequest; import javax.portlet.ResourceRequest; -import com.vaadin.Application; import com.vaadin.shared.ApplicationConstants; /** @@ -151,7 +150,7 @@ public class WrappedPortletRequest implements WrappedRequest { @Override public WebBrowser getWebBrowser() { - PortletApplicationContext2 context = (PortletApplicationContext2) Application + VaadinPortletSession context = (VaadinPortletSession) VaadinSession .getCurrent(); return context.getBrowser(); } diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index 37ca9f1a03..e6cc80f1cf 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -27,7 +27,6 @@ import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; -import com.vaadin.Application; import com.vaadin.event.ActionManager; import com.vaadin.event.EventRouter; import com.vaadin.event.MethodEventSource; @@ -38,6 +37,7 @@ import com.vaadin.server.ComponentSizeValidator; import com.vaadin.server.ErrorMessage; import com.vaadin.server.Resource; import com.vaadin.server.Terminal; +import com.vaadin.server.VaadinSession; import com.vaadin.shared.ComponentConstants; import com.vaadin.shared.ComponentState; import com.vaadin.shared.ui.ComponentStateUtil; @@ -259,7 +259,7 @@ public abstract class AbstractComponent extends AbstractClientConnector if (parent != null) { return parent.getLocale(); } - final Application app = getApplication(); + final VaadinSession app = getApplication(); if (app != null) { return app.getLocale(); } @@ -616,7 +616,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ protected void focus() { if (this instanceof Focusable) { - final Application app = getApplication(); + final VaadinSession app = getApplication(); if (app != null) { getUI().setFocusedComponent((Focusable) this); delayedFocus = false; @@ -646,7 +646,7 @@ public abstract class AbstractComponent extends AbstractClientConnector * @see #attach() */ @Override - public Application getApplication() { + public VaadinSession getApplication() { // Just make method inherited from Component interface public return super.getApplication(); } diff --git a/server/src/com/vaadin/ui/Component.java b/server/src/com/vaadin/ui/Component.java index 5bd1d53b86..812edbb8d2 100644 --- a/server/src/com/vaadin/ui/Component.java +++ b/server/src/com/vaadin/ui/Component.java @@ -21,12 +21,12 @@ import java.util.EventListener; import java.util.EventObject; import java.util.Locale; -import com.vaadin.Application; import com.vaadin.event.FieldEvents; import com.vaadin.server.ClientConnector; import com.vaadin.server.ErrorMessage; import com.vaadin.server.Resource; import com.vaadin.server.Sizeable; +import com.vaadin.server.VaadinSession; import com.vaadin.server.VariableOwner; /** @@ -532,7 +532,7 @@ public interface Component extends ClientConnector, Sizeable, Serializable { *

    * Getting a null value is often a problem in constructors of regular * components and in the initializers of custom composite components. A - * standard workaround is to use {@link Application#getCurrent()} to + * standard workaround is to use {@link VaadinSession#getCurrent()} to * retrieve the application instance that the current request relates to. * Another way is to move the problematic initialization to * {@link #attach()}, as described in the documentation of the method. @@ -541,7 +541,7 @@ public interface Component extends ClientConnector, Sizeable, Serializable { * @return the parent application of the component or null. * @see #attach() */ - public Application getApplication(); + public VaadinSession getApplication(); /** * {@inheritDoc} diff --git a/server/src/com/vaadin/ui/LoginForm.java b/server/src/com/vaadin/ui/LoginForm.java index 61846eab4e..1d0c5c41b6 100644 --- a/server/src/com/vaadin/ui/LoginForm.java +++ b/server/src/com/vaadin/ui/LoginForm.java @@ -24,10 +24,10 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import com.vaadin.Application; import com.vaadin.server.ConnectorResource; import com.vaadin.server.DownloadStream; import com.vaadin.server.RequestHandler; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.server.WrappedResponse; import com.vaadin.shared.ApplicationConstants; @@ -83,7 +83,7 @@ public class LoginForm extends CustomComponent { private final RequestHandler requestHandler = new RequestHandler() { @Override - public boolean handleRequest(Application application, + public boolean handleRequest(VaadinSession application, WrappedRequest request, WrappedResponse response) throws IOException { String requestPathInfo = request.getRequestPathInfo(); diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index 7389a898eb..e2d79454f6 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -27,7 +27,6 @@ import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Map; -import com.vaadin.Application; import com.vaadin.LegacyApplication; import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; @@ -42,6 +41,7 @@ import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; import com.vaadin.server.Resource; import com.vaadin.server.VaadinServlet; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.server.WrappedRequest.BrowserDetails; import com.vaadin.shared.EventId; @@ -66,9 +66,9 @@ import com.vaadin.util.ReflectTools; *

    * When a new UI instance is needed, typically because the user opens a URL in a * browser window which points to {@link VaadinServlet}, - * {@link Application#getUIForRequest(WrappedRequest)} is invoked to get a UI. + * {@link VaadinSession#getUIForRequest(WrappedRequest)} is invoked to get a UI. * That method does by default create a UI according to the - * {@value Application#UI_PARAMETER} parameter from web.xml. + * {@value VaadinSession#UI_PARAMETER} parameter from web.xml. *

    *

    * After a UI has been created by the application, it is initialized using @@ -80,7 +80,7 @@ import com.vaadin.util.ReflectTools; *

    * * @see #init(WrappedRequest) - * @see Application#createUI(WrappedRequest) + * @see VaadinSession#createUI(WrappedRequest) * * @since 7.0 */ @@ -135,7 +135,7 @@ public abstract class UI extends AbstractComponentContainer implements * The name also determines the URL that can be used for direct access * to a window. All windows can be accessed through * {@code http://host:port/app/win} where {@code http://host:port/app} - * is the application URL (as returned by {@link Application#getURL()} + * is the application URL (as returned by {@link VaadinSession#getURL()} * and {@code win} is the window name. *

    *

    @@ -155,7 +155,7 @@ public abstract class UI extends AbstractComponentContainer implements * The name also determines the URL that can be used for direct access * to a window. All windows can be accessed through * {@code http://host:port/app/win} where {@code http://host:port/app} - * is the application URL (as returned by {@link Application#getURL()} + * is the application URL (as returned by {@link VaadinSession#getURL()} * and {@code win} is the window name. *

    *

    @@ -193,7 +193,7 @@ public abstract class UI extends AbstractComponentContainer implements * to an application */ public URL getURL() { - Application application = getApplication(); + VaadinSession application = getApplication(); if (application == null) { return null; } @@ -424,7 +424,7 @@ public abstract class UI extends AbstractComponentContainer implements /** * The application to which this UI belongs */ - private Application application; + private VaadinSession application; /** * List of windows in this UI. @@ -442,7 +442,7 @@ public abstract class UI extends AbstractComponentContainer implements * which a request originates. A negative value indicates that the UI id has * not yet been assigned by the Application. * - * @see Application#nextUIId + * @see VaadinSession#nextUIId */ private int uiId = -1; @@ -564,7 +564,7 @@ public abstract class UI extends AbstractComponentContainer implements } @Override - public Application getApplication() { + public VaadinSession getApplication() { return application; } @@ -684,7 +684,7 @@ public abstract class UI extends AbstractComponentContainer implements * * @see #getApplication() */ - public void setApplication(Application application) { + public void setApplication(VaadinSession application) { if ((application == null) == (this.application == null)) { throw new IllegalStateException("Application has already been set"); } else { @@ -703,7 +703,7 @@ public abstract class UI extends AbstractComponentContainer implements * Gets the id of the UI, used to identify this UI within its application * when processing requests. The UI id should be present in every request to * the server that originates from this UI. - * {@link Application#getUIForRequest(WrappedRequest)} uses this id to find + * {@link VaadinSession#getUIForRequest(WrappedRequest)} uses this id to find * the route to which the request belongs. * * @return @@ -716,7 +716,7 @@ public abstract class UI extends AbstractComponentContainer implements * Adds a window as a subwindow inside this UI. To open a new browser window * or tab, you should instead use {@link open(Resource)} with an url * pointing to this application and ensure - * {@link Application#createUI(WrappedRequest)} returns an appropriate UI + * {@link VaadinSession#createUI(WrappedRequest)} returns an appropriate UI * for the request. * * @param window @@ -1294,7 +1294,7 @@ public abstract class UI extends AbstractComponentContainer implements * heartbeat for this UI. * * @see #heartbeat() - * @see Application#closeInactiveUIs() + * @see VaadinSession#closeInactiveUIs() * * @return The time the last heartbeat request occurred. */ diff --git a/server/tests/src/com/vaadin/tests/VaadinClasses.java b/server/tests/src/com/vaadin/tests/VaadinClasses.java index 15e1283e47..b30ddcee7e 100644 --- a/server/tests/src/com/vaadin/tests/VaadinClasses.java +++ b/server/tests/src/com/vaadin/tests/VaadinClasses.java @@ -15,7 +15,7 @@ import java.util.Enumeration; import java.util.List; import java.util.jar.JarEntry; -import com.vaadin.Application; +import com.vaadin.server.VaadinSession; import com.vaadin.ui.Component; import com.vaadin.ui.ComponentContainer; import com.vaadin.ui.CustomComponent; @@ -144,7 +144,7 @@ public class VaadinClasses { String basePackage, String[] ignoredPackages) throws IOException { List> classes = new ArrayList>(); String basePackageDirName = "/" + basePackage.replace('.', '/'); - URL location = Application.class.getResource(basePackageDirName); + URL location = VaadinSession.class.getResource(basePackageDirName); if (location.getProtocol().equals("file")) { try { File f = new File(location.toURI()); diff --git a/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java b/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java index 6393d61981..66160907b2 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java +++ b/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java @@ -19,9 +19,9 @@ import java.util.Locale; import junit.framework.TestCase; -import com.vaadin.Application; import com.vaadin.data.util.converter.Converter; import com.vaadin.data.util.converter.DefaultConverterFactory; +import com.vaadin.server.VaadinSession; import com.vaadin.ui.TextField; public class ConverterFactory extends TestCase { @@ -65,14 +65,14 @@ public class ConverterFactory extends TestCase { } public void testApplicationConverterFactoryInBackgroundThread() { - Application.setCurrent(null); - final Application appWithCustomIntegerConverter = new Application(); + VaadinSession.setCurrent(null); + final VaadinSession appWithCustomIntegerConverter = new VaadinSession(); appWithCustomIntegerConverter .setConverterFactory(new ConverterFactory42()); TextField tf = new TextField("", "123") { @Override - public Application getApplication() { + public VaadinSession getApplication() { return appWithCustomIntegerConverter; }; }; @@ -83,10 +83,10 @@ public class ConverterFactory extends TestCase { } public void testApplicationConverterFactoryForDetachedComponent() { - final Application appWithCustomIntegerConverter = new Application(); + final VaadinSession appWithCustomIntegerConverter = new VaadinSession(); appWithCustomIntegerConverter .setConverterFactory(new ConverterFactory42()); - Application.setCurrent(appWithCustomIntegerConverter); + VaadinSession.setCurrent(appWithCustomIntegerConverter); TextField tf = new TextField("", "123"); tf.setConverter(Integer.class); @@ -96,14 +96,14 @@ public class ConverterFactory extends TestCase { } public void testApplicationConverterFactoryForDifferentThanCurrentApplication() { - final Application fieldAppWithCustomIntegerConverter = new Application(); + final VaadinSession fieldAppWithCustomIntegerConverter = new VaadinSession(); fieldAppWithCustomIntegerConverter .setConverterFactory(new ConverterFactory42()); - Application.setCurrent(new Application()); + VaadinSession.setCurrent(new VaadinSession()); TextField tf = new TextField("", "123") { @Override - public Application getApplication() { + public VaadinSession getApplication() { return fieldAppWithCustomIntegerConverter; } }; diff --git a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java index 775348fb5c..e286e7231e 100644 --- a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java +++ b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java @@ -4,9 +4,9 @@ import junit.framework.TestCase; import org.easymock.EasyMock; -import com.vaadin.Application; import com.vaadin.server.CommunicationManager; import com.vaadin.server.StreamVariable; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.ui.UI; import com.vaadin.ui.Upload; @@ -21,7 +21,7 @@ public class TestStreamVariableMapping extends TestCase { @Override protected void setUp() throws Exception { - final Application application = new Application(); + final VaadinSession application = new VaadinSession(); final UI uI = new UI() { @Override protected void init(WrappedRequest request) { @@ -30,7 +30,7 @@ public class TestStreamVariableMapping extends TestCase { } @Override - public Application getApplication() { + public VaadinSession getApplication() { return application; } }; @@ -66,7 +66,7 @@ public class TestStreamVariableMapping extends TestCase { } private CommunicationManager createCommunicationManager() { - return new CommunicationManager(new Application()); + return new CommunicationManager(new VaadinSession()); } } diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java index 57af748247..d372b96339 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java @@ -4,10 +4,10 @@ import java.util.Locale; import junit.framework.TestCase; -import com.vaadin.Application; import com.vaadin.data.util.MethodProperty; import com.vaadin.data.util.converter.Converter; import com.vaadin.data.util.converter.StringToIntegerConverter; +import com.vaadin.server.VaadinSession; import com.vaadin.tests.data.bean.Address; import com.vaadin.tests.data.bean.Country; import com.vaadin.tests.data.bean.Person; @@ -186,11 +186,11 @@ public class AbstractFieldValueConversions extends TestCase { } public void testNumberDoubleConverterChange() { - final Application a = new Application(); - Application.setCurrent(a); + final VaadinSession a = new VaadinSession(); + VaadinSession.setCurrent(a); TextField tf = new TextField() { @Override - public Application getApplication() { + public VaadinSession getApplication() { return a; } }; diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java index 25430fc9a5..a1b6541ee0 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java @@ -5,8 +5,8 @@ import java.util.Locale; import junit.framework.TestCase; -import com.vaadin.Application; import com.vaadin.data.util.MethodProperty; +import com.vaadin.server.VaadinSession; import com.vaadin.tests.data.bean.Address; import com.vaadin.tests.data.bean.Country; import com.vaadin.tests.data.bean.Person; @@ -26,8 +26,8 @@ public class DefaultConverterFactory extends TestCase { } public void testDefaultNumberConversion() { - Application app = new Application(); - Application.setCurrent(app); + VaadinSession app = new VaadinSession(); + VaadinSession.setCurrent(app); TextField tf = new TextField(); tf.setLocale(new Locale("en", "US")); tf.setPropertyDataSource(new MethodProperty(paulaBean, diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java index 18567b62f0..b498bbe73f 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java @@ -4,10 +4,10 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; -import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.util.AbstractProperty; import com.vaadin.data.util.converter.Converter.ConversionException; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.ui.AbstractField; import com.vaadin.ui.UI; @@ -18,7 +18,7 @@ public class RemoveListenersOnDetach { int numReadOnlyChanges = 0; AbstractField field = new AbstractField() { - final private Application application = new Application() { + final private VaadinSession application = new VaadinSession() { }; private UI uI = new UI() { @@ -29,7 +29,7 @@ public class RemoveListenersOnDetach { } @Override - public Application getApplication() { + public VaadinSession getApplication() { return application; } @@ -59,7 +59,7 @@ public class RemoveListenersOnDetach { }; @Override - public Application getApplication() { + public VaadinSession getApplication() { return application; }; }; diff --git a/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java b/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java index 48279c7c88..22cd450af7 100644 --- a/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java +++ b/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java @@ -17,9 +17,9 @@ package com.vaadin.tests.server.component.label; import junit.framework.TestCase; -import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.util.MethodProperty; +import com.vaadin.server.VaadinSession; import com.vaadin.tests.data.bean.Person; import com.vaadin.ui.Label; @@ -37,7 +37,7 @@ public class LabelConverters extends TestCase { } public void testIntegerDataSource() { - Application.setCurrent(new Application()); + VaadinSession.setCurrent(new VaadinSession()); Label l = new Label("Foo"); Property ds = new MethodProperty(Person.createTestPerson1(), "age"); diff --git a/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java b/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java index aef35084f8..acc2ed3b14 100644 --- a/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java +++ b/server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java @@ -8,13 +8,13 @@ import junit.framework.TestCase; import org.easymock.EasyMock; -import com.vaadin.Application; -import com.vaadin.Application.ApplicationStartEvent; import com.vaadin.DefaultApplicationConfiguration; import com.vaadin.server.ApplicationConfiguration; import com.vaadin.server.DefaultUIProvider; import com.vaadin.server.DeploymentConfiguration; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; +import com.vaadin.server.VaadinSession.ApplicationStartEvent; import com.vaadin.ui.UI; public class CustomUIClassLoader extends TestCase { @@ -53,7 +53,7 @@ public class CustomUIClassLoader extends TestCase { * if thrown */ public void testWithNullClassLoader() throws Exception { - Application application = createStubApplication(); + VaadinSession application = createStubApplication(); application.start(new ApplicationStartEvent(null, createConfigurationMock(), null)); @@ -66,7 +66,7 @@ public class CustomUIClassLoader extends TestCase { private static ApplicationConfiguration createConfigurationMock() { Properties properties = new Properties(); - properties.put(Application.UI_PARAMETER, MyUI.class.getName()); + properties.put(VaadinSession.UI_PARAMETER, MyUI.class.getName()); return new DefaultApplicationConfiguration(CustomUIClassLoader.class, properties); } @@ -97,7 +97,7 @@ public class CustomUIClassLoader extends TestCase { public void testWithClassLoader() throws Exception { LoggingClassLoader loggingClassLoader = new LoggingClassLoader(); - Application application = createStubApplication(); + VaadinSession application = createStubApplication(); application.start(new ApplicationStartEvent(null, createConfigurationMock(), null)); @@ -112,8 +112,8 @@ public class CustomUIClassLoader extends TestCase { } - private Application createStubApplication() { - return new Application() { + private VaadinSession createStubApplication() { + return new VaadinSession() { @Override public ApplicationConfiguration getConfiguration() { return createConfigurationMock(); diff --git a/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java b/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java index 0fb0765c9f..bab7ca2c8c 100644 --- a/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java +++ b/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java @@ -5,7 +5,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; -import com.vaadin.Application; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.ui.Label; import com.vaadin.ui.UI; @@ -14,7 +14,7 @@ import com.vaadin.ui.Window; public class AttachDetachWindow { - private Application testApp = new Application(); + private VaadinSession testApp = new VaadinSession(); private interface TestContainer { public boolean attachCalled(); @@ -23,7 +23,7 @@ public class AttachDetachWindow { public TestContent getTestContent(); - public Application getApplication(); + public VaadinSession getApplication(); } private class TestWindow extends Window implements TestContainer { diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java index 34c1cc1fce..4f37a9b505 100644 --- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java +++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java @@ -29,13 +29,13 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import com.vaadin.Application; import com.vaadin.LegacyApplication; import com.vaadin.server.AbstractUIProvider; import com.vaadin.server.ApplicationConfiguration; import com.vaadin.server.LegacyVaadinServlet; -import com.vaadin.server.ServletApplicationContext; +import com.vaadin.server.VaadinServletSession; import com.vaadin.server.UIProvider; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedHttpServletRequest; import com.vaadin.server.WrappedRequest; import com.vaadin.tests.components.TestBase; @@ -113,17 +113,17 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { } @Override - protected ServletApplicationContext createApplication( + protected VaadinServletSession createApplication( HttpServletRequest request) throws ServletException { try { final Class classToRun = getClassToRun(); if (UI.class.isAssignableFrom(classToRun)) { - ServletApplicationContext application = new ServletApplicationContext(); + VaadinServletSession application = new VaadinServletSession(); application.addUIProvider(new AbstractUIProvider() { @Override public Class getUIClass( - Application application, WrappedRequest request) { + VaadinSession application, WrappedRequest request) { return (Class) classToRun; } }); @@ -131,7 +131,7 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { } else if (LegacyApplication.class.isAssignableFrom(classToRun)) { return super.createApplication(request); } else if (UIProvider.class.isAssignableFrom(classToRun)) { - ServletApplicationContext application = new ServletApplicationContext(); + VaadinServletSession application = new VaadinServletSession(); application .addUIProvider((UIProvider) classToRun.newInstance()); return application; diff --git a/uitest/src/com/vaadin/tests/ModalWindow.java b/uitest/src/com/vaadin/tests/ModalWindow.java index 558989e069..7c9e60c943 100644 --- a/uitest/src/com/vaadin/tests/ModalWindow.java +++ b/uitest/src/com/vaadin/tests/ModalWindow.java @@ -31,7 +31,7 @@ import com.vaadin.ui.Window; * * @author Vaadin Ltd. * @since 4.0.1 - * @see com.vaadin.Application + * @see com.vaadin.server.VaadinSession * @see com.vaadin.ui.Window * @see com.vaadin.ui.Label */ diff --git a/uitest/src/com/vaadin/tests/Parameters.java b/uitest/src/com/vaadin/tests/Parameters.java index 901b0a6dd7..01270456c8 100644 --- a/uitest/src/com/vaadin/tests/Parameters.java +++ b/uitest/src/com/vaadin/tests/Parameters.java @@ -21,10 +21,10 @@ import java.net.URL; import java.util.Iterator; import java.util.Map; -import com.vaadin.Application; import com.vaadin.LegacyApplication; import com.vaadin.server.ExternalResource; import com.vaadin.server.RequestHandler; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.server.WrappedResponse; import com.vaadin.ui.Label; @@ -57,7 +57,7 @@ public class Parameters extends com.vaadin.LegacyApplication setMainWindow(main); // This class acts both as URI handler and parameter handler - Application.getCurrent().addRequestHandler(this); + VaadinSession.getCurrent().addRequestHandler(this); final VerticalLayout layout = new VerticalLayout(); final Label info = new Label("To test URI and Parameter Handlers, " @@ -107,7 +107,7 @@ public class Parameters extends com.vaadin.LegacyApplication } @Override - public boolean handleRequest(Application application, + public boolean handleRequest(VaadinSession application, WrappedRequest request, WrappedResponse response) throws IOException { context.setValue("Context not available"); diff --git a/uitest/src/com/vaadin/tests/TestBench.java b/uitest/src/com/vaadin/tests/TestBench.java index d5b603db39..098ce4af29 100644 --- a/uitest/src/com/vaadin/tests/TestBench.java +++ b/uitest/src/com/vaadin/tests/TestBench.java @@ -312,7 +312,7 @@ public class TestBench extends com.vaadin.LegacyApplication final Class c = Class.forName(p); if (c.getSuperclass() != null) { if ((c.getSuperclass() - .equals(com.vaadin.Application.class))) { + .equals(com.vaadin.server.VaadinSession.class))) { classes.add(c); } else if ((c.getSuperclass() .equals(com.vaadin.ui.CustomComponent.class))) { diff --git a/uitest/src/com/vaadin/tests/TreeFilesystem.java b/uitest/src/com/vaadin/tests/TreeFilesystem.java index 096952c74c..3d1705381e 100644 --- a/uitest/src/com/vaadin/tests/TreeFilesystem.java +++ b/uitest/src/com/vaadin/tests/TreeFilesystem.java @@ -18,9 +18,9 @@ package com.vaadin.tests; import java.io.File; -import com.vaadin.Application; import com.vaadin.LegacyApplication; import com.vaadin.data.Item; +import com.vaadin.server.VaadinSession; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.util.SampleDirectory; import com.vaadin.ui.Label; @@ -64,7 +64,7 @@ public class TreeFilesystem extends com.vaadin.LegacyApplication // Get sample directory final File sampleDir = SampleDirectory.getDirectory( - Application.getCurrent(), main); + VaadinSession.getCurrent(), main); // populate tree's root node with example directory if (sampleDir != null) { populateNode(sampleDir.getAbsolutePath(), null); diff --git a/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java b/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java index baf73b4383..b61a7a53a5 100644 --- a/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java +++ b/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java @@ -18,10 +18,10 @@ package com.vaadin.tests; import java.io.File; -import com.vaadin.Application; import com.vaadin.LegacyApplication; import com.vaadin.data.util.FilesystemContainer; import com.vaadin.data.util.FilesystemContainer.FileItem; +import com.vaadin.server.VaadinSession; import com.vaadin.tests.util.SampleDirectory; import com.vaadin.ui.Component.Event; import com.vaadin.ui.Component.Listener; @@ -80,7 +80,7 @@ public class TreeFilesystemContainer extends // Get sample directory final File sampleDir = SampleDirectory.getDirectory( - Application.getCurrent(), w); + VaadinSession.getCurrent(), w); // Populate tree with FilesystemContainer final FilesystemContainer fsc = new FilesystemContainer(sampleDir, true); filesystem.setContainerDataSource(fsc); diff --git a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java index 1eda9e54fe..3adb284f1b 100644 --- a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java +++ b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java @@ -1,8 +1,8 @@ package com.vaadin.tests.application; -import com.vaadin.Application; import com.vaadin.server.DownloadStream; import com.vaadin.server.PaintException; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.tests.components.AbstractTestCase; import com.vaadin.tests.integration.FlagSeResource; @@ -14,7 +14,7 @@ import com.vaadin.ui.UI; import com.vaadin.ui.UI.LegacyWindow; public class ThreadLocalInstances extends AbstractTestCase { - private static final Application staticInitApplication = Application + private static final VaadinSession staticInitApplication = VaadinSession .getCurrent(); private static final UI staticInitRoot = UI.getCurrent(); @@ -87,10 +87,10 @@ public class ThreadLocalInstances extends AbstractTestCase { } private void reportCurrentStatus(String phase) { - reportStatus(phase, Application.getCurrent(), UI.getCurrent()); + reportStatus(phase, VaadinSession.getCurrent(), UI.getCurrent()); } - private void reportStatus(String phase, Application application, UI uI) { + private void reportStatus(String phase, VaadinSession application, UI uI) { log.log(getState(application, this) + " app in " + phase); log.log(getState(uI, mainWindow) + " root in " + phase); } diff --git a/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java b/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java index 96ebe1345f..72e0a215a7 100644 --- a/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java +++ b/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java @@ -1,6 +1,6 @@ package com.vaadin.tests.applicationcontext; -import com.vaadin.server.ServletApplicationContext; +import com.vaadin.server.VaadinServletSession; import com.vaadin.tests.components.AbstractTestCase; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; @@ -32,7 +32,7 @@ public class ChangeSessionId extends AbstractTestCase { loginButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { - ServletApplicationContext context = ((ServletApplicationContext) getContext()); + VaadinServletSession context = ((VaadinServletSession) getContext()); String oldSessionId = context.getHttpSession().getId(); context.reinitializeSession(); @@ -55,7 +55,7 @@ public class ChangeSessionId extends AbstractTestCase { } protected String getSessionId() { - return ((ServletApplicationContext) getContext()).getHttpSession().getId(); + return ((VaadinServletSession) getContext()).getHttpSession().getId(); } @Override diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestCase.java b/uitest/src/com/vaadin/tests/components/AbstractTestCase.java index 5dc5fd7128..356b130433 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestCase.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestCase.java @@ -1,7 +1,7 @@ package com.vaadin.tests.components; -import com.vaadin.Application; import com.vaadin.LegacyApplication; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WebBrowser; public abstract class AbstractTestCase extends LegacyApplication { @@ -11,7 +11,7 @@ public abstract class AbstractTestCase extends LegacyApplication { protected abstract Integer getTicketNumber(); protected WebBrowser getBrowser() { - WebBrowser webBrowser = Application.getCurrent().getBrowser(); + WebBrowser webBrowser = VaadinSession.getCurrent().getBrowser(); return webBrowser; } diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java b/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java index 4311cd6a0f..db388405a8 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java @@ -1,7 +1,7 @@ package com.vaadin.tests.components; -import com.vaadin.Application; import com.vaadin.server.AbstractUIProvider; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WebBrowser; public abstract class AbstractTestUIProvider extends AbstractUIProvider { @@ -10,7 +10,7 @@ public abstract class AbstractTestUIProvider extends AbstractUIProvider { protected abstract Integer getTicketNumber(); protected WebBrowser getBrowser() { - WebBrowser webBrowser = Application.getCurrent().getBrowser(); + WebBrowser webBrowser = VaadinSession.getCurrent().getBrowser(); return webBrowser; } } diff --git a/uitest/src/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java b/uitest/src/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java index 327ed0f86b..2eef498aff 100644 --- a/uitest/src/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java +++ b/uitest/src/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java @@ -4,11 +4,11 @@ import java.util.HashSet; import java.util.Locale; import java.util.Set; -import com.vaadin.Application; import com.vaadin.data.Container; import com.vaadin.data.Item; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.server.VaadinSession; import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.Log; import com.vaadin.ui.AbstractField; @@ -55,7 +55,7 @@ public abstract class AbstractComponentDataBindingTest extends TestBase } protected void updateLocale(Locale locale) { - Application.getCurrent().setLocale(locale); + VaadinSession.getCurrent().setLocale(locale); for (Component c : fields) { removeComponent(c); } diff --git a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java index b141dc0990..a3ca2420f7 100644 --- a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java +++ b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java @@ -1,7 +1,7 @@ package com.vaadin.tests.components.ui; -import com.vaadin.Application; import com.vaadin.server.ExternalResource; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.components.AbstractTestUIProvider; @@ -20,13 +20,13 @@ public class LazyInitUIs extends AbstractTestUIProvider { } @Override - public UI createInstance(Application application, Class type, + public UI createInstance(VaadinSession application, Class type, WrappedRequest request) { return getUI(request); } @Override - public Class getUIClass(Application application, + public Class getUIClass(VaadinSession application, WrappedRequest request) { return getUI(request).getClass(); } @@ -52,13 +52,13 @@ public class LazyInitUIs extends AbstractTestUIProvider { addComponent(getRequestInfo("NormalUI", request)); Link lazyCreateLink = new Link("Open lazyCreate UI", - new ExternalResource(Application.getCurrent() + new ExternalResource(VaadinSession.getCurrent() .getURL() + "?lazyCreate#lazyCreate")); lazyCreateLink.setTargetName("_blank"); addComponent(lazyCreateLink); Link lazyInitLink = new Link("Open eagerInit UI", - new ExternalResource(Application.getCurrent() + new ExternalResource(VaadinSession.getCurrent() .getURL() + "?eagerInit#eagerInit")); lazyInitLink.setTargetName("_blank"); addComponent(lazyInitLink); diff --git a/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java b/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java index 9a66e9ad0a..19c85a729d 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java +++ b/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java @@ -3,7 +3,7 @@ package com.vaadin.tests.components.ui; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; -import com.vaadin.Application; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.tests.components.AbstractTestUIProvider; import com.vaadin.ui.Label; @@ -11,12 +11,12 @@ import com.vaadin.ui.UI; public class UIsInMultipleTabs extends AbstractTestUIProvider { // No cleanup -> will leak, but shouldn't matter for tests - private static ConcurrentHashMap numberOfUIsOpened = new ConcurrentHashMap(); + private static ConcurrentHashMap numberOfUIsOpened = new ConcurrentHashMap(); public static class TabUI extends UI { @Override protected void init(WrappedRequest request) { - Application application = Application.getCurrent(); + VaadinSession application = VaadinSession.getCurrent(); AtomicInteger count = numberOfUIsOpened.get(application); if (count == null) { numberOfUIsOpened.putIfAbsent(application, new AtomicInteger()); @@ -32,7 +32,7 @@ public class UIsInMultipleTabs extends AbstractTestUIProvider { } @Override - public Class getUIClass(Application application, + public Class getUIClass(VaadinSession application, WrappedRequest request) { return TabUI.class; } diff --git a/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java b/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java index a296d912bc..f3c7f009c8 100644 --- a/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java +++ b/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java @@ -21,8 +21,8 @@ import javax.portlet.WindowState; import com.vaadin.LegacyApplication; import com.vaadin.annotations.StyleSheet; import com.vaadin.server.ExternalResource; -import com.vaadin.server.PortletApplicationContext2; -import com.vaadin.server.PortletApplicationContext2.PortletListener; +import com.vaadin.server.VaadinPortletSession; +import com.vaadin.server.VaadinPortletSession.PortletListener; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Embedded; import com.vaadin.ui.Label; @@ -87,8 +87,8 @@ public class JSR286PortletApplication extends LegacyApplication { }); main.addComponent(upload); - if (getContext() instanceof PortletApplicationContext2) { - PortletApplicationContext2 ctx = (PortletApplicationContext2) getContext(); + if (getContext() instanceof VaadinPortletSession) { + VaadinPortletSession ctx = (VaadinPortletSession) getContext(); ctx.addPortletListener(new DemoPortletListener()); } else { getMainWindow().showNotification("Not inited via Portal!", diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java index 05da2506e8..f9309d87b2 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java @@ -16,8 +16,8 @@ package com.vaadin.tests.minitutorials.v7a1; -import com.vaadin.Application; import com.vaadin.server.AbstractUIProvider; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WebBrowser; import com.vaadin.server.WrappedRequest; import com.vaadin.ui.Label; @@ -34,7 +34,7 @@ import com.vaadin.ui.UI; public class DifferentFeaturesForDifferentClients extends AbstractUIProvider { @Override - public Class getUIClass(Application application, + public Class getUIClass(VaadinSession application, WrappedRequest request) { // could also use browser version etc. if (request.getHeader("user-agent").contains("mobile")) { @@ -47,7 +47,7 @@ public class DifferentFeaturesForDifferentClients extends AbstractUIProvider { // Must override as default implementation isn't allowed to // instantiate our non-public classes @Override - public UI createInstance(Application application, Class type, + public UI createInstance(VaadinSession application, Class type, WrappedRequest request) { try { return type.newInstance(); diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/DynamicImageUI.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/DynamicImageUI.java index 4fd9c1187b..d78cdd9ad5 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/DynamicImageUI.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/DynamicImageUI.java @@ -7,9 +7,9 @@ import java.net.URL; import javax.imageio.ImageIO; -import com.vaadin.Application; import com.vaadin.server.ExternalResource; import com.vaadin.server.RequestHandler; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.server.WrappedResponse; import com.vaadin.tests.components.AbstractTestUI; @@ -56,7 +56,7 @@ class DynamicImageRequestHandler implements RequestHandler { public static final String IMAGE_URL = "myimage.png"; @Override - public boolean handleRequest(Application application, + public boolean handleRequest(VaadinSession application, WrappedRequest request, WrappedResponse response) throws IOException { String pathInfo = request.getRequestPathInfo(); diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/FindCurrentUI.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/FindCurrentUI.java index e0f53935c7..147ea2a919 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/FindCurrentUI.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/FindCurrentUI.java @@ -16,7 +16,7 @@ package com.vaadin.tests.minitutorials.v7a1; -import com.vaadin.Application; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -41,7 +41,7 @@ public class FindCurrentUI extends UI { @Override public void buttonClick(ClickEvent event) { String msg = "Running in "; - msg += Application.getCurrent().isProductionMode() ? "production" + msg += VaadinSession.getCurrent().isProductionMode() ? "production" : "debug"; Notification.show(msg); } diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1589.java b/uitest/src/com/vaadin/tests/tickets/Ticket1589.java index 580aa3f7a6..4e90ae0e9e 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1589.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1589.java @@ -10,11 +10,11 @@ import java.util.Date; import javax.imageio.ImageIO; -import com.vaadin.Application; import com.vaadin.LegacyApplication; import com.vaadin.server.DownloadStream; import com.vaadin.server.ExternalResource; import com.vaadin.server.RequestHandler; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.server.WrappedResponse; import com.vaadin.ui.Link; @@ -29,7 +29,7 @@ public class Ticket1589 extends LegacyApplication { MyDynamicResource res = new MyDynamicResource(); - Application.getCurrent().addRequestHandler(res); + VaadinSession.getCurrent().addRequestHandler(res); w.addComponent(new Link( "Test (without Content-Disposition, should suggest generatedFile.png when saving, browser default for actual disposition)", @@ -52,7 +52,7 @@ class MyDynamicResource implements RequestHandler { * stream that contains the response from the server. */ @Override - public boolean handleRequest(Application application, + public boolean handleRequest(VaadinSession application, WrappedRequest request, WrappedResponse response) throws IOException { String relativeUri = request.getRequestPathInfo(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1921.java b/uitest/src/com/vaadin/tests/tickets/Ticket1921.java index 165f4a8d0d..6f525a1bfc 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1921.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1921.java @@ -3,9 +3,9 @@ package com.vaadin.tests.tickets; import java.io.IOException; import java.util.Map; -import com.vaadin.Application; import com.vaadin.LegacyApplication; import com.vaadin.server.RequestHandler; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.server.WrappedResponse; import com.vaadin.ui.Button; @@ -43,7 +43,7 @@ public class Ticket1921 extends LegacyApplication implements newState(); - Application.getCurrent().addRequestHandler(this); + VaadinSession.getCurrent().addRequestHandler(this); } public void newState() { @@ -95,7 +95,7 @@ public class Ticket1921 extends LegacyApplication implements } @Override - public boolean handleRequest(Application application, + public boolean handleRequest(VaadinSession application, WrappedRequest request, WrappedResponse response) throws IOException { Map parameters = request.getParameterMap(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2292.java b/uitest/src/com/vaadin/tests/tickets/Ticket2292.java index 34f24276e5..0f663d78f5 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2292.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2292.java @@ -9,11 +9,11 @@ import java.io.IOException; import javax.imageio.ImageIO; -import com.vaadin.Application; import com.vaadin.LegacyApplication; import com.vaadin.server.DownloadStream; import com.vaadin.server.ExternalResource; import com.vaadin.server.RequestHandler; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.server.WrappedResponse; import com.vaadin.ui.Button; @@ -45,11 +45,11 @@ public class Ticket2292 extends com.vaadin.LegacyApplication Link l = new Link("l", icon); main.addComponent(l); - Application.getCurrent().addRequestHandler(this); + VaadinSession.getCurrent().addRequestHandler(this); } @Override - public boolean handleRequest(Application application, + public boolean handleRequest(VaadinSession application, WrappedRequest request, WrappedResponse response) throws IOException { String relativeUri = request.getRequestPathInfo(); diff --git a/uitest/src/com/vaadin/tests/util/SampleDirectory.java b/uitest/src/com/vaadin/tests/util/SampleDirectory.java index 7304f1cab8..be98de67cc 100644 --- a/uitest/src/com/vaadin/tests/util/SampleDirectory.java +++ b/uitest/src/com/vaadin/tests/util/SampleDirectory.java @@ -18,8 +18,8 @@ package com.vaadin.tests.util; import java.io.File; -import com.vaadin.Application; import com.vaadin.server.SystemError; +import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Label; @@ -43,7 +43,7 @@ public class SampleDirectory { * @param application * @return file pointing to sample directory */ - public static File getDirectory(Application application, UI uI) { + public static File getDirectory(VaadinSession application, UI uI) { String errorMessage = "Access to application " + "context base directory failed, " + "possible security constraint with Application " -- cgit v1.2.3 From cc3ddcac953a087b09ae330ff37126dcd5ec727f Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 5 Sep 2012 19:30:41 +0300 Subject: Remove getApplication() and add getSession() (#9402) --- server/src/com/vaadin/LegacyApplication.java | 8 ++-- .../vaadin/event/dd/acceptcriteria/SourceIs.java | 2 +- .../com/vaadin/server/AbstractClientConnector.java | 14 +++--- .../server/AbstractCommunicationManager.java | 14 +++--- .../com/vaadin/server/CommunicationManager.java | 2 +- .../vaadin/server/ConnectorResourceHandler.java | 2 +- server/src/com/vaadin/server/JsonPaintTarget.java | 2 +- server/src/com/vaadin/server/Page.java | 2 +- .../vaadin/server/PortletCommunicationManager.java | 2 +- .../src/com/vaadin/server/ResourceReference.java | 2 +- server/src/com/vaadin/server/VaadinSession.java | 4 +- server/src/com/vaadin/ui/AbstractComponent.java | 29 +----------- server/src/com/vaadin/ui/AbstractField.java | 2 +- server/src/com/vaadin/ui/Component.java | 25 +--------- server/src/com/vaadin/ui/ConnectorTracker.java | 2 +- server/src/com/vaadin/ui/Label.java | 2 +- server/src/com/vaadin/ui/LoginForm.java | 6 +-- server/src/com/vaadin/ui/Table.java | 2 +- server/src/com/vaadin/ui/UI.java | 53 +++++++++++++++------- .../tests/data/converter/ConverterFactory.java | 4 +- .../tests/server/TestStreamVariableMapping.java | 2 +- .../AbstractFieldValueConversions.java | 2 +- .../abstractfield/RemoveListenersOnDetach.java | 4 +- .../component/window/AttachDetachWindow.java | 47 ++++++++++++------- .../com/vaadin/tests/StressComponentsInTable.java | 2 +- uitest/src/com/vaadin/tests/TestForUpload.java | 2 +- .../tests/application/ApplicationCloseTest.java | 2 +- .../vaadin/tests/components/AbstractTestUI.java | 2 +- .../components/table/TableFirstRowFlicker.java | 4 +- .../textfield/SelectionAndCursorPosition.java | 3 +- .../ComplexGLColumnExpansionWithColSpan.java | 2 +- .../v7a1/CustomConverterFactoryUI.java | 2 +- .../tests/minitutorials/v7a1/DynamicImageUI.java | 4 +- 33 files changed, 122 insertions(+), 135 deletions(-) (limited to 'uitest/src') diff --git a/server/src/com/vaadin/LegacyApplication.java b/server/src/com/vaadin/LegacyApplication.java index 9f02a2d588..66b2ca3973 100644 --- a/server/src/com/vaadin/LegacyApplication.java +++ b/server/src/com/vaadin/LegacyApplication.java @@ -68,9 +68,9 @@ public abstract class LegacyApplication extends AbstractUIProvider implements if (this.mainWindow != null) { throw new IllegalStateException("mainWindow has already been set"); } - if (mainWindow.getApplication() == null) { - mainWindow.setApplication(VaadinSession.getCurrent()); - } else if (mainWindow.getApplication() != VaadinSession.getCurrent()) { + if (mainWindow.getSession() == null) { + mainWindow.setSession(VaadinSession.getCurrent()); + } else if (mainWindow.getSession() != VaadinSession.getCurrent()) { throw new IllegalStateException( "mainWindow is attached to another application"); } @@ -242,7 +242,7 @@ public abstract class LegacyApplication extends AbstractUIProvider implements } legacyUINames.put(uI.getName(), uI); - uI.setApplication(VaadinSession.getCurrent()); + uI.setSession(VaadinSession.getCurrent()); } /** diff --git a/server/src/com/vaadin/event/dd/acceptcriteria/SourceIs.java b/server/src/com/vaadin/event/dd/acceptcriteria/SourceIs.java index 6258aed423..dee807c610 100644 --- a/server/src/com/vaadin/event/dd/acceptcriteria/SourceIs.java +++ b/server/src/com/vaadin/event/dd/acceptcriteria/SourceIs.java @@ -48,7 +48,7 @@ public class SourceIs extends ClientSideCriterion { int paintedComponents = 0; for (int i = 0; i < components.length; i++) { Component c = components[i]; - if (c.getApplication() != null) { + if (c.getUI() != null && c.getUI().getSession() != null) { target.addAttribute("component" + paintedComponents++, c); } else { Logger.getLogger(SourceIs.class.getName()) diff --git a/server/src/com/vaadin/server/AbstractClientConnector.java b/server/src/com/vaadin/server/AbstractClientConnector.java index 82a154d4e5..f8fbbeeb4c 100644 --- a/server/src/com/vaadin/server/AbstractClientConnector.java +++ b/server/src/com/vaadin/server/AbstractClientConnector.java @@ -342,11 +342,11 @@ public abstract class AbstractClientConnector implements ClientConnector { @Override public String getConnectorId() { if (connectorId == null) { - if (getApplication() == null) { + if (getSession() == null) { throw new RuntimeException( "Component must be attached to an application when getConnectorId() is called for the first time"); } - connectorId = getApplication().createConnectorId(this); + connectorId = getSession().createConnectorId(this); } return connectorId; } @@ -357,12 +357,12 @@ public abstract class AbstractClientConnector implements ClientConnector { * * @return The connector's application, or null if not attached */ - protected VaadinSession getApplication() { + protected VaadinSession getSession() { UI uI = getUI(); if (uI == null) { return null; } else { - return uI.getApplication(); + return uI.getSession(); } } @@ -501,7 +501,7 @@ public abstract class AbstractClientConnector implements ClientConnector { } // Send detach event if the component have been connected to a window - if (getApplication() != null) { + if (getSession() != null) { detach(); } @@ -509,7 +509,7 @@ public abstract class AbstractClientConnector implements ClientConnector { this.parent = parent; // Send attach event if connected to an application - if (getApplication() != null) { + if (getSession() != null) { attach(); } } @@ -535,7 +535,7 @@ public abstract class AbstractClientConnector implements ClientConnector { * {@inheritDoc} * *

    - * The {@link #getApplication()} and {@link #getUI()} methods might return + * The {@link #getSession()} and {@link #getUI()} methods might return * null after this method is called. *

    */ diff --git a/server/src/com/vaadin/server/AbstractCommunicationManager.java b/server/src/com/vaadin/server/AbstractCommunicationManager.java index 71f5a07d77..4f408d6fe9 100644 --- a/server/src/com/vaadin/server/AbstractCommunicationManager.java +++ b/server/src/com/vaadin/server/AbstractCommunicationManager.java @@ -676,7 +676,7 @@ public abstract class AbstractCommunicationManager implements Serializable { } sb.append("\nComponent hierarchy:\n"); - VaadinSession application2 = component.getApplication(); + VaadinSession application2 = component.getUI().getSession(); sb.append(application2.getClass().getName()); sb.append("."); sb.append(application2.getClass().getSimpleName()); @@ -789,7 +789,7 @@ public abstract class AbstractCommunicationManager implements Serializable { final PrintWriter outWriter, UI ui, boolean analyzeLayouts) throws PaintException, JSONException { ArrayList dirtyVisibleConnectors = new ArrayList(); - VaadinSession application = ui.getApplication(); + VaadinSession application = ui.getSession(); // Paints components ConnectorTracker uiConnectorTracker = ui.getConnectorTracker(); getLogger().log(Level.FINE, "* Creating response to client"); @@ -1697,7 +1697,7 @@ public abstract class AbstractCommunicationManager implements Serializable { if (connector instanceof Component) { errorComponent = (Component) connector; } - handleChangeVariablesError(uI.getApplication(), + handleChangeVariablesError(uI.getSession(), errorComponent, realException, null); } } else { @@ -1729,7 +1729,7 @@ public abstract class AbstractCommunicationManager implements Serializable { errorComponent = (Component) dropHandlerOwner; } } - handleChangeVariablesError(uI.getApplication(), + handleChangeVariablesError(uI.getSession(), errorComponent, e, changes); } } @@ -2154,8 +2154,8 @@ public abstract class AbstractCommunicationManager implements Serializable { * Ends the Application. * * The browser is redirected to the Application logout URL set with - * {@link VaadinSession#setLogoutURL(String)}, or to the application URL if no - * logout URL is given. + * {@link VaadinSession#setLogoutURL(String)}, or to the application URL if + * no logout URL is given. * * @param request * the request instance. @@ -2450,7 +2450,7 @@ public abstract class AbstractCommunicationManager implements Serializable { StringWriter sWriter = new StringWriter(); PrintWriter pWriter = new PrintWriter(sWriter); pWriter.print("{"); - if (isXSRFEnabled(uI.getApplication())) { + if (isXSRFEnabled(uI.getSession())) { pWriter.print(getSecurityKeyUIDL(request)); } writeUidlResponse(request, true, pWriter, uI, false); diff --git a/server/src/com/vaadin/server/CommunicationManager.java b/server/src/com/vaadin/server/CommunicationManager.java index 3cc8831901..32c4d2c217 100644 --- a/server/src/com/vaadin/server/CommunicationManager.java +++ b/server/src/com/vaadin/server/CommunicationManager.java @@ -112,7 +112,7 @@ public class CommunicationManager extends AbstractCommunicationManager { protected InputStream getThemeResourceAsStream(UI uI, String themeName, String resource) { VaadinServletSession context = (VaadinServletSession) uI - .getApplication(); + .getSession(); ServletContext servletContext = context.getHttpSession() .getServletContext(); return servletContext.getResourceAsStream("/" diff --git a/server/src/com/vaadin/server/ConnectorResourceHandler.java b/server/src/com/vaadin/server/ConnectorResourceHandler.java index 80d3a60a1a..6702fb140f 100644 --- a/server/src/com/vaadin/server/ConnectorResourceHandler.java +++ b/server/src/com/vaadin/server/ConnectorResourceHandler.java @@ -44,7 +44,7 @@ public class ConnectorResourceHandler implements RequestHandler { } UI.setCurrent(ui); - VaadinSession.setCurrent(ui.getApplication()); + VaadinSession.setCurrent(ui.getSession()); ClientConnector connector = ui.getConnectorTracker().getConnector( cid); diff --git a/server/src/com/vaadin/server/JsonPaintTarget.java b/server/src/com/vaadin/server/JsonPaintTarget.java index b193c47528..d2f90c33b6 100644 --- a/server/src/com/vaadin/server/JsonPaintTarget.java +++ b/server/src/com/vaadin/server/JsonPaintTarget.java @@ -345,7 +345,7 @@ public class JsonPaintTarget implements PaintTarget { throw new NullPointerException(); } ClientConnector ownerConnector = openPaintables.peek(); - ownerConnector.getUI().getApplication().getGlobalResourceHandler(true) + ownerConnector.getUI().getSession().getGlobalResourceHandler(true) .register(value, ownerConnector); ResourceReference reference = ResourceReference.create(value, diff --git a/server/src/com/vaadin/server/Page.java b/server/src/com/vaadin/server/Page.java index a1c181dcb9..9a0948edc8 100644 --- a/server/src/com/vaadin/server/Page.java +++ b/server/src/com/vaadin/server/Page.java @@ -391,7 +391,7 @@ public class Page implements Serializable { } public WebBrowser getWebBrowser() { - return uI.getApplication().getBrowser(); + return uI.getSession().getBrowser(); } public void setBrowserWindowSize(int width, int height) { diff --git a/server/src/com/vaadin/server/PortletCommunicationManager.java b/server/src/com/vaadin/server/PortletCommunicationManager.java index 6eccfa6084..1a2b892a32 100644 --- a/server/src/com/vaadin/server/PortletCommunicationManager.java +++ b/server/src/com/vaadin/server/PortletCommunicationManager.java @@ -157,7 +157,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { protected InputStream getThemeResourceAsStream(UI uI, String themeName, String resource) { VaadinPortletSession context = (VaadinPortletSession) uI - .getApplication(); + .getSession(); PortletContext portletContext = context.getPortletSession() .getPortletContext(); return portletContext.getResourceAsStream("/" diff --git a/server/src/com/vaadin/server/ResourceReference.java b/server/src/com/vaadin/server/ResourceReference.java index 098fb6c3e4..815cbee275 100644 --- a/server/src/com/vaadin/server/ResourceReference.java +++ b/server/src/com/vaadin/server/ResourceReference.java @@ -71,7 +71,7 @@ public class ResourceReference extends URLReference { ConnectorResource connectorResource = (ConnectorResource) resource; GlobalResourceHandler globalResourceHandler = connector.getUI() - .getApplication().getGlobalResourceHandler(false); + .getSession().getGlobalResourceHandler(false); if (globalResourceHandler != null) { String uri = globalResourceHandler.getUri(connector, connectorResource); diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java index 10532559f0..440fc02ee6 100644 --- a/server/src/com/vaadin/server/VaadinSession.java +++ b/server/src/com/vaadin/server/VaadinSession.java @@ -1706,8 +1706,8 @@ public class VaadinSession implements Terminal.ErrorListener, UI ui = createUIInstance(request, uiClass); // Initialize some fields for a newly created UI - if (ui.getApplication() == null) { - ui.setApplication(this); + if (ui.getSession() == null) { + ui.setSession(this); } // Get the next id Integer uiId = Integer.valueOf(nextUIId++); diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index e6cc80f1cf..85938c4fe3 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -259,7 +259,7 @@ public abstract class AbstractComponent extends AbstractClientConnector if (parent != null) { return parent.getLocale(); } - final VaadinSession app = getApplication(); + final VaadinSession app = getSession(); if (app != null) { return app.getLocale(); } @@ -616,7 +616,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ protected void focus() { if (this instanceof Focusable) { - final VaadinSession app = getApplication(); + final VaadinSession app = getSession(); if (app != null) { getUI().setFocusedComponent((Focusable) this); delayedFocus = false; @@ -626,31 +626,6 @@ public abstract class AbstractComponent extends AbstractClientConnector } } - /** - * Gets the application object to which the component is attached. - * - *

    - * The method will return {@code null} if the component is not currently - * attached to an application. This is often a problem in constructors of - * regular components and in the initializers of custom composite - * components. A standard workaround is to move the problematic - * initialization to {@link #attach()}, as described in the documentation of - * the method. - *

    - *

    - * This method is not meant to be overridden. Due to CDI requirements we - * cannot declare it as final even though it should be final. - *

    - * - * @return the parent application of the component or null. - * @see #attach() - */ - @Override - public VaadinSession getApplication() { - // Just make method inherited from Component interface public - return super.getApplication(); - } - /** * Build CSS compatible string representation of height. * diff --git a/server/src/com/vaadin/ui/AbstractField.java b/server/src/com/vaadin/ui/AbstractField.java index 548cb06c8f..f673babc26 100644 --- a/server/src/com/vaadin/ui/AbstractField.java +++ b/server/src/com/vaadin/ui/AbstractField.java @@ -697,7 +697,7 @@ public abstract class AbstractField extends AbstractComponent implements */ public void setConverter(Class datamodelType) { Converter c = (Converter) ConverterUtil.getConverter( - getType(), datamodelType, getApplication()); + getType(), datamodelType, getSession()); setConverter(c); } diff --git a/server/src/com/vaadin/ui/Component.java b/server/src/com/vaadin/ui/Component.java index 812edbb8d2..492e0c25c6 100644 --- a/server/src/com/vaadin/ui/Component.java +++ b/server/src/com/vaadin/ui/Component.java @@ -26,7 +26,6 @@ import com.vaadin.server.ClientConnector; import com.vaadin.server.ErrorMessage; import com.vaadin.server.Resource; import com.vaadin.server.Sizeable; -import com.vaadin.server.VaadinSession; import com.vaadin.server.VariableOwner; /** @@ -521,35 +520,13 @@ public interface Component extends ClientConnector, Sizeable, Serializable { @Override public UI getUI(); - /** - * Gets the application object to which the component is attached. - * - *

    - * The method will return {@code null} if the component is not currently - * attached to an application. - *

    - * - *

    - * Getting a null value is often a problem in constructors of regular - * components and in the initializers of custom composite components. A - * standard workaround is to use {@link VaadinSession#getCurrent()} to - * retrieve the application instance that the current request relates to. - * Another way is to move the problematic initialization to - * {@link #attach()}, as described in the documentation of the method. - *

    - * - * @return the parent application of the component or null. - * @see #attach() - */ - public VaadinSession getApplication(); - /** * {@inheritDoc} * *

    * Reimplementing the {@code attach()} method is useful for tasks that need * to get a reference to the parent, window, or application object with the - * {@link #getParent()}, {@link #getUI()}, and {@link #getApplication()} + * {@link #getParent()}, {@link #getUI()}, and {@link #getSession()} * methods. A component does not yet know these objects in the constructor, * so in such case, the methods will return {@code null}. For example, the * following is invalid: diff --git a/server/src/com/vaadin/ui/ConnectorTracker.java b/server/src/com/vaadin/ui/ConnectorTracker.java index c84b75ca51..d454df98ee 100644 --- a/server/src/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/com/vaadin/ui/ConnectorTracker.java @@ -152,7 +152,7 @@ public class ConnectorTracker implements Serializable { } private void removeFromGlobalResourceHandler(ClientConnector connector) { - GlobalResourceHandler globalResourceHandler = uI.getApplication() + GlobalResourceHandler globalResourceHandler = uI.getSession() .getGlobalResourceHandler(false); // Nothing to do if there is no handler if (globalResourceHandler != null) { diff --git a/server/src/com/vaadin/ui/Label.java b/server/src/com/vaadin/ui/Label.java index ff4a5dcb07..53b618a87f 100644 --- a/server/src/com/vaadin/ui/Label.java +++ b/server/src/com/vaadin/ui/Label.java @@ -254,7 +254,7 @@ public class Label extends AbstractComponent implements Property, newDataSource.getType())) { // Try to find a converter Converter c = ConverterUtil.getConverter(String.class, - newDataSource.getType(), getApplication()); + newDataSource.getType(), getSession()); setConverter(c); } dataSource = newDataSource; diff --git a/server/src/com/vaadin/ui/LoginForm.java b/server/src/com/vaadin/ui/LoginForm.java index 1d0c5c41b6..b57b271778 100644 --- a/server/src/com/vaadin/ui/LoginForm.java +++ b/server/src/com/vaadin/ui/LoginForm.java @@ -132,7 +132,7 @@ public class LoginForm extends CustomComponent { * @return byte array containing login page html */ protected byte[] getLoginHTML() { - String appUri = getApplication().getURL().toString(); + String appUri = getSession().getURL().toString(); try { return (" + * The method will return {@code null} if the component is not currently + * attached to an application. + *

    + * + *

    + * Getting a null value is often a problem in constructors of regular + * components and in the initializers of custom composite components. A + * standard workaround is to use {@link VaadinSession#getCurrent()} to + * retrieve the application instance that the current request relates to. + * Another way is to move the problematic initialization to + * {@link #attach()}, as described in the documentation of the method. + *

    + * + * @return the parent application of the component or null. + * @see #attach() + */ @Override - public VaadinSession getApplication() { - return application; + public VaadinSession getSession() { + return session; } @Override @@ -676,25 +695,25 @@ public abstract class UI extends AbstractComponentContainer implements * This method is mainly intended for internal use by the framework. *

    * - * @param application + * @param session * the application to set * * @throws IllegalStateException * if the application has already been set * - * @see #getApplication() + * @see #getSession() */ - public void setApplication(VaadinSession application) { - if ((application == null) == (this.application == null)) { + public void setSession(VaadinSession session) { + if ((session == null) == (this.session == null)) { throw new IllegalStateException("Application has already been set"); } else { - if (application == null) { + if (session == null) { detach(); } - this.application = application; + this.session = session; } - if (application != null) { + if (session != null) { attach(); } } @@ -703,8 +722,8 @@ public abstract class UI extends AbstractComponentContainer implements * Gets the id of the UI, used to identify this UI within its application * when processing requests. The UI id should be present in every request to * the server that originates from this UI. - * {@link VaadinSession#getUIForRequest(WrappedRequest)} uses this id to find - * the route to which the request belongs. + * {@link VaadinSession#getUIForRequest(WrappedRequest)} uses this id to + * find the route to which the request belongs. * * @return */ @@ -732,7 +751,7 @@ public abstract class UI extends AbstractComponentContainer implements throw new NullPointerException("Argument must not be null"); } - if (window.getApplication() != null) { + if (window.getUI() != null && window.getUI().getSession() != null) { throw new IllegalArgumentException( "Window is already attached to an application."); } @@ -937,7 +956,7 @@ public abstract class UI extends AbstractComponentContainer implements throw new IllegalStateException("UI id has already been defined"); } this.uiId = uiId; - theme = getApplication().getUiProvider(request, getClass()) + theme = getSession().getUiProvider(request, getClass()) .getThemeForUI(request, getClass()); getPage().init(request); diff --git a/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java b/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java index 66160907b2..b64514ea14 100644 --- a/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java +++ b/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java @@ -72,7 +72,7 @@ public class ConverterFactory extends TestCase { TextField tf = new TextField("", "123") { @Override - public VaadinSession getApplication() { + public VaadinSession getSession() { return appWithCustomIntegerConverter; }; }; @@ -103,7 +103,7 @@ public class ConverterFactory extends TestCase { TextField tf = new TextField("", "123") { @Override - public VaadinSession getApplication() { + public VaadinSession getSession() { return fieldAppWithCustomIntegerConverter; } }; diff --git a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java index e286e7231e..0dd7efa507 100644 --- a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java +++ b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java @@ -30,7 +30,7 @@ public class TestStreamVariableMapping extends TestCase { } @Override - public VaadinSession getApplication() { + public VaadinSession getSession() { return application; } }; diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java index d372b96339..b48ad62bcc 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java @@ -190,7 +190,7 @@ public class AbstractFieldValueConversions extends TestCase { VaadinSession.setCurrent(a); TextField tf = new TextField() { @Override - public VaadinSession getApplication() { + public VaadinSession getSession() { return a; } }; diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java index b498bbe73f..c9f579a887 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java @@ -29,7 +29,7 @@ public class RemoveListenersOnDetach { } @Override - public VaadinSession getApplication() { + public VaadinSession getSession() { return application; } @@ -59,7 +59,7 @@ public class RemoveListenersOnDetach { }; @Override - public VaadinSession getApplication() { + public VaadinSession getSession() { return application; }; }; diff --git a/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java b/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java index bab7ca2c8c..ec722fdffb 100644 --- a/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java +++ b/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java @@ -5,6 +5,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; +import com.vaadin.server.ClientConnector; import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; import com.vaadin.ui.Label; @@ -23,7 +24,7 @@ public class AttachDetachWindow { public TestContent getTestContent(); - public VaadinSession getApplication(); + public VaadinSession getSession(); } private class TestWindow extends Window implements TestContainer { @@ -61,6 +62,11 @@ public class AttachDetachWindow { public TestContent getTestContent() { return testContent; } + + @Override + public VaadinSession getSession() { + return super.getSession(); + } } private class TestContent extends VerticalLayout { @@ -155,7 +161,7 @@ public class AttachDetachWindow { assertUnattached(sub); // attaching main should recurse to sub - main.setApplication(testApp); + main.setSession(testApp); assertAttached(main); assertAttached(sub); } @@ -165,7 +171,7 @@ public class AttachDetachWindow { assertUnattached(main); assertUnattached(sub); - main.setApplication(testApp); + main.setSession(testApp); assertAttached(main); assertUnattached(sub); @@ -177,7 +183,7 @@ public class AttachDetachWindow { @Test public void removeSubWindowBeforeDetachingMainWindow() { - main.setApplication(testApp); + main.setSession(testApp); main.addWindow(sub); // sub should be detached when removing from attached main @@ -186,18 +192,18 @@ public class AttachDetachWindow { assertDetached(sub); // main detach should recurse to sub - main.setApplication(null); + main.setSession(null); assertDetached(main); assertDetached(sub); } @Test public void removeSubWindowAfterDetachingMainWindow() { - main.setApplication(testApp); + main.setSession(testApp); main.addWindow(sub); // main detach should recurse to sub - main.setApplication(null); + main.setSession(null); assertDetached(main); assertDetached(sub); @@ -219,22 +225,31 @@ public class AttachDetachWindow { assertTrue("window child attach not called", testContent.childAttachCalled); - assertSame("window not attached", win.getApplication(), testApp); - assertSame("window content not attached", testContent.getApplication(), - testApp); - assertSame("window children not attached", - testContent.child.getApplication(), testApp); + assertSame("window not attached", win.getSession(), testApp); + assertSame("window content not attached", testContent.getUI() + .getSession(), testApp); + assertSame("window children not attached", testContent.child.getUI() + .getSession(), testApp); } /** * Asserts that win and its children are not attached. */ private void assertUnattached(TestContainer win) { - assertSame("window not detached", win.getApplication(), null); - assertSame("window content not detached", win.getTestContent() - .getApplication(), null); + assertSame("window not detached", win.getSession(), null); + assertSame("window content not detached", + getVaadinSession(win.getTestContent()), null); assertSame("window children not detached", - win.getTestContent().child.getApplication(), null); + getVaadinSession(win.getTestContent().child), null); + } + + private VaadinSession getVaadinSession(ClientConnector testContainer) { + UI ui = testContainer.getUI(); + if (ui != null) { + return ui.getSession(); + } else { + return null; + } } /** diff --git a/uitest/src/com/vaadin/tests/StressComponentsInTable.java b/uitest/src/com/vaadin/tests/StressComponentsInTable.java index 7c4cca2b0b..fa0b98b1b1 100644 --- a/uitest/src/com/vaadin/tests/StressComponentsInTable.java +++ b/uitest/src/com/vaadin/tests/StressComponentsInTable.java @@ -54,7 +54,7 @@ public class StressComponentsInTable extends CustomComponent { Button b = event.getButton(); System.out.println(b.getCaption() + " click: " + (new Date()).toString()); - System.out.println(b.getApplication()); + System.out.println(b.getUI().getSession()); } })); diff --git a/uitest/src/com/vaadin/tests/TestForUpload.java b/uitest/src/com/vaadin/tests/TestForUpload.java index b0697d337d..7c2359a404 100644 --- a/uitest/src/com/vaadin/tests/TestForUpload.java +++ b/uitest/src/com/vaadin/tests/TestForUpload.java @@ -244,7 +244,7 @@ public class TestForUpload extends CustomComponent implements @Override public void buttonClick(ClickEvent event) { - getApplication().close(); + getSession().close(); } }); main.addComponent(restart); diff --git a/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java b/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java index 7250ba3cfb..8cfed569dc 100644 --- a/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java +++ b/uitest/src/com/vaadin/tests/application/ApplicationCloseTest.java @@ -26,7 +26,7 @@ public class ApplicationCloseTest extends TestBase { @Override public void buttonClick(ClickEvent event) { - event.getButton().getApplication().close(); + event.getButton().getUI().getSession().close(); } }); diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java index 92ac336df7..210cb2535e 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestUI.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestUI.java @@ -54,7 +54,7 @@ public abstract class AbstractTestUI extends UI { protected abstract Integer getTicketNumber(); protected WebBrowser getBrowser() { - return getApplication().getBrowser(); + return getSession().getBrowser(); } } diff --git a/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java b/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java index 30b878b7eb..5d36b8381b 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java +++ b/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java @@ -5,8 +5,8 @@ import com.vaadin.data.Container; import com.vaadin.data.util.IndexedContainer; import com.vaadin.ui.Label; import com.vaadin.ui.ProgressIndicator; -import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; +import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; public class TableFirstRowFlicker extends LegacyApplication { @@ -43,7 +43,7 @@ public class TableFirstRowFlicker extends LegacyApplication { @Override public void run() { while (t != null) { - synchronized (t.getApplication()) { + synchronized (t.getUI().getSession()) { int firstId = t.getCurrentPageFirstItemIndex(); Object selected = t.getValue(); t.setContainerDataSource(buildContainer()); diff --git a/uitest/src/com/vaadin/tests/components/textfield/SelectionAndCursorPosition.java b/uitest/src/com/vaadin/tests/components/textfield/SelectionAndCursorPosition.java index f6368f0c78..d63d7ddc66 100644 --- a/uitest/src/com/vaadin/tests/components/textfield/SelectionAndCursorPosition.java +++ b/uitest/src/com/vaadin/tests/components/textfield/SelectionAndCursorPosition.java @@ -30,7 +30,8 @@ public class SelectionAndCursorPosition extends TestBase { ml.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { - if (textField.getApplication() == null) { + if (textField.getUI() == null + || textField.getUI().getSession() == null) { replaceComponent(textArea, textField); activeComponent = textField; } else { diff --git a/uitest/src/com/vaadin/tests/layouts/ComplexGLColumnExpansionWithColSpan.java b/uitest/src/com/vaadin/tests/layouts/ComplexGLColumnExpansionWithColSpan.java index f4050ea085..b584cdb5cf 100644 --- a/uitest/src/com/vaadin/tests/layouts/ComplexGLColumnExpansionWithColSpan.java +++ b/uitest/src/com/vaadin/tests/layouts/ComplexGLColumnExpansionWithColSpan.java @@ -73,7 +73,7 @@ public class ComplexGLColumnExpansionWithColSpan extends AbstractTestCase { restart.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { - mainLayout.getUI().getApplication().close(); + mainLayout.getUI().getSession().close(); } }); diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/CustomConverterFactoryUI.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/CustomConverterFactoryUI.java index 2cbff64117..ff2263e208 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/CustomConverterFactoryUI.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/CustomConverterFactoryUI.java @@ -7,7 +7,7 @@ import com.vaadin.ui.TextField; public class CustomConverterFactoryUI extends AbstractTestUI { @Override public void setup(WrappedRequest request) { - getApplication().setConverterFactory(new MyConverterFactory()); + getSession().setConverterFactory(new MyConverterFactory()); TextField tf = new TextField("This is my double field"); tf.setImmediate(true); diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/DynamicImageUI.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/DynamicImageUI.java index d78cdd9ad5..632eda2491 100644 --- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/DynamicImageUI.java +++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/DynamicImageUI.java @@ -20,12 +20,12 @@ public class DynamicImageUI extends AbstractTestUI { @Override public void setup(WrappedRequest request) { // Add the request handler that handles our dynamic image - getApplication().addRequestHandler(new DynamicImageRequestHandler()); + getSession().addRequestHandler(new DynamicImageRequestHandler()); // Create a URL that we can handle in DynamicImageRequestHandler URL imageUrl; try { - imageUrl = new URL(getApplication().getURL(), + imageUrl = new URL(getSession().getURL(), DynamicImageRequestHandler.IMAGE_URL + "?text=Hello!"); } catch (MalformedURLException e) { // This should never happen -- cgit v1.2.3 From 4019f7d03a1d8437a24ccadc562c30f99da5efe0 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Wed, 5 Sep 2012 19:32:27 +0300 Subject: Rename LegacyApplication -> Application (#9402) --- server/src/com/vaadin/Application.java | 302 +++++++++++++++++++++ server/src/com/vaadin/LegacyApplication.java | 302 --------------------- .../src/com/vaadin/server/LegacyVaadinPortlet.java | 10 +- .../src/com/vaadin/server/LegacyVaadinServlet.java | 10 +- .../com/vaadin/server/ServletPortletHelper.java | 6 +- server/src/com/vaadin/ui/UI.java | 2 +- .../component/window/AddRemoveSubWindow.java | 4 +- .../vaadin/launcher/ApplicationRunnerServlet.java | 8 +- uitest/src/com/vaadin/tests/Components.java | 4 +- uitest/src/com/vaadin/tests/CustomLayoutDemo.java | 4 +- uitest/src/com/vaadin/tests/LayoutDemo.java | 4 +- uitest/src/com/vaadin/tests/ListenerOrder.java | 4 +- uitest/src/com/vaadin/tests/ModalWindow.java | 4 +- uitest/src/com/vaadin/tests/NativeWindowing.java | 4 +- uitest/src/com/vaadin/tests/Parameters.java | 4 +- .../src/com/vaadin/tests/RandomLayoutStress.java | 4 +- .../src/com/vaadin/tests/ScrollbarStressTest.java | 4 +- uitest/src/com/vaadin/tests/TestBench.java | 6 +- ...ApplicationLayoutThatUsesWholeBrosersSpace.java | 4 +- .../com/vaadin/tests/TestForNativeWindowing.java | 4 +- .../src/com/vaadin/tests/TestForStyledUpload.java | 4 +- .../com/vaadin/tests/TestSetVisibleAndCaching.java | 4 +- .../com/vaadin/tests/TestSizeableIncomponents.java | 4 +- uitest/src/com/vaadin/tests/TestSplitPanel.java | 4 +- uitest/src/com/vaadin/tests/TreeFilesystem.java | 4 +- .../com/vaadin/tests/TreeFilesystemContainer.java | 4 +- .../src/com/vaadin/tests/UsingObjectsInSelect.java | 4 +- .../com/vaadin/tests/appengine/GAESyncTest.java | 8 +- .../vaadin/tests/components/AbstractTestCase.java | 4 +- .../combobox/ComboBoxReapperingOldValue.java | 4 +- .../UndefinedWideFormWithRelativeWideFooter.java | 4 +- .../loginform/LoginFormWithMultipleWindows.java | 4 +- .../components/table/TableFirstRowFlicker.java | 4 +- .../textfield/TextFieldInLayoutInTable.java | 4 +- .../sqlcontainer/CheckboxUpdateProblem.java | 4 +- .../sqlcontainer/ComboBoxUpdateProblem.java | 4 +- .../sqlcontainer/MassInsertMemoryLeakTestApp.java | 4 +- .../integration/IntegrationTestApplication.java | 4 +- .../integration/JSR286PortletApplication.java | 4 +- .../vaadin/tests/integration/LiferayThemeDemo.java | 4 +- ...tletSizeInLiferayFreeformLayoutApplication.java | 4 +- .../tests/layouts/GridLayoutInsidePanel2.java | 4 +- .../layouts/layouttester/GridLayoutTests.java | 4 +- .../layouttester/HorizontalLayoutTests.java | 4 +- .../layouts/layouttester/VerticalLayoutTests.java | 4 +- .../src/com/vaadin/tests/themes/ButtonsTest.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1225.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1230.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket124.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1245.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1365.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1368.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1397.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1435.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1444.java | 4 +- .../tests/tickets/Ticket1465ModalNotification.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1519.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1572.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1581.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1589.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1598.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket161.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1632.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1659.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1663.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1673.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1710.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1737.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1767.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1772.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1775.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1804.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1805.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1806.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1811.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1819.java | 4 +- .../tests/tickets/Ticket1834PanelScrolling.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1857.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1868.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1869.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1878.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1900.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1904.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1916.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1919.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1921.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1923.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1925.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1939.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1940.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1953.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1966.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1966_2.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1966_3.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1969.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1970.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1972.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1973.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1973_2.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1975.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1982.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1983.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1986.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1991.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket1995.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket20.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2001.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2002.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2007.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2009.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2011.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2014.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2021.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2022.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2023.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2024.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2026.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2029.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2037.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2038.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2040.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2042.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2043.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2048.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2051.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2053.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2060.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2061.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2061b.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2061c.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2062.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2083.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2090.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2095.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2098.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2099.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2101.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2103.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2104.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2106.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2107.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2117.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2119.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2125.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2126.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2151.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2157.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2178.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2179.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2180.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2181.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2186.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2204.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2208.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2209.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2209OL.java | 4 +- .../com/vaadin/tests/tickets/Ticket2209OL2.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2215.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2221.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2222.java | 4 +- .../tickets/Ticket2227OrderedlayoutInTable.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2231.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2232.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2234.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2235.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2240.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2242.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2244.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2245.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2267.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2271.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2282.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2283.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2289.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2292.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2294.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2296.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2303.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2304.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2310.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2319.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2323.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2325.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2329.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2337.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2339.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2341.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2344.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2347.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2364.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2365.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2398.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2404.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2405.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2406.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2407.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2411.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2415.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2420.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2425.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2426.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2431.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2432.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2434.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2436.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2526.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2742.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2901.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket2998.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket3146.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket34.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket5053.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket5157.java | 4 +- .../src/com/vaadin/tests/tickets/Ticket5952.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket677.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket695.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket736.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket846.java | 4 +- uitest/src/com/vaadin/tests/tickets/Ticket932.java | 4 +- 219 files changed, 747 insertions(+), 747 deletions(-) create mode 100644 server/src/com/vaadin/Application.java delete mode 100644 server/src/com/vaadin/LegacyApplication.java (limited to 'uitest/src') diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java new file mode 100644 index 0000000000..13ce23d1e4 --- /dev/null +++ b/server/src/com/vaadin/Application.java @@ -0,0 +1,302 @@ +/* + * 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; + +import java.net.URL; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.vaadin.server.AbstractUIProvider; +import com.vaadin.server.VaadinSession; +import com.vaadin.server.Terminal.ErrorEvent; +import com.vaadin.server.Terminal.ErrorListener; +import com.vaadin.server.WrappedRequest; +import com.vaadin.ui.UI; + +/** + * A special application designed to help migrating applications from Vaadin 6 + * to Vaadin 7. The legacy application supports setting a main window, adding + * additional browser level windows and defining the theme for the entire + * application. + * + * @deprecated This class is only intended to ease migration and should not be + * used for new projects. + * + * @since 7.0 + */ +@Deprecated +public abstract class Application extends AbstractUIProvider implements + ErrorListener { + /** + * Ignore initial / and then get everything up to the next / + */ + private static final Pattern WINDOW_NAME_PATTERN = Pattern + .compile("^/?([^/]+).*"); + + private UI.LegacyWindow mainWindow; + private String theme; + + private Map legacyUINames = new HashMap(); + + /** + * Sets the main window of this application. Setting window as a main window + * of this application also adds the window to this application. + * + * @param mainWindow + * the UI to set as the default window + */ + public void setMainWindow(UI.LegacyWindow mainWindow) { + if (this.mainWindow != null) { + throw new IllegalStateException("mainWindow has already been set"); + } + if (mainWindow.getSession() == null) { + mainWindow.setSession(VaadinSession.getCurrent()); + } else if (mainWindow.getSession() != VaadinSession.getCurrent()) { + throw new IllegalStateException( + "mainWindow is attached to another application"); + } + if (UI.getCurrent() == null) { + // Assume setting a main window from Application.init if there's + // no current UI -> set the main window as the current UI + UI.setCurrent(mainWindow); + } + this.mainWindow = mainWindow; + } + + public void doInit() { + VaadinSession.getCurrent().setErrorHandler(this); + init(); + } + + protected abstract void init(); + + @Override + public Class getUIClass(VaadinSession application, + WrappedRequest request) { + UI uiInstance = getUIInstance(request); + if (uiInstance != null) { + return uiInstance.getClass(); + } + return null; + } + + @Override + public UI createInstance(VaadinSession application, Class type, + WrappedRequest request) { + return getUIInstance(request); + } + + @Override + public String getThemeForUI(WrappedRequest request, + Class uiClass) { + return theme; + } + + @Override + public String getPageTitleForUI(WrappedRequest request, + Class uiClass) { + UI uiInstance = getUIInstance(request); + if (uiInstance != null) { + return uiInstance.getCaption(); + } else { + return super.getPageTitleForUI(request, uiClass); + } + } + + /** + * Gets the mainWindow of the application. + * + *

    + * The main window is the window attached to the application URL ( + * {@link #getURL()}) and thus which is show by default to the user. + *

    + *

    + * Note that each application must have at least one main window. + *

    + * + * @return the UI used as the default window + */ + public UI.LegacyWindow getMainWindow() { + return mainWindow; + } + + private UI getUIInstance(WrappedRequest request) { + String pathInfo = request.getRequestPathInfo(); + String name = null; + if (pathInfo != null && pathInfo.length() > 0) { + Matcher matcher = WINDOW_NAME_PATTERN.matcher(pathInfo); + if (matcher.matches()) { + // Skip the initial slash + name = matcher.group(1); + } + } + UI.LegacyWindow window = getWindow(name); + if (window != null) { + return window; + } + return mainWindow; + } + + /** + * This implementation simulates the way of finding a window for a request + * by extracting a window name from the requested path and passes that name + * to {@link #getWindow(String)}. + *

    + * {@inheritDoc} + */ + @Override + public UI getExistingUI(WrappedRequest request) { + UI uiInstance = getUIInstance(request); + if (uiInstance.getUIId() == -1) { + // Not initialized -> Let go through createUIInstance to make it + // initialized + return null; + } else { + UI.setCurrent(uiInstance); + return uiInstance; + } + } + + /** + * Sets the application's theme. + *

    + * Note that this theme can be overridden for a specific UI with + * {@link VaadinSession#getThemeForUI(UI)}. Setting theme to be + * null selects the default theme. For the available theme + * names, see the contents of the VAADIN/themes directory. + *

    + * + * @param theme + * the new theme for this application. + */ + public void setTheme(String theme) { + this.theme = theme; + } + + /** + * Gets the application's theme. The application's theme is the default + * theme used by all the uIs for which a theme is not explicitly defined. If + * the application theme is not explicitly set, null is + * returned. + * + * @return the name of the application's theme. + */ + public String getTheme() { + return theme; + } + + /** + *

    + * Gets a UI by name. Returns null if the application is not + * running or it does not contain a window corresponding to the name. + *

    + * + * @param name + * the name of the requested window + * @return a UI corresponding to the name, or null to use the + * default window + */ + public UI.LegacyWindow getWindow(String name) { + return legacyUINames.get(name); + } + + /** + * Counter to get unique names for windows with no explicit name + */ + private int namelessUIIndex = 0; + + /** + * Adds a new browser level window to this application. Please note that UI + * doesn't have a name that is used in the URL - to add a named window you + * should instead use {@link #addWindow(UI, String)} + * + * @param uI + * the UI window to add to the application + * @return returns the name that has been assigned to the window + * + * @see #addWindow(UI, String) + */ + public void addWindow(UI.LegacyWindow uI) { + if (uI.getName() == null) { + String name = Integer.toString(namelessUIIndex++); + uI.setName(name); + } + + legacyUINames.put(uI.getName(), uI); + uI.setSession(VaadinSession.getCurrent()); + } + + /** + * Removes the specified window from the application. This also removes all + * name mappings for the window (see {@link #addWindow(UI, String) and + * #getWindowName(UI)}. + * + *

    + * Note that removing window from the application does not close the browser + * window - the window is only removed from the server-side. + *

    + * + * @param uI + * the UI to remove + */ + public void removeWindow(UI.LegacyWindow uI) { + for (Entry entry : legacyUINames.entrySet()) { + if (entry.getValue() == uI) { + legacyUINames.remove(entry.getKey()); + } + } + } + + /** + * Gets the set of windows contained by the application. + * + *

    + * Note that the returned set of windows can not be modified. + *

    + * + * @return the unmodifiable collection of windows. + */ + public Collection getWindows() { + return Collections.unmodifiableCollection(legacyUINames.values()); + } + + @Override + public void terminalError(ErrorEvent event) { + VaadinSession.getCurrent().terminalError(event); + } + + public VaadinSession getContext() { + return VaadinSession.getCurrent(); + } + + protected void close() { + VaadinSession.getCurrent().close(); + } + + public boolean isRunning() { + return VaadinSession.getCurrent().isRunning(); + } + + public URL getURL() { + return VaadinSession.getCurrent().getURL(); + } +} \ No newline at end of file diff --git a/server/src/com/vaadin/LegacyApplication.java b/server/src/com/vaadin/LegacyApplication.java deleted file mode 100644 index 66b2ca3973..0000000000 --- a/server/src/com/vaadin/LegacyApplication.java +++ /dev/null @@ -1,302 +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; - -import java.net.URL; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import com.vaadin.server.AbstractUIProvider; -import com.vaadin.server.VaadinSession; -import com.vaadin.server.Terminal.ErrorEvent; -import com.vaadin.server.Terminal.ErrorListener; -import com.vaadin.server.WrappedRequest; -import com.vaadin.ui.UI; - -/** - * A special application designed to help migrating applications from Vaadin 6 - * to Vaadin 7. The legacy application supports setting a main window, adding - * additional browser level windows and defining the theme for the entire - * application. - * - * @deprecated This class is only intended to ease migration and should not be - * used for new projects. - * - * @since 7.0 - */ -@Deprecated -public abstract class LegacyApplication extends AbstractUIProvider implements - ErrorListener { - /** - * Ignore initial / and then get everything up to the next / - */ - private static final Pattern WINDOW_NAME_PATTERN = Pattern - .compile("^/?([^/]+).*"); - - private UI.LegacyWindow mainWindow; - private String theme; - - private Map legacyUINames = new HashMap(); - - /** - * Sets the main window of this application. Setting window as a main window - * of this application also adds the window to this application. - * - * @param mainWindow - * the UI to set as the default window - */ - public void setMainWindow(UI.LegacyWindow mainWindow) { - if (this.mainWindow != null) { - throw new IllegalStateException("mainWindow has already been set"); - } - if (mainWindow.getSession() == null) { - mainWindow.setSession(VaadinSession.getCurrent()); - } else if (mainWindow.getSession() != VaadinSession.getCurrent()) { - throw new IllegalStateException( - "mainWindow is attached to another application"); - } - if (UI.getCurrent() == null) { - // Assume setting a main window from Application.init if there's - // no current UI -> set the main window as the current UI - UI.setCurrent(mainWindow); - } - this.mainWindow = mainWindow; - } - - public void doInit() { - VaadinSession.getCurrent().setErrorHandler(this); - init(); - } - - protected abstract void init(); - - @Override - public Class getUIClass(VaadinSession application, - WrappedRequest request) { - UI uiInstance = getUIInstance(request); - if (uiInstance != null) { - return uiInstance.getClass(); - } - return null; - } - - @Override - public UI createInstance(VaadinSession application, Class type, - WrappedRequest request) { - return getUIInstance(request); - } - - @Override - public String getThemeForUI(WrappedRequest request, - Class uiClass) { - return theme; - } - - @Override - public String getPageTitleForUI(WrappedRequest request, - Class uiClass) { - UI uiInstance = getUIInstance(request); - if (uiInstance != null) { - return uiInstance.getCaption(); - } else { - return super.getPageTitleForUI(request, uiClass); - } - } - - /** - * Gets the mainWindow of the application. - * - *

    - * The main window is the window attached to the application URL ( - * {@link #getURL()}) and thus which is show by default to the user. - *

    - *

    - * Note that each application must have at least one main window. - *

    - * - * @return the UI used as the default window - */ - public UI.LegacyWindow getMainWindow() { - return mainWindow; - } - - private UI getUIInstance(WrappedRequest request) { - String pathInfo = request.getRequestPathInfo(); - String name = null; - if (pathInfo != null && pathInfo.length() > 0) { - Matcher matcher = WINDOW_NAME_PATTERN.matcher(pathInfo); - if (matcher.matches()) { - // Skip the initial slash - name = matcher.group(1); - } - } - UI.LegacyWindow window = getWindow(name); - if (window != null) { - return window; - } - return mainWindow; - } - - /** - * This implementation simulates the way of finding a window for a request - * by extracting a window name from the requested path and passes that name - * to {@link #getWindow(String)}. - *

    - * {@inheritDoc} - */ - @Override - public UI getExistingUI(WrappedRequest request) { - UI uiInstance = getUIInstance(request); - if (uiInstance.getUIId() == -1) { - // Not initialized -> Let go through createUIInstance to make it - // initialized - return null; - } else { - UI.setCurrent(uiInstance); - return uiInstance; - } - } - - /** - * Sets the application's theme. - *

    - * Note that this theme can be overridden for a specific UI with - * {@link VaadinSession#getThemeForUI(UI)}. Setting theme to be - * null selects the default theme. For the available theme - * names, see the contents of the VAADIN/themes directory. - *

    - * - * @param theme - * the new theme for this application. - */ - public void setTheme(String theme) { - this.theme = theme; - } - - /** - * Gets the application's theme. The application's theme is the default - * theme used by all the uIs for which a theme is not explicitly defined. If - * the application theme is not explicitly set, null is - * returned. - * - * @return the name of the application's theme. - */ - public String getTheme() { - return theme; - } - - /** - *

    - * Gets a UI by name. Returns null if the application is not - * running or it does not contain a window corresponding to the name. - *

    - * - * @param name - * the name of the requested window - * @return a UI corresponding to the name, or null to use the - * default window - */ - public UI.LegacyWindow getWindow(String name) { - return legacyUINames.get(name); - } - - /** - * Counter to get unique names for windows with no explicit name - */ - private int namelessUIIndex = 0; - - /** - * Adds a new browser level window to this application. Please note that UI - * doesn't have a name that is used in the URL - to add a named window you - * should instead use {@link #addWindow(UI, String)} - * - * @param uI - * the UI window to add to the application - * @return returns the name that has been assigned to the window - * - * @see #addWindow(UI, String) - */ - public void addWindow(UI.LegacyWindow uI) { - if (uI.getName() == null) { - String name = Integer.toString(namelessUIIndex++); - uI.setName(name); - } - - legacyUINames.put(uI.getName(), uI); - uI.setSession(VaadinSession.getCurrent()); - } - - /** - * Removes the specified window from the application. This also removes all - * name mappings for the window (see {@link #addWindow(UI, String) and - * #getWindowName(UI)}. - * - *

    - * Note that removing window from the application does not close the browser - * window - the window is only removed from the server-side. - *

    - * - * @param uI - * the UI to remove - */ - public void removeWindow(UI.LegacyWindow uI) { - for (Entry entry : legacyUINames.entrySet()) { - if (entry.getValue() == uI) { - legacyUINames.remove(entry.getKey()); - } - } - } - - /** - * Gets the set of windows contained by the application. - * - *

    - * Note that the returned set of windows can not be modified. - *

    - * - * @return the unmodifiable collection of windows. - */ - public Collection getWindows() { - return Collections.unmodifiableCollection(legacyUINames.values()); - } - - @Override - public void terminalError(ErrorEvent event) { - VaadinSession.getCurrent().terminalError(event); - } - - public VaadinSession getContext() { - return VaadinSession.getCurrent(); - } - - protected void close() { - VaadinSession.getCurrent().close(); - } - - public boolean isRunning() { - return VaadinSession.getCurrent().isRunning(); - } - - public URL getURL() { - return VaadinSession.getCurrent().getURL(); - } -} \ No newline at end of file diff --git a/server/src/com/vaadin/server/LegacyVaadinPortlet.java b/server/src/com/vaadin/server/LegacyVaadinPortlet.java index 6efd9b29b3..f436cbb624 100644 --- a/server/src/com/vaadin/server/LegacyVaadinPortlet.java +++ b/server/src/com/vaadin/server/LegacyVaadinPortlet.java @@ -19,12 +19,12 @@ package com.vaadin.server; import javax.portlet.PortletException; import javax.portlet.PortletRequest; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ServletPortletHelper.ApplicationClassException; public class LegacyVaadinPortlet extends VaadinPortlet { - protected Class getApplicationClass() + protected Class getApplicationClass() throws ClassNotFoundException { try { return ServletPortletHelper @@ -34,10 +34,10 @@ public class LegacyVaadinPortlet extends VaadinPortlet { } } - protected LegacyApplication getNewApplication(PortletRequest request) + protected Application getNewApplication(PortletRequest request) throws PortletException { try { - Class applicationClass = getApplicationClass(); + Class applicationClass = getApplicationClass(); return applicationClass.newInstance(); } catch (Exception e) { throw new PortletException(e); @@ -53,7 +53,7 @@ public class LegacyVaadinPortlet extends VaadinPortlet { // Must set current before running init() VaadinSession.setCurrent(application); - LegacyApplication legacyApplication = getNewApplication(request); + Application legacyApplication = getNewApplication(request); legacyApplication.doInit(); application.addUIProvider(legacyApplication); diff --git a/server/src/com/vaadin/server/LegacyVaadinServlet.java b/server/src/com/vaadin/server/LegacyVaadinServlet.java index d853e55099..93a9410509 100644 --- a/server/src/com/vaadin/server/LegacyVaadinServlet.java +++ b/server/src/com/vaadin/server/LegacyVaadinServlet.java @@ -19,12 +19,12 @@ package com.vaadin.server; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ServletPortletHelper.ApplicationClassException; public class LegacyVaadinServlet extends VaadinServlet { - protected Class getApplicationClass() + protected Class getApplicationClass() throws ClassNotFoundException { try { return ServletPortletHelper @@ -34,10 +34,10 @@ public class LegacyVaadinServlet extends VaadinServlet { } } - protected LegacyApplication getNewApplication(HttpServletRequest request) + protected Application getNewApplication(HttpServletRequest request) throws ServletException { try { - Class applicationClass = getApplicationClass(); + Class applicationClass = getApplicationClass(); return applicationClass.newInstance(); } catch (Exception e) { throw new ServletException(e); @@ -53,7 +53,7 @@ public class LegacyVaadinServlet extends VaadinServlet { // Must set current before running init() VaadinSession.setCurrent(application); - LegacyApplication legacyApplication = getNewApplication(request); + Application legacyApplication = getNewApplication(request); legacyApplication.doInit(); application.addUIProvider(legacyApplication); diff --git a/server/src/com/vaadin/server/ServletPortletHelper.java b/server/src/com/vaadin/server/ServletPortletHelper.java index 068a9f9192..609168ee96 100644 --- a/server/src/com/vaadin/server/ServletPortletHelper.java +++ b/server/src/com/vaadin/server/ServletPortletHelper.java @@ -3,7 +3,7 @@ package com.vaadin.server; import java.io.Serializable; import java.util.Properties; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.shared.ApplicationConstants; import com.vaadin.ui.UI; @@ -41,7 +41,7 @@ class ServletPortletHelper implements Serializable { } } - static Class getLegacyApplicationClass( + static Class getLegacyApplicationClass( DeploymentConfiguration deploymentConfiguration) throws ApplicationClassException { Properties initParameters = deploymentConfiguration @@ -56,7 +56,7 @@ class ServletPortletHelper implements Serializable { try { return classLoader.loadClass(applicationParameter).asSubclass( - LegacyApplication.class); + Application.class); } catch (final ClassNotFoundException e) { throw new ApplicationClassException( "Failed to load application class: " + applicationParameter, diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index 0b376f54c1..1c1fcf5492 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -89,7 +89,7 @@ public abstract class UI extends AbstractComponentContainer implements /** * Helper class to emulate the main window from Vaadin 6 using UIs. This * class should be used in the same way as Window used as a browser level - * window in Vaadin 6 with {@link com.vaadin.LegacyApplication} + * window in Vaadin 6 with {@link com.vaadin.Application} */ @Deprecated public static class LegacyWindow extends UI { diff --git a/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java b/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java index 9ee4ffe6e7..2e59f9ee41 100644 --- a/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java +++ b/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java @@ -6,14 +6,14 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.UI; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Window; public class AddRemoveSubWindow { - public class TestApp extends LegacyApplication { + public class TestApp extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java index 4f37a9b505..1e963a8cc8 100644 --- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java +++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java @@ -29,7 +29,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.AbstractUIProvider; import com.vaadin.server.ApplicationConfiguration; import com.vaadin.server.LegacyVaadinServlet; @@ -107,9 +107,9 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { } @Override - protected Class getApplicationClass() + protected Class getApplicationClass() throws ClassNotFoundException { - return getClassToRun().asSubclass(LegacyApplication.class); + return getClassToRun().asSubclass(Application.class); } @Override @@ -128,7 +128,7 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { } }); return application; - } else if (LegacyApplication.class.isAssignableFrom(classToRun)) { + } else if (Application.class.isAssignableFrom(classToRun)) { return super.createApplication(request); } else if (UIProvider.class.isAssignableFrom(classToRun)) { VaadinServletSession application = new VaadinServletSession(); diff --git a/uitest/src/com/vaadin/tests/Components.java b/uitest/src/com/vaadin/tests/Components.java index 5d534a4dd8..5d1cb6a5dc 100644 --- a/uitest/src/com/vaadin/tests/Components.java +++ b/uitest/src/com/vaadin/tests/Components.java @@ -9,7 +9,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.data.util.DefaultItemSorter; import com.vaadin.data.util.HierarchicalContainer; @@ -30,7 +30,7 @@ import com.vaadin.ui.Tree.ItemStyleGenerator; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Components extends LegacyApplication { +public class Components extends Application { private static final Object CAPTION = "c"; private Map, String> tests = new HashMap, String>(); diff --git a/uitest/src/com/vaadin/tests/CustomLayoutDemo.java b/uitest/src/com/vaadin/tests/CustomLayoutDemo.java index 8f11233f38..af80ac0a88 100644 --- a/uitest/src/com/vaadin/tests/CustomLayoutDemo.java +++ b/uitest/src/com/vaadin/tests/CustomLayoutDemo.java @@ -16,7 +16,7 @@ package com.vaadin.tests; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -44,7 +44,7 @@ import com.vaadin.ui.Tree; * @since 4.0.0 * */ -public class CustomLayoutDemo extends com.vaadin.LegacyApplication +public class CustomLayoutDemo extends com.vaadin.Application implements Listener { private CustomLayout mainLayout = null; diff --git a/uitest/src/com/vaadin/tests/LayoutDemo.java b/uitest/src/com/vaadin/tests/LayoutDemo.java index 28cf4a922b..e4d6683e2a 100644 --- a/uitest/src/com/vaadin/tests/LayoutDemo.java +++ b/uitest/src/com/vaadin/tests/LayoutDemo.java @@ -16,7 +16,7 @@ package com.vaadin.tests; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ClassResource; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Component; @@ -38,7 +38,7 @@ import com.vaadin.ui.VerticalLayout; * @since 4.0.0 * */ -public class LayoutDemo extends com.vaadin.LegacyApplication { +public class LayoutDemo extends com.vaadin.Application { /** * Initialize Application. Demo components are added to main window. diff --git a/uitest/src/com/vaadin/tests/ListenerOrder.java b/uitest/src/com/vaadin/tests/ListenerOrder.java index c58fa17373..dafa142e1d 100644 --- a/uitest/src/com/vaadin/tests/ListenerOrder.java +++ b/uitest/src/com/vaadin/tests/ListenerOrder.java @@ -3,7 +3,7 @@ package com.vaadin.tests; import java.util.HashMap; import java.util.Iterator; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Container.ItemSetChangeEvent; import com.vaadin.data.Container.ItemSetChangeListener; import com.vaadin.data.Container.PropertySetChangeEvent; @@ -17,7 +17,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Select; -public class ListenerOrder extends com.vaadin.LegacyApplication +public class ListenerOrder extends com.vaadin.Application implements Button.ClickListener, PropertySetChangeListener, ItemSetChangeListener, ValueChangeListener { diff --git a/uitest/src/com/vaadin/tests/ModalWindow.java b/uitest/src/com/vaadin/tests/ModalWindow.java index 7c9e60c943..04d6c1eb1d 100644 --- a/uitest/src/com/vaadin/tests/ModalWindow.java +++ b/uitest/src/com/vaadin/tests/ModalWindow.java @@ -16,7 +16,7 @@ package com.vaadin.tests; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -35,7 +35,7 @@ import com.vaadin.ui.Window; * @see com.vaadin.ui.Window * @see com.vaadin.ui.Label */ -public class ModalWindow extends com.vaadin.LegacyApplication +public class ModalWindow extends com.vaadin.Application implements ClickListener { private Window test; diff --git a/uitest/src/com/vaadin/tests/NativeWindowing.java b/uitest/src/com/vaadin/tests/NativeWindowing.java index 95b42b7ce5..b364d506ce 100644 --- a/uitest/src/com/vaadin/tests/NativeWindowing.java +++ b/uitest/src/com/vaadin/tests/NativeWindowing.java @@ -19,7 +19,7 @@ package com.vaadin.tests; import java.net.MalformedURLException; import java.net.URL; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -27,7 +27,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Window; -public class NativeWindowing extends LegacyApplication { +public class NativeWindowing extends Application { LegacyWindow main = new LegacyWindow("Windowing test"); diff --git a/uitest/src/com/vaadin/tests/Parameters.java b/uitest/src/com/vaadin/tests/Parameters.java index 01270456c8..206a2e77ab 100644 --- a/uitest/src/com/vaadin/tests/Parameters.java +++ b/uitest/src/com/vaadin/tests/Parameters.java @@ -21,7 +21,7 @@ import java.net.URL; import java.util.Iterator; import java.util.Map; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ExternalResource; import com.vaadin.server.RequestHandler; import com.vaadin.server.VaadinSession; @@ -42,7 +42,7 @@ import com.vaadin.ui.VerticalLayout; * * @since 3.1.1 */ -public class Parameters extends com.vaadin.LegacyApplication +public class Parameters extends com.vaadin.Application implements RequestHandler { private final Label context = new Label(); diff --git a/uitest/src/com/vaadin/tests/RandomLayoutStress.java b/uitest/src/com/vaadin/tests/RandomLayoutStress.java index 1bbb35b9e3..60db80eb6a 100644 --- a/uitest/src/com/vaadin/tests/RandomLayoutStress.java +++ b/uitest/src/com/vaadin/tests/RandomLayoutStress.java @@ -18,7 +18,7 @@ package com.vaadin.tests; import java.util.Random; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ExternalResource; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.Button; @@ -44,7 +44,7 @@ import com.vaadin.ui.VerticalLayout; * */ public class RandomLayoutStress extends - com.vaadin.LegacyApplication { + com.vaadin.Application { private final Random seededRandom = new Random(1); diff --git a/uitest/src/com/vaadin/tests/ScrollbarStressTest.java b/uitest/src/com/vaadin/tests/ScrollbarStressTest.java index 831a863d5b..bce62a65b0 100644 --- a/uitest/src/com/vaadin/tests/ScrollbarStressTest.java +++ b/uitest/src/com/vaadin/tests/ScrollbarStressTest.java @@ -1,6 +1,6 @@ package com.vaadin.tests; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Accordion; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -17,7 +17,7 @@ import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalSplitPanel; import com.vaadin.ui.Window; -public class ScrollbarStressTest extends LegacyApplication { +public class ScrollbarStressTest extends Application { final LegacyWindow main = new LegacyWindow("Scrollbar Stress Test"); diff --git a/uitest/src/com/vaadin/tests/TestBench.java b/uitest/src/com/vaadin/tests/TestBench.java index 098ce4af29..41d7d207cb 100644 --- a/uitest/src/com/vaadin/tests/TestBench.java +++ b/uitest/src/com/vaadin/tests/TestBench.java @@ -24,7 +24,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.util.HierarchicalContainer; import com.vaadin.server.ExternalResource; @@ -51,7 +51,7 @@ import com.vaadin.ui.VerticalLayout; * @author Vaadin Ltd. * */ -public class TestBench extends com.vaadin.LegacyApplication +public class TestBench extends com.vaadin.Application implements Property.ValueChangeListener { // Add here packages which are used for finding testable classes @@ -223,7 +223,7 @@ public class TestBench extends com.vaadin.LegacyApplication private Component createTestable(Class c) { try { - final LegacyApplication app = (LegacyApplication) c + final Application app = (Application) c .newInstance(); app.doInit(); Layout lo = (Layout) app.getMainWindow().getContent(); diff --git a/uitest/src/com/vaadin/tests/TestForApplicationLayoutThatUsesWholeBrosersSpace.java b/uitest/src/com/vaadin/tests/TestForApplicationLayoutThatUsesWholeBrosersSpace.java index 99ae361471..e5998592b7 100644 --- a/uitest/src/com/vaadin/tests/TestForApplicationLayoutThatUsesWholeBrosersSpace.java +++ b/uitest/src/com/vaadin/tests/TestForApplicationLayoutThatUsesWholeBrosersSpace.java @@ -16,7 +16,7 @@ package com.vaadin.tests; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.HorizontalSplitPanel; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; @@ -25,7 +25,7 @@ import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalSplitPanel; public class TestForApplicationLayoutThatUsesWholeBrosersSpace extends - LegacyApplication { + Application { LegacyWindow main = new LegacyWindow("Windowing test"); diff --git a/uitest/src/com/vaadin/tests/TestForNativeWindowing.java b/uitest/src/com/vaadin/tests/TestForNativeWindowing.java index f7bad7cd19..6f131bdb8e 100644 --- a/uitest/src/com/vaadin/tests/TestForNativeWindowing.java +++ b/uitest/src/com/vaadin/tests/TestForNativeWindowing.java @@ -19,7 +19,7 @@ package com.vaadin.tests; import java.net.MalformedURLException; import java.net.URL; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -27,7 +27,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Window; -public class TestForNativeWindowing extends LegacyApplication { +public class TestForNativeWindowing extends Application { LegacyWindow main = new LegacyWindow("Windowing test"); diff --git a/uitest/src/com/vaadin/tests/TestForStyledUpload.java b/uitest/src/com/vaadin/tests/TestForStyledUpload.java index 53bb6d37c2..a534f0ec84 100644 --- a/uitest/src/com/vaadin/tests/TestForStyledUpload.java +++ b/uitest/src/com/vaadin/tests/TestForStyledUpload.java @@ -26,7 +26,7 @@ import java.io.OutputStream; import java.lang.management.ManagementFactory; import java.lang.management.MemoryMXBean; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.StreamResource; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Button; @@ -48,7 +48,7 @@ import com.vaadin.ui.Upload.SucceededEvent; import com.vaadin.ui.Upload.SucceededListener; import com.vaadin.ui.VerticalLayout; -public class TestForStyledUpload extends LegacyApplication +public class TestForStyledUpload extends Application implements Upload.FinishedListener, FailedListener, SucceededListener, StartedListener { diff --git a/uitest/src/com/vaadin/tests/TestSetVisibleAndCaching.java b/uitest/src/com/vaadin/tests/TestSetVisibleAndCaching.java index 1edf7b2d88..2e81daa781 100644 --- a/uitest/src/com/vaadin/tests/TestSetVisibleAndCaching.java +++ b/uitest/src/com/vaadin/tests/TestSetVisibleAndCaching.java @@ -16,7 +16,7 @@ package com.vaadin.tests; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -25,7 +25,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; public class TestSetVisibleAndCaching extends - com.vaadin.LegacyApplication { + com.vaadin.Application { Panel panelA = new Panel("Panel A"); Panel panelB = new Panel("Panel B"); diff --git a/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java b/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java index b9de56e35c..c376b40e24 100644 --- a/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java +++ b/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java @@ -21,7 +21,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Iterator; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Container; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.util.IndexedContainer; @@ -41,7 +41,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class TestSizeableIncomponents extends LegacyApplication { +public class TestSizeableIncomponents extends Application { private IndexedContainer cont; private ComboBox select; diff --git a/uitest/src/com/vaadin/tests/TestSplitPanel.java b/uitest/src/com/vaadin/tests/TestSplitPanel.java index 52f2538343..dddef837c7 100644 --- a/uitest/src/com/vaadin/tests/TestSplitPanel.java +++ b/uitest/src/com/vaadin/tests/TestSplitPanel.java @@ -16,12 +16,12 @@ package com.vaadin.tests; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalSplitPanel; -public class TestSplitPanel extends com.vaadin.LegacyApplication { +public class TestSplitPanel extends com.vaadin.Application { VerticalSplitPanel verticalSplit = new VerticalSplitPanel(); diff --git a/uitest/src/com/vaadin/tests/TreeFilesystem.java b/uitest/src/com/vaadin/tests/TreeFilesystem.java index 3d1705381e..5434bbdd82 100644 --- a/uitest/src/com/vaadin/tests/TreeFilesystem.java +++ b/uitest/src/com/vaadin/tests/TreeFilesystem.java @@ -18,7 +18,7 @@ package com.vaadin.tests; import java.io.File; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.server.VaadinSession; import com.vaadin.shared.ui.label.ContentMode; @@ -38,7 +38,7 @@ import com.vaadin.ui.UI.LegacyWindow; * @since 4.0.0 * */ -public class TreeFilesystem extends com.vaadin.LegacyApplication +public class TreeFilesystem extends com.vaadin.Application implements Tree.ExpandListener { // Filesystem explorer panel and it's components diff --git a/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java b/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java index b61a7a53a5..4390b24d4b 100644 --- a/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java +++ b/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java @@ -18,7 +18,7 @@ package com.vaadin.tests; import java.io.File; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.util.FilesystemContainer; import com.vaadin.data.util.FilesystemContainer.FileItem; import com.vaadin.server.VaadinSession; @@ -43,7 +43,7 @@ import com.vaadin.ui.VerticalLayout; * */ public class TreeFilesystemContainer extends - com.vaadin.LegacyApplication implements Listener { + com.vaadin.Application implements Listener { // Filesystem explorer panel and it's components private final Panel explorerPanel = new Panel("Filesystem explorer"); diff --git a/uitest/src/com/vaadin/tests/UsingObjectsInSelect.java b/uitest/src/com/vaadin/tests/UsingObjectsInSelect.java index 1b0fc93a55..04980b7aac 100644 --- a/uitest/src/com/vaadin/tests/UsingObjectsInSelect.java +++ b/uitest/src/com/vaadin/tests/UsingObjectsInSelect.java @@ -19,7 +19,7 @@ package com.vaadin.tests; import java.util.LinkedList; import java.util.Random; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.shared.ui.label.ContentMode; @@ -29,7 +29,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Select; public class UsingObjectsInSelect extends - com.vaadin.LegacyApplication implements ValueChangeListener { + com.vaadin.Application implements ValueChangeListener { private final Select select = new Select(); private final Label selectedTask = new Label("Selected task", diff --git a/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java b/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java index 19b872cb2f..c819f4ebea 100644 --- a/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java +++ b/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java @@ -1,7 +1,7 @@ package com.vaadin.tests.appengine; import com.google.apphosting.api.DeadlineExceededException; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.server.ClassResource; @@ -15,7 +15,7 @@ import com.vaadin.ui.Notification; import com.vaadin.ui.TextField; import com.vaadin.ui.UI.LegacyWindow; -public class GAESyncTest extends LegacyApplication { +public class GAESyncTest extends Application { /** * @@ -50,10 +50,10 @@ public class GAESyncTest extends LegacyApplication { private static final long serialVersionUID = -6521351715072191625l; TextField tf; Label l; - LegacyApplication app; + Application app; GridLayout gl; - private IntrWindow(LegacyApplication app) { + private IntrWindow(Application app) { this.app = app; tf = new TextField("Echo thingie"); diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestCase.java b/uitest/src/com/vaadin/tests/components/AbstractTestCase.java index 356b130433..7556976d00 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractTestCase.java +++ b/uitest/src/com/vaadin/tests/components/AbstractTestCase.java @@ -1,10 +1,10 @@ package com.vaadin.tests.components; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.VaadinSession; import com.vaadin.server.WebBrowser; -public abstract class AbstractTestCase extends LegacyApplication { +public abstract class AbstractTestCase extends Application { protected abstract String getDescription(); diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxReapperingOldValue.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxReapperingOldValue.java index cba699b701..4482cf3121 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxReapperingOldValue.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxReapperingOldValue.java @@ -1,6 +1,6 @@ package com.vaadin.tests.components.combobox; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Container; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; @@ -12,7 +12,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; @SuppressWarnings("serial") -public class ComboBoxReapperingOldValue extends LegacyApplication +public class ComboBoxReapperingOldValue extends Application implements ValueChangeListener { ComboBox cbox1 = new ComboBox(); diff --git a/uitest/src/com/vaadin/tests/components/form/UndefinedWideFormWithRelativeWideFooter.java b/uitest/src/com/vaadin/tests/components/form/UndefinedWideFormWithRelativeWideFooter.java index 9608db5772..218e3998a6 100644 --- a/uitest/src/com/vaadin/tests/components/form/UndefinedWideFormWithRelativeWideFooter.java +++ b/uitest/src/com/vaadin/tests/components/form/UndefinedWideFormWithRelativeWideFooter.java @@ -1,6 +1,6 @@ package com.vaadin.tests.components.form; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; import com.vaadin.ui.Form; @@ -10,7 +10,7 @@ import com.vaadin.ui.TextField; @SuppressWarnings("serial") public class UndefinedWideFormWithRelativeWideFooter extends - LegacyApplication { + Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/components/loginform/LoginFormWithMultipleWindows.java b/uitest/src/com/vaadin/tests/components/loginform/LoginFormWithMultipleWindows.java index e469d13e07..6de14e949b 100644 --- a/uitest/src/com/vaadin/tests/components/loginform/LoginFormWithMultipleWindows.java +++ b/uitest/src/com/vaadin/tests/components/loginform/LoginFormWithMultipleWindows.java @@ -1,13 +1,13 @@ package com.vaadin.tests.components.loginform; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.LoginForm; import com.vaadin.ui.LoginForm.LoginEvent; import com.vaadin.ui.LoginForm.LoginListener; import com.vaadin.ui.UI.LegacyWindow; @SuppressWarnings("serial") -public class LoginFormWithMultipleWindows extends LegacyApplication { +public class LoginFormWithMultipleWindows extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java b/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java index 5d36b8381b..27905b5cf9 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java +++ b/uitest/src/com/vaadin/tests/components/table/TableFirstRowFlicker.java @@ -1,6 +1,6 @@ package com.vaadin.tests.components.table; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Container; import com.vaadin.data.util.IndexedContainer; import com.vaadin.ui.Label; @@ -9,7 +9,7 @@ import com.vaadin.ui.Table; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class TableFirstRowFlicker extends LegacyApplication { +public class TableFirstRowFlicker extends Application { Table t; diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java b/uitest/src/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java index 135c00182e..bab39bf656 100644 --- a/uitest/src/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java +++ b/uitest/src/com/vaadin/tests/components/textfield/TextFieldInLayoutInTable.java @@ -1,6 +1,6 @@ package com.vaadin.tests.components.textfield; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Component; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; @@ -8,7 +8,7 @@ import com.vaadin.ui.Table; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class TextFieldInLayoutInTable extends LegacyApplication { +public class TextFieldInLayoutInTable extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/containers/sqlcontainer/CheckboxUpdateProblem.java b/uitest/src/com/vaadin/tests/containers/sqlcontainer/CheckboxUpdateProblem.java index 9c2a6f387c..3af415217c 100644 --- a/uitest/src/com/vaadin/tests/containers/sqlcontainer/CheckboxUpdateProblem.java +++ b/uitest/src/com/vaadin/tests/containers/sqlcontainer/CheckboxUpdateProblem.java @@ -2,7 +2,7 @@ package com.vaadin.tests.containers.sqlcontainer; import java.sql.SQLException; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Container.ItemSetChangeEvent; import com.vaadin.data.Container.ItemSetChangeListener; import com.vaadin.data.Item; @@ -15,7 +15,7 @@ import com.vaadin.ui.HorizontalSplitPanel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; -public class CheckboxUpdateProblem extends LegacyApplication +public class CheckboxUpdateProblem extends Application implements Property.ValueChangeListener { private final DatabaseHelper databaseHelper = new DatabaseHelper(); private Table testList; diff --git a/uitest/src/com/vaadin/tests/containers/sqlcontainer/ComboBoxUpdateProblem.java b/uitest/src/com/vaadin/tests/containers/sqlcontainer/ComboBoxUpdateProblem.java index edaefeb0c3..e33607b4f7 100644 --- a/uitest/src/com/vaadin/tests/containers/sqlcontainer/ComboBoxUpdateProblem.java +++ b/uitest/src/com/vaadin/tests/containers/sqlcontainer/ComboBoxUpdateProblem.java @@ -1,6 +1,6 @@ package com.vaadin.tests.containers.sqlcontainer; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.AbstractSelect.Filtering; import com.vaadin.ui.ComboBox; import com.vaadin.ui.UI; @@ -8,7 +8,7 @@ import com.vaadin.ui.UI; /** * See http://dev.vaadin.com/ticket/9155 . */ -public class ComboBoxUpdateProblem extends LegacyApplication { +public class ComboBoxUpdateProblem extends Application { private final DatabaseHelper databaseHelper = new DatabaseHelper(); @Override diff --git a/uitest/src/com/vaadin/tests/containers/sqlcontainer/MassInsertMemoryLeakTestApp.java b/uitest/src/com/vaadin/tests/containers/sqlcontainer/MassInsertMemoryLeakTestApp.java index 3a07a89302..1546f51a33 100644 --- a/uitest/src/com/vaadin/tests/containers/sqlcontainer/MassInsertMemoryLeakTestApp.java +++ b/uitest/src/com/vaadin/tests/containers/sqlcontainer/MassInsertMemoryLeakTestApp.java @@ -2,7 +2,7 @@ package com.vaadin.tests.containers.sqlcontainer; import java.sql.SQLException; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.util.sqlcontainer.SQLContainer; import com.vaadin.data.util.sqlcontainer.connection.JDBCConnectionPool; import com.vaadin.data.util.sqlcontainer.connection.SimpleJDBCConnectionPool; @@ -25,7 +25,7 @@ import com.vaadin.ui.VerticalLayout; // +-------------+-------------+------+-----+---------+----------------+ @SuppressWarnings("serial") -public class MassInsertMemoryLeakTestApp extends LegacyApplication { +public class MassInsertMemoryLeakTestApp extends Application { ProgressIndicator proggress = new ProgressIndicator(); Button process = new Button("Mass insert"); diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestApplication.java b/uitest/src/com/vaadin/tests/integration/IntegrationTestApplication.java index 03af8bbd52..d3c85cbde5 100644 --- a/uitest/src/com/vaadin/tests/integration/IntegrationTestApplication.java +++ b/uitest/src/com/vaadin/tests/integration/IntegrationTestApplication.java @@ -1,6 +1,6 @@ package com.vaadin.tests.integration; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; @@ -10,7 +10,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Table; import com.vaadin.ui.UI.LegacyWindow; -public class IntegrationTestApplication extends LegacyApplication { +public class IntegrationTestApplication extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java b/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java index f3c7f009c8..db8307b635 100644 --- a/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java +++ b/uitest/src/com/vaadin/tests/integration/JSR286PortletApplication.java @@ -18,7 +18,7 @@ import javax.portlet.ResourceRequest; import javax.portlet.ResourceResponse; import javax.portlet.WindowState; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.annotations.StyleSheet; import com.vaadin.server.ExternalResource; import com.vaadin.server.VaadinPortletSession; @@ -37,7 +37,7 @@ import com.vaadin.ui.Upload.Receiver; /** * Adapted from old PortletDemo to support integration testing. */ -public class JSR286PortletApplication extends LegacyApplication { +public class JSR286PortletApplication extends Application { @StyleSheet("PortletConnectorResource.css") public final class LegacyWindowWithStylesheet extends LegacyWindow { diff --git a/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java b/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java index d4b9d3e4af..82761afa68 100644 --- a/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java +++ b/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java @@ -4,7 +4,7 @@ import java.util.Date; import java.util.Iterator; import java.util.Locale; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.event.Action; @@ -57,7 +57,7 @@ import com.vaadin.ui.Window; import com.vaadin.ui.themes.LiferayTheme; @SuppressWarnings("serial") -public class LiferayThemeDemo extends LegacyApplication { +public class LiferayThemeDemo extends Application { @SuppressWarnings("deprecation") private static final Date DATE = new Date(2009 - 1900, 6 - 1, 2); diff --git a/uitest/src/com/vaadin/tests/integration/PortletSizeInLiferayFreeformLayoutApplication.java b/uitest/src/com/vaadin/tests/integration/PortletSizeInLiferayFreeformLayoutApplication.java index 897649fcc2..abbc819705 100644 --- a/uitest/src/com/vaadin/tests/integration/PortletSizeInLiferayFreeformLayoutApplication.java +++ b/uitest/src/com/vaadin/tests/integration/PortletSizeInLiferayFreeformLayoutApplication.java @@ -1,6 +1,6 @@ package com.vaadin.tests.integration; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; @@ -12,7 +12,7 @@ import com.vaadin.ui.VerticalLayout; * See ticket #5521. */ public class PortletSizeInLiferayFreeformLayoutApplication extends - LegacyApplication { + Application { @Override public void init() { LegacyWindow mainWindow = new LegacyWindow("Portlet5521 Application"); diff --git a/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel2.java b/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel2.java index df34dc2f66..66248d7a5b 100644 --- a/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel2.java +++ b/uitest/src/com/vaadin/tests/layouts/GridLayoutInsidePanel2.java @@ -1,12 +1,12 @@ package com.vaadin.tests.layouts; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Layout; import com.vaadin.ui.UI.LegacyWindow; -public class GridLayoutInsidePanel2 extends LegacyApplication { +public class GridLayoutInsidePanel2 extends Application { private Layout layout; diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java index ddf79989f1..8da94feb7f 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/GridLayoutTests.java @@ -2,7 +2,7 @@ package com.vaadin.tests.layouts.layouttester; import java.util.Date; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.Resource; import com.vaadin.server.SystemError; import com.vaadin.server.ThemeResource; @@ -32,7 +32,7 @@ public class GridLayoutTests extends AbstractLayoutTests { private AbstractComponent rc1, col1, col2, col3, row1, row2, row3, x3, x22; - public GridLayoutTests(LegacyApplication application) { + public GridLayoutTests(Application application) { super(); } diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java index 2525a5e620..0042f0ba11 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java @@ -1,6 +1,6 @@ package com.vaadin.tests.layouts.layouttester; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.Resource; import com.vaadin.server.SystemError; import com.vaadin.server.ThemeResource; @@ -26,7 +26,7 @@ import com.vaadin.ui.themes.Reindeer; public class HorizontalLayoutTests extends AbstractLayoutTests { - public HorizontalLayoutTests(LegacyApplication application) { + public HorizontalLayoutTests(Application application) { super(); } diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java index 0322178ac8..3e668289fe 100644 --- a/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java +++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java @@ -1,6 +1,6 @@ package com.vaadin.tests.layouts.layouttester; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.Resource; import com.vaadin.server.SystemError; import com.vaadin.server.ThemeResource; @@ -26,7 +26,7 @@ import com.vaadin.ui.VerticalLayout; public class VerticalLayoutTests extends AbstractLayoutTests { - public VerticalLayoutTests(LegacyApplication application) { + public VerticalLayoutTests(Application application) { super(); } diff --git a/uitest/src/com/vaadin/tests/themes/ButtonsTest.java b/uitest/src/com/vaadin/tests/themes/ButtonsTest.java index 551f9d8fbf..411dbed340 100644 --- a/uitest/src/com/vaadin/tests/themes/ButtonsTest.java +++ b/uitest/src/com/vaadin/tests/themes/ButtonsTest.java @@ -1,6 +1,6 @@ package com.vaadin.tests.themes; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.server.ThemeResource; @@ -15,7 +15,7 @@ import com.vaadin.ui.UI; import com.vaadin.ui.UI.LegacyWindow; @SuppressWarnings("serial") -public class ButtonsTest extends com.vaadin.LegacyApplication { +public class ButtonsTest extends com.vaadin.Application { final UI.LegacyWindow main = new LegacyWindow("Button states & themes"); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1225.java b/uitest/src/com/vaadin/tests/tickets/Ticket1225.java index 8f0edb3116..5ea26c882e 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1225.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1225.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; import com.vaadin.ui.Alignment; @@ -16,7 +16,7 @@ import com.vaadin.ui.VerticalSplitPanel; * properly. Scrollbars will disappear if "shaking" content a bit, like * selecting tests in area. */ -public class Ticket1225 extends LegacyApplication { +public class Ticket1225 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1230.java b/uitest/src/com/vaadin/tests/tickets/Ticket1230.java index 860f0ec8c4..69a1e7d20d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1230.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1230.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -9,7 +9,7 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Select; -public class Ticket1230 extends LegacyApplication { +public class Ticket1230 extends Application { private static final Object PROPERTY_ID = new Object(); private static final Object NULL_ITEM_ID = new Object(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket124.java b/uitest/src/com/vaadin/tests/tickets/Ticket124.java index b63f453ada..6fc67af975 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket124.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket124.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -10,7 +10,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket124 extends LegacyApplication { +public class Ticket124 extends Application { private TextField tf; private GridLayout gl; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1245.java b/uitest/src/com/vaadin/tests/tickets/Ticket1245.java index bf7be0f291..0c72d8ecaa 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1245.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1245.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.data.Property; import com.vaadin.ui.AbstractSelect; @@ -12,7 +12,7 @@ import com.vaadin.ui.Tree; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.themes.Reindeer; -public class Ticket1245 extends com.vaadin.LegacyApplication { +public class Ticket1245 extends com.vaadin.Application { TextField f = new TextField(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1365.java b/uitest/src/com/vaadin/tests/tickets/Ticket1365.java index 1306e95af9..80b29fff17 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1365.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1365.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; import com.vaadin.event.ShortcutAction; @@ -8,7 +8,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket1365 extends com.vaadin.LegacyApplication +public class Ticket1365 extends com.vaadin.Application implements Handler { TextField f = new TextField(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1368.java b/uitest/src/com/vaadin/tests/tickets/Ticket1368.java index 2ac04ebcaf..27410af474 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1368.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1368.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; import com.vaadin.ui.ComboBox; import com.vaadin.ui.UI.LegacyWindow; @@ -8,7 +8,7 @@ import com.vaadin.ui.Table; /** */ -public class Ticket1368 extends LegacyApplication { +public class Ticket1368 extends Application { private Table t; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1397.java b/uitest/src/com/vaadin/tests/tickets/Ticket1397.java index 8c5b9ffcf4..7cbe2cfd3b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1397.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1397.java @@ -2,7 +2,7 @@ package com.vaadin.tests.tickets; import java.util.Date; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.util.ObjectProperty; import com.vaadin.ui.Button; import com.vaadin.ui.Component; @@ -14,7 +14,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.TextField; -public class Ticket1397 extends LegacyApplication { +public class Ticket1397 extends Application { LegacyWindow main; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1435.java b/uitest/src/com/vaadin/tests/tickets/Ticket1435.java index a31b421bf2..fa6a4d42f7 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1435.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1435.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -16,7 +16,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket1435 extends LegacyApplication { +public class Ticket1435 extends Application { private static final boolean useWorkaround = true; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1444.java b/uitest/src/com/vaadin/tests/tickets/Ticket1444.java index 70fc394f62..256b519371 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1444.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1444.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1444 extends LegacyApplication { +public class Ticket1444 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java b/uitest/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java index e57eb0962a..c13b6968ed 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; @@ -8,7 +8,7 @@ import com.vaadin.ui.Notification; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Window; -public class Ticket1465ModalNotification extends LegacyApplication { +public class Ticket1465ModalNotification extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1519.java b/uitest/src/com/vaadin/tests/tickets/Ticket1519.java index fea7725e66..cd3bc86677 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1519.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1519.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.CustomLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TabSheet; -public class Ticket1519 extends LegacyApplication { +public class Ticket1519 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1572.java b/uitest/src/com/vaadin/tests/tickets/Ticket1572.java index 44ef87f428..adeb4c7a87 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1572.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1572.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.shared.ui.MarginInfo; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -10,7 +10,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1572 extends com.vaadin.LegacyApplication { +public class Ticket1572 extends com.vaadin.Application { private Label state; private GridLayout gl; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1581.java b/uitest/src/com/vaadin/tests/tickets/Ticket1581.java index 0ee53004e8..8766e1135a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1581.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1581.java @@ -2,7 +2,7 @@ package com.vaadin.tests.tickets; import java.util.Date; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -10,7 +10,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.ProgressIndicator; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1581 extends com.vaadin.LegacyApplication { +public class Ticket1581 extends com.vaadin.Application { private Label time; private ProgressIndicator poller; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1589.java b/uitest/src/com/vaadin/tests/tickets/Ticket1589.java index 4e90ae0e9e..82cfa2b3ec 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1589.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1589.java @@ -10,7 +10,7 @@ import java.util.Date; import javax.imageio.ImageIO; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.DownloadStream; import com.vaadin.server.ExternalResource; import com.vaadin.server.RequestHandler; @@ -20,7 +20,7 @@ import com.vaadin.server.WrappedResponse; import com.vaadin.ui.Link; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1589 extends LegacyApplication { +public class Ticket1589 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1598.java b/uitest/src/com/vaadin/tests/tickets/Ticket1598.java index cbb1f88043..e1f04cbf8e 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1598.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1598.java @@ -3,14 +3,14 @@ package com.vaadin.tests.tickets; import java.util.ArrayList; import java.util.List; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ThemeResource; import com.vaadin.ui.MenuBar; import com.vaadin.ui.MenuBar.Command; import com.vaadin.ui.MenuBar.MenuItem; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1598 extends LegacyApplication { +public class Ticket1598 extends Application { LegacyWindow main = new LegacyWindow("MenuBar test"); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket161.java b/uitest/src/com/vaadin/tests/tickets/Ticket161.java index 6a6f95a9b5..94eba29551 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket161.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket161.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Container; import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; import com.vaadin.ui.Button; @@ -10,7 +10,7 @@ import com.vaadin.ui.Table; /** */ -public class Ticket161 extends LegacyApplication { +public class Ticket161 extends Application { private Table t; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1632.java b/uitest/src/com/vaadin/tests/tickets/Ticket1632.java index 9ecdff39d5..ff50380c42 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1632.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1632.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -9,7 +9,7 @@ import com.vaadin.ui.Table; /** */ -public class Ticket1632 extends LegacyApplication { +public class Ticket1632 extends Application { private Table t; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1659.java b/uitest/src/com/vaadin/tests/tickets/Ticket1659.java index a587aa5a94..cd96ac56c7 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1659.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1659.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ExternalResource; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1659 extends LegacyApplication { +public class Ticket1659 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1663.java b/uitest/src/com/vaadin/tests/tickets/Ticket1663.java index 9a08dc8502..7a5c1163b5 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1663.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1663.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.SystemError; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket1663 extends com.vaadin.LegacyApplication { +public class Ticket1663 extends com.vaadin.Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1673.java b/uitest/src/com/vaadin/tests/tickets/Ticket1673.java index 663d955e77..c2b7b38435 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1673.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1673.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.CustomizedSystemMessages; import com.vaadin.server.SystemMessages; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1673 extends com.vaadin.LegacyApplication { +public class Ticket1673 extends com.vaadin.Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1710.java b/uitest/src/com/vaadin/tests/tickets/Ticket1710.java index b4258dff61..641bd43f70 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1710.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1710.java @@ -2,7 +2,7 @@ package com.vaadin.tests.tickets; import java.util.Iterator; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.util.MethodProperty; @@ -29,7 +29,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket1710 extends com.vaadin.LegacyApplication { +public class Ticket1710 extends com.vaadin.Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1737.java b/uitest/src/com/vaadin/tests/tickets/Ticket1737.java index 4384215943..8bb244545a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1737.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1737.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ClassResource; import com.vaadin.server.DownloadStream; import com.vaadin.server.Resource; @@ -10,7 +10,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1737 extends LegacyApplication { +public class Ticket1737 extends Application { Resource slowRes = new ClassResource(Ticket1737.class, "m-bullet-blue.gif") { @Override diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1767.java b/uitest/src/com/vaadin/tests/tickets/Ticket1767.java index f2e2dd32b8..42706a1428 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1767.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1767.java @@ -1,10 +1,10 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.ComboBox; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1767 extends com.vaadin.LegacyApplication { +public class Ticket1767 extends com.vaadin.Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1772.java b/uitest/src/com/vaadin/tests/tickets/Ticket1772.java index 648fa4e598..a2ddbebad8 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1772.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1772.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket1772 extends com.vaadin.LegacyApplication { +public class Ticket1772 extends com.vaadin.Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1775.java b/uitest/src/com/vaadin/tests/tickets/Ticket1775.java index 3d9165e491..80a19720bb 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1775.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1775.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.CustomLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1775 extends com.vaadin.LegacyApplication { +public class Ticket1775 extends com.vaadin.Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1804.java b/uitest/src/com/vaadin/tests/tickets/Ticket1804.java index 196a4863db..d7c9a45992 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1804.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1804.java @@ -3,7 +3,7 @@ package com.vaadin.tests.tickets; import java.util.Iterator; import java.util.LinkedList; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Validator; import com.vaadin.data.util.MethodProperty; import com.vaadin.server.SystemError; @@ -16,7 +16,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Select; import com.vaadin.ui.Window; -public class Ticket1804 extends com.vaadin.LegacyApplication { +public class Ticket1804 extends com.vaadin.Application { LinkedList(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1805.java b/uitest/src/com/vaadin/tests/tickets/Ticket1805.java index 329bfeaa38..376173ebf2 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1805.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1805.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.ui.Alignment; @@ -11,7 +11,7 @@ import com.vaadin.ui.Layout.MarginHandler; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket1805 extends com.vaadin.LegacyApplication { +public class Ticket1805 extends com.vaadin.Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1806.java b/uitest/src/com/vaadin/tests/tickets/Ticket1806.java index 333350f94e..31746b455d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1806.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1806.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.util.ObjectProperty; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket1806 extends com.vaadin.LegacyApplication { +public class Ticket1806 extends com.vaadin.Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1811.java b/uitest/src/com/vaadin/tests/tickets/Ticket1811.java index 066587e349..d68fc8be3d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1811.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1811.java @@ -3,7 +3,7 @@ package com.vaadin.tests.tickets; import java.util.Iterator; import java.util.LinkedList; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Validator; import com.vaadin.data.validator.StringLengthValidator; import com.vaadin.shared.ui.label.ContentMode; @@ -14,7 +14,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.Window; -public class Ticket1811 extends com.vaadin.LegacyApplication { +public class Ticket1811 extends com.vaadin.Application { LinkedList listOfAllFields = new LinkedList(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1819.java b/uitest/src/com/vaadin/tests/tickets/Ticket1819.java index 1ff918b676..162bfbad2d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1819.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1819.java @@ -3,7 +3,7 @@ package com.vaadin.tests.tickets; import java.util.Iterator; import java.util.LinkedList; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.AbstractField; import com.vaadin.ui.Button; @@ -13,7 +13,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Select; import com.vaadin.ui.Window; -public class Ticket1819 extends com.vaadin.LegacyApplication { +public class Ticket1819 extends com.vaadin.Application { LinkedList(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java b/uitest/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java index 614d3aff62..a929b3a60b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -10,7 +10,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; public class Ticket1834PanelScrolling extends - com.vaadin.LegacyApplication { + com.vaadin.Application { private static final int ROWS = 50; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1857.java b/uitest/src/com/vaadin/tests/tickets/Ticket1857.java index dd304a14aa..1b74d3c142 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1857.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1857.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.event.Action; @@ -11,7 +11,7 @@ import com.vaadin.ui.Table; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1857 extends LegacyApplication implements +public class Ticket1857 extends Application implements Handler { @Override diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1868.java b/uitest/src/com/vaadin/tests/tickets/Ticket1868.java index ff8c512339..b301eb1ea9 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1868.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1868.java @@ -1,10 +1,10 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1868 extends com.vaadin.LegacyApplication { +public class Ticket1868 extends com.vaadin.Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1869.java b/uitest/src/com/vaadin/tests/tickets/Ticket1869.java index cd1be102ec..f704235178 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1869.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1869.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; @@ -8,7 +8,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1869 extends com.vaadin.LegacyApplication { +public class Ticket1869 extends com.vaadin.Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1878.java b/uitest/src/com/vaadin/tests/tickets/Ticket1878.java index 5d8074d553..3b53023084 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1878.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1878.java @@ -4,7 +4,7 @@ import java.util.Date; import java.util.Iterator; import java.util.Random; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.util.BeanItem; import com.vaadin.data.validator.StringLengthValidator; import com.vaadin.server.Resource; @@ -27,7 +27,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket1878 extends LegacyApplication { +public class Ticket1878 extends Application { private Layout orderedLayout; private Layout gridLayout; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1900.java b/uitest/src/com/vaadin/tests/tickets/Ticket1900.java index 573634d61b..d1bd127500 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1900.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1900.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Validator; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket1900 extends LegacyApplication { +public class Ticket1900 extends Application { TextField f[] = new TextField[5]; LegacyWindow main = new LegacyWindow("#1900 test"); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1904.java b/uitest/src/com/vaadin/tests/tickets/Ticket1904.java index ee6a9fe638..5891831038 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1904.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1904.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; import com.vaadin.ui.HorizontalLayout; @@ -8,7 +8,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1904 extends LegacyApplication { +public class Ticket1904 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1916.java b/uitest/src/com/vaadin/tests/tickets/Ticket1916.java index 03efef3b2c..422b6e57d0 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1916.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1916.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.UserError; import com.vaadin.ui.Alignment; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket1916 extends LegacyApplication { +public class Ticket1916 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1919.java b/uitest/src/com/vaadin/tests/tickets/Ticket1919.java index 6c0fa581ac..ae7f44dc19 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1919.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1919.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Component; @@ -8,7 +8,7 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1919 extends com.vaadin.LegacyApplication { +public class Ticket1919 extends com.vaadin.Application { private GridLayout lo; private boolean on = true; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1921.java b/uitest/src/com/vaadin/tests/tickets/Ticket1921.java index 6f525a1bfc..33be859fec 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1921.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1921.java @@ -3,7 +3,7 @@ package com.vaadin.tests.tickets; import java.io.IOException; import java.util.Map; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.RequestHandler; import com.vaadin.server.VaadinSession; import com.vaadin.server.WrappedRequest; @@ -14,7 +14,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1921 extends LegacyApplication implements +public class Ticket1921 extends Application implements RequestHandler { int state = -1; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1923.java b/uitest/src/com/vaadin/tests/tickets/Ticket1923.java index fde8fa0638..32c4adeff9 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1923.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1923.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1923 extends com.vaadin.LegacyApplication { +public class Ticket1923 extends com.vaadin.Application { private static final int ROWS = 50; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1925.java b/uitest/src/com/vaadin/tests/tickets/Ticket1925.java index ccf21c7206..8e0b65bb6e 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1925.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1925.java @@ -1,9 +1,9 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1925 extends LegacyApplication { +public class Ticket1925 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1939.java b/uitest/src/com/vaadin/tests/tickets/Ticket1939.java index 6abfc730b6..ee349c79e1 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1939.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1939.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket1939 extends LegacyApplication { +public class Ticket1939 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1940.java b/uitest/src/com/vaadin/tests/tickets/Ticket1940.java index 11f4cfe40d..5d5b9c4918 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1940.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1940.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket1940 extends LegacyApplication { +public class Ticket1940 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1953.java b/uitest/src/com/vaadin/tests/tickets/Ticket1953.java index 3824f1f662..8fd62b8a2b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1953.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1953.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1953 extends LegacyApplication { +public class Ticket1953 extends Application { public static final String cellStyle = "test-cell"; public static final String colHeadStyle = "test-col-head"; public static final String headingStyle = "test-heading"; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1966.java b/uitest/src/com/vaadin/tests/tickets/Ticket1966.java index 461923da9c..ebd04a8857 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1966.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1966.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; @@ -12,7 +12,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1966 extends LegacyApplication { +public class Ticket1966 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1966_2.java b/uitest/src/com/vaadin/tests/tickets/Ticket1966_2.java index 8a5641d05c..12b17a4601 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1966_2.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1966_2.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; @@ -12,7 +12,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket1966_2 extends LegacyApplication { +public class Ticket1966_2 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1966_3.java b/uitest/src/com/vaadin/tests/tickets/Ticket1966_3.java index c27e81f0c7..577ca463bc 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1966_3.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1966_3.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ThemeResource; import com.vaadin.server.UserError; import com.vaadin.ui.Alignment; @@ -10,7 +10,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket1966_3 extends LegacyApplication { +public class Ticket1966_3 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1969.java b/uitest/src/com/vaadin/tests/tickets/Ticket1969.java index df1e40e1eb..04cd11ce72 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1969.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1969.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.UserError; import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; import com.vaadin.ui.Button; @@ -11,7 +11,7 @@ import com.vaadin.ui.TabSheet; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket1969 extends com.vaadin.LegacyApplication { +public class Ticket1969 extends com.vaadin.Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1970.java b/uitest/src/com/vaadin/tests/tickets/Ticket1970.java index 135d21ca36..839e9e683c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1970.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1970.java @@ -2,14 +2,14 @@ package com.vaadin.tests.tickets; import java.util.Iterator; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1970 extends LegacyApplication { +public class Ticket1970 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1972.java b/uitest/src/com/vaadin/tests/tickets/Ticket1972.java index 2d73edf487..0de827bfd2 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1972.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1972.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1972 extends LegacyApplication { +public class Ticket1972 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1973.java b/uitest/src/com/vaadin/tests/tickets/Ticket1973.java index 2e77e0e594..b91d8dfee3 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1973.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1973.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.data.util.IndexedContainer; import com.vaadin.ui.Button; @@ -9,7 +9,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket1973 extends com.vaadin.LegacyApplication { +public class Ticket1973 extends com.vaadin.Application { LegacyWindow main = new LegacyWindow(); Table table = new Table(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1973_2.java b/uitest/src/com/vaadin/tests/tickets/Ticket1973_2.java index eca5e69a69..9ea740b546 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1973_2.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1973_2.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.data.util.IndexedContainer; import com.vaadin.ui.Button; @@ -9,7 +9,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket1973_2 extends LegacyApplication { +public class Ticket1973_2 extends Application { LegacyWindow main = new LegacyWindow(); Table table = new Table(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java index 117f99883c..93ecf4b6eb 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1975.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1975.java @@ -4,7 +4,7 @@ import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.WrappedRequest; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -14,7 +14,7 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.util.CurrentInstance; -public class Ticket1975 extends LegacyApplication { +public class Ticket1975 extends Application { private CustomLayout cl1; private CustomLayout cl2; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1982.java b/uitest/src/com/vaadin/tests/tickets/Ticket1982.java index 55e95f0eb3..433dce1bfb 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1982.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1982.java @@ -3,7 +3,7 @@ package com.vaadin.tests.tickets; import java.util.ArrayList; import java.util.List; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -12,7 +12,7 @@ import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket1982 extends LegacyApplication { +public class Ticket1982 extends Application { private List components = new ArrayList(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1983.java b/uitest/src/com/vaadin/tests/tickets/Ticket1983.java index 7f728b2ab5..2e38c7c1b1 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1983.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1983.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.data.util.IndexedContainer; @@ -16,7 +16,7 @@ import com.vaadin.ui.VerticalLayout; /** * Test class for ticket 1983 */ -public class Ticket1983 extends LegacyApplication { +public class Ticket1983 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1986.java b/uitest/src/com/vaadin/tests/tickets/Ticket1986.java index df1c640795..dc452e1664 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1986.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1986.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.ComboBox; import com.vaadin.ui.DateField; @@ -12,7 +12,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.TwinColSelect; -public class Ticket1986 extends LegacyApplication { +public class Ticket1986 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1991.java b/uitest/src/com/vaadin/tests/tickets/Ticket1991.java index 1dad9e0b55..ef3b4c73e8 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1991.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1991.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.CheckBox; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; -public class Ticket1991 extends com.vaadin.LegacyApplication { +public class Ticket1991 extends com.vaadin.Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1995.java b/uitest/src/com/vaadin/tests/tickets/Ticket1995.java index 21ccc28d55..cf628ad806 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1995.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1995.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Container; import com.vaadin.data.Container.Filterable; import com.vaadin.data.Item; @@ -10,7 +10,7 @@ import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; -public class Ticket1995 extends LegacyApplication { +public class Ticket1995 extends Application { private static final Object PROPERTY_1 = "Test"; private Table table; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket20.java b/uitest/src/com/vaadin/tests/tickets/Ticket20.java index cb391395b1..e8ea84c96d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket20.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket20.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Validator; import com.vaadin.data.util.MethodProperty; import com.vaadin.data.validator.CompositeValidator; @@ -11,7 +11,7 @@ import com.vaadin.ui.CheckBox; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket20 extends LegacyApplication { +public class Ticket20 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2001.java b/uitest/src/com/vaadin/tests/tickets/Ticket2001.java index f8e9154c42..447d0e671c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2001.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2001.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.ui.CheckBox; @@ -8,7 +8,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2001 extends LegacyApplication { +public class Ticket2001 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2002.java b/uitest/src/com/vaadin/tests/tickets/Ticket2002.java index 4be6577aaa..148d7e67ef 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2002.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2002.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.util.MethodProperty; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2002 extends LegacyApplication { +public class Ticket2002 extends Application { private Long long1 = new Long(1L); private Long long2 = new Long(2L); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2007.java b/uitest/src/com/vaadin/tests/tickets/Ticket2007.java index d97444d5c7..4b64cc33d2 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2007.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2007.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ExternalResource; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2007 extends LegacyApplication { +public class Ticket2007 extends Application { int childs = 0; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2009.java b/uitest/src/com/vaadin/tests/tickets/Ticket2009.java index 1e79eaab39..a3517fdf76 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2009.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2009.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Container; import com.vaadin.event.ItemClickEvent; import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; @@ -16,7 +16,7 @@ import com.vaadin.ui.Tree; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; -public class Ticket2009 extends com.vaadin.LegacyApplication { +public class Ticket2009 extends com.vaadin.Application { TextField f = new TextField(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2011.java b/uitest/src/com/vaadin/tests/tickets/Ticket2011.java index 708b5758ad..65634de549 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2011.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2011.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Select; -public class Ticket2011 extends LegacyApplication { +public class Ticket2011 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2014.java b/uitest/src/com/vaadin/tests/tickets/Ticket2014.java index 1398feca2b..bf05b8bb14 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2014.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2014.java @@ -2,7 +2,7 @@ package com.vaadin.tests.tickets; import java.util.UUID; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -11,7 +11,7 @@ import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2014 extends LegacyApplication { +public class Ticket2014 extends Application { private HorizontalLayout innerLayout1; private Button b1; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2021.java b/uitest/src/com/vaadin/tests/tickets/Ticket2021.java index 7bbdc1637c..8ebf41bbe4 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2021.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2021.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; @@ -15,7 +15,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextArea; import com.vaadin.ui.VerticalLayout; -public class Ticket2021 extends LegacyApplication { +public class Ticket2021 extends Application { private TextArea tf1, tf2, tf3; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2022.java b/uitest/src/com/vaadin/tests/tickets/Ticket2022.java index a5737a0fbf..523e1b7f7d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2022.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2022.java @@ -1,10 +1,10 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.CustomLayout; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2022 extends LegacyApplication { +public class Ticket2022 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2023.java b/uitest/src/com/vaadin/tests/tickets/Ticket2023.java index 0e52b932b7..a336f18428 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2023.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2023.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2023 extends com.vaadin.LegacyApplication +public class Ticket2023 extends com.vaadin.Application implements Button.ClickListener { AbstractComponent c = new Button(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2024.java b/uitest/src/com/vaadin/tests/tickets/Ticket2024.java index e7201aaf89..4ef8c2fa89 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2024.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2024.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket2024 extends LegacyApplication { +public class Ticket2024 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2026.java b/uitest/src/com/vaadin/tests/tickets/Ticket2026.java index c96404bf53..9528f2c56b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2026.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2026.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2026 extends LegacyApplication { +public class Ticket2026 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2029.java b/uitest/src/com/vaadin/tests/tickets/Ticket2029.java index 7859ccc642..bf11aa312a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2029.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2029.java @@ -2,7 +2,7 @@ package com.vaadin.tests.tickets; import java.util.Random; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.server.UserError; @@ -16,7 +16,7 @@ import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket2029 extends LegacyApplication { +public class Ticket2029 extends Application { int COMPONENTS; int DIM1, DIM2; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2037.java b/uitest/src/com/vaadin/tests/tickets/Ticket2037.java index a02432202e..f39e6a2845 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2037.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2037.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; @@ -8,7 +8,7 @@ import com.vaadin.ui.Layout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2037 extends com.vaadin.LegacyApplication { +public class Ticket2037 extends com.vaadin.Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2038.java b/uitest/src/com/vaadin/tests/tickets/Ticket2038.java index 03e7861a90..db01fae34f 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2038.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2038.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.ui.CheckBox; @@ -8,7 +8,7 @@ import com.vaadin.ui.Notification; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2038 extends LegacyApplication { +public class Ticket2038 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2040.java b/uitest/src/com/vaadin/tests/tickets/Ticket2040.java index be3e7b0c39..2c30f666dc 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2040.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2040.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Accordion; import com.vaadin.ui.Label; import com.vaadin.ui.Layout.MarginHandler; @@ -8,7 +8,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; -public class Ticket2040 extends com.vaadin.LegacyApplication { +public class Ticket2040 extends com.vaadin.Application { TextField f = new TextField(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2042.java b/uitest/src/com/vaadin/tests/tickets/Ticket2042.java index c96dd52183..2cb9e103d6 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2042.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2042.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -9,7 +9,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Notification; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2042 extends LegacyApplication { +public class Ticket2042 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2043.java b/uitest/src/com/vaadin/tests/tickets/Ticket2043.java index d3d984c8be..84e7167164 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2043.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2043.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ExternalResource; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Link; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2043 extends LegacyApplication { +public class Ticket2043 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2048.java b/uitest/src/com/vaadin/tests/tickets/Ticket2048.java index 05ca9c4526..4d9454341a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2048.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2048.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ThemeResource; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -13,7 +13,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2048 extends LegacyApplication { +public class Ticket2048 extends Application { private Embedded embedded; private Panel p; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2051.java b/uitest/src/com/vaadin/tests/tickets/Ticket2051.java index d536db0e14..b1c2666808 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2051.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2051.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.ui.Button; import com.vaadin.ui.Component; @@ -11,7 +11,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.TextField; -public class Ticket2051 extends LegacyApplication { +public class Ticket2051 extends Application { private static final Object P1 = new Object(); private static final Object P2 = new Object(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2053.java b/uitest/src/com/vaadin/tests/tickets/Ticket2053.java index ae0ba0c315..33c1313e20 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2053.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2053.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.server.ExternalResource; @@ -10,7 +10,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2053 extends LegacyApplication { +public class Ticket2053 extends Application { int childs = 0; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2060.java b/uitest/src/com/vaadin/tests/tickets/Ticket2060.java index a461264237..de5f44d0e8 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2060.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2060.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -8,7 +8,7 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2060 extends LegacyApplication { +public class Ticket2060 extends Application { private Button button1; private Button button2; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2061.java b/uitest/src/com/vaadin/tests/tickets/Ticket2061.java index a2f599f139..54f1d22a45 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2061.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2061.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; @@ -13,7 +13,7 @@ import com.vaadin.ui.TabSheet; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket2061 extends LegacyApplication { +public class Ticket2061 extends Application { private LegacyWindow mainWindow; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2061b.java b/uitest/src/com/vaadin/tests/tickets/Ticket2061b.java index 0b76d2e83a..402b1c195c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2061b.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2061b.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; @@ -21,7 +21,7 @@ import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalSplitPanel; -public class Ticket2061b extends LegacyApplication implements +public class Ticket2061b extends Application implements SelectedTabChangeListener { private LegacyWindow mainWindow; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2061c.java b/uitest/src/com/vaadin/tests/tickets/Ticket2061c.java index 2af686ced0..14f1a3b6ea 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2061c.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2061c.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; @@ -17,7 +17,7 @@ import com.vaadin.ui.TabSheet.SelectedTabChangeListener; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket2061c extends LegacyApplication implements +public class Ticket2061c extends Application implements SelectedTabChangeListener { private LegacyWindow mainWindow; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2062.java b/uitest/src/com/vaadin/tests/tickets/Ticket2062.java index 12149e6eda..24122b7dee 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2062.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2062.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.HorizontalSplitPanel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TabSheet; import com.vaadin.ui.Table; import com.vaadin.ui.TextField; -public class Ticket2062 extends LegacyApplication { +public class Ticket2062 extends Application { private static final Object P1 = new Object(); @Override diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2083.java b/uitest/src/com/vaadin/tests/tickets/Ticket2083.java index 061fb47f76..69583ce367 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2083.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2083.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2083 extends LegacyApplication { +public class Ticket2083 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2090.java b/uitest/src/com/vaadin/tests/tickets/Ticket2090.java index 50deab7a8a..786d922973 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2090.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2090.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.server.UserError; @@ -9,7 +9,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2090 extends LegacyApplication { +public class Ticket2090 extends Application { Label label = new Label(); Button target = new Button(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2095.java b/uitest/src/com/vaadin/tests/tickets/Ticket2095.java index 701c306c19..c0152a1fc9 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2095.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2095.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ExternalResource; import com.vaadin.ui.Embedded; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2095 extends LegacyApplication { +public class Ticket2095 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2098.java b/uitest/src/com/vaadin/tests/tickets/Ticket2098.java index 6db08f5063..a4ba5b0595 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2098.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2098.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TabSheet; -public class Ticket2098 extends LegacyApplication { +public class Ticket2098 extends Application { private static final String info = "First tab hidden, second should initially be selected"; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2099.java b/uitest/src/com/vaadin/tests/tickets/Ticket2099.java index 08acda39f2..f5e36a1650 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2099.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2099.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -11,7 +11,7 @@ import com.vaadin.ui.TabSheet; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; -public class Ticket2099 extends LegacyApplication { +public class Ticket2099 extends Application { private Label l1, l2, l3; private VerticalLayout ol1, ol2, ol3; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2101.java b/uitest/src/com/vaadin/tests/tickets/Ticket2101.java index c4c6b7320d..c38e4b6ed2 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2101.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2101.java @@ -1,10 +1,10 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2101 extends LegacyApplication { +public class Ticket2101 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2103.java b/uitest/src/com/vaadin/tests/tickets/Ticket2103.java index 43c86efd9d..7dc7d7bf95 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2103.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2103.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.data.util.HierarchicalContainer; import com.vaadin.ui.Accordion; @@ -9,7 +9,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket2103 extends LegacyApplication { +public class Ticket2103 extends Application { private LegacyWindow mainWindow; @Override diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2104.java b/uitest/src/com/vaadin/tests/tickets/Ticket2104.java index cb1173d6e9..f3fb936c9a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2104.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2104.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.data.util.MethodProperty; @@ -15,7 +15,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.Tree; -public class Ticket2104 extends LegacyApplication { +public class Ticket2104 extends Application { private static final Label info = new Label( "Click event should _always_ come trough. Switching features on/off should immediatly affect the tree (verify w/ debug window)", diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2106.java b/uitest/src/com/vaadin/tests/tickets/Ticket2106.java index 569d4fe30f..f509a082e1 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2106.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2106.java @@ -2,7 +2,7 @@ package com.vaadin.tests.tickets; import java.util.Date; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.CustomizedSystemMessages; import com.vaadin.server.SystemMessages; import com.vaadin.ui.Button; @@ -10,7 +10,7 @@ import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2106 extends LegacyApplication { +public class Ticket2106 extends Application { private static CustomizedSystemMessages msgs = new CustomizedSystemMessages(); static { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2107.java b/uitest/src/com/vaadin/tests/tickets/Ticket2107.java index 553221a874..c6dd33fdd9 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2107.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2107.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Validator; @@ -9,7 +9,7 @@ import com.vaadin.ui.Notification; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2107 extends LegacyApplication { +public class Ticket2107 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2117.java b/uitest/src/com/vaadin/tests/tickets/Ticket2117.java index 24aec36422..e4365c3edb 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2117.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2117.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ExternalResource; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Button; @@ -9,7 +9,7 @@ import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2117 extends LegacyApplication { +public class Ticket2117 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2119.java b/uitest/src/com/vaadin/tests/tickets/Ticket2119.java index 81bba1d6c8..9c02eef318 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2119.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2119.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.util.ObjectProperty; import com.vaadin.server.ExternalResource; @@ -15,7 +15,7 @@ import com.vaadin.ui.VerticalLayout; /** * Test case for Ticket 2119. */ -public class Ticket2119 extends LegacyApplication { +public class Ticket2119 extends Application { private ObjectProperty globalValue; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2125.java b/uitest/src/com/vaadin/tests/tickets/Ticket2125.java index 5101b6d46b..8b65bc6b0d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2125.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2125.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.util.MethodProperty; import com.vaadin.ui.CheckBox; import com.vaadin.ui.Component; @@ -10,7 +10,7 @@ import com.vaadin.ui.Table.CellStyleGenerator; import com.vaadin.ui.Table.ColumnGenerator; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2125 extends LegacyApplication { +public class Ticket2125 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2126.java b/uitest/src/com/vaadin/tests/tickets/Ticket2126.java index 6121832da6..02644d8a67 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2126.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2126.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.data.util.IndexedContainer; import com.vaadin.ui.Button; @@ -15,7 +15,7 @@ import com.vaadin.ui.Table; * client. * */ -public class Ticket2126 extends com.vaadin.LegacyApplication { +public class Ticket2126 extends com.vaadin.Application { LegacyWindow main = new LegacyWindow(); Table table = new Table(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2151.java b/uitest/src/com/vaadin/tests/tickets/Ticket2151.java index 1606218b88..13611bf16c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2151.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2151.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.util.ObjectProperty; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.AbstractField; @@ -10,7 +10,7 @@ import com.vaadin.ui.CheckBox; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2151 extends LegacyApplication { +public class Ticket2151 extends Application { private Label status; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2157.java b/uitest/src/com/vaadin/tests/tickets/Ticket2157.java index bbd4dcf192..423183bddf 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2157.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2157.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.ComboBox; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2157 extends LegacyApplication { +public class Ticket2157 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2178.java b/uitest/src/com/vaadin/tests/tickets/Ticket2178.java index 897ffaaf1b..33b5177935 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2178.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2178.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.ComboBox; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2178 extends LegacyApplication { +public class Ticket2178 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2179.java b/uitest/src/com/vaadin/tests/tickets/Ticket2179.java index 1bfa5c2beb..9894baa00b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2179.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2179.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Validator; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2179 extends LegacyApplication { +public class Ticket2179 extends Application { TextField f = new TextField("Test fiel ( must contain 1 & 2 )"); LegacyWindow main = new LegacyWindow("Dual validator test"); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2180.java b/uitest/src/com/vaadin/tests/tickets/Ticket2180.java index 1629db4737..4de46eff3a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2180.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2180.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TabSheet; -public class Ticket2180 extends LegacyApplication { +public class Ticket2180 extends Application { private LegacyWindow mainWindow; private TabSheet tabSheet; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2181.java b/uitest/src/com/vaadin/tests/tickets/Ticket2181.java index 892505306a..cc9fa442c9 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2181.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2181.java @@ -5,7 +5,7 @@ import java.util.Date; import java.util.Random; import java.util.Set; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ThemeResource; import com.vaadin.server.UserError; import com.vaadin.ui.Button; @@ -16,7 +16,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket2181 extends LegacyApplication implements +public class Ticket2181 extends Application implements Button.ClickListener { // private static final Object PROPERTY_VALUE = new Object(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2186.java b/uitest/src/com/vaadin/tests/tickets/Ticket2186.java index 27bec589d0..ed1873b9f8 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2186.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2186.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; @@ -8,7 +8,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; -public class Ticket2186 extends LegacyApplication { +public class Ticket2186 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2204.java b/uitest/src/com/vaadin/tests/tickets/Ticket2204.java index f9591d19fa..f7116348fd 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2204.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2204.java @@ -5,7 +5,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.data.util.BeanItem; import com.vaadin.ui.AbstractOrderedLayout; @@ -31,7 +31,7 @@ import com.vaadin.ui.TabSheet; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalSplitPanel; -public class Ticket2204 extends LegacyApplication { +public class Ticket2204 extends Application { private final List textAreas = new ArrayList(); private TabSheet ts; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2208.java b/uitest/src/com/vaadin/tests/tickets/Ticket2208.java index c517e50070..c8c1eba9d7 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2208.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2208.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.ui.Component; import com.vaadin.ui.Label; @@ -9,7 +9,7 @@ import com.vaadin.ui.Table.CellStyleGenerator; import com.vaadin.ui.Table.ColumnGenerator; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2208 extends LegacyApplication { +public class Ticket2208 extends Application { private Table t; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2209.java b/uitest/src/com/vaadin/tests/tickets/Ticket2209.java index 6dc1e7bd71..9e84b82a0f 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2209.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2209.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -9,7 +9,7 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2209 extends LegacyApplication { +public class Ticket2209 extends Application { private GridLayout gl; private ComboBox combo; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2209OL.java b/uitest/src/com/vaadin/tests/tickets/Ticket2209OL.java index 55b7a17c89..76ce659370 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2209OL.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2209OL.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -9,7 +9,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2209OL extends LegacyApplication { +public class Ticket2209OL extends Application { private VerticalLayout gl; private ComboBox combo; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2209OL2.java b/uitest/src/com/vaadin/tests/tickets/Ticket2209OL2.java index 9615b6f249..63947d91fb 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2209OL2.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2209OL2.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -9,7 +9,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2209OL2 extends LegacyApplication { +public class Ticket2209OL2 extends Application { private VerticalLayout gl; private ComboBox combo; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2215.java b/uitest/src/com/vaadin/tests/tickets/Ticket2215.java index 6dfcf9d344..1a9e4382d7 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2215.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2215.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.themes.Reindeer; -public class Ticket2215 extends LegacyApplication { +public class Ticket2215 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2221.java b/uitest/src/com/vaadin/tests/tickets/Ticket2221.java index 8fc62800e0..4677995119 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2221.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2221.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -13,7 +13,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket2221 extends LegacyApplication { +public class Ticket2221 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2222.java b/uitest/src/com/vaadin/tests/tickets/Ticket2222.java index e46477e4de..c0b56f14c2 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2222.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2222.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; @@ -8,7 +8,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2222 extends LegacyApplication { +public class Ticket2222 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2227OrderedlayoutInTable.java b/uitest/src/com/vaadin/tests/tickets/Ticket2227OrderedlayoutInTable.java index 5ef06379e0..56bdc7782d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2227OrderedlayoutInTable.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2227OrderedlayoutInTable.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.ui.Component; import com.vaadin.ui.Label; @@ -10,7 +10,7 @@ import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; public class Ticket2227OrderedlayoutInTable extends - LegacyApplication { + Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2231.java b/uitest/src/com/vaadin/tests/tickets/Ticket2231.java index 935c34fec2..c26c08c0bd 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2231.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2231.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2231 extends LegacyApplication { +public class Ticket2231 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2232.java b/uitest/src/com/vaadin/tests/tickets/Ticket2232.java index 4aa1b948a5..48b4765c0a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2232.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2232.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; @@ -9,7 +9,7 @@ import com.vaadin.ui.Layout.SpacingHandler; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2232 extends LegacyApplication { +public class Ticket2232 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2234.java b/uitest/src/com/vaadin/tests/tickets/Ticket2234.java index dcc3f90696..a66164043a 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2234.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2234.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.ComboBox; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2234 extends LegacyApplication { +public class Ticket2234 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2235.java b/uitest/src/com/vaadin/tests/tickets/Ticket2235.java index 2587937cbc..9126b9916b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2235.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2235.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextArea; -public class Ticket2235 extends LegacyApplication { +public class Ticket2235 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2240.java b/uitest/src/com/vaadin/tests/tickets/Ticket2240.java index 27235c1afb..5f9a005af0 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2240.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2240.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2240 extends LegacyApplication { +public class Ticket2240 extends Application { public static final String txt = "

    There are two main types of windows: application-level windows, and " + "\"sub windows\".

    A sub window is rendered as a \"inline\" popup window" diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2242.java b/uitest/src/com/vaadin/tests/tickets/Ticket2242.java index d0191d3d13..e49920a4d1 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2242.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2242.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; @@ -13,7 +13,7 @@ import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; -public class Ticket2242 extends LegacyApplication implements +public class Ticket2242 extends Application implements ValueChangeListener { private Object tableValue = null; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2244.java b/uitest/src/com/vaadin/tests/tickets/Ticket2244.java index 5b46e0332d..e65e826a53 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2244.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2244.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.util.BeanItem; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -10,7 +10,7 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2244 extends LegacyApplication { +public class Ticket2244 extends Application { Form form; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2245.java b/uitest/src/com/vaadin/tests/tickets/Ticket2245.java index 09d2e7a678..c62ccd0395 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2245.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2245.java @@ -1,10 +1,10 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.HorizontalSplitPanel; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2245 extends LegacyApplication { +public class Ticket2245 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2267.java b/uitest/src/com/vaadin/tests/tickets/Ticket2267.java index 1a8e743f42..0cedac4490 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2267.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2267.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -8,7 +8,7 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2267 extends LegacyApplication { +public class Ticket2267 extends Application { Label l = new Label("0"); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2271.java b/uitest/src/com/vaadin/tests/tickets/Ticket2271.java index 71f47be1b3..c784385e93 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2271.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2271.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; import com.vaadin.ui.ComboBox; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2271 extends LegacyApplication { +public class Ticket2271 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2282.java b/uitest/src/com/vaadin/tests/tickets/Ticket2282.java index 8f6da9ffc5..b805f2403c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2282.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2282.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.FormLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2282 extends LegacyApplication { +public class Ticket2282 extends Application { private FormLayout layout1; private FormLayout layout2; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2283.java b/uitest/src/com/vaadin/tests/tickets/Ticket2283.java index daac9ae704..3a174bf9cf 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2283.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2283.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Alignment; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2283 extends LegacyApplication { +public class Ticket2283 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2289.java b/uitest/src/com/vaadin/tests/tickets/Ticket2289.java index 9d7bc32d2b..fc7e5feadf 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2289.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2289.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Accordion; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -11,7 +11,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TabSheet; import com.vaadin.ui.VerticalLayout; -public class Ticket2289 extends LegacyApplication { +public class Ticket2289 extends Application { TabSheet ts = null; Accordion acc = null; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2292.java b/uitest/src/com/vaadin/tests/tickets/Ticket2292.java index 0f663d78f5..adafa93a75 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2292.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2292.java @@ -9,7 +9,7 @@ import java.io.IOException; import javax.imageio.ImageIO; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.DownloadStream; import com.vaadin.server.ExternalResource; import com.vaadin.server.RequestHandler; @@ -22,7 +22,7 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Link; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2292 extends com.vaadin.LegacyApplication +public class Ticket2292 extends com.vaadin.Application implements RequestHandler { @Override diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2294.java b/uitest/src/com/vaadin/tests/tickets/Ticket2294.java index cfa5ecdd61..e8b36596fc 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2294.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2294.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Alignment; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2294 extends LegacyApplication { +public class Ticket2294 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2296.java b/uitest/src/com/vaadin/tests/tickets/Ticket2296.java index 2a19899425..d274151b63 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2296.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2296.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.CustomLayout; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2296 extends LegacyApplication { +public class Ticket2296 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2303.java b/uitest/src/com/vaadin/tests/tickets/Ticket2303.java index dd6a3886ac..b32828abfb 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2303.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2303.java @@ -3,13 +3,13 @@ package com.vaadin.tests.tickets; import java.io.ByteArrayInputStream; import java.io.IOException; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.CustomLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2303 extends LegacyApplication { +public class Ticket2303 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2304.java b/uitest/src/com/vaadin/tests/tickets/Ticket2304.java index 84321b88f3..6d404643aa 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2304.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2304.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.themes.Reindeer; -public class Ticket2304 extends LegacyApplication { +public class Ticket2304 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2310.java b/uitest/src/com/vaadin/tests/tickets/Ticket2310.java index 99d10ff36d..f66b5dcc18 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2310.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2310.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; @@ -8,7 +8,7 @@ import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.themes.Reindeer; -public class Ticket2310 extends LegacyApplication { +public class Ticket2310 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2319.java b/uitest/src/com/vaadin/tests/tickets/Ticket2319.java index dd0a54dc63..bb0ceb5629 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2319.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2319.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.HorizontalSplitPanel; @@ -10,7 +10,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalSplitPanel; -public class Ticket2319 extends LegacyApplication { +public class Ticket2319 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2323.java b/uitest/src/com/vaadin/tests/tickets/Ticket2323.java index eba7f2b06d..db33c6f6a6 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2323.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2323.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.RichTextArea; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Window; -public class Ticket2323 extends LegacyApplication { +public class Ticket2323 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2325.java b/uitest/src/com/vaadin/tests/tickets/Ticket2325.java index f63226d465..cd8239d542 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2325.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2325.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextArea; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; -public class Ticket2325 extends LegacyApplication { +public class Ticket2325 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2329.java b/uitest/src/com/vaadin/tests/tickets/Ticket2329.java index c3daa680aa..c575aebb32 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2329.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2329.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Component; import com.vaadin.ui.UI.LegacyWindow; @@ -8,7 +8,7 @@ import com.vaadin.ui.Table; import com.vaadin.ui.Table.ColumnGenerator; import com.vaadin.ui.VerticalLayout; -public class Ticket2329 extends LegacyApplication { +public class Ticket2329 extends Application { private Table table; private VerticalLayout mainLo; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2337.java b/uitest/src/com/vaadin/tests/tickets/Ticket2337.java index b2ad360bf8..cc99796588 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2337.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2337.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2337 extends LegacyApplication { +public class Ticket2337 extends Application { GridLayout gl = new GridLayout(3, 1); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2339.java b/uitest/src/com/vaadin/tests/tickets/Ticket2339.java index e1eb9ed5c4..fb535cbce7 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2339.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2339.java @@ -3,12 +3,12 @@ package com.vaadin.tests.tickets; import java.io.ByteArrayInputStream; import java.io.IOException; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.CustomLayout; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2339 extends LegacyApplication { +public class Ticket2339 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2341.java b/uitest/src/com/vaadin/tests/tickets/Ticket2341.java index 560b945479..3e4d739413 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2341.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2341.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Item; import com.vaadin.ui.Label; import com.vaadin.ui.Layout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; -public class Ticket2341 extends com.vaadin.LegacyApplication { +public class Ticket2341 extends com.vaadin.Application { @Override public void init() { LegacyWindow main = new LegacyWindow(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2344.java b/uitest/src/com/vaadin/tests/tickets/Ticket2344.java index bf1296ec73..ffc91c60d7 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2344.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2344.java @@ -2,14 +2,14 @@ package com.vaadin.tests.tickets; import java.util.Random; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.themes.BaseTheme; -public class Ticket2344 extends LegacyApplication { +public class Ticket2344 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2347.java b/uitest/src/com/vaadin/tests/tickets/Ticket2347.java index 393aebf2ad..2aa3eccc32 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2347.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2347.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -8,7 +8,7 @@ import com.vaadin.ui.CustomLayout; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2347 extends LegacyApplication { +public class Ticket2347 extends Application { private Button b1; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2364.java b/uitest/src/com/vaadin/tests/tickets/Ticket2364.java index e7d9e19ab4..e37ed6e782 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2364.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2364.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Form; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Select; import com.vaadin.ui.VerticalLayout; -public class Ticket2364 extends LegacyApplication { +public class Ticket2364 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2365.java b/uitest/src/com/vaadin/tests/tickets/Ticket2365.java index 8361b0b308..b2737ed3aa 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2365.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2365.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; -public class Ticket2365 extends LegacyApplication { +public class Ticket2365 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2398.java b/uitest/src/com/vaadin/tests/tickets/Ticket2398.java index 66fbcd0c96..276006ef5b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2398.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2398.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.util.IndexedContainer; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; -public class Ticket2398 extends LegacyApplication { +public class Ticket2398 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2404.java b/uitest/src/com/vaadin/tests/tickets/Ticket2404.java index b26cfc027a..8b86c6b0b5 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2404.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2404.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2404 extends LegacyApplication { +public class Ticket2404 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2405.java b/uitest/src/com/vaadin/tests/tickets/Ticket2405.java index 57ed8e86fe..e36d3e24a4 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2405.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2405.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.ExternalResource; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; @@ -13,7 +13,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket2405 extends LegacyApplication { +public class Ticket2405 extends Application { private Label label; private HorizontalSplitPanel split; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2406.java b/uitest/src/com/vaadin/tests/tickets/Ticket2406.java index a6ef9be77a..c14c655cd1 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2406.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2406.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; @@ -8,7 +8,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; -public class Ticket2406 extends LegacyApplication { +public class Ticket2406 extends Application { private Window w; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2407.java b/uitest/src/com/vaadin/tests/tickets/Ticket2407.java index 91c92ac07a..6f9c3c9ac8 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2407.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2407.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Form; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket2407 extends com.vaadin.LegacyApplication { +public class Ticket2407 extends com.vaadin.Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2411.java b/uitest/src/com/vaadin/tests/tickets/Ticket2411.java index b9784d6941..a73b7fab95 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2411.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2411.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2411 extends LegacyApplication { +public class Ticket2411 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2415.java b/uitest/src/com/vaadin/tests/tickets/Ticket2415.java index c5d1500876..f58fa51b6d 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2415.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2415.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket2415 extends LegacyApplication { +public class Ticket2415 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2420.java b/uitest/src/com/vaadin/tests/tickets/Ticket2420.java index d1ecfab9be..bc14a7291f 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2420.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2420.java @@ -1,10 +1,10 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.ProgressIndicator; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2420 extends LegacyApplication { +public class Ticket2420 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2425.java b/uitest/src/com/vaadin/tests/tickets/Ticket2425.java index ba4c0b508b..47127c4b55 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2425.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2425.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TabSheet; -public class Ticket2425 extends LegacyApplication { +public class Ticket2425 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2426.java b/uitest/src/com/vaadin/tests/tickets/Ticket2426.java index a8f2cf9e02..b48d8164c9 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2426.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2426.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2426 extends LegacyApplication { +public class Ticket2426 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2431.java b/uitest/src/com/vaadin/tests/tickets/Ticket2431.java index 5db59ab45c..4bf17c9668 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2431.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2431.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; import com.vaadin.event.ShortcutAction; @@ -9,7 +9,7 @@ import com.vaadin.event.ShortcutAction.ModifierKey; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2431 extends LegacyApplication { +public class Ticket2431 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2432.java b/uitest/src/com/vaadin/tests/tickets/Ticket2432.java index 4a1dfb33bb..d741902619 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2432.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2432.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Alignment; import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; @@ -10,7 +10,7 @@ import com.vaadin.ui.Layout.AlignmentHandler; import com.vaadin.ui.Layout.SpacingHandler; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2432 extends LegacyApplication { +public class Ticket2432 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2434.java b/uitest/src/com/vaadin/tests/tickets/Ticket2434.java index 7d8ba3ae47..2c7a26f44f 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2434.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2434.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; -public class Ticket2434 extends LegacyApplication { +public class Ticket2434 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2436.java b/uitest/src/com/vaadin/tests/tickets/Ticket2436.java index 1445095b1e..bbda394f65 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2436.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2436.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Component; import com.vaadin.ui.PopupView; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket2436 extends LegacyApplication { +public class Ticket2436 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2526.java b/uitest/src/com/vaadin/tests/tickets/Ticket2526.java index f340dd7e80..a61d012f43 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2526.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2526.java @@ -1,12 +1,12 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Window; -public class Ticket2526 extends LegacyApplication { +public class Ticket2526 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2742.java b/uitest/src/com/vaadin/tests/tickets/Ticket2742.java index 6e9dea0363..0947d68c9c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2742.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2742.java @@ -3,7 +3,7 @@ */ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.NativeSelect; import com.vaadin.ui.UI.LegacyWindow; @@ -12,7 +12,7 @@ import com.vaadin.ui.UI.LegacyWindow; * @author Risto Yrjänä / Vaadin Ltd. * */ -public class Ticket2742 extends LegacyApplication { +public class Ticket2742 extends Application { /* * (non-Javadoc) diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2901.java b/uitest/src/com/vaadin/tests/tickets/Ticket2901.java index 23f875a747..63464617da 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2901.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2901.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.VerticalLayout; @@ -11,7 +11,7 @@ import com.vaadin.ui.VerticalSplitPanel; * properly. Scrollbars will disappear if "shaking" content a bit, like * selecting tests in area. */ -public class Ticket2901 extends LegacyApplication { +public class Ticket2901 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2998.java b/uitest/src/com/vaadin/tests/tickets/Ticket2998.java index e089c25349..0646d1bed3 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2998.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2998.java @@ -8,7 +8,7 @@ import java.util.Map; import java.util.Random; import java.util.Set; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Container; import com.vaadin.data.Validator; import com.vaadin.data.util.BeanItemContainer; @@ -38,7 +38,7 @@ import com.vaadin.ui.themes.Reindeer; * * Other browsers are much faster. */ -public class Ticket2998 extends LegacyApplication { +public class Ticket2998 extends Application { private Table table; private VerticalLayout mainLayout; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket3146.java b/uitest/src/com/vaadin/tests/tickets/Ticket3146.java index fe91040f2f..f82400a3b7 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket3146.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket3146.java @@ -3,14 +3,14 @@ package com.vaadin.tests.tickets; import java.util.Collection; import java.util.HashSet; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.TextField; -public class Ticket3146 extends LegacyApplication { +public class Ticket3146 extends Application { Table table; TextField result; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket34.java b/uitest/src/com/vaadin/tests/tickets/Ticket34.java index 394ff0613e..da4cf3ce5c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket34.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket34.java @@ -3,7 +3,7 @@ package com.vaadin.tests.tickets; import java.util.HashMap; import java.util.Map; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.server.Page; import com.vaadin.server.Page.FragmentChangedEvent; import com.vaadin.ui.Button; @@ -15,7 +15,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; -public class Ticket34 extends LegacyApplication { +public class Ticket34 extends Application { private Map views = new HashMap(); private VerticalLayout mainLayout; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket5053.java b/uitest/src/com/vaadin/tests/tickets/Ticket5053.java index b055e63789..e263bf66fd 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket5053.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket5053.java @@ -1,13 +1,13 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.ComboBox; import com.vaadin.ui.UI.LegacyWindow; /** * #5053: Last ComboBox item may not be shown if null selection enabled */ -public class Ticket5053 extends LegacyApplication { +public class Ticket5053 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket5157.java b/uitest/src/com/vaadin/tests/tickets/Ticket5157.java index 0bcd4e60bd..f169431341 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket5157.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket5157.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.event.ShortcutAction.KeyCode; import com.vaadin.event.ShortcutListener; import com.vaadin.ui.Label; @@ -14,7 +14,7 @@ import com.vaadin.ui.TextField; * Therefore, registering e.g. F8 as a key code resulted in "w" being used as * the trigger and F8 being ignored. */ -public class Ticket5157 extends LegacyApplication { +public class Ticket5157 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket5952.java b/uitest/src/com/vaadin/tests/tickets/Ticket5952.java index c240d94f0c..7af3da6990 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket5952.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket5952.java @@ -1,11 +1,11 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket5952 extends LegacyApplication { +public class Ticket5952 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket677.java b/uitest/src/com/vaadin/tests/tickets/Ticket677.java index 6b0ffc02ed..1d95f3945f 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket677.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket677.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Container; import com.vaadin.data.Item; import com.vaadin.data.Property; @@ -21,7 +21,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.Table; import com.vaadin.ui.TextField; -public class Ticket677 extends LegacyApplication { +public class Ticket677 extends Application { private static final Label info = new Label( "

  • keep debug window open to see variable changes" diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket695.java b/uitest/src/com/vaadin/tests/tickets/Ticket695.java index d5f3d74ef0..68031b1fbd 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket695.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket695.java @@ -4,13 +4,13 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI.LegacyWindow; @SuppressWarnings("serial") -public class Ticket695 extends LegacyApplication { +public class Ticket695 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket736.java b/uitest/src/com/vaadin/tests/tickets/Ticket736.java index 865c5483dc..72137500dd 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket736.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket736.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.Validator; import com.vaadin.data.util.BeanItem; import com.vaadin.data.util.MethodProperty; @@ -17,7 +17,7 @@ import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Panel; import com.vaadin.ui.UI.LegacyWindow; -public class Ticket736 extends LegacyApplication { +public class Ticket736 extends Application { Address address = new Address(); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket846.java b/uitest/src/com/vaadin/tests/tickets/Ticket846.java index d498797ef1..a8170148a2 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket846.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket846.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.data.util.MethodProperty; import com.vaadin.data.validator.IntegerValidator; import com.vaadin.ui.Button; @@ -8,7 +8,7 @@ import com.vaadin.ui.CheckBox; import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextField; -public class Ticket846 extends LegacyApplication { +public class Ticket846 extends Application { @Override public void init() { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket932.java b/uitest/src/com/vaadin/tests/tickets/Ticket932.java index d6d6304053..3c5332ff01 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket932.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket932.java @@ -1,6 +1,6 @@ package com.vaadin.tests.tickets; -import com.vaadin.LegacyApplication; +import com.vaadin.Application; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; @@ -8,7 +8,7 @@ import com.vaadin.ui.UI.LegacyWindow; import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; -public class Ticket932 extends LegacyApplication { +public class Ticket932 extends Application { @Override public void init() { -- cgit v1.2.3