From 8679f49c5e036d39d34a9fca8a907c4d19df21c9 Mon Sep 17 00:00:00 2001
From: Leif Åstrand
- * This method is mainly intended for internal use by the framework. - *
- * - * @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 @@ -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; + } } -- cgit v1.2.3