summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-09-06 16:58:43 +0300
committerLeif Åstrand <leif@vaadin.com>2012-09-06 17:07:49 +0300
commit4011783ed51dffe80ceb5642c02d65033de6d400 (patch)
tree46f43c481fde0b06c443269f7c84ee180ae48f2e
parenta64b703b2bd714f8ff1c6cfd1b8b89908e502691 (diff)
downloadvaadin-framework-4011783ed51dffe80ceb5642c02d65033de6d400.tar.gz
vaadin-framework-4011783ed51dffe80ceb5642c02d65033de6d400.zip
Remove Application from UIProvider API (#9402)
-rw-r--r--server/src/com/vaadin/Application.java7
-rw-r--r--server/src/com/vaadin/server/AbstractUIProvider.java4
-rw-r--r--server/src/com/vaadin/server/DefaultUIProvider.java8
-rw-r--r--server/src/com/vaadin/server/UIProvider.java7
-rw-r--r--server/src/com/vaadin/server/VaadinSession.java10
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/root/CustomUIClassLoader.java6
-rw-r--r--uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java3
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java7
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java3
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java8
10 files changed, 26 insertions, 37 deletions
diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java
index 121e156da8..d755817896 100644
--- a/server/src/com/vaadin/Application.java
+++ b/server/src/com/vaadin/Application.java
@@ -90,8 +90,7 @@ public abstract class Application extends AbstractUIProvider implements
protected abstract void init();
@Override
- public Class<? extends UI> getUIClass(VaadinSession application,
- WrappedRequest request) {
+ public Class<? extends UI> getUIClass(WrappedRequest request) {
UI uiInstance = getUIInstance(request);
if (uiInstance != null) {
return uiInstance.getClass();
@@ -100,8 +99,8 @@ public abstract class Application extends AbstractUIProvider implements
}
@Override
- public UI createInstance(VaadinSession application,
- Class<? extends UI> type, WrappedRequest request) {
+ public UI createInstance(Class<? extends UI> type,
+ WrappedRequest request) {
return getUIInstance(request);
}
diff --git a/server/src/com/vaadin/server/AbstractUIProvider.java b/server/src/com/vaadin/server/AbstractUIProvider.java
index e93e1a6ae1..321ca75f65 100644
--- a/server/src/com/vaadin/server/AbstractUIProvider.java
+++ b/server/src/com/vaadin/server/AbstractUIProvider.java
@@ -27,8 +27,8 @@ import com.vaadin.ui.UI;
public abstract class AbstractUIProvider implements UIProvider {
@Override
- public UI createInstance(VaadinSession application,
- Class<? extends UI> type, WrappedRequest request) {
+ public UI createInstance(Class<? extends UI> type,
+ WrappedRequest request) {
try {
return type.newInstance();
} catch (InstantiationException e) {
diff --git a/server/src/com/vaadin/server/DefaultUIProvider.java b/server/src/com/vaadin/server/DefaultUIProvider.java
index 0a5613a588..c4a8069269 100644
--- a/server/src/com/vaadin/server/DefaultUIProvider.java
+++ b/server/src/com/vaadin/server/DefaultUIProvider.java
@@ -21,10 +21,10 @@ import com.vaadin.ui.UI;
public class DefaultUIProvider extends AbstractUIProvider {
@Override
- public Class<? extends UI> getUIClass(VaadinSession application,
- WrappedRequest request) {
- Object uiClassNameObj = application.getConfiguration()
- .getInitParameters().getProperty(VaadinSession.UI_PARAMETER);
+ public Class<? extends UI> getUIClass(WrappedRequest request) {
+ Object uiClassNameObj = request.getVaadinService()
+ .getDeploymentConfiguration().getInitParameters()
+ .getProperty(VaadinSession.UI_PARAMETER);
if (uiClassNameObj instanceof String) {
String uiClassName = uiClassNameObj.toString();
diff --git a/server/src/com/vaadin/server/UIProvider.java b/server/src/com/vaadin/server/UIProvider.java
index de68b121f0..752da3aafc 100644
--- a/server/src/com/vaadin/server/UIProvider.java
+++ b/server/src/com/vaadin/server/UIProvider.java
@@ -20,11 +20,10 @@ import com.vaadin.annotations.Widgetset;
import com.vaadin.ui.UI;
public interface UIProvider {
- public Class<? extends UI> getUIClass(VaadinSession application,
- WrappedRequest request);
+ public Class<? extends UI> getUIClass(WrappedRequest request);
- public UI createInstance(VaadinSession application,
- Class<? extends UI> type, WrappedRequest request);
+ public UI createInstance(Class<? extends UI> type,
+ WrappedRequest request);
public String getPageTitleForUI(WrappedRequest request,
Class<? extends UI> uiClass);
diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java
index 094f3501d7..42194b2609 100644
--- a/server/src/com/vaadin/server/VaadinSession.java
+++ b/server/src/com/vaadin/server/VaadinSession.java
@@ -650,7 +650,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
@Deprecated
public Class<? extends UI> getUIClass(WrappedRequest request) {
UIProvider uiProvider = getUiProvider(request, null);
- return uiProvider.getUIClass(this, request);
+ return uiProvider.getUIClass(request);
}
/**
@@ -667,7 +667,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
protected <T extends UI> T createUIInstance(WrappedRequest request,
Class<T> uiClass) {
UIProvider uiProvider = getUiProvider(request, uiClass);
- return uiClass.cast(uiProvider.createInstance(this, uiClass, request));
+ return uiClass.cast(uiProvider.createInstance(uiClass, request));
}
/**
@@ -695,8 +695,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
.getAttribute(UIProvider.class.getName());
if (provider != null) {
// Cached provider found, verify that it's a sensible selection
- Class<? extends UI> providerClass = provider.getUIClass(this,
- request);
+ Class<? extends UI> providerClass = provider.getUIClass(request);
if (uiClass == null && providerClass != null) {
// Use it if it gives any answer if no specific class is
// required
@@ -729,8 +728,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
for (int i = providersSize - 1; i >= 0; i--) {
UIProvider provider = uiProviders.get(i);
- Class<? extends UI> providerClass = provider.getUIClass(this,
- request);
+ Class<? extends UI> providerClass = provider.getUIClass(request);
// If we found something
if (providerClass != null) {
if (uiClass == null) {
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 26e6dd7bd7..b14d3dd2a8 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
@@ -58,8 +58,7 @@ public class CustomUIClassLoader extends TestCase {
createConfigurationMock(), null));
DefaultUIProvider uiProvider = new DefaultUIProvider();
- Class<? extends UI> uiClass = uiProvider.getUIClass(application,
- createRequestMock(null));
+ Class<? extends UI> uiClass = uiProvider.getUIClass(createRequestMock(null));
assertEquals(MyUI.class, uiClass);
}
@@ -102,8 +101,7 @@ public class CustomUIClassLoader extends TestCase {
createConfigurationMock(), null));
DefaultUIProvider uiProvider = new DefaultUIProvider();
- Class<? extends UI> uiClass = uiProvider.getUIClass(application,
- createRequestMock(loggingClassLoader));
+ Class<? extends UI> uiClass = uiProvider.getUIClass(createRequestMock(loggingClassLoader));
assertEquals(MyUI.class, uiClass);
assertEquals(1, loggingClassLoader.requestedClasses.size());
diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
index b483a9fd9d..029bebd9c9 100644
--- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
+++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
@@ -35,7 +35,6 @@ import com.vaadin.server.DeploymentConfiguration;
import com.vaadin.server.LegacyVaadinServlet;
import com.vaadin.server.UIProvider;
import com.vaadin.server.VaadinServletSession;
-import com.vaadin.server.VaadinSession;
import com.vaadin.server.WrappedHttpServletRequest;
import com.vaadin.server.WrappedRequest;
import com.vaadin.tests.components.TestBase;
@@ -122,7 +121,7 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet {
@Override
public Class<? extends UI> getUIClass(
- VaadinSession application, WrappedRequest request) {
+ WrappedRequest request) {
return (Class<? extends UI>) classToRun;
}
});
diff --git a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java
index 5278fb0073..c8c6911c1a 100644
--- a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java
+++ b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java
@@ -20,14 +20,13 @@ public class LazyInitUIs extends AbstractTestUIProvider {
}
@Override
- public UI createInstance(VaadinSession application,
- Class<? extends UI> type, WrappedRequest request) {
+ public UI createInstance(Class<? extends UI> type,
+ WrappedRequest request) {
return getUI(request);
}
@Override
- public Class<? extends UI> getUIClass(VaadinSession application,
- WrappedRequest request) {
+ public Class<? extends UI> getUIClass(WrappedRequest request) {
return getUI(request).getClass();
}
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java b/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java
index 19c85a729d..2d27989dd4 100644
--- a/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java
+++ b/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java
@@ -32,8 +32,7 @@ public class UIsInMultipleTabs extends AbstractTestUIProvider {
}
@Override
- public Class<? extends UI> getUIClass(VaadinSession application,
- WrappedRequest request) {
+ public Class<? extends UI> getUIClass(WrappedRequest request) {
return TabUI.class;
}
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java
index 0cb2587082..5a8d8a8ea1 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java
@@ -17,7 +17,6 @@
package com.vaadin.tests.minitutorials.v7a1;
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,8 +33,7 @@ import com.vaadin.ui.UI;
public class DifferentFeaturesForDifferentClients extends AbstractUIProvider {
@Override
- public Class<? extends UI> getUIClass(VaadinSession application,
- WrappedRequest request) {
+ public Class<? extends UI> getUIClass(WrappedRequest request) {
// could also use browser version etc.
if (request.getHeader("user-agent").contains("mobile")) {
return TouchRoot.class;
@@ -47,8 +45,8 @@ public class DifferentFeaturesForDifferentClients extends AbstractUIProvider {
// Must override as default implementation isn't allowed to
// instantiate our non-public classes
@Override
- public UI createInstance(VaadinSession application,
- Class<? extends UI> type, WrappedRequest request) {
+ public UI createInstance(Class<? extends UI> type,
+ WrappedRequest request) {
try {
return type.newInstance();
} catch (Exception e) {