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();
}
@Override
- public UI createInstance(VaadinSession application,
- Class<? extends UI> type, WrappedRequest request) {
+ public UI createInstance(Class<? extends UI> type,
+ WrappedRequest request) {
return getUIInstance(request);
}
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) {
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();
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);
@Deprecated
public Class<? extends UI> getUIClass(WrappedRequest request) {
UIProvider uiProvider = getUiProvider(request, null);
- return uiProvider.getUIClass(this, request);
+ return uiProvider.getUIClass(request);
}
/**
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));
}
/**
.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
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) {
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);
}
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());
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;
@Override
public Class<? extends UI> getUIClass(
- VaadinSession application, WrappedRequest request) {
+ WrappedRequest request) {
return (Class<? extends UI>) classToRun;
}
});
}
@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();
}
}
@Override
- public Class<? extends UI> getUIClass(VaadinSession application,
- WrappedRequest request) {
+ public Class<? extends UI> getUIClass(WrappedRequest request) {
return TabUI.class;
}
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;
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;
// 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) {