diff options
author | Artur Signell <artur@vaadin.com> | 2012-08-24 08:44:20 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-08-24 13:23:16 +0300 |
commit | da176c32c4d92676424021712a7f6d7ee8cedf76 (patch) | |
tree | 36e5c97e5c556dd882498516415663384db18185 /server | |
parent | 86bbe59bb855b6cf57486322bca92e2ace88e8a2 (diff) | |
download | vaadin-framework-da176c32c4d92676424021712a7f6d7ee8cedf76.tar.gz vaadin-framework-da176c32c4d92676424021712a7f6d7ee8cedf76.zip |
Renamed Root to UI, automatic rename (#8908)
Automatic rename in Eclipse of the class Root to UI with all
rename options enabled, rename also embedded "Root" in
variable and method names.
The following classes/methods were excluded in the rename:
- BootstrapHandler.getApplicationCSSClassName()
- ComponentLocator
- ConnectorMap
- ItemClickEvent
- KeepAllItemsVisible
- MenuBarTest
- MenuBarTooltips
- TreeTableTest
- TreeWithIcons
- Trees
- VDebugConsole.printLayoutProblems()
Diffstat (limited to 'server')
32 files changed, 357 insertions, 357 deletions
diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java index d2924eb716..23d407e4f3 100644 --- a/server/src/com/vaadin/Application.java +++ b/server/src/com/vaadin/Application.java @@ -74,7 +74,7 @@ import com.vaadin.terminal.gwt.server.WebApplicationContext; import com.vaadin.tools.ReflectTools; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.AbstractField; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; import com.vaadin.ui.Table; import com.vaadin.ui.Window; @@ -134,7 +134,7 @@ public class Application implements Terminal.ErrorListener, Serializable { /** * The name of the parameter that is by default used in e.g. web.xml to - * define the name of the default {@link Root} class. + * define the name of the default {@link UI} class. */ public static final String ROOT_PARAMETER = "root"; @@ -164,10 +164,10 @@ public class Application implements Terminal.ErrorListener, Serializable { private static final Pattern WINDOW_NAME_PATTERN = Pattern .compile("^/?([^/]+).*"); - private Root.LegacyWindow mainWindow; + private UI.LegacyWindow mainWindow; private String theme; - private Map<String, Root.LegacyWindow> legacyRootNames = new HashMap<String, Root.LegacyWindow>(); + private Map<String, UI.LegacyWindow> legacyRootNames = new HashMap<String, UI.LegacyWindow>(); /** * Sets the main window of this application. Setting window as a main @@ -176,7 +176,7 @@ public class Application implements Terminal.ErrorListener, Serializable { * @param mainWindow * the root to set as the default window */ - public void setMainWindow(Root.LegacyWindow mainWindow) { + public void setMainWindow(UI.LegacyWindow mainWindow) { if (this.mainWindow != null) { throw new IllegalStateException( "mainWindow has already been set"); @@ -203,7 +203,7 @@ public class Application implements Terminal.ErrorListener, Serializable { * * @return the root used as the default window */ - public Root.LegacyWindow getMainWindow() { + public UI.LegacyWindow getMainWindow() { return mainWindow; } @@ -219,7 +219,7 @@ public class Application implements Terminal.ErrorListener, Serializable { */ @Override - public Root.LegacyWindow getRoot(WrappedRequest request) { + public UI.LegacyWindow getRoot(WrappedRequest request) { String pathInfo = request.getRequestPathInfo(); String name = null; if (pathInfo != null && pathInfo.length() > 0) { @@ -229,7 +229,7 @@ public class Application implements Terminal.ErrorListener, Serializable { name = matcher.group(1); } } - Root.LegacyWindow window = getWindow(name); + UI.LegacyWindow window = getWindow(name); if (window != null) { return window; } @@ -240,7 +240,7 @@ public class Application implements Terminal.ErrorListener, Serializable { * Sets the application's theme. * <p> * Note that this theme can be overridden for a specific root with - * {@link Application#getThemeForRoot(Root)}. Setting theme to be + * {@link Application#getThemeForRoot(UI)}. Setting theme to be * <code>null</code> selects the default theme. For the available theme * names, see the contents of the VAADIN/themes directory. * </p> @@ -254,7 +254,7 @@ public class Application implements Terminal.ErrorListener, Serializable { /** * Gets the application's theme. The application's theme is the default - * theme used by all the roots for which a theme is not explicitly + * theme used by all the uIs for which a theme is not explicitly * defined. If the application theme is not explicitly set, * <code>null</code> is returned. * @@ -272,7 +272,7 @@ public class Application implements Terminal.ErrorListener, Serializable { */ @Override - public String getThemeForRoot(Root root) { + public String getThemeForRoot(UI uI) { return theme; } @@ -288,7 +288,7 @@ public class Application implements Terminal.ErrorListener, Serializable { * @return a root corresponding to the name, or <code>null</code> to use * the default window */ - public Root.LegacyWindow getWindow(String name) { + public UI.LegacyWindow getWindow(String name) { return legacyRootNames.get(name); } @@ -299,42 +299,42 @@ public class Application implements Terminal.ErrorListener, Serializable { /** * Adds a new browser level window to this application. Please note that - * Root doesn't have a name that is used in the URL - to add a named - * window you should instead use {@link #addWindow(Root, String)} + * UI doesn't have a name that is used in the URL - to add a named + * window you should instead use {@link #addWindow(UI, String)} * - * @param root + * @param uI * the root window to add to the application * @return returns the name that has been assigned to the window * - * @see #addWindow(Root, String) + * @see #addWindow(UI, String) */ - public void addWindow(Root.LegacyWindow root) { - if (root.getName() == null) { + public void addWindow(UI.LegacyWindow uI) { + if (uI.getName() == null) { String name = Integer.toString(namelessRootIndex++); - root.setName(name); + uI.setName(name); } - legacyRootNames.put(root.getName(), root); - root.setApplication(this); + legacyRootNames.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(Root, String) and #getWindowName(Root)}. + * {@link #addWindow(UI, String) and #getWindowName(UI)}. * * <p> * Note that removing window from the application does not close the * browser window - the window is only removed from the server-side. * </p> * - * @param root + * @param uI * the root to remove */ - public void removeWindow(Root.LegacyWindow root) { - for (Entry<String, Root.LegacyWindow> entry : legacyRootNames + public void removeWindow(UI.LegacyWindow uI) { + for (Entry<String, UI.LegacyWindow> entry : legacyRootNames .entrySet()) { - if (entry.getValue() == root) { + if (entry.getValue() == uI) { legacyRootNames.remove(entry.getKey()); } } @@ -349,7 +349,7 @@ public class Application implements Terminal.ErrorListener, Serializable { * * @return the unmodifiable collection of windows. */ - public Collection<Root.LegacyWindow> getWindows() { + public Collection<UI.LegacyWindow> getWindows() { return Collections.unmodifiableCollection(legacyRootNames.values()); } } @@ -490,14 +490,14 @@ public class Application implements Terminal.ErrorListener, Serializable { private LinkedList<RequestHandler> requestHandlers = new LinkedList<RequestHandler>(); private int nextRootId = 0; - private Map<Integer, Root> roots = new HashMap<Integer, Root>(); + private Map<Integer, UI> uIs = new HashMap<Integer, UI>(); private final Map<String, Integer> retainOnRefreshRoots = new HashMap<String, Integer>(); private final EventRouter eventRouter = new EventRouter(); /** - * Keeps track of which roots have been inited. + * Keeps track of which uIs have been inited. * <p> * TODO Investigate whether this might be derived from the different states * in getRootForRrequest. @@ -1844,7 +1844,7 @@ public class Application implements Terminal.ErrorListener, Serializable { * </p> * * <p> - * If {@link BrowserDetails} are required to create a Root, the + * If {@link BrowserDetails} are required to create a UI, the * implementation can throw a {@link RootRequiresMoreInformationException} * exception. In this case, the framework will instruct the browser to send * the additional details, whereupon this method is invoked again with the @@ -1854,10 +1854,10 @@ public class Application implements Terminal.ErrorListener, Serializable { * * <p> * The default implementation in {@link Application} creates a new instance - * of the Root class returned by {@link #getRootClassName(WrappedRequest)}, + * 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 Root class. + * returns a {@link ClassLoader}, it is used for loading the UI class. * Otherwise the {@link ClassLoader} used to load this class is used. * </p> * @@ -1869,20 +1869,20 @@ public class Application implements Terminal.ErrorListener, Serializable { * {@link BrowserDetails} are required to create a root * * @see #getRootClassName(WrappedRequest) - * @see Root + * @see UI * @see RootRequiresMoreInformationException * @see WrappedRequest#getBrowserDetails() * * @since 7.0 */ - protected Root getRoot(WrappedRequest request) + protected UI getRoot(WrappedRequest request) throws RootRequiresMoreInformationException { // Iterate in reverse order - test check newest provider first for (int i = rootProviders.size() - 1; i >= 0; i--) { RootProvider provider = rootProviders.get(i); - Class<? extends Root> rootClass = provider.getRootClass(this, + Class<? extends UI> rootClass = provider.getRootClass(this, request); if (rootClass != null) { @@ -1900,15 +1900,15 @@ public class Application implements Terminal.ErrorListener, Serializable { * * TODO Tell what the default implementation does once it does something. * - * @param root + * @param uI * the root to get a theme for * @return the name of the theme, or <code>null</code> if the default theme * should be used * * @since 7.0 */ - public String getThemeForRoot(Root root) { - Theme rootTheme = getAnnotationFor(root.getClass(), Theme.class); + public String getThemeForRoot(UI uI) { + Theme rootTheme = getAnnotationFor(uI.getClass(), Theme.class); if (rootTheme != null) { return rootTheme.value(); } else { @@ -1922,15 +1922,15 @@ public class Application implements Terminal.ErrorListener, Serializable { * * TODO Tell what the default implementation does once it does something. * - * @param root + * @param uI * the root to get a widgetset for * @return the name of the widgetset, or <code>null</code> if the default * widgetset should be used * * @since 7.0 */ - public String getWidgetsetForRoot(Root root) { - Widgetset rootWidgetset = getAnnotationFor(root.getClass(), + public String getWidgetsetForRoot(UI uI) { + Widgetset rootWidgetset = getAnnotationFor(uI.getClass(), Widgetset.class); if (rootWidgetset != null) { return rootWidgetset.value(); @@ -2148,16 +2148,16 @@ public class Application implements Terminal.ErrorListener, Serializable { } /** - * Finds the {@link Root} to which a particular request belongs. If the - * request originates from an existing Root, that root is returned. In other + * Finds the {@link UI} to which a particular request belongs. If the + * request originates from an existing UI, that root is returned. In other * cases, the method attempts to create and initialize a new root and might * throw a {@link RootRequiresMoreInformationException} if all required * information is not available. * <p> * Please note that this method can also return a newly created - * <code>Root</code> which has not yet been initialized. You can use + * <code>UI</code> which has not yet been initialized. You can use * {@link #isRootInitPending(int)} with the root's id ( - * {@link Root#getRootId()} to check whether the initialization is still + * {@link UI#getRootId()} to check whether the initialization is still * pending. * </p> * @@ -2173,11 +2173,11 @@ public class Application implements Terminal.ErrorListener, Serializable { * * @since 7.0 */ - public Root getRootForRequest(WrappedRequest request) + public UI getRootForRequest(WrappedRequest request) throws RootRequiresMoreInformationException { - Root root = Root.getCurrent(); - if (root != null) { - return root; + UI uI = UI.getCurrent(); + if (uI != null) { + return uI; } Integer rootId = getRootId(request); @@ -2186,9 +2186,9 @@ public class Application implements Terminal.ErrorListener, Serializable { boolean hasBrowserDetails = browserDetails != null && browserDetails.getUriFragment() != null; - root = roots.get(rootId); + uI = uIs.get(rootId); - if (root == null && isRootPreserved()) { + if (uI == null && isRootPreserved()) { // Check for a known root if (!retainOnRefreshRoots.isEmpty()) { @@ -2202,39 +2202,39 @@ public class Application implements Terminal.ErrorListener, Serializable { if (retainedRootId != null) { rootId = retainedRootId; - root = roots.get(rootId); + uI = uIs.get(rootId); } } } - if (root == null) { + if (uI == null) { // Throws exception if root can not yet be created - root = getRoot(request); + uI = getRoot(request); // Initialize some fields for a newly created root - if (root.getApplication() == null) { - root.setApplication(this); + if (uI.getApplication() == null) { + uI.setApplication(this); } - if (root.getRootId() < 0) { + if (uI.getRootId() < 0) { if (rootId == null) { // Get the next id if none defined rootId = Integer.valueOf(nextRootId++); } - root.setRootId(rootId.intValue()); - roots.put(rootId, root); + uI.setRootId(rootId.intValue()); + uIs.put(rootId, uI); } } // Set thread local here so it is available in init - Root.setCurrent(root); + UI.setCurrent(uI); if (!initedRoots.contains(rootId)) { boolean initRequiresBrowserDetails = isRootPreserved() - || !root.getClass() + || !uI.getClass() .isAnnotationPresent(EagerInit.class); if (!initRequiresBrowserDetails || hasBrowserDetails) { - root.doInit(request); + uI.doInit(request); // Remember that this root has been initialized initedRoots.add(rootId); @@ -2250,7 +2250,7 @@ public class Application implements Terminal.ErrorListener, Serializable { } } // end synchronized block - return root; + return uI; } /** @@ -2276,7 +2276,7 @@ public class Application implements Terminal.ErrorListener, Serializable { } /** - * Sets whether the same Root state should be reused if the framework can + * Sets whether the same UI state should be reused if the framework can * detect that the application is opened in a browser window where it has * previously been open. The framework attempts to discover this by checking * the value of window.name in the browser. @@ -2286,7 +2286,7 @@ public class Application implements Terminal.ErrorListener, Serializable { * </p> * * @param rootPreserved - * <code>true</code>if the same Root instance should be reused + * <code>true</code>if the same UI instance should be reused * e.g. when the browser window is refreshed. */ public void setRootPreserved(boolean rootPreserved) { @@ -2297,12 +2297,12 @@ public class Application implements Terminal.ErrorListener, Serializable { } /** - * Checks whether the same Root state should be reused if the framework can + * Checks whether the same UI state should be reused if the framework can * detect that the application is opened in a browser window where it has * previously been open. The framework attempts to discover this by checking * the value of window.name in the browser. * - * @return <code>true</code>if the same Root instance should be reused e.g. + * @return <code>true</code>if the same UI instance should be reused e.g. * when the browser window is refreshed. */ public boolean isRootPreserved() { @@ -2326,21 +2326,21 @@ public class Application implements Terminal.ErrorListener, Serializable { } /** - * Gets all the roots of this application. This includes roots that have - * been requested but not yet initialized. Please note, that roots 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 roots will thus not be + * 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 roots is planned for an upcoming alpha release of + * for releasing unused uIs is planned for an upcoming alpha release of * Vaadin 7. * - * @return a collection of roots belonging to this application + * @return a collection of uIs belonging to this application * * @since 7.0 */ - public Collection<Root> getRoots() { - return Collections.unmodifiableCollection(roots.values()); + public Collection<UI> getRoots() { + return Collections.unmodifiableCollection(uIs.values()); } private int connectorIdSequence = 0; @@ -2362,7 +2362,7 @@ public class Application implements Terminal.ErrorListener, Serializable { } /** - * Returns a Root with the given id. + * Returns a UI with the given id. * <p> * This is meant for framework internal use. * </p> @@ -2371,8 +2371,8 @@ public class Application implements Terminal.ErrorListener, Serializable { * The root id * @return The root with the given id or null if not found */ - public Root getRootById(int rootId) { - return roots.get(rootId); + public UI getRootById(int rootId) { + return uIs.get(rootId); } /** diff --git a/server/src/com/vaadin/annotations/EagerInit.java b/server/src/com/vaadin/annotations/EagerInit.java index 5131a79576..462c6bb5ac 100644 --- a/server/src/com/vaadin/annotations/EagerInit.java +++ b/server/src/com/vaadin/annotations/EagerInit.java @@ -21,15 +21,15 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import com.vaadin.terminal.WrappedRequest; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; /** - * Indicates that the init method in a Root class can be called before full + * Indicates that the init method in a UI class can be called before full * browser details ({@link WrappedRequest#getBrowserDetails()}) are available. * This will make the UI appear more quickly, as ensuring the availability of * this information typically requires an additional round trip to the client. * - * @see Root#init(com.vaadin.terminal.WrappedRequest) + * @see UI#init(com.vaadin.terminal.WrappedRequest) * @see WrappedRequest#getBrowserDetails() * * @since 7.0 diff --git a/server/src/com/vaadin/annotations/Theme.java b/server/src/com/vaadin/annotations/Theme.java index e2610d2b3f..052bc245fd 100644 --- a/server/src/com/vaadin/annotations/Theme.java +++ b/server/src/com/vaadin/annotations/Theme.java @@ -21,10 +21,10 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; /** - * Defines a specific theme for a {@link Root}. + * Defines a specific theme for a {@link UI}. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) diff --git a/server/src/com/vaadin/annotations/Widgetset.java b/server/src/com/vaadin/annotations/Widgetset.java index e80f887691..69e3e19319 100644 --- a/server/src/com/vaadin/annotations/Widgetset.java +++ b/server/src/com/vaadin/annotations/Widgetset.java @@ -21,10 +21,10 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; /** - * Defines a specific theme for a {@link Root}. + * Defines a specific theme for a {@link UI}. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) diff --git a/server/src/com/vaadin/terminal/AbstractClientConnector.java b/server/src/com/vaadin/terminal/AbstractClientConnector.java index d2490225fb..87e1dbaa38 100644 --- a/server/src/com/vaadin/terminal/AbstractClientConnector.java +++ b/server/src/com/vaadin/terminal/AbstractClientConnector.java @@ -43,7 +43,7 @@ import com.vaadin.terminal.gwt.server.RpcManager; import com.vaadin.terminal.gwt.server.RpcTarget; import com.vaadin.terminal.gwt.server.ServerRpcManager; import com.vaadin.ui.HasComponents; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; /** * An abstract base class for ClientConnector implementations. This class @@ -94,9 +94,9 @@ public abstract class AbstractClientConnector implements ClientConnector { /* Documentation copied from interface */ @Override public void markAsDirty() { - Root root = getRoot(); - if (root != null) { - root.getConnectorTracker().markDirty(this); + UI uI = getRoot(); + if (uI != null) { + uI.getConnectorTracker().markDirty(this); } } @@ -154,8 +154,8 @@ public abstract class AbstractClientConnector implements ClientConnector { sharedState = createState(); } - Root root = getRoot(); - if (root != null && !root.getConnectorTracker().isDirty(this)) { + UI uI = getRoot(); + if (uI != null && !uI.getConnectorTracker().isDirty(this)) { requestRepaint(); } @@ -363,28 +363,28 @@ public abstract class AbstractClientConnector implements ClientConnector { * @return The connector's application, or <code>null</code> if not attached */ protected Application getApplication() { - Root root = getRoot(); - if (root == null) { + UI uI = getRoot(); + if (uI == null) { return null; } else { - return root.getApplication(); + return uI.getApplication(); } } /** - * Finds a Root ancestor of this connector. <code>null</code> is returned if - * no Root ancestor is found (typically because the connector is not + * Finds a UI ancestor of this connector. <code>null</code> is returned if + * no UI ancestor is found (typically because the connector is not * attached to a proper hierarchy). * - * @return the Root ancestor of this connector, or <code>null</code> if none + * @return the UI ancestor of this connector, or <code>null</code> if none * is found. */ @Override - public Root getRoot() { + public UI getRoot() { ClientConnector connector = this; while (connector != null) { - if (connector instanceof Root) { - return (Root) connector; + if (connector instanceof UI) { + return (UI) connector; } connector = connector.getParent(); } diff --git a/server/src/com/vaadin/terminal/AbstractRootProvider.java b/server/src/com/vaadin/terminal/AbstractRootProvider.java index 0b63003440..b340c62448 100644 --- a/server/src/com/vaadin/terminal/AbstractRootProvider.java +++ b/server/src/com/vaadin/terminal/AbstractRootProvider.java @@ -17,13 +17,13 @@ package com.vaadin.terminal;
import com.vaadin.Application;
-import com.vaadin.ui.Root;
+import com.vaadin.ui.UI;
public abstract class AbstractRootProvider implements RootProvider {
@Override
- public Root instantiateRoot(Application application,
- Class<? extends Root> type, WrappedRequest request) {
+ public UI instantiateRoot(Application application,
+ Class<? extends UI> type, WrappedRequest request) {
try {
return type.newInstance();
} catch (InstantiationException e) {
diff --git a/server/src/com/vaadin/terminal/DefaultRootProvider.java b/server/src/com/vaadin/terminal/DefaultRootProvider.java index cbf8c98828..07533949a0 100644 --- a/server/src/com/vaadin/terminal/DefaultRootProvider.java +++ b/server/src/com/vaadin/terminal/DefaultRootProvider.java @@ -18,12 +18,12 @@ package com.vaadin.terminal; import com.vaadin.Application;
import com.vaadin.RootRequiresMoreInformationException;
-import com.vaadin.ui.Root;
+import com.vaadin.ui.UI;
public class DefaultRootProvider extends AbstractRootProvider {
@Override
- public Class<? extends Root> getRootClass(Application application,
+ public Class<? extends UI> getRootClass(Application application,
WrappedRequest request) throws RootRequiresMoreInformationException {
Object rootClassNameObj = application
.getProperty(Application.ROOT_PARAMETER);
@@ -37,8 +37,8 @@ public class DefaultRootProvider extends AbstractRootProvider { classLoader = getClass().getClassLoader();
}
try {
- Class<? extends Root> rootClass = Class.forName(rootClassName,
- true, classLoader).asSubclass(Root.class);
+ Class<? extends UI> rootClass = Class.forName(rootClassName,
+ true, classLoader).asSubclass(UI.class);
return rootClass;
} catch (ClassNotFoundException e) {
diff --git a/server/src/com/vaadin/terminal/DeploymentConfiguration.java b/server/src/com/vaadin/terminal/DeploymentConfiguration.java index 14a5a3724f..8da088969d 100644 --- a/server/src/com/vaadin/terminal/DeploymentConfiguration.java +++ b/server/src/com/vaadin/terminal/DeploymentConfiguration.java @@ -97,7 +97,7 @@ public interface DeploymentConfiguration extends Serializable { /** * Get the class loader to use for loading classes loaded by name, e.g. - * custom Root classes. <code>null</code> indicates that the default class + * custom UI classes. <code>null</code> indicates that the default class * loader should be used. * * @return the class loader to use, or <code>null</code> diff --git a/server/src/com/vaadin/terminal/Page.java b/server/src/com/vaadin/terminal/Page.java index 41ab8cc8b6..95f9a7b3ec 100644 --- a/server/src/com/vaadin/terminal/Page.java +++ b/server/src/com/vaadin/terminal/Page.java @@ -33,19 +33,19 @@ import com.vaadin.terminal.gwt.server.WebBrowser; import com.vaadin.tools.ReflectTools; import com.vaadin.ui.JavaScript; import com.vaadin.ui.Notification; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; public class Page implements Serializable { /** * Listener that gets notified when the size of the browser window - * containing the root has changed. + * containing the uI has changed. * - * @see Root#addListener(BrowserWindowResizeListener) + * @see UI#addListener(BrowserWindowResizeListener) */ public interface BrowserWindowResizeListener extends Serializable { /** - * Invoked when the browser window containing a Root has been resized. + * Invoked when the browser window containing a UI has been resized. * * @param event * a browser window resize event @@ -54,7 +54,7 @@ public class Page implements Serializable { } /** - * Event that is fired when a browser window containing a root is resized. + * Event that is fired when a browser window containing a uI is resized. */ public class BrowserWindowResizeEvent extends EventObject { @@ -65,7 +65,7 @@ public class Page implements Serializable { * Creates a new event * * @param source - * the root for which the browser window has been resized + * the uI for which the browser window has been resized * @param width * the new width of the browser window * @param height @@ -254,9 +254,9 @@ public class Page implements Serializable { } /** - * Gets the root in which the fragment has changed. + * Gets the uI in which the fragment has changed. * - * @return the root in which the fragment has changed + * @return the uI in which the fragment has changed */ public Page getPage() { return (Page) getSource(); @@ -279,15 +279,15 @@ public class Page implements Serializable { */ private String fragment; - private final Root root; + private final UI uI; private int browserWindowWidth = -1; private int browserWindowHeight = -1; private JavaScript javaScript; - public Page(Root root) { - this.root = root; + public Page(UI uI) { + this.uI = uI; } private void addListener(Class<?> eventType, Object target, Method method) { @@ -332,7 +332,7 @@ public class Page implements Serializable { if (fireEvents) { fireEvent(new FragmentChangedEvent(this, newFragment)); } - root.markAsDirty(); + uI.markAsDirty(); } } @@ -374,7 +374,7 @@ public class Page implements Serializable { } public WebBrowser getWebBrowser() { - return ((WebApplicationContext) root.getApplication().getContext()) + return ((WebApplicationContext) uI.getApplication().getContext()) .getBrowser(); } @@ -399,8 +399,8 @@ public class Page implements Serializable { } /** - * Adds a new {@link BrowserWindowResizeListener} to this root. The listener - * will be notified whenever the browser window within which this root + * Adds a new {@link BrowserWindowResizeListener} to this uI. The listener + * will be notified whenever the browser window within which this uI * resides is resized. * * @param resizeListener @@ -415,7 +415,7 @@ public class Page implements Serializable { } /** - * Removes a {@link BrowserWindowResizeListener} from this root. The + * Removes a {@link BrowserWindowResizeListener} from this uI. The * listener will no longer be notified when the browser window is resized. * * @param resizeListener @@ -427,7 +427,7 @@ public class Page implements Serializable { } /** - * Gets the last known height of the browser window in which this root + * Gets the last known height of the browser window in which this uI * resides. * * @return the browser window height in pixels @@ -437,7 +437,7 @@ public class Page implements Serializable { } /** - * Gets the last known width of the browser window in which this root + * Gets the last known width of the browser window in which this uI * resides. * * @return the browser window width in pixels @@ -450,7 +450,7 @@ public class Page implements Serializable { if (javaScript == null) { // Create and attach on first use javaScript = new JavaScript(); - javaScript.extend(root); + javaScript.extend(uI); } return javaScript; @@ -515,15 +515,15 @@ public class Page implements Serializable { } /** - * Opens the given resource in this root. The contents of this Root is + * Opens the given resource in this uI. The contents of this UI is * replaced by the {@code Resource}. * * @param resource - * the resource to show in this root + * the resource to show in this uI */ public void open(Resource resource) { openList.add(new OpenResource(resource, null, -1, -1, BORDER_DEFAULT)); - root.markAsDirty(); + uI.markAsDirty(); } /** @@ -566,7 +566,7 @@ public class Page implements Serializable { public void open(Resource resource, String windowName) { openList.add(new OpenResource(resource, windowName, -1, -1, BORDER_DEFAULT)); - root.markAsDirty(); + uI.markAsDirty(); } /** @@ -589,7 +589,7 @@ public class Page implements Serializable { int height, BorderStyle border) { openList.add(new OpenResource(resource, windowName, width, height, border)); - root.markAsDirty(); + uI.markAsDirty(); } /** @@ -603,7 +603,7 @@ public class Page implements Serializable { notifications = new LinkedList<Notification>(); } notifications.add(notification); - root.markAsDirty(); + uI.markAsDirty(); } /** @@ -622,17 +622,17 @@ public class Page implements Serializable { } /** - * Gets the Page to which the current root belongs. This is automatically + * Gets the Page to which the current uI belongs. This is automatically * defined when processing requests to the server. In other cases, (e.g. - * from background threads), the current root is not automatically defined. + * from background threads), the current uI is not automatically defined. * - * @see Root#getCurrent() + * @see UI#getCurrent() * * @return the current page instance if available, otherwise * <code>null</code> */ public static Page getCurrent() { - Root currentRoot = Root.getCurrent(); + UI currentRoot = UI.getCurrent(); if (currentRoot == null) { return null; } @@ -647,7 +647,7 @@ public class Page implements Serializable { * the new page title to set */ public void setTitle(String title) { - root.getRpcProxy(PageClientRpc.class).setTitle(title); + uI.getRpcProxy(PageClientRpc.class).setTitle(title); } } diff --git a/server/src/com/vaadin/terminal/RootProvider.java b/server/src/com/vaadin/terminal/RootProvider.java index 476cf1bd78..53173b6b94 100644 --- a/server/src/com/vaadin/terminal/RootProvider.java +++ b/server/src/com/vaadin/terminal/RootProvider.java @@ -18,12 +18,12 @@ package com.vaadin.terminal; import com.vaadin.Application;
import com.vaadin.RootRequiresMoreInformationException;
-import com.vaadin.ui.Root;
+import com.vaadin.ui.UI;
public interface RootProvider {
- public Class<? extends Root> getRootClass(Application application,
+ public Class<? extends UI> getRootClass(Application application,
WrappedRequest request) throws RootRequiresMoreInformationException;
- public Root instantiateRoot(Application application,
- Class<? extends Root> type, WrappedRequest request);
+ public UI instantiateRoot(Application application,
+ Class<? extends UI> type, WrappedRequest request);
}
diff --git a/server/src/com/vaadin/terminal/WrappedRequest.java b/server/src/com/vaadin/terminal/WrappedRequest.java index c317eae048..1186d678b0 100644 --- a/server/src/com/vaadin/terminal/WrappedRequest.java +++ b/server/src/com/vaadin/terminal/WrappedRequest.java @@ -30,7 +30,7 @@ import com.vaadin.Application; import com.vaadin.RootRequiresMoreInformationException; import com.vaadin.annotations.EagerInit; import com.vaadin.terminal.gwt.server.WebBrowser; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; /** * A generic request to the server, wrapping a more specific request type, e.g. @@ -221,7 +221,7 @@ public interface WrappedRequest extends Serializable { * This information is only guaranteed to be available in some special * cases, for instance when {@link Application#getRoot} is called again * after throwing {@link RootRequiresMoreInformationException} or in - * {@link Root#init(WrappedRequest)} for a Root class not annotated with + * {@link UI#init(WrappedRequest)} for a UI class not annotated with * {@link EagerInit} * * @return the browser details, or <code>null</code> if details are not diff --git a/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java b/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java index bd39504237..2315a9c1d6 100644 --- a/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java +++ b/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java @@ -62,7 +62,7 @@ import com.vaadin.terminal.Terminal; import com.vaadin.terminal.WrappedRequest; import com.vaadin.terminal.WrappedResponse; import com.vaadin.terminal.gwt.server.AbstractCommunicationManager.Callback; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; /** * Portlet 2.0 base class. This replaces the servlet in servlet/portlet 1.0 @@ -488,17 +488,17 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet /* Notify listeners */ // Finds the window within the application - Root root = null; + UI uI = null; synchronized (application) { if (application.isRunning()) { switch (requestType) { case RENDER: case ACTION: // Both action requests and render requests are ok - // without a Root as they render the initial HTML + // without a UI as they render the initial HTML // and then do a second request try { - root = application + uI = application .getRootForRequest(wrappedRequest); } catch (RootRequiresMoreInformationException e) { // Ignore problem and continue without root @@ -516,7 +516,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet // root = application.getRoot(); break; default: - root = application + uI = application .getRootForRequest(wrappedRequest); } // if window not found, not a problem - use null @@ -527,25 +527,25 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet // starts? if (request instanceof RenderRequest) { applicationContext.firePortletRenderRequest(application, - root, (RenderRequest) request, + uI, (RenderRequest) request, (RenderResponse) response); } else if (request instanceof ActionRequest) { applicationContext.firePortletActionRequest(application, - root, (ActionRequest) request, + uI, (ActionRequest) request, (ActionResponse) response); } else if (request instanceof EventRequest) { applicationContext.firePortletEventRequest(application, - root, (EventRequest) request, + uI, (EventRequest) request, (EventResponse) response); } else if (request instanceof ResourceRequest) { applicationContext.firePortletResourceRequest(application, - root, (ResourceRequest) request, + uI, (ResourceRequest) request, (ResourceResponse) response); } /* Handle the request */ if (requestType == RequestType.FILE_UPLOAD) { - // Root is resolved in handleFileUpload by + // UI is resolved in handleFileUpload by // PortletCommunicationManager applicationManager.handleFileUpload(application, wrappedRequest, wrappedResponse); @@ -557,7 +557,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet } else if (requestType == RequestType.UIDL) { // Handles AJAX UIDL requests applicationManager.handleUidlRequest(wrappedRequest, - wrappedResponse, portletWrapper, root); + wrappedResponse, portletWrapper, uI); return; } else { /* @@ -599,7 +599,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet } } finally { - Root.setCurrent(null); + UI.setCurrent(null); Application.setCurrent(null); PortletSession session = request diff --git a/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java b/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java index 062ba6cdf7..b17ef20cde 100644 --- a/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java +++ b/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java @@ -56,7 +56,7 @@ import com.vaadin.terminal.ThemeResource; import com.vaadin.terminal.WrappedRequest; import com.vaadin.terminal.WrappedResponse; import com.vaadin.terminal.gwt.server.AbstractCommunicationManager.Callback; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; /** * Abstract implementation of the ApplicationServlet which handles all @@ -314,18 +314,18 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements /* Handle the request */ if (requestType == RequestType.FILE_UPLOAD) { - // Root is resolved in communication manager + // UI is resolved in communication manager applicationManager.handleFileUpload(application, request, response); return; } else if (requestType == RequestType.UIDL) { - Root root = application.getRootForRequest(request); - if (root == null) { + UI uI = application.getRootForRequest(request); + if (uI == null) { throw new ServletException(ERROR_NO_ROOT_FOUND); } // Handles AJAX UIDL requests applicationManager.handleUidlRequest(request, response, - servletWrapper, root); + servletWrapper, uI); return; } else if (requestType == RequestType.BROWSER_DETAILS) { // Browser details - not related to a specific root @@ -369,7 +369,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements .onRequestEnd(request, response); } } finally { - Root.setCurrent(null); + UI.setCurrent(null); Application.setCurrent(null); HttpSession session = request.getSession(false); diff --git a/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index b2436b2ce4..39475f3131 100644 --- a/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -97,7 +97,7 @@ import com.vaadin.ui.AbstractField; import com.vaadin.ui.Component; import com.vaadin.ui.ConnectorTracker; import com.vaadin.ui.HasComponents; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; import com.vaadin.ui.Window; /** @@ -506,7 +506,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * Internally process a UIDL request from the client. * * This method calls - * {@link #handleVariables(WrappedRequest, WrappedResponse, Callback, Application, Root)} + * {@link #handleVariables(WrappedRequest, WrappedResponse, Callback, Application, UI)} * to process any changes to variables by the client and then repaints * affected components using {@link #paintAfterVariableChanges()}. * @@ -520,7 +520,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * @param request * @param response * @param callback - * @param root + * @param uI * target window for the UIDL request, can be null if target not * found * @throws IOException @@ -528,7 +528,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * @throws JSONException */ public void handleUidlRequest(WrappedRequest request, - WrappedResponse response, Callback callback, Root root) + WrappedResponse response, Callback callback, UI uI) throws IOException, InvalidUIDLSecurityKeyException, JSONException { checkWidgetsetVersion(request); @@ -550,7 +550,7 @@ public abstract class AbstractCommunicationManager implements Serializable { if (request.getParameter(GET_PARAM_HIGHLIGHT_COMPONENT) != null) { String pid = request .getParameter(GET_PARAM_HIGHLIGHT_COMPONENT); - highlightedConnector = root.getConnectorTracker().getConnector( + highlightedConnector = uI.getConnectorTracker().getConnector( pid); highlightConnector(highlightedConnector); } @@ -567,7 +567,7 @@ public abstract class AbstractCommunicationManager implements Serializable { // Finds the window within the application if (application.isRunning()) { // Returns if no window found - if (root == null) { + if (uI == null) { // This should not happen, no windows exists but // application is still open. getLogger().warning("Could not get root for application"); @@ -580,7 +580,7 @@ public abstract class AbstractCommunicationManager implements Serializable { } // Change all variables based on request parameters - if (!handleVariables(request, response, callback, application, root)) { + if (!handleVariables(request, response, callback, application, uI)) { // var inconsistency; the client is probably out-of-sync SystemMessages ci = null; @@ -611,8 +611,8 @@ public abstract class AbstractCommunicationManager implements Serializable { } paintAfterVariableChanges(request, response, callback, repaintAll, - outWriter, root, analyzeLayouts); - postPaint(root); + outWriter, uI, analyzeLayouts); + postPaint(uI); } outWriter.close(); @@ -645,20 +645,20 @@ public abstract class AbstractCommunicationManager implements Serializable { * Method called after the paint phase while still being synchronized on the * application * - * @param root + * @param uI * */ - protected void postPaint(Root root) { + protected void postPaint(UI uI) { // Remove connectors that have been detached from the application during // handling of the request - root.getConnectorTracker().cleanConnectorMap(); + uI.getConnectorTracker().cleanConnectorMap(); if (pidToNameToStreamVariable != null) { Iterator<String> iterator = pidToNameToStreamVariable.keySet() .iterator(); while (iterator.hasNext()) { String connectorId = iterator.next(); - if (root.getConnectorTracker().getConnector(connectorId) == null) { + if (uI.getConnectorTracker().getConnector(connectorId) == null) { // Owner is no longer attached to the application Map<String, StreamVariable> removed = pidToNameToStreamVariable .get(connectorId); @@ -746,7 +746,7 @@ public abstract class AbstractCommunicationManager implements Serializable { */ private void paintAfterVariableChanges(WrappedRequest request, WrappedResponse response, Callback callback, boolean repaintAll, - final PrintWriter outWriter, Root root, boolean analyzeLayouts) + final PrintWriter outWriter, UI uI, boolean analyzeLayouts) throws PaintException, IOException, JSONException { // Removes application if it has stopped during variable changes @@ -765,7 +765,7 @@ public abstract class AbstractCommunicationManager implements Serializable { outWriter.print(getSecurityKeyUIDL(request)); } - writeUidlResponse(request, repaintAll, outWriter, root, analyzeLayouts); + writeUidlResponse(request, repaintAll, outWriter, uI, analyzeLayouts); closeJsonMessage(outWriter); @@ -810,15 +810,15 @@ public abstract class AbstractCommunicationManager implements Serializable { @SuppressWarnings("unchecked") public void writeUidlResponse(WrappedRequest request, boolean repaintAll, - final PrintWriter outWriter, Root root, boolean analyzeLayouts) + final PrintWriter outWriter, UI uI, boolean analyzeLayouts) throws PaintException, JSONException { ArrayList<ClientConnector> dirtyVisibleConnectors = new ArrayList<ClientConnector>(); - Application application = root.getApplication(); + Application application = uI.getApplication(); // Paints components - ConnectorTracker rootConnectorTracker = root.getConnectorTracker(); + ConnectorTracker rootConnectorTracker = uI.getConnectorTracker(); getLogger().log(Level.FINE, "* Creating response to client"); if (repaintAll) { - getClientCache(root).clear(); + getClientCache(uI).clear(); rootConnectorTracker.markAllConnectorsDirty(); rootConnectorTracker.markAllClientSidesUninitialized(); @@ -851,12 +851,12 @@ public abstract class AbstractCommunicationManager implements Serializable { if (analyzeLayouts) { invalidComponentRelativeSizes = ComponentSizeValidator - .validateComponentRelativeSizes(root.getContent(), null, + .validateComponentRelativeSizes(uI.getContent(), null, null); // Also check any existing subwindows - if (root.getWindows() != null) { - for (Window subWindow : root.getWindows()) { + if (uI.getWindows() != null) { + for (Window subWindow : uI.getWindows()) { invalidComponentRelativeSizes = ComponentSizeValidator .validateComponentRelativeSizes( subWindow.getContent(), @@ -985,7 +985,7 @@ public abstract class AbstractCommunicationManager implements Serializable { // } paramJson.put(JsonCodec.encode( invocation.getParameters()[i], referenceParameter, - parameterType, root.getConnectorTracker())); + parameterType, uI.getConnectorTracker())); } invocationJson.put(paramJson); rpcCalls.put(invocationJson); @@ -1087,7 +1087,7 @@ public abstract class AbstractCommunicationManager implements Serializable { final String resource = (String) i.next(); InputStream is = null; try { - is = getThemeResourceAsStream(root, getTheme(root), resource); + is = getThemeResourceAsStream(uI, getTheme(uI), resource); } catch (final Exception e) { // FIXME: Handle exception getLogger().log(Level.FINER, @@ -1124,7 +1124,7 @@ public abstract class AbstractCommunicationManager implements Serializable { Collection<Class<? extends ClientConnector>> usedClientConnectors = paintTarget .getUsedClientConnectors(); boolean typeMappingsOpen = false; - ClientCache clientCache = getClientCache(root); + ClientCache clientCache = getClientCache(uI); List<Class<? extends ClientConnector>> newConnectorTypes = new ArrayList<Class<? extends ClientConnector>>(); @@ -1245,8 +1245,8 @@ public abstract class AbstractCommunicationManager implements Serializable { public static JSONObject encodeState(ClientConnector connector, SharedState state) throws JSONException { - Root root = connector.getRoot(); - ConnectorTracker connectorTracker = root.getConnectorTracker(); + UI uI = connector.getRoot(); + ConnectorTracker connectorTracker = uI.getConnectorTracker(); Class<? extends SharedState> stateType = connector.getStateType(); Object diffState = connectorTracker.getDiffState(connector); if (diffState == null) { @@ -1260,7 +1260,7 @@ public abstract class AbstractCommunicationManager implements Serializable { try { SharedState referenceState = stateType.newInstance(); diffState = JsonCodec.encode(referenceState, null, - stateType, root.getConnectorTracker()); + stateType, uI.getConnectorTracker()); } catch (Exception e) { getLogger().log( Level.WARNING, @@ -1271,7 +1271,7 @@ public abstract class AbstractCommunicationManager implements Serializable { } } JSONObject stateJson = (JSONObject) JsonCodec.encode(state, diffState, - stateType, root.getConnectorTracker()); + stateType, uI.getConnectorTracker()); return stateJson; } @@ -1389,8 +1389,8 @@ public abstract class AbstractCommunicationManager implements Serializable { } - private ClientCache getClientCache(Root root) { - Integer rootId = Integer.valueOf(root.getRootId()); + private ClientCache getClientCache(UI uI) { + Integer rootId = Integer.valueOf(uI.getRootId()); ClientCache cache = rootToClientCache.get(rootId); if (cache == null) { cache = new ClientCache(); @@ -1440,7 +1440,7 @@ public abstract class AbstractCommunicationManager implements Serializable { HasComponents parent = child.getParent(); if (parent == null) { - if (child instanceof Root) { + if (child instanceof UI) { return child.isVisible(); } else { return false; @@ -1507,15 +1507,15 @@ public abstract class AbstractCommunicationManager implements Serializable { return pendingInvocations; } - protected abstract InputStream getThemeResourceAsStream(Root root, + protected abstract InputStream getThemeResourceAsStream(UI uI, String themeName, String resource); private int getTimeoutInterval() { return maxInactiveInterval; } - private String getTheme(Root root) { - String themeName = root.getApplication().getThemeForRoot(root); + private String getTheme(UI uI) { + String themeName = uI.getApplication().getThemeForRoot(uI); String requestThemeName = getRequestTheme(); if (requestThemeName != null) { @@ -1554,7 +1554,7 @@ public abstract class AbstractCommunicationManager implements Serializable { */ private boolean handleVariables(WrappedRequest request, WrappedResponse response, Callback callback, - Application application2, Root root) throws IOException, + Application application2, UI uI) throws IOException, InvalidUIDLSecurityKeyException, JSONException { boolean success = true; @@ -1590,7 +1590,7 @@ public abstract class AbstractCommunicationManager implements Serializable { for (int bi = 1; bi < bursts.length; bi++) { // unescape any encoded separator characters in the burst final String burst = unescapeBurst(bursts[bi]); - success &= handleBurst(request, root, burst); + success &= handleBurst(request, uI, burst); // In case that there were multiple bursts, we know that this is // a special synchronous case for closing window. Thus we are @@ -1605,7 +1605,7 @@ public abstract class AbstractCommunicationManager implements Serializable { new CharArrayWriter()); paintAfterVariableChanges(request, response, callback, - true, outWriter, root, false); + true, outWriter, uI, false); } @@ -1632,23 +1632,23 @@ public abstract class AbstractCommunicationManager implements Serializable { * directly. * * @param source - * @param root + * @param uI * the root receiving the burst * @param burst * the content of the burst as a String to be parsed * @return true if the processing of the burst was successful and there were * no messages to non-existent components */ - public boolean handleBurst(WrappedRequest source, Root root, + public boolean handleBurst(WrappedRequest source, UI uI, final String burst) { boolean success = true; try { Set<Connector> enabledConnectors = new HashSet<Connector>(); List<MethodInvocation> invocations = parseInvocations( - root.getConnectorTracker(), burst); + uI.getConnectorTracker(), burst); for (MethodInvocation invocation : invocations) { - final ClientConnector connector = getConnector(root, + final ClientConnector connector = getConnector(uI, invocation.getConnectorId()); if (connector != null && connector.isConnectorEnabled()) { @@ -1659,7 +1659,7 @@ public abstract class AbstractCommunicationManager implements Serializable { for (int i = 0; i < invocations.size(); i++) { MethodInvocation invocation = invocations.get(i); - final ClientConnector connector = getConnector(root, + final ClientConnector connector = getConnector(uI, invocation.getConnectorId()); if (connector == null) { @@ -1715,7 +1715,7 @@ public abstract class AbstractCommunicationManager implements Serializable { if (connector instanceof Component) { errorComponent = (Component) connector; } - handleChangeVariablesError(root.getApplication(), + handleChangeVariablesError(uI.getApplication(), errorComponent, realException, null); } } else { @@ -1747,7 +1747,7 @@ public abstract class AbstractCommunicationManager implements Serializable { errorComponent = (Component) dropHandlerOwner; } } - handleChangeVariablesError(root.getApplication(), + handleChangeVariablesError(uI.getApplication(), errorComponent, e, changes); } } @@ -1877,8 +1877,8 @@ public abstract class AbstractCommunicationManager implements Serializable { owner.changeVariables(source, m); } - protected ClientConnector getConnector(Root root, String connectorId) { - ClientConnector c = root.getConnectorTracker() + protected ClientConnector getConnector(UI uI, String connectorId) { + ClientConnector c = uI.getConnectorTracker() .getConnector(connectorId); if (c == null && connectorId.equals(getDragAndDropService().getConnectorId())) { @@ -2417,18 +2417,18 @@ public abstract class AbstractCommunicationManager implements Serializable { // if we do not yet have a currentRoot, it should be initialized // shortly, and we should send the initial UIDL - boolean sendUIDL = Root.getCurrent() == null; + boolean sendUIDL = UI.getCurrent() == null; try { CombinedRequest combinedRequest = new CombinedRequest(request); - Root root = application.getRootForRequest(combinedRequest); + UI uI = application.getRootForRequest(combinedRequest); response.setContentType("application/json; charset=UTF-8"); // Use the same logic as for determined roots BootstrapHandler bootstrapHandler = getBootstrapHandler(); BootstrapContext context = bootstrapHandler.createContext( - combinedRequest, response, application, root.getRootId()); + combinedRequest, response, application, uI.getRootId()); String widgetset = context.getWidgetsetName(); String theme = context.getThemeName(); @@ -2439,10 +2439,10 @@ public abstract class AbstractCommunicationManager implements Serializable { JSONObject params = new JSONObject(); params.put("widgetset", widgetset); params.put("themeUri", themeUri); - // Root id might have changed based on e.g. window.name - params.put(ApplicationConstants.ROOT_ID_PARAMETER, root.getRootId()); + // UI id might have changed based on e.g. window.name + params.put(ApplicationConstants.ROOT_ID_PARAMETER, uI.getRootId()); if (sendUIDL) { - String initialUIDL = getInitialUIDL(combinedRequest, root); + String initialUIDL = getInitialUIDL(combinedRequest, uI); params.put("uidl", initialUIDL); } @@ -2473,7 +2473,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * * @param request * the request that caused the initialization - * @param root + * @param uI * the root for which the UIDL should be generated * @return a string with the initial UIDL message * @throws PaintException @@ -2481,16 +2481,16 @@ public abstract class AbstractCommunicationManager implements Serializable { * @throws JSONException * if an exception occurs while encoding output */ - protected String getInitialUIDL(WrappedRequest request, Root root) + protected String getInitialUIDL(WrappedRequest request, UI uI) throws PaintException, JSONException { // TODO maybe unify writeUidlResponse()? StringWriter sWriter = new StringWriter(); PrintWriter pWriter = new PrintWriter(sWriter); pWriter.print("{"); - if (isXSRFEnabled(root.getApplication())) { + if (isXSRFEnabled(uI.getApplication())) { pWriter.print(getSecurityKeyUIDL(request)); } - writeUidlResponse(request, true, pWriter, root, false); + writeUidlResponse(request, true, pWriter, uI, false); pWriter.print("}"); String initialUIDL = sWriter.toString(); getLogger().log(Level.FINE, "Initial UIDL:" + initialUIDL); @@ -2628,15 +2628,15 @@ public abstract class AbstractCommunicationManager implements Serializable { String rootId = parts[0]; String connectorId = parts[1]; String variableName = parts[2]; - Root root = application.getRootById(Integer.parseInt(rootId)); - Root.setCurrent(root); + UI uI = application.getRootById(Integer.parseInt(rootId)); + UI.setCurrent(uI); StreamVariable streamVariable = getStreamVariable(connectorId, variableName); String secKey = streamVariableToSeckey.get(streamVariable); if (secKey.equals(parts[3])) { - ClientConnector source = getConnector(root, connectorId); + ClientConnector source = getConnector(uI, connectorId); String contentType = request.getContentType(); if (contentType.contains("boundary")) { // Multipart requests contain boundary string diff --git a/server/src/com/vaadin/terminal/gwt/server/BootstrapFragmentResponse.java b/server/src/com/vaadin/terminal/gwt/server/BootstrapFragmentResponse.java index fabb69784f..df77600150 100644 --- a/server/src/com/vaadin/terminal/gwt/server/BootstrapFragmentResponse.java +++ b/server/src/com/vaadin/terminal/gwt/server/BootstrapFragmentResponse.java @@ -49,7 +49,7 @@ public class BootstrapFragmentResponse extends BootstrapResponse { * the application for which the bootstrap page should be * generated * @param rootId - * the generated id of the Root that will be displayed on the + * the generated id of the UI that will be displayed on the * page * @param fragmentNodes * a mutable list containing the DOM nodes that will make up the diff --git a/server/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java b/server/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java index fad80cacaa..b6953da35e 100644 --- a/server/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java +++ b/server/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java @@ -47,7 +47,7 @@ import com.vaadin.terminal.PaintException; import com.vaadin.terminal.RequestHandler; import com.vaadin.terminal.WrappedRequest; import com.vaadin.terminal.WrappedResponse; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; public abstract class BootstrapHandler implements RequestHandler { @@ -82,14 +82,14 @@ public abstract class BootstrapHandler implements RequestHandler { return bootstrapResponse.getRootId(); } - public Root getRoot() { + public UI getRoot() { return bootstrapResponse.getRoot(); } public String getWidgetsetName() { if (widgetsetName == null) { - Root root = getRoot(); - if (root != null) { + UI uI = getRoot(); + if (uI != null) { widgetsetName = getWidgetsetForRoot(this); } } @@ -98,8 +98,8 @@ public abstract class BootstrapHandler implements RequestHandler { public String getThemeName() { if (themeName == null) { - Root root = getRoot(); - if (root != null) { + UI uI = getRoot(); + if (uI != null) { themeName = findAndEscapeThemeName(this); } } @@ -127,13 +127,13 @@ public abstract class BootstrapHandler implements RequestHandler { // TODO Should all urls be handled here? Integer rootId = null; try { - Root root = application.getRootForRequest(request); - if (root == null) { - writeError(response, new Throwable("No Root found")); + UI uI = application.getRootForRequest(request); + if (uI == null) { + writeError(response, new Throwable("No UI found")); return true; } - rootId = Integer.valueOf(root.getRootId()); + rootId = Integer.valueOf(uI.getRootId()); } catch (RootRequiresMoreInformationException e) { // Just keep going without rootId } @@ -246,8 +246,8 @@ public abstract class BootstrapHandler implements RequestHandler { head.appendElement("meta").attr("http-equiv", "X-UA-Compatible") .attr("content", "chrome=1"); - Root root = context.getRoot(); - String title = ((root == null || root.getCaption() == null) ? "" : root + UI uI = context.getRoot(); + String title = ((uI == null || uI.getCaption() == null) ? "" : uI .getCaption()); head.appendElement("title").appendText(title); @@ -294,10 +294,10 @@ public abstract class BootstrapHandler implements RequestHandler { protected abstract String getApplicationId(BootstrapContext context); public String getWidgetsetForRoot(BootstrapContext context) { - Root root = context.getRoot(); + UI uI = context.getRoot(); WrappedRequest request = context.getRequest(); - String widgetset = root.getApplication().getWidgetsetForRoot(root); + String widgetset = uI.getApplication().getWidgetsetForRoot(uI); if (widgetset == null) { widgetset = request.getDeploymentConfiguration() .getConfiguredWidgetset(request); @@ -568,7 +568,7 @@ public abstract class BootstrapHandler implements RequestHandler { * * @param request * the originating request - * @param root + * @param uI * the root for which the UIDL should be generated * @return a string with the initial UIDL message * @throws PaintException @@ -576,7 +576,7 @@ public abstract class BootstrapHandler implements RequestHandler { * @throws JSONException * if an exception occurs while formatting the output */ - protected abstract String getInitialUIDL(WrappedRequest request, Root root) + protected abstract String getInitialUIDL(WrappedRequest request, UI uI) throws PaintException, JSONException; } diff --git a/server/src/com/vaadin/terminal/gwt/server/BootstrapPageResponse.java b/server/src/com/vaadin/terminal/gwt/server/BootstrapPageResponse.java index e7440f4c22..535ab23c92 100644 --- a/server/src/com/vaadin/terminal/gwt/server/BootstrapPageResponse.java +++ b/server/src/com/vaadin/terminal/gwt/server/BootstrapPageResponse.java @@ -52,7 +52,7 @@ public class BootstrapPageResponse extends BootstrapResponse { * the application for which the bootstrap page should be * generated * @param rootId - * the generated id of the Root that will be displayed on the + * the generated id of the UI that will be displayed on the * page * @param document * the DOM document making up the HTML page diff --git a/server/src/com/vaadin/terminal/gwt/server/BootstrapResponse.java b/server/src/com/vaadin/terminal/gwt/server/BootstrapResponse.java index 10f97e7e79..4f69dda48b 100644 --- a/server/src/com/vaadin/terminal/gwt/server/BootstrapResponse.java +++ b/server/src/com/vaadin/terminal/gwt/server/BootstrapResponse.java @@ -21,7 +21,7 @@ import java.util.EventObject; import com.vaadin.Application; import com.vaadin.RootRequiresMoreInformationException; import com.vaadin.terminal.WrappedRequest; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; /** * Base class providing common functionality used in different bootstrap @@ -47,7 +47,7 @@ public abstract class BootstrapResponse extends EventObject { * the application for which the bootstrap page should be * generated * @param rootId - * the generated id of the Root that will be displayed on the + * the generated id of the UI that will be displayed on the * page */ public BootstrapResponse(BootstrapHandler handler, WrappedRequest request, @@ -93,7 +93,7 @@ public abstract class BootstrapResponse extends EventObject { /** * Gets the root id that has been generated for this response. Please note * that if {@link Application#isRootPreserved()} is enabled, a previously - * created Root with a different id might eventually end up being used. + * created UI with a different id might eventually end up being used. * * @return the root id */ @@ -102,21 +102,21 @@ public abstract class BootstrapResponse extends EventObject { } /** - * Gets the Root for which this page is being rendered, if available. Some - * features of the framework will postpone the Root selection until after + * Gets the UI for which this page is being rendered, if available. Some + * features of the framework will postpone the UI selection until after * the bootstrap page has been rendered and required information from the * browser has been sent back. This method will return <code>null</code> if - * no Root instance is yet available. + * no UI instance is yet available. * * @see Application#isRootPreserved() * @see Application#getRoot(WrappedRequest) * @see RootRequiresMoreInformationException * - * @return The Root that will be displayed in the page being generated, or + * @return The UI that will be displayed in the page being generated, or * <code>null</code> if all required information is not yet * available. */ - public Root getRoot() { - return Root.getCurrent(); + public UI getRoot() { + return UI.getCurrent(); } } diff --git a/server/src/com/vaadin/terminal/gwt/server/ClientConnector.java b/server/src/com/vaadin/terminal/gwt/server/ClientConnector.java index 24675c9e45..3a18dbd6f4 100644 --- a/server/src/com/vaadin/terminal/gwt/server/ClientConnector.java +++ b/server/src/com/vaadin/terminal/gwt/server/ClientConnector.java @@ -26,7 +26,7 @@ import com.vaadin.terminal.AbstractClientConnector; import com.vaadin.terminal.Extension; import com.vaadin.ui.Component; import com.vaadin.ui.ComponentContainer; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; /** * Interface implemented by all connectors that are capable of communicating @@ -177,10 +177,10 @@ public interface ClientConnector extends Connector, RpcTarget { /** * Returns the root this connector is attached to * - * @return The Root this connector is attached to or null if it is not - * attached to any Root + * @return The UI this connector is attached to or null if it is not + * attached to any UI */ - public Root getRoot(); + public UI getRoot(); /** * Called before the shared state and RPC invocations are sent to the diff --git a/server/src/com/vaadin/terminal/gwt/server/ClientMethodInvocation.java b/server/src/com/vaadin/terminal/gwt/server/ClientMethodInvocation.java index 25d0b23725..7cc5159bc0 100644 --- a/server/src/com/vaadin/terminal/gwt/server/ClientMethodInvocation.java +++ b/server/src/com/vaadin/terminal/gwt/server/ClientMethodInvocation.java @@ -34,7 +34,7 @@ public class ClientMethodInvocation implements Serializable, private final Object[] parameters; private Type[] parameterTypes; - // used for sorting calls between different connectors in the same Root + // used for sorting calls between different connectors in the same UI private final long sequenceNumber; // TODO may cause problems when clustering etc. private static long counter = 0; diff --git a/server/src/com/vaadin/terminal/gwt/server/CommunicationManager.java b/server/src/com/vaadin/terminal/gwt/server/CommunicationManager.java index e0386b51b4..7551e849a1 100644 --- a/server/src/com/vaadin/terminal/gwt/server/CommunicationManager.java +++ b/server/src/com/vaadin/terminal/gwt/server/CommunicationManager.java @@ -25,7 +25,7 @@ import com.vaadin.Application; import com.vaadin.external.json.JSONException; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.WrappedRequest; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; /** * Application manager processes changes and paints for single application @@ -111,17 +111,17 @@ public class CommunicationManager extends AbstractCommunicationManager { } @Override - protected String getInitialUIDL(WrappedRequest request, Root root) + protected String getInitialUIDL(WrappedRequest request, UI uI) throws PaintException, JSONException { - return CommunicationManager.this.getInitialUIDL(request, root); + return CommunicationManager.this.getInitialUIDL(request, uI); } }; } @Override - protected InputStream getThemeResourceAsStream(Root root, String themeName, + protected InputStream getThemeResourceAsStream(UI uI, String themeName, String resource) { - WebApplicationContext context = (WebApplicationContext) root + WebApplicationContext context = (WebApplicationContext) uI .getApplication().getContext(); ServletContext servletContext = context.getHttpSession() .getServletContext(); diff --git a/server/src/com/vaadin/terminal/gwt/server/DragAndDropService.java b/server/src/com/vaadin/terminal/gwt/server/DragAndDropService.java index 221598171c..42312b72fd 100644 --- a/server/src/com/vaadin/terminal/gwt/server/DragAndDropService.java +++ b/server/src/com/vaadin/terminal/gwt/server/DragAndDropService.java @@ -40,7 +40,7 @@ import com.vaadin.terminal.Extension; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.VariableOwner; import com.vaadin.ui.Component; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; public class DragAndDropService implements VariableOwner, ClientConnector { @@ -327,7 +327,7 @@ public class DragAndDropService implements VariableOwner, ClientConnector { } @Override - public Root getRoot() { + public UI getRoot() { return null; } diff --git a/server/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java b/server/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java index eba7d6e3a3..a5a3e94954 100644 --- a/server/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java +++ b/server/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java @@ -46,7 +46,7 @@ import javax.xml.namespace.QName; import com.vaadin.Application; import com.vaadin.terminal.ExternalResource; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; /** * TODO Write documentation, fix JavaDoc tags. @@ -180,18 +180,18 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { } } - public void firePortletRenderRequest(Application app, Root root, + public void firePortletRenderRequest(Application app, UI uI, RenderRequest request, RenderResponse response) { Set<PortletListener> listeners = portletListeners.get(app); if (listeners != null) { for (PortletListener l : listeners) { l.handleRenderRequest(request, new RestrictedRenderResponse( - response), root); + response), uI); } } } - public void firePortletActionRequest(Application app, Root root, + public void firePortletActionRequest(Application app, UI uI, ActionRequest request, ActionResponse response) { String key = request.getParameter(ActionRequest.ACTION_NAME); if (eventActionDestinationMap.containsKey(key)) { @@ -213,28 +213,28 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { Set<PortletListener> listeners = portletListeners.get(app); if (listeners != null) { for (PortletListener l : listeners) { - l.handleActionRequest(request, response, root); + l.handleActionRequest(request, response, uI); } } } } - public void firePortletEventRequest(Application app, Root root, + public void firePortletEventRequest(Application app, UI uI, EventRequest request, EventResponse response) { Set<PortletListener> listeners = portletListeners.get(app); if (listeners != null) { for (PortletListener l : listeners) { - l.handleEventRequest(request, response, root); + l.handleEventRequest(request, response, uI); } } } - public void firePortletResourceRequest(Application app, Root root, + public void firePortletResourceRequest(Application app, UI uI, ResourceRequest request, ResourceResponse response) { Set<PortletListener> listeners = portletListeners.get(app); if (listeners != null) { for (PortletListener l : listeners) { - l.handleResourceRequest(request, response, root); + l.handleResourceRequest(request, response, uI); } } } @@ -242,16 +242,16 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { public interface PortletListener extends Serializable { public void handleRenderRequest(RenderRequest request, - RenderResponse response, Root root); + RenderResponse response, UI uI); public void handleActionRequest(ActionRequest request, - ActionResponse response, Root root); + ActionResponse response, UI uI); public void handleEventRequest(EventRequest request, - EventResponse response, Root root); + EventResponse response, UI uI); public void handleResourceRequest(ResourceRequest request, - ResourceResponse response, Root root); + ResourceResponse response, UI uI); } /** @@ -295,7 +295,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { * Event names for events sent and received by a portlet need to be declared * in portlet.xml . * - * @param root + * @param uI * a window in which a temporary action URL can be opened if * necessary * @param name @@ -304,7 +304,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { * event value object that is Serializable and, if appropriate, * has a valid JAXB annotation */ - public void sendPortletEvent(Root root, QName name, Serializable value) + public void sendPortletEvent(UI uI, QName name, Serializable value) throws IllegalStateException { if (response instanceof MimeResponse) { String actionKey = "" + System.currentTimeMillis(); @@ -315,7 +315,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { if (actionUrl != null) { eventActionDestinationMap.put(actionKey, name); eventActionValueMap.put(actionKey, value); - root.getPage().open(new ExternalResource(actionUrl.toString())); + uI.getPage().open(new ExternalResource(actionUrl.toString())); } else { // this should never happen as we already know the response is a // MimeResponse @@ -342,7 +342,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { * Shared parameters set or read by a portlet need to be declared in * portlet.xml . * - * @param root + * @param uI * a window in which a temporary action URL can be opened if * necessary * @param name @@ -350,7 +350,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { * @param value * parameter value */ - public void setSharedRenderParameter(Root root, String name, String value) + public void setSharedRenderParameter(UI uI, String name, String value) throws IllegalStateException { if (response instanceof MimeResponse) { String actionKey = "" + System.currentTimeMillis(); @@ -361,7 +361,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { if (actionUrl != null) { sharedParameterActionNameMap.put(actionKey, name); sharedParameterActionValueMap.put(actionKey, value); - root.getPage().open(new ExternalResource(actionUrl.toString())); + uI.getPage().open(new ExternalResource(actionUrl.toString())); } else { // this should never happen as we already know the response is a // MimeResponse @@ -381,7 +381,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { * * Portlet modes used by a portlet need to be declared in portlet.xml . * - * @param root + * @param uI * a window in which the render URL can be opened if necessary * @param portletMode * the portlet mode to switch to @@ -389,12 +389,12 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { * if the portlet mode is not allowed for some reason * (configuration, permissions etc.) */ - public void setPortletMode(Root root, PortletMode portletMode) + public void setPortletMode(UI uI, PortletMode portletMode) throws IllegalStateException, PortletModeException { if (response instanceof MimeResponse) { PortletURL url = ((MimeResponse) response).createRenderURL(); url.setPortletMode(portletMode); - throw new RuntimeException("Root.open has not yet been implemented"); + throw new RuntimeException("UI.open has not yet been implemented"); // root.open(new ExternalResource(url.toString())); } else if (response instanceof StateAwareResponse) { ((StateAwareResponse) response).setPortletMode(portletMode); diff --git a/server/src/com/vaadin/terminal/gwt/server/PortletCommunicationManager.java b/server/src/com/vaadin/terminal/gwt/server/PortletCommunicationManager.java index b6fbbec298..e127425786 100644 --- a/server/src/com/vaadin/terminal/gwt/server/PortletCommunicationManager.java +++ b/server/src/com/vaadin/terminal/gwt/server/PortletCommunicationManager.java @@ -34,7 +34,7 @@ import com.vaadin.terminal.DeploymentConfiguration; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.WrappedRequest; import com.vaadin.terminal.WrappedResponse; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; /** * TODO document me! @@ -142,10 +142,10 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { } @Override - protected String getInitialUIDL(WrappedRequest request, Root root) + protected String getInitialUIDL(WrappedRequest request, UI uI) throws PaintException, JSONException { return PortletCommunicationManager.this.getInitialUIDL(request, - root); + uI); } @Override @@ -168,9 +168,9 @@ public class PortletCommunicationManager extends AbstractCommunicationManager { } @Override - protected InputStream getThemeResourceAsStream(Root root, String themeName, + protected InputStream getThemeResourceAsStream(UI uI, String themeName, String resource) { - PortletApplicationContext2 context = (PortletApplicationContext2) root + PortletApplicationContext2 context = (PortletApplicationContext2) uI .getApplication().getContext(); PortletContext portletContext = context.getPortletSession() .getPortletContext(); diff --git a/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java b/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java index 200f9a9103..13d558e66e 100644 --- a/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java +++ b/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java @@ -6,7 +6,7 @@ import com.vaadin.Application; import com.vaadin.shared.ApplicationConstants; import com.vaadin.terminal.DeploymentConfiguration; import com.vaadin.terminal.WrappedRequest; -import com.vaadin.ui.Root; +import com.vaadin.ui.UI; /* * Copyright 2011 Vaadin Ltd. @@ -76,9 +76,9 @@ class ServletPortletHelper implements Serializable { // Check that the root layout class can be found try { Class<?> rootClass = classLoader.loadClass(className); - if (!Root.class.isAssignableFrom(rootClass)) { + if (!UI.class.isAssignableFrom(rootClass)) { throw new ApplicationClassException(className - + " does not implement Root"); + + " does not implement UI"); } // Try finding a default constructor, else throw exception rootClass.getConstructor(); diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index b1393488f7..147034fe6b 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -561,7 +561,7 @@ public abstract class AbstractComponent extends AbstractClientConnector * here, we use the default documentation from implemented interface. */ @Override - public Root getRoot() { + public UI getRoot() { // Just make method from implemented Component interface public return super.getRoot(); } @@ -588,9 +588,9 @@ public abstract class AbstractComponent extends AbstractClientConnector public void detach() { super.detach(); if (actionManager != null) { - // Remove any existing viewer. Root cast is just to make the + // Remove any existing viewer. UI cast is just to make the // compiler happy - actionManager.setViewer((Root) null); + actionManager.setViewer((UI) null); } } diff --git a/server/src/com/vaadin/ui/Component.java b/server/src/com/vaadin/ui/Component.java index 89e282d4e1..7406303af9 100644 --- a/server/src/com/vaadin/ui/Component.java +++ b/server/src/com/vaadin/ui/Component.java @@ -507,18 +507,18 @@ public interface Component extends ClientConnector, Sizeable, Serializable { public void setIcon(Resource icon); /** - * Gets the Root the component is attached to. + * Gets the UI the component is attached to. * * <p> - * If the component is not attached to a Root through a component + * If the component is not attached to a UI through a component * containment hierarchy, <code>null</code> is returned. * </p> * - * @return the Root of the component or <code>null</code> if it is not - * attached to a Root + * @return the UI of the component or <code>null</code> if it is not + * attached to a UI */ @Override - public Root getRoot(); + public UI getRoot(); /** * Gets the application object to which the component is attached. @@ -574,8 +574,8 @@ public interface Component extends ClientConnector, Sizeable, Serializable { * {@link #setParent(Component)}. * </p> * <p> - * This method must call {@link Root#componentAttached(Component)} to let - * the Root know that a new Component has been attached. + * This method must call {@link UI#componentAttached(Component)} to let + * the UI know that a new Component has been attached. * </p> * * diff --git a/server/src/com/vaadin/ui/ConnectorTracker.java b/server/src/com/vaadin/ui/ConnectorTracker.java index 72879e0a25..3a6e1e4ea8 100644 --- a/server/src/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/com/vaadin/ui/ConnectorTracker.java @@ -30,7 +30,7 @@ import com.vaadin.terminal.gwt.server.ClientConnector; /** * A class which takes care of book keeping of {@link ClientConnector}s for a - * Root. + * UI. * <p> * Provides {@link #getConnector(String)} which can be used to lookup a * connector from its id. This is for framework use only and should not be @@ -54,7 +54,7 @@ public class ConnectorTracker implements Serializable { private Set<ClientConnector> dirtyConnectors = new HashSet<ClientConnector>(); private Set<ClientConnector> uninitializedConnectors = new HashSet<ClientConnector>(); - private Root root; + private UI uI; private Map<ClientConnector, Object> diffStates = new HashMap<ClientConnector, Object>(); /** @@ -68,15 +68,15 @@ public class ConnectorTracker implements Serializable { } /** - * Creates a new ConnectorTracker for the given root. A tracker is always - * attached to a root and the root cannot be changed during the lifetime of + * Creates a new ConnectorTracker for the given uI. A tracker is always + * attached to a uI and the uI cannot be changed during the lifetime of * a {@link ConnectorTracker}. * - * @param root - * The root to attach to. Cannot be null. + * @param uI + * The uI to attach to. Cannot be null. */ - public ConnectorTracker(Root root) { - this.root = root; + public ConnectorTracker(UI uI) { + this.uI = uI; } /** @@ -210,8 +210,8 @@ public class ConnectorTracker implements Serializable { while (iterator.hasNext()) { String connectorId = iterator.next(); ClientConnector connector = connectorIdToConnector.get(connectorId); - if (getRootForConnector(connector) != root) { - // If connector is no longer part of this root, + if (getRootForConnector(connector) != uI) { + // If connector is no longer part of this uI, // remove it from the map. If it is re-attached to the // application at some point it will be re-added through // registerConnector(connector) @@ -232,14 +232,14 @@ public class ConnectorTracker implements Serializable { } /** - * Finds the root that the connector is attached to. + * Finds the uI that the connector is attached to. * * @param connector * The connector to lookup - * @return The root the connector is attached to or null if it is not - * attached to any root. + * @return The uI the connector is attached to or null if it is not + * attached to any uI. */ - private Root getRootForConnector(ClientConnector connector) { + private UI getRootForConnector(ClientConnector connector) { if (connector == null) { return null; } @@ -330,15 +330,15 @@ public class ConnectorTracker implements Serializable { } /** - * Mark all connectors in this root as dirty. + * Mark all connectors in this uI as dirty. */ public void markAllConnectorsDirty() { - markConnectorsDirtyRecursively(root); + markConnectorsDirtyRecursively(uI); getLogger().fine("All connectors are now dirty"); } /** - * Mark all connectors in this root as clean. + * Mark all connectors in this uI as clean. */ public void markAllConnectorsClean() { dirtyConnectors.clear(); @@ -370,7 +370,7 @@ public class ConnectorTracker implements Serializable { * client in the following request. * </p> * - * @return A collection of all dirty connectors for this root. This list may + * @return A collection of all dirty connectors for this uI. This list may * contain invisible connectors. */ public Collection<ClientConnector> getDirtyConnectors() { diff --git a/server/src/com/vaadin/ui/LoginForm.java b/server/src/com/vaadin/ui/LoginForm.java index bb7767084c..f127a2705b 100644 --- a/server/src/com/vaadin/ui/LoginForm.java +++ b/server/src/com/vaadin/ui/LoginForm.java @@ -99,8 +99,8 @@ public class LoginForm extends CustomComponent { throws IOException { String requestPathInfo = request.getRequestPathInfo(); if ("/loginHandler".equals(requestPathInfo)) { - // Ensure Root.getCurrent() works in listeners - Root.setCurrent(getRoot()); + // Ensure UI.getCurrent() works in listeners + UI.setCurrent(getRoot()); response.setCacheTime(-1); response.setContentType("text/html; charset=utf-8"); diff --git a/server/src/com/vaadin/ui/Root.java b/server/src/com/vaadin/ui/UI.java index 67f2e04a65..33eefff485 100644 --- a/server/src/com/vaadin/ui/Root.java +++ b/server/src/com/vaadin/ui/UI.java @@ -76,7 +76,7 @@ import com.vaadin.ui.Window.CloseListener; * </p> * <p> * If a {@link EagerInit} annotation is present on a class extending - * <code>Root</code>, the framework will use a faster initialization method + * <code>UI</code>, 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. * </p> @@ -86,7 +86,7 @@ import com.vaadin.ui.Window.CloseListener; * * @since 7.0 */ -public abstract class Root extends AbstractComponentContainer implements +public abstract class UI extends AbstractComponentContainer implements Action.Container, Action.Notifier, Vaadin6Component { /** @@ -96,7 +96,7 @@ public abstract class Root extends AbstractComponentContainer implements */ @Deprecated @EagerInit - public static class LegacyWindow extends Root { + public static class LegacyWindow extends UI { private String name; /** @@ -210,7 +210,7 @@ public abstract class Root extends AbstractComponentContainer implements } /** - * Opens the given resource in this root. The contents of this Root is + * Opens the given resource in this root. The contents of this UI is * replaced by the {@code Resource}. * * @param resource @@ -422,7 +422,7 @@ public abstract class Root extends AbstractComponentContainer implements /** * Thread local for keeping track of the current root. */ - private static final ThreadLocal<Root> currentRoot = new ThreadLocal<Root>(); + private static final ThreadLocal<UI> currentRoot = new ThreadLocal<UI>(); /** Identifies the click event */ private ConnectorTracker connectorTracker = new ConnectorTracker(this); @@ -432,7 +432,7 @@ public abstract class Root extends AbstractComponentContainer implements private RootServerRpc rpc = new RootServerRpc() { @Override public void click(MouseEventDetails mouseDetails) { - fireEvent(new ClickEvent(Root.this, mouseDetails)); + fireEvent(new ClickEvent(UI.this, mouseDetails)); } @Override @@ -447,7 +447,7 @@ public abstract class Root extends AbstractComponentContainer implements * Creates a new empty root without a caption. This root will have a * {@link VerticalLayout} with margins enabled as its content. */ - public Root() { + public UI() { this((ComponentContainer) null); } @@ -459,7 +459,7 @@ public abstract class Root extends AbstractComponentContainer implements * * @see #setContent(ComponentContainer) */ - public Root(ComponentContainer content) { + public UI(ComponentContainer content) { registerRpc(rpc); setSizeFull(); setContent(content); @@ -475,7 +475,7 @@ public abstract class Root extends AbstractComponentContainer implements * * @see #setCaption(String) */ - public Root(String caption) { + public UI(String caption) { this((ComponentContainer) null); setCaption(caption); } @@ -492,7 +492,7 @@ public abstract class Root extends AbstractComponentContainer implements * @see #setContent(ComponentContainer) * @see #setCaption(String) */ - public Root(String caption, ComponentContainer content) { + public UI(String caption, ComponentContainer content) { this(content); setCaption(caption); } @@ -517,7 +517,7 @@ public abstract class Root extends AbstractComponentContainer implements * @see com.vaadin.ui.AbstractComponent#getRoot() */ @Override - public Root getRoot() { + public UI getRoot() { return this; } @@ -668,7 +668,7 @@ public abstract class Root extends AbstractComponentContainer implements */ public void setRootId(int rootId) { if (this.rootId != -1) { - throw new IllegalStateException("Root id has already been defined"); + throw new IllegalStateException("UI id has already been defined"); } this.rootId = rootId; } @@ -845,7 +845,7 @@ public abstract class Root extends AbstractComponentContainer implements * * @return a component container to use as content * - * @see #Root(ComponentContainer) + * @see #UI(ComponentContainer) * @see #createDefaultLayout() */ public void setContent(ComponentContainer content) { @@ -920,7 +920,7 @@ public abstract class Root extends AbstractComponentContainer implements * {@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 - * by adding the {@link EagerInit} annotation to the Root class. + * by adding the {@link EagerInit} annotation to the UI class. * </p> * * @param request @@ -938,14 +938,14 @@ public abstract class Root extends AbstractComponentContainer implements * background threads. * </p> * - * @param root + * @param uI * the root to register as the current root * * @see #getCurrent() * @see ThreadLocal */ - public static void setCurrent(Root root) { - currentRoot.set(root); + public static void setCurrent(UI uI) { + currentRoot.set(uI); } /** @@ -956,9 +956,9 @@ public abstract class Root extends AbstractComponentContainer implements * @return the current root instance if available, otherwise * <code>null</code> * - * @see #setCurrent(Root) + * @see #setCurrent(UI) */ - public static Root getCurrent() { + public static UI getCurrent() { return currentRoot.get(); } @@ -1027,9 +1027,9 @@ public abstract class Root extends AbstractComponentContainer implements } /** - * Add a click listener to the Root. The listener is called whenever the - * user clicks inside the Root. Also when the click targets a component - * inside the Root, provided the targeted component does not prevent the + * 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. @@ -1043,7 +1043,7 @@ public abstract class Root extends AbstractComponentContainer implements } /** - * Remove a click listener from the Root. The listener should earlier have + * Remove a click listener from the UI. The listener should earlier have * been added using {@link #addListener(ClickListener)}. * * @param listener @@ -1056,7 +1056,7 @@ public abstract class Root extends AbstractComponentContainer implements @Override public boolean isConnectorEnabled() { - // TODO How can a Root be invisible? What does it mean? + // TODO How can a UI be invisible? What does it mean? return isVisible() && isEnabled(); } @@ -1069,7 +1069,7 @@ public abstract class Root extends AbstractComponentContainer implements } /** - * Setting the caption of a Root is not supported. To set the title of the + * Setting the caption of a UI is not supported. To set the title of the * HTML page, use Page.setTitle * * @deprecated as of 7.0.0, use {@link Page#setTitle(String)} @@ -1078,7 +1078,7 @@ public abstract class Root extends AbstractComponentContainer implements @Deprecated public void setCaption(String caption) { throw new IllegalStateException( - "You can not set the title of a Root. To set the title of the HTML page, use Page.setTitle"); + "You can not set the title of a UI. To set the title of the HTML page, use Page.setTitle"); } /** diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java index d79588cc63..335f7fd67d 100644 --- a/server/src/com/vaadin/ui/Window.java +++ b/server/src/com/vaadin/ui/Window.java @@ -40,8 +40,8 @@ import com.vaadin.terminal.Vaadin6Component; /** * A component that represents a floating popup window that can be added to a - * {@link Root}. A window is added to a {@code Root} using - * {@link Root#addWindow(Window)}. </p> + * {@link UI}. A window is added to a {@code UI} using + * {@link UI#addWindow(Window)}. </p> * <p> * The contents of a window is set using {@link #setContent(ComponentContainer)} * or by using the {@link #Window(String, ComponentContainer)} constructor. The @@ -57,7 +57,7 @@ import com.vaadin.terminal.Vaadin6Component; * </p> * <p> * In Vaadin versions prior to 7.0.0, Window was also used as application level - * windows. This function is now covered by the {@link Root} class. + * windows. This function is now covered by the {@link UI} class. * </p> * * @author Vaadin Ltd. @@ -222,14 +222,14 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * </p> */ public void close() { - Root root = getRoot(); + UI uI = getRoot(); // Don't do anything if not attached to a root - if (root != null) { + if (uI != null) { // focus is restored to the parent window - root.focus(); + uI.focus(); // subwindow is removed from the root - root.removeWindow(this); + uI.removeWindow(this); } } @@ -476,13 +476,13 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * <p> */ public void bringToFront() { - Root root = getRoot(); - if (root == null) { + UI uI = getRoot(); + if (uI == null) { throw new IllegalStateException( "Window must be attached to parent before calling bringToFront method."); } int maxBringToFront = -1; - for (Window w : root.getWindows()) { + for (Window w : uI.getWindows()) { if (!isModal() && w.isModal()) { throw new IllegalStateException( "The root contains modal windows, non-modal window cannot be brought to front."); diff --git a/server/src/org/jsoup/select/Evaluator.java b/server/src/org/jsoup/select/Evaluator.java index 16a083bd77..bd0cee481d 100644 --- a/server/src/org/jsoup/select/Evaluator.java +++ b/server/src/org/jsoup/select/Evaluator.java @@ -18,7 +18,7 @@ public abstract class Evaluator { /** * Test if the element meets the evaluator's requirements. * - * @param root Root of the matching subtree + * @param root UI of the matching subtree * @param element tested element */ public abstract boolean matches(Element root, Element element); |