summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-09-24 16:35:51 +0300
committerLeif Åstrand <leif@vaadin.com>2012-09-24 16:36:08 +0300
commitcb474f17b6de48f85287491ba24f4c8975c62b0f (patch)
tree7414e395ee040a49aefbc2df7dadbde6191024f7
parent5f0952f60ed9d5b41a761ef0cd56c3ddc596d2b2 (diff)
downloadvaadin-framework-cb474f17b6de48f85287491ba24f4c8975c62b0f.tar.gz
vaadin-framework-cb474f17b6de48f85287491ba24f4c8975c62b0f.zip
Refine based on review (#9721)
-rw-r--r--server/src/com/vaadin/server/UIProvider.java26
-rw-r--r--server/src/com/vaadin/server/UIProviderEvent.java3
2 files changed, 16 insertions, 13 deletions
diff --git a/server/src/com/vaadin/server/UIProvider.java b/server/src/com/vaadin/server/UIProvider.java
index e90d4f27f4..e9ec25c326 100644
--- a/server/src/com/vaadin/server/UIProvider.java
+++ b/server/src/com/vaadin/server/UIProvider.java
@@ -40,20 +40,20 @@ public abstract class UIProvider implements Serializable {
/**
* Helper to get an annotation for a class. If the annotation is not present
- * on the target class, it's super classes and implemented interfaces are
+ * on the target class, its super classes and implemented interfaces are
* also searched for the annotation.
*
- * @param event
- * the UI create event to get required info from
+ * @param clazz
+ * the class from which the annotation should be found
* @param annotationType
* the annotation type to look for
* @return an annotation of the given type, or <code>null</code> if the
* annotation is not present on the class
*/
- protected static <T extends Annotation> T getAnnotationFor(
- UICreateEvent event, Class<T> annotationType) {
+ protected static <T extends Annotation> T getAnnotationFor(Class<?> clazz,
+ Class<T> annotationType) {
// Find from the class hierarchy
- Class<?> currentType = event.getUIClass();
+ Class<?> currentType = clazz;
while (currentType != Object.class) {
T annotation = currentType.getAnnotation(annotationType);
if (annotation != null) {
@@ -64,7 +64,7 @@ public abstract class UIProvider implements Serializable {
}
// Find from an implemented interface
- for (Class<?> iface : event.getUIClass().getInterfaces()) {
+ for (Class<?> iface : clazz.getInterfaces()) {
T annotation = iface.getAnnotation(annotationType);
if (annotation != null) {
return annotation;
@@ -89,7 +89,7 @@ public abstract class UIProvider implements Serializable {
*
*/
public String getTheme(UICreateEvent event) {
- Theme uiTheme = getAnnotationFor(event, Theme.class);
+ Theme uiTheme = getAnnotationFor(event.getUIClass(), Theme.class);
if (uiTheme != null) {
return uiTheme.value();
} else {
@@ -112,7 +112,8 @@ public abstract class UIProvider implements Serializable {
*
*/
public String getWidgetset(UICreateEvent event) {
- Widgetset uiWidgetset = getAnnotationFor(event, Widgetset.class);
+ Widgetset uiWidgetset = getAnnotationFor(event.getUIClass(),
+ Widgetset.class);
if (uiWidgetset != null) {
return uiWidgetset.value();
} else {
@@ -134,13 +135,14 @@ public abstract class UIProvider implements Serializable {
* when the browser window is refreshed.
*/
public boolean isPreservedOnRefresh(UICreateEvent event) {
- PreserveOnRefresh preserveOnRefresh = getAnnotationFor(event,
- PreserveOnRefresh.class);
+ PreserveOnRefresh preserveOnRefresh = getAnnotationFor(
+ event.getUIClass(), PreserveOnRefresh.class);
return preserveOnRefresh != null;
}
public String getPageTitle(UICreateEvent event) {
- Title titleAnnotation = getAnnotationFor(event, Title.class);
+ Title titleAnnotation = getAnnotationFor(event.getUIClass(),
+ Title.class);
if (titleAnnotation == null) {
return null;
} else {
diff --git a/server/src/com/vaadin/server/UIProviderEvent.java b/server/src/com/vaadin/server/UIProviderEvent.java
index 335ce86119..cf552a70fc 100644
--- a/server/src/com/vaadin/server/UIProviderEvent.java
+++ b/server/src/com/vaadin/server/UIProviderEvent.java
@@ -16,6 +16,7 @@
package com.vaadin.server;
+import java.io.Serializable;
import java.util.EventObject;
/**
@@ -26,7 +27,7 @@ import java.util.EventObject;
* @author Vaadin Ltd
* @since 7.0.0
*/
-public class UIProviderEvent extends EventObject {
+public class UIProviderEvent extends EventObject implements Serializable {
private final VaadinRequest request;