From ff0761f787f94a157d12af2a37e10e808d43fc59 Mon Sep 17 00:00:00 2001
From: Artur Signell
- * Note that this theme can be overridden for a specific root with
- * {@link Application#getThemeForRoot(UI)}. Setting theme to be
+ * Note that this theme can be overridden for a specific UI with
+ * {@link Application#getThemeForUI(UI)}. Setting theme to be
* null
selects the default theme. For the available theme
* names, see the contents of the VAADIN/themes directory.
*
- * Gets a root by name. Returns null
if the application is
+ * Gets a UI by name. Returns null
if the application is
* not running or it does not contain a window corresponding to the
* name.
*
null
to use
+ * @return a UI corresponding to the name, or null
to use
* the default window
*/
public UI.LegacyWindow getWindow(String name) {
- return legacyRootNames.get(name);
+ return legacyUINames.get(name);
}
/**
* Counter to get unique names for windows with no explicit name
*/
- private int namelessRootIndex = 0;
+ private int namelessUIIndex = 0;
/**
* Adds a new browser level window to this application. Please note that
@@ -303,25 +303,25 @@ public class Application implements Terminal.ErrorListener, Serializable {
* window you should instead use {@link #addWindow(UI, String)}
*
* @param uI
- * the root window to add to the application
+ * the UI window to add to the application
* @return returns the name that has been assigned to the window
*
* @see #addWindow(UI, String)
*/
public void addWindow(UI.LegacyWindow uI) {
if (uI.getName() == null) {
- String name = Integer.toString(namelessRootIndex++);
+ String name = Integer.toString(namelessUIIndex++);
uI.setName(name);
}
- legacyRootNames.put(uI.getName(), uI);
+ legacyUINames.put(uI.getName(), uI);
uI.setApplication(this);
}
/**
* Removes the specified window from the application. This also removes
- * all name mappings for the window (see
- * {@link #addWindow(UI, String) and #getWindowName(UI)}.
+ * all name mappings for the window (see {@link #addWindow(UI, String)
+ * and #getWindowName(UI)}.
*
* * Note that removing window from the application does not close the @@ -329,13 +329,13 @@ public class Application implements Terminal.ErrorListener, Serializable { *
* * @param uI - * the root to remove + * the UI to remove */ public void removeWindow(UI.LegacyWindow uI) { - for (Entry* TODO Investigate whether this might be derived from the different states - * in getRootForRrequest. + * in getUIForRrequest. *
*/ - private Set* Subclasses of Application may override this method to provide custom - * logic for choosing how to create a suitable root or for picking an - * already created root. If an existing root is picked, care should be taken - * to avoid keeping the same root open in multiple browser windows, as that - * will cause the states to go out of sync. + * logic for choosing how to create a suitable UI or for picking an already + * created UI. If an existing UI is picked, care should be taken to avoid + * keeping the same UI open in multiple browser windows, as that will cause + * the states to go out of sync. *
* *- * If {@link BrowserDetails} are required to create a UI, the - * implementation can throw a {@link UIRequiresMoreInformationException} - * exception. In this case, the framework will instruct the browser to send - * the additional details, whereupon this method is invoked again with the - * browser details present in the wrapped request. Throwing the exception if - * the browser details are already available is not supported. + * If {@link BrowserDetails} are required to create a UI, the implementation + * can throw a {@link UIRequiresMoreInformationException} exception. In this + * case, the framework will instruct the browser to send the additional + * details, whereupon this method is invoked again with the browser details + * present in the wrapped request. Throwing the exception if the browser + * details are already available is not supported. *
* ** The default implementation in {@link Application} creates a new instance - * of the UI class returned by {@link #getRootClassName(WrappedRequest)}, - * which in turn uses the {@value #ROOT_PARAMETER} parameter from web.xml. - * If {@link DeploymentConfiguration#getClassLoader()} for the request - * returns a {@link ClassLoader}, it is used for loading the UI class. - * Otherwise the {@link ClassLoader} used to load this class is used. + * of the UI class returned by {@link #getUIClassName(WrappedRequest)}, + * which in turn uses the {@value #UI_PARAMETER} parameter from web.xml. If + * {@link DeploymentConfiguration#getClassLoader()} for the request returns + * a {@link ClassLoader}, it is used for loading the UI class. Otherwise the + * {@link ClassLoader} used to load this class is used. *
* * @param request - * the wrapped request for which a root is needed - * @return a root instance to use for the request + * the wrapped request for which a UI is needed + * @return a UI instance to use for the request * @throws UIRequiresMoreInformationException * may be thrown by an implementation to indicate that - * {@link BrowserDetails} are required to create a root + * {@link BrowserDetails} are required to create a UI * - * @see #getRootClassName(WrappedRequest) + * @see #getUIClassName(WrappedRequest) * @see UI * @see UIRequiresMoreInformationException * @see WrappedRequest#getBrowserDetails() * * @since 7.0 */ - protected UI getRoot(WrappedRequest request) + protected UI getUI(WrappedRequest request) throws UIRequiresMoreInformationException { // Iterate in reverse order - test check newest provider first - for (int i = rootProviders.size() - 1; i >= 0; i--) { - RootProvider provider = rootProviders.get(i); + for (int i = uiProviders.size() - 1; i >= 0; i--) { + UIProvider provider = uiProviders.get(i); - Class extends UI> rootClass = provider.getRootClass(this, - request); + Class extends UI> uiClass = provider.getUIClass(this, request); - if (rootClass != null) { - return provider.instantiateRoot(this, rootClass, request); + if (uiClass != null) { + return provider.instantiateUI(this, uiClass, request); } } throw new RuntimeException( - "No root providers available or providers are not able to find root instance"); + "No UI providers available or providers are not able to find UI instance"); } /** - * Finds the theme to use for a specific root. If no specific theme is + * Finds the theme to use for a specific UI. If no specific theme is * required,null
is returned.
*
* TODO Tell what the default implementation does once it does something.
*
* @param uI
- * the root to get a theme for
+ * the UI to get a theme for
* @return the name of the theme, or null
if the default theme
* should be used
*
* @since 7.0
*/
- public String getThemeForRoot(UI uI) {
- Theme rootTheme = getAnnotationFor(uI.getClass(), Theme.class);
- if (rootTheme != null) {
- return rootTheme.value();
+ public String getThemeForUI(UI uI) {
+ Theme uiTheme = getAnnotationFor(uI.getClass(), Theme.class);
+ if (uiTheme != null) {
+ return uiTheme.value();
} else {
return null;
}
}
/**
- * Finds the widgetset to use for a specific root. If no specific widgetset
- * is required, null
is returned.
+ * Finds the widgetset to use for a specific UI. If no specific widgetset is
+ * required, null
is returned.
*
* TODO Tell what the default implementation does once it does something.
*
* @param uI
- * the root to get a widgetset for
+ * the UI to get a widgetset for
* @return the name of the widgetset, or null
if the default
* widgetset should be used
*
* @since 7.0
*/
- public String getWidgetsetForRoot(UI uI) {
- Widgetset rootWidgetset = getAnnotationFor(uI.getClass(),
- Widgetset.class);
- if (rootWidgetset != null) {
- return rootWidgetset.value();
+ public String getWidgetsetForUI(UI uI) {
+ Widgetset uiWidgetset = getAnnotationFor(uI.getClass(), Widgetset.class);
+ if (uiWidgetset != null) {
+ return uiWidgetset.value();
} else {
return null;
}
@@ -2087,7 +2085,7 @@ public class Application implements Terminal.ErrorListener, Serializable {
*/
private static final ThreadLocal
* Please note that this method can also return a newly created
* UI
which has not yet been initialized. You can use
- * {@link #isRootInitPending(int)} with the root's id (
- * {@link UI#getRootId()} to check whether the initialization is still
- * pending.
+ * {@link #isUIInitPending(int)} with the UI's id ( {@link UI#getUIId()} to
+ * check whether the initialization is still pending.
*
null
if no root id is defined
+ * the request to get the UI id for
+ * @return a UI id, or null
if no UI id is defined
*
* @since 7.0
*/
- private static Integer getRootId(WrappedRequest request) {
+ private static Integer getUIId(WrappedRequest request) {
if (request instanceof CombinedRequest) {
- // Combined requests has the rootid parameter in the second request
+ // Combined requests has the uiId parameter in the second request
CombinedRequest combinedRequest = (CombinedRequest) request;
request = combinedRequest.getSecondRequest();
}
- String rootIdString = request
+ String uiIdString = request
.getParameter(ApplicationConstants.ROOT_ID_PARAMETER);
- Integer rootId = rootIdString == null ? null
- : new Integer(rootIdString);
- return rootId;
+ Integer uiId = uiIdString == null ? null : new Integer(uiIdString);
+ return uiId;
}
/**
@@ -2285,14 +2280,14 @@ public class Application implements Terminal.ErrorListener, Serializable {
* the UI is already shown, as it might not be retained as intended.
*
*
- * @param rootPreserved
- * true
if the same UI instance should be reused
- * e.g. when the browser window is refreshed.
+ * @param uiPreserved
+ * true
if the same UI instance should be reused e.g.
+ * when the browser window is refreshed.
*/
- public void setRootPreserved(boolean rootPreserved) {
- this.rootPreserved = rootPreserved;
- if (!rootPreserved) {
- retainOnRefreshRoots.clear();
+ public void setUiPreserved(boolean uiPreserved) {
+ this.uiPreserved = uiPreserved;
+ if (!uiPreserved) {
+ retainOnRefreshUIs.clear();
}
}
@@ -2305,41 +2300,41 @@ public class Application implements Terminal.ErrorListener, Serializable {
* @return true
if the same UI instance should be reused e.g.
* when the browser window is refreshed.
*/
- public boolean isRootPreserved() {
- return rootPreserved;
+ public boolean isUiPreserved() {
+ return uiPreserved;
}
/**
- * Checks whether there's a pending initialization for the root with the
- * given id.
+ * Checks whether there's a pending initialization for the UI with the given
+ * id.
*
- * @param rootId
- * root id to check for
+ * @param uiId
+ * UI id to check for
* @return true
of the initialization is pending,
- * false
if the root id is not registered or if the
- * root has already been initialized
+ * false
if the UI id is not registered or if the UI
+ * has already been initialized
*
- * @see #getRootForRequest(WrappedRequest)
+ * @see #getUIForRequest(WrappedRequest)
*/
- public boolean isRootInitPending(int rootId) {
- return !initedRoots.contains(Integer.valueOf(rootId));
+ public boolean isUIInitPending(int uiId) {
+ return !initedUIs.contains(Integer.valueOf(uiId));
}
/**
- * Gets all the uIs of this application. This includes uIs that have
- * been requested but not yet initialized. Please note, that uIs are not
+ * Gets all the uIs of this application. This includes uIs that have been
+ * requested but not yet initialized. Please note, that uIs are not
* automatically removed e.g. if the browser window is closed and that there
- * is no way to manually remove a root. Inactive uIs will thus not be
- * released for GC until the entire application is released when the session
- * has timed out (unless there are dangling references). Improved support
- * for releasing unused uIs is planned for an upcoming alpha release of
- * Vaadin 7.
+ * is no way to manually remove a UI. Inactive uIs will thus not be released
+ * for GC until the entire application is released when the session has
+ * timed out (unless there are dangling references). Improved support for
+ * releasing unused uIs is planned for an upcoming alpha release of Vaadin
+ * 7.
*
* @return a collection of uIs belonging to this application
*
* @since 7.0
*/
- public Collectionnull
if
* no UI instance is yet available.
*
- * @see Application#isRootPreserved()
- * @see Application#getRoot(WrappedRequest)
+ * @see Application#isUiPreserved()
+ * @see Application#getUI(WrappedRequest)
* @see UIRequiresMoreInformationException
*
* @return The UI that will be displayed in the page being generated, or
diff --git a/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java b/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java
index 13d558e66e..7e669d939c 100644
--- a/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java
+++ b/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java
@@ -44,7 +44,7 @@ class ServletPortletHelper implements Serializable {
String applicationParameter = deploymentConfiguration
.getInitParameters().getProperty("application");
String rootParameter = deploymentConfiguration.getInitParameters()
- .getProperty(Application.ROOT_PARAMETER);
+ .getProperty(Application.UI_PARAMETER);
ClassLoader classLoader = deploymentConfiguration.getClassLoader();
if (applicationParameter == null) {
@@ -69,7 +69,7 @@ class ServletPortletHelper implements Serializable {
private static void verifyRootClass(String className,
ClassLoader classLoader) throws ApplicationClassException {
if (className == null) {
- throw new ApplicationClassException(Application.ROOT_PARAMETER
+ throw new ApplicationClassException(Application.UI_PARAMETER
+ " init parameter not defined");
}
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index e2facefb33..957e00385d 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -47,27 +47,28 @@ import com.vaadin.terminal.Resource;
import com.vaadin.terminal.Vaadin6Component;
import com.vaadin.terminal.WrappedRequest;
import com.vaadin.terminal.WrappedRequest.BrowserDetails;
+import com.vaadin.terminal.gwt.server.AbstractApplicationServlet;
import com.vaadin.ui.Window.CloseListener;
/**
- * The topmost component in any component hierarchy. There is one root for every
- * Vaadin instance in a browser window. A root may either represent an entire
+ * The topmost component in any component hierarchy. There is one UI for every
+ * Vaadin instance in a browser window. A UI may either represent an entire
* browser window (or tab) or some part of a html page where a Vaadin
* application is embedded.
* - * The root is the server side entry point for various client side features that + * The UI is the server side entry point for various client side features that * are not represented as components added to a layout, e.g notifications, sub * windows, and executing javascript in the browser. *
*- * When a new application instance is needed, typically because the user opens - * the application in a browser window, - * {@link Application#gerRoot(WrappedRequest)} is invoked to get a root. That - * method does by default create a root according to the - * {@value Application#ROOT_PARAMETER} parameter from web.xml. + * When a new UI instance is needed, typically because the user opens a URL in a + * browser window which points to {@link AbstractApplicationServlet}, + * {@link Application#getUIForRequest(WrappedRequest)} is invoked to get a UI. + * That method does by default create a root according to the + * {@value Application#UI_PARAMETER} parameter from web.xml. *
*- * After a root has been created by the application, it is initialized using + * After a UI has been created by the application, it is initialized using * {@link #init(WrappedRequest)}. This method is intended to be overridden by * the developer to add components to the user interface and initialize * non-component functionality. The component hierarchy is initialized by @@ -76,13 +77,13 @@ import com.vaadin.ui.Window.CloseListener; *
*
* If a {@link EagerInit} annotation is present on a class extending
- * UI
, the framework will use a faster initialization method
- * which will not ensure that {@link BrowserDetails} are present in the
+ * UI
, the framework will use a faster initialization method which
+ * will not ensure that {@link BrowserDetails} are present in the
* {@link WrappedRequest} passed to the init method.
*
null
application.
* @@ -652,46 +653,46 @@ public abstract class UI extends AbstractComponentContainer implements } /** - * Sets the id of this root within its application. The root id is used to - * route requests to the right root. + * Sets the id of this UI within its application. The UI id is used to route + * requests to the right UI. *
* This method is mainly intended for internal use by the framework. *
* - * @param rootId - * the id of this root + * @param uiId + * the id of this UI * * @throws IllegalStateException - * if the root id has already been set + * if the UI id has already been set * - * @see #getRootId() + * @see #getUIId() */ - public void setRootId(int rootId) { - if (this.rootId != -1) { + public void setUIId(int uiId) { + if (this.uiId != -1) { throw new IllegalStateException("UI id has already been defined"); } - this.rootId = rootId; + this.uiId = uiId; } /** - * Gets the id of the root, used to identify this root within its - * application when processing requests. The root id should be present in - * every request to the server that originates from this root. - * {@link Application#getRootForRequest(WrappedRequest)} uses this id to - * find the route to which the request belongs. + * 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. + * {@link Application#getUIForRequest(WrappedRequest)} uses this id to find + * the route to which the request belongs. * * @return */ - public int getRootId() { - return rootId; + public int getUIId() { + return uiId; } /** - * Adds a window as a subwindow inside this root. To open a new browser - * window or tab, you should instead use {@link open(Resource)} with an url + * 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#getRoot(WrappedRequest)} returns an appropriate root - * for the request. + * {@link Application#getUI(WrappedRequest)} returns an appropriate UI for + * the request. * * @param window * @throws IllegalArgumentException @@ -727,7 +728,7 @@ public abstract class UI extends AbstractComponentContainer implements } /** - * Remove the given subwindow from this root. + * Remove the given subwindow from this UI. * * Since Vaadin 6.5, {@link CloseListener}s are called also when explicitly * removing a window by calling this method. @@ -741,7 +742,7 @@ public abstract class UI extends AbstractComponentContainer implements */ public boolean removeWindow(Window window) { if (!windows.remove(window)) { - // Window window is not a subwindow of this root. + // Window window is not a subwindow of this UI. return false; } window.setParent(null); @@ -752,7 +753,7 @@ public abstract class UI extends AbstractComponentContainer implements } /** - * Gets all the windows added to this root. + * Gets all the windows added to this UI. * * @return an unmodifiable collection of windows */ @@ -792,28 +793,28 @@ public abstract class UI extends AbstractComponentContainer implements } /** - * Scrolls any component between the component and root to a suitable - * position so the component is visible to the user. The given component - * must belong to this root. + * Scrolls any component between the component and UI to a suitable position + * so the component is visible to the user. The given component must belong + * to this UI. * * @param component * the component to be scrolled into view * @throws IllegalArgumentException - * if {@code component} does not belong to this root + * if {@code component} does not belong to this UI */ public void scrollIntoView(Component component) throws IllegalArgumentException { if (component.getRoot() != this) { throw new IllegalArgumentException( - "The component where to scroll must belong to this root."); + "The component where to scroll must belong to this UI."); } scrollIntoView = component; markAsDirty(); } /** - * Gets the content of this root. The content is a component container that - * serves as the outermost item of the visual contents of this root. + * Gets the content of this UI. The content is a component container that + * serves as the outermost item of the visual contents of this UI. * * @return a component container to use as content * @@ -837,8 +838,8 @@ public abstract class UI extends AbstractComponentContainer implements } /** - * Sets the content of this root. The content is a component container that - * serves as the outermost item of the visual contents of this root. If no + * Sets the content of this UI. The content is a component container that + * serves as the outermost item of the visual contents of this UI. If no * content has been set, a {@link VerticalLayout} with margins enabled will * be used by default - see {@link #createDefaultLayout()}. The content can * also be set in a constructor. @@ -863,11 +864,11 @@ public abstract class UI extends AbstractComponentContainer implements } /** - * Adds a component to this root. The component is not added directly to the - * root, but instead to the content container ({@link #getContent()}). + * Adds a component to this UI. The component is not added directly to the + * UI, but instead to the content container ({@link #getContent()}). * * @param component - * the component to add to this root + * the component to add to this UI * * @see #getContent() */ @@ -878,7 +879,7 @@ public abstract class UI extends AbstractComponentContainer implements /** * This implementation removes the component from the content container ( - * {@link #getContent()}) instead of from the actual root. + * {@link #getContent()}) instead of from the actual UI. */ @Override public void removeComponent(Component component) { @@ -887,7 +888,7 @@ public abstract class UI extends AbstractComponentContainer implements /** * This implementation removes the components from the content container ( - * {@link #getContent()}) instead of from the actual root. + * {@link #getContent()}) instead of from the actual UI. */ @Override public void removeAllComponents() { @@ -910,13 +911,13 @@ public abstract class UI extends AbstractComponentContainer implements } /** - * Initializes this root. This method is intended to be overridden by + * Initializes this UI. This method is intended to be overridden by * subclasses to build the view and configure non-component functionality. * Performing the initialization in a constructor is not suggested as the - * state of the root is not properly set up when the constructor is invoked. + * state of the UI is not properly set up when the constructor is invoked. ** The {@link WrappedRequest} can be used to get information about the - * request that caused this root to be created. By default, the + * request that caused this UI to be created. By default, the * {@link BrowserDetails} will be available in the request. If the browser * details are not required, loading the application in the browser can take * some shortcuts giving a faster initial rendering. This can be indicated @@ -924,42 +925,41 @@ public abstract class UI extends AbstractComponentContainer implements *
* * @param request - * the wrapped request that caused this root to be created + * the wrapped request that caused this UI to be created */ protected abstract void init(WrappedRequest request); /** - * Sets the thread local for the current root. This method is used by the + * Sets the thread local for the current UI. This method is used by the * framework to set the current application whenever a new request is * processed and it is cleared when the request has been processed. ** The application developer can also use this method to define the current - * root outside the normal request handling, e.g. when initiating custom + * UI outside the normal request handling, e.g. when initiating custom * background threads. *
* * @param uI - * the root to register as the current root + * the UI to register as the current UI * * @see #getCurrent() * @see ThreadLocal */ - public static void setCurrent(UI uI) { - currentRoot.set(uI); + public static void setCurrent(UI ui) { + currentUI.set(ui); } /** - * Gets the currently used root. The current root is automatically defined - * when processing requests to the server. In other cases, (e.g. from - * background threads), the current root is not automatically defined. + * Gets the currently used UI. The current UI is automatically defined when + * processing requests to the server. In other cases, (e.g. from background + * threads), the current UI is not automatically defined. * - * @return the current root instance if available, otherwise - *null
+ * @return the current UI instance if available, otherwise null
*
* @see #setCurrent(UI)
*/
public static UI getCurrent() {
- return currentRoot.get();
+ return currentUI.get();
}
public void setScrollTop(int scrollTop) {
@@ -1027,10 +1027,10 @@ public abstract class UI extends AbstractComponentContainer implements
}
/**
- * Add a click listener to the UI. The listener is called whenever the
- * user clicks inside the UI. Also when the click targets a component
- * inside the UI, provided the targeted component does not prevent the
- * click event from propagating.
+ * Add a click listener to the UI. The listener is called whenever the user
+ * clicks inside the UI. Also when the click targets a component inside the
+ * UI, provided the targeted component does not prevent the click event from
+ * propagating.
*
* Use {@link #removeListener(ClickListener)} to remove the listener.
*
@@ -1082,7 +1082,7 @@ public abstract class UI extends AbstractComponentContainer implements
}
/**
- * Shows a notification message on the middle of the root. The message
+ * Shows a notification message on the middle of the UI. The message
* automatically disappears ("humanized message").
*
* Care should be taken to to avoid XSS vulnerabilities as the caption is
@@ -1105,7 +1105,7 @@ public abstract class UI extends AbstractComponentContainer implements
}
/**
- * Shows a notification message the root. The position and behavior of the
+ * Shows a notification message the UI. The position and behavior of the
* message depends on the type, which is one of the basic types defined in
* {@link Notification}, for instance Notification.TYPE_WARNING_MESSAGE.
*
@@ -1132,8 +1132,8 @@ public abstract class UI extends AbstractComponentContainer implements
/**
* Shows a notification consisting of a bigger caption and a smaller
- * description on the middle of the root. The message automatically
- * disappears ("humanized message").
+ * description on the middle of the UI. The message automatically disappears
+ * ("humanized message").
*
* Care should be taken to to avoid XSS vulnerabilities as the caption and
* description are rendered as html.
--
cgit v1.2.3