summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-09-11 15:53:39 +0300
committerLeif Åstrand <leif@vaadin.com>2012-09-11 15:54:23 +0300
commit501977762dee21abb14822e5d38f2260a056175e (patch)
treeee79a64ed52c924112b658be7f41838a5139edbe
parentc46f51809a368d3905aeedf0f2a7cef010dc211f (diff)
downloadvaadin-framework-501977762dee21abb14822e5d38f2260a056175e.tar.gz
vaadin-framework-501977762dee21abb14822e5d38f2260a056175e.zip
Tweak UIProvider API based on review (#9443)
-rw-r--r--server/src/com/vaadin/LegacyApplication.java8
-rw-r--r--server/src/com/vaadin/server/AbstractUIProvider.java12
-rw-r--r--server/src/com/vaadin/server/BootstrapHandler.java6
-rw-r--r--server/src/com/vaadin/server/UIProvider.java14
-rw-r--r--server/src/com/vaadin/server/VaadinSession.java4
-rw-r--r--server/src/com/vaadin/ui/UI.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java4
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java4
8 files changed, 27 insertions, 27 deletions
diff --git a/server/src/com/vaadin/LegacyApplication.java b/server/src/com/vaadin/LegacyApplication.java
index a1aeb037fd..ca9b196ff1 100644
--- a/server/src/com/vaadin/LegacyApplication.java
+++ b/server/src/com/vaadin/LegacyApplication.java
@@ -100,24 +100,24 @@ public abstract class LegacyApplication extends AbstractUIProvider implements
}
@Override
- public UI createInstance(Class<? extends UI> type, WrappedRequest request) {
+ public UI createInstance(WrappedRequest request, Class<? extends UI> type) {
return getUIInstance(request);
}
@Override
- public String getThemeForUI(WrappedRequest request,
+ public String getTheme(WrappedRequest request,
Class<? extends UI> uiClass) {
return theme;
}
@Override
- public String getPageTitleForUI(WrappedRequest request,
+ public String getPageTitle(WrappedRequest request,
Class<? extends UI> uiClass) {
UI uiInstance = getUIInstance(request);
if (uiInstance != null) {
return uiInstance.getCaption();
} else {
- return super.getPageTitleForUI(request, uiClass);
+ return super.getPageTitle(request, uiClass);
}
}
diff --git a/server/src/com/vaadin/server/AbstractUIProvider.java b/server/src/com/vaadin/server/AbstractUIProvider.java
index 321ca75f65..5208997a65 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(Class<? extends UI> type,
- WrappedRequest request) {
+ public UI createInstance(WrappedRequest request,
+ Class<? extends UI> type) {
try {
return type.newInstance();
} catch (InstantiationException e) {
@@ -75,7 +75,7 @@ public abstract class AbstractUIProvider implements UIProvider {
}
@Override
- public String getThemeForUI(WrappedRequest request,
+ public String getTheme(WrappedRequest request,
Class<? extends UI> uiClass) {
Theme uiTheme = getAnnotationFor(uiClass, Theme.class);
if (uiTheme != null) {
@@ -86,7 +86,7 @@ public abstract class AbstractUIProvider implements UIProvider {
}
@Override
- public String getWidgetsetForUI(WrappedRequest request,
+ public String getWidgetset(WrappedRequest request,
Class<? extends UI> uiClass) {
Widgetset uiWidgetset = getAnnotationFor(uiClass, Widgetset.class);
if (uiWidgetset != null) {
@@ -97,7 +97,7 @@ public abstract class AbstractUIProvider implements UIProvider {
}
@Override
- public boolean isUiPreserved(WrappedRequest request,
+ public boolean isPreservedOnRefresh(WrappedRequest request,
Class<? extends UI> uiClass) {
PreserveOnRefresh preserveOnRefresh = getAnnotationFor(uiClass,
PreserveOnRefresh.class);
@@ -105,7 +105,7 @@ public abstract class AbstractUIProvider implements UIProvider {
}
@Override
- public String getPageTitleForUI(WrappedRequest request,
+ public String getPageTitle(WrappedRequest request,
Class<? extends UI> uiClass) {
Title titleAnnotation = getAnnotationFor(uiClass, Title.class);
if (titleAnnotation == null) {
diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java
index 1417889d00..a25c1860ef 100644
--- a/server/src/com/vaadin/server/BootstrapHandler.java
+++ b/server/src/com/vaadin/server/BootstrapHandler.java
@@ -225,7 +225,7 @@ public abstract class BootstrapHandler implements RequestHandler {
String title = context.getVaadinSession()
.getUiProvider(context.getRequest(), context.getUIClass())
- .getPageTitleForUI(context.getRequest(), context.getUIClass());
+ .getPageTitle(context.getRequest(), context.getUIClass());
if (title != null) {
head.appendElement("title").appendText(title);
}
@@ -278,7 +278,7 @@ public abstract class BootstrapHandler implements RequestHandler {
String widgetset = context.getVaadinSession()
.getUiProvider(context.getRequest(), context.getUIClass())
- .getWidgetsetForUI(context.getRequest(), context.getUIClass());
+ .getWidgetset(context.getRequest(), context.getUIClass());
if (widgetset == null) {
widgetset = request.getVaadinService().getConfiguredWidgetset(
request);
@@ -502,7 +502,7 @@ public abstract class BootstrapHandler implements RequestHandler {
public String getThemeName(BootstrapContext context) {
return context.getVaadinSession()
.getUiProvider(context.getRequest(), context.getUIClass())
- .getThemeForUI(context.getRequest(), context.getUIClass());
+ .getTheme(context.getRequest(), context.getUIClass());
}
/**
diff --git a/server/src/com/vaadin/server/UIProvider.java b/server/src/com/vaadin/server/UIProvider.java
index 752da3aafc..a15a50a42a 100644
--- a/server/src/com/vaadin/server/UIProvider.java
+++ b/server/src/com/vaadin/server/UIProvider.java
@@ -22,10 +22,10 @@ import com.vaadin.ui.UI;
public interface UIProvider {
public Class<? extends UI> getUIClass(WrappedRequest request);
- public UI createInstance(Class<? extends UI> type,
- WrappedRequest request);
+ public UI createInstance(WrappedRequest request,
+ Class<? extends UI> type);
- public String getPageTitleForUI(WrappedRequest request,
+ public String getPageTitle(WrappedRequest request,
Class<? extends UI> uiClass);
/**
@@ -40,7 +40,7 @@ public interface UIProvider {
* @return <code>true</code>if the same UI instance should be reused e.g.
* when the browser window is refreshed.
*/
- public boolean isUiPreserved(WrappedRequest request,
+ public boolean isPreservedOnRefresh(WrappedRequest request,
Class<? extends UI> uiClass);
/**
@@ -58,7 +58,7 @@ public interface UIProvider {
* widgetset should be used
*
*/
- public String getWidgetsetForUI(WrappedRequest request,
+ public String getWidgetset(WrappedRequest request,
Class<? extends UI> uiClass);
/**
@@ -73,7 +73,7 @@ public interface UIProvider {
* should be used
*
*/
- public String getThemeForUI(WrappedRequest request,
+ public String getTheme(WrappedRequest request,
Class<? extends UI> uiClass);
/**
@@ -85,7 +85,7 @@ public interface UIProvider {
* <p>
* 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
+ * {@link #isPreservedOnRefresh(WrappedRequest, Class)} before falling back to
* bootstrapping and creating a new UI instance.
*
* @param request
diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java
index 3a379fdc76..4f4ba23640 100644
--- a/server/src/com/vaadin/server/VaadinSession.java
+++ b/server/src/com/vaadin/server/VaadinSession.java
@@ -716,7 +716,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(uiClass, request));
+ return uiClass.cast(uiProvider.createInstance(request, uiClass));
}
/**
@@ -1027,7 +1027,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
ui.doInit(request, uiId.intValue());
- if (getUiProvider(request, uiClass).isUiPreserved(request, uiClass)) {
+ if (getUiProvider(request, uiClass).isPreservedOnRefresh(request, uiClass)) {
// Remember this UI
String windowName = request.getBrowserDetails().getWindowName();
if (windowName == null) {
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index adb2a63c2e..41d0c43399 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -981,7 +981,7 @@ public abstract class UI extends AbstractComponentContainer implements
throw new IllegalStateException("UI id has already been defined");
}
this.uiId = uiId;
- theme = getSession().getUiProvider(request, getClass()).getThemeForUI(
+ theme = getSession().getUiProvider(request, getClass()).getTheme(
request, getClass());
getPage().init(request);
diff --git a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java
index cfcf0e1996..f8f7a16c4d 100644
--- a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java
+++ b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java
@@ -20,8 +20,8 @@ public class LazyInitUIs extends AbstractTestUIProvider {
}
@Override
- public UI createInstance(Class<? extends UI> type,
- WrappedRequest request) {
+ public UI createInstance(WrappedRequest request,
+ Class<? extends UI> type) {
return getUI(request);
}
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java
index 5a8d8a8ea1..821660e9e6 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java
@@ -45,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(Class<? extends UI> type,
- WrappedRequest request) {
+ public UI createInstance(WrappedRequest request,
+ Class<? extends UI> type) {
try {
return type.newInstance();
} catch (Exception e) {