summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/UI.java
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-08-31 12:02:51 +0300
committerLeif Åstrand <leif@vaadin.com>2012-08-31 19:00:00 +0300
commit8679f49c5e036d39d34a9fca8a907c4d19df21c9 (patch)
tree9979d5cf330043523e7d68221133bbcd5b3300f5 /server/src/com/vaadin/ui/UI.java
parentcf9ab5aea84d2be1686c5f46edd9522cd0750baf (diff)
downloadvaadin-framework-8679f49c5e036d39d34a9fca8a907c4d19df21c9.tar.gz
vaadin-framework-8679f49c5e036d39d34a9fca8a907c4d19df21c9.zip
Refactor UI bootstrap (#9443)
Diffstat (limited to 'server/src/com/vaadin/ui/UI.java')
-rw-r--r--server/src/com/vaadin/ui/UI.java50
1 files changed, 23 insertions, 27 deletions
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index d86d46c155..b6ac271942 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -85,7 +85,7 @@ import com.vaadin.tools.ReflectTools;
* </p>
*
* @see #init(WrappedRequest)
- * @see Application#getUI(WrappedRequest)
+ * @see Application#createUI(WrappedRequest)
*
* @since 7.0
*/
@@ -98,7 +98,6 @@ public abstract class UI extends AbstractComponentContainer implements
* window in Vaadin 6 with {@link com.vaadin.Application.LegacyApplication}
*/
@Deprecated
- @EagerInit
public static class LegacyWindow extends UI {
private String name;
@@ -710,28 +709,6 @@ public abstract class UI extends AbstractComponentContainer implements
}
/**
- * Sets the id of this UI within its application. The UI id is used to route
- * requests to the right UI.
- * <p>
- * This method is mainly intended for internal use by the framework.
- * </p>
- *
- * @param uiId
- * the id of this UI
- *
- * @throws IllegalStateException
- * if the UI id has already been set
- *
- * @see #getUIId()
- */
- public void setUIId(int uiId) {
- if (this.uiId != -1) {
- throw new IllegalStateException("UI id has already been defined");
- }
- this.uiId = uiId;
- }
-
- /**
* 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.
@@ -748,8 +725,8 @@ 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#getUI(WrappedRequest)} returns an appropriate UI for
- * the request.
+ * {@link Application#createUI(WrappedRequest)} returns an appropriate UI
+ * for the request.
*
* @param window
* @throws IllegalArgumentException
@@ -831,6 +808,8 @@ public abstract class UI extends AbstractComponentContainer implements
private boolean resizeLazy = false;
+ private String theme;
+
/**
* This method is used by Component.Focusable objects to request focus to
* themselves. Focus renders must be handled at window level (instead of
@@ -959,8 +938,16 @@ public abstract class UI extends AbstractComponentContainer implements
*
* @param request
* the initialization request
+ * @param uiId
+ * the id of the new ui
*/
- public void doInit(WrappedRequest request) {
+ public void doInit(WrappedRequest request, int uiId) {
+ if (this.uiId != -1) {
+ throw new IllegalStateException("UI id has already been defined");
+ }
+ this.uiId = uiId;
+ theme = getApplication().getThemeForUI(request, getClass());
+
getPage().init(request);
// Call the init overridden by the application developer
@@ -1352,4 +1339,13 @@ public abstract class UI extends AbstractComponentContainer implements
public void setLastUidlRequestTime(long lastUidlRequest) {
this.lastUidlRequest = lastUidlRequest;
}
+
+ /**
+ * Gets the theme that was used when the UI was initialized.
+ *
+ * @return the theme name
+ */
+ public String getTheme() {
+ return theme;
+ }
}