]> source.dussan.org Git - vaadin-framework.git/commitdiff
Renamed Application and UI methods and fields from "Root" to "UI" (#8908).
authorArtur Signell <artur@vaadin.com>
Fri, 24 Aug 2012 08:27:11 +0000 (11:27 +0300)
committerArtur Signell <artur@vaadin.com>
Fri, 24 Aug 2012 10:23:18 +0000 (13:23 +0300)
23 files changed:
server/src/com/vaadin/Application.java
server/src/com/vaadin/UIRequiresMoreInformationException.java
server/src/com/vaadin/terminal/AbstractRootProvider.java
server/src/com/vaadin/terminal/DefaultRootProvider.java
server/src/com/vaadin/terminal/RootProvider.java [deleted file]
server/src/com/vaadin/terminal/UIProvider.java [new file with mode: 0644]
server/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
server/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
server/src/com/vaadin/terminal/gwt/server/ApplicationServlet.java
server/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java
server/src/com/vaadin/terminal/gwt/server/BootstrapResponse.java
server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java
server/src/com/vaadin/ui/UI.java
tests/server-side/com/vaadin/tests/server/component/root/CustomRootClassLoader.java
tests/testbench/com/vaadin/launcher/ApplicationRunnerServlet.java
tests/testbench/com/vaadin/tests/application/RefreshStatePreserve.java
tests/testbench/com/vaadin/tests/application/ThreadLocalInstances.java
tests/testbench/com/vaadin/tests/components/loginform/LoginFormWithMultipleWindows.java
tests/testbench/com/vaadin/tests/components/root/LazyInitRoots.java
tests/testbench/com/vaadin/tests/components/root/RootsInMultipleTabs.java
tests/testbench/com/vaadin/tests/minitutorials/v7a1/CreatingPreserveState.java
tests/testbench/com/vaadin/tests/minitutorials/v7a1/DifferentFeaturesForDifferentClients.java

index 582e05d3f45979536162cfa2b661ea9a057e7bc7..1827a55b725d664aa8e2cbd66eb5898f24ee8560 100644 (file)
@@ -57,8 +57,8 @@ import com.vaadin.terminal.ApplicationResource;
 import com.vaadin.terminal.CombinedRequest;
 import com.vaadin.terminal.DeploymentConfiguration;
 import com.vaadin.terminal.RequestHandler;
-import com.vaadin.terminal.RootProvider;
 import com.vaadin.terminal.Terminal;
+import com.vaadin.terminal.UIProvider;
 import com.vaadin.terminal.VariableOwner;
 import com.vaadin.terminal.WrappedRequest;
 import com.vaadin.terminal.WrappedRequest.BrowserDetails;
@@ -74,8 +74,8 @@ 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.UI;
 import com.vaadin.ui.Table;
+import com.vaadin.ui.UI;
 import com.vaadin.ui.Window;
 
 /**
@@ -136,7 +136,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 UI} class.
      */
-    public static final String ROOT_PARAMETER = "root";
+    public static final String UI_PARAMETER = "UI";
 
     private static final Method BOOTSTRAP_FRAGMENT_METHOD = ReflectTools
             .findMethod(BootstrapListener.class, "modifyBootstrapFragment",
@@ -167,14 +167,14 @@ public class Application implements Terminal.ErrorListener, Serializable {
         private UI.LegacyWindow mainWindow;
         private String theme;
 
-        private Map<String, UI.LegacyWindow> legacyRootNames = new HashMap<String, UI.LegacyWindow>();
+        private Map<String, UI.LegacyWindow> legacyUINames = new HashMap<String, UI.LegacyWindow>();
 
         /**
          * Sets the main window of this application. Setting window as a main
          * window of this application also adds the window to this application.
          * 
          * @param mainWindow
-         *            the root to set as the default window
+         *            the UI to set as the default window
          */
         public void setMainWindow(UI.LegacyWindow mainWindow) {
             if (this.mainWindow != null) {
@@ -201,7 +201,7 @@ public class Application implements Terminal.ErrorListener, Serializable {
          * Note that each application must have at least one main window.
          * </p>
          * 
-         * @return the root used as the default window
+         * @return the UI used as the default window
          */
         public UI.LegacyWindow getMainWindow() {
             return mainWindow;
@@ -215,11 +215,11 @@ public class Application implements Terminal.ErrorListener, Serializable {
          * {@inheritDoc}
          * 
          * @see #getWindow(String)
-         * @see Application#getRoot(WrappedRequest)
+         * @see Application#getUI(WrappedRequest)
          */
 
         @Override
-        public UI.LegacyWindow getRoot(WrappedRequest request) {
+        public UI.LegacyWindow getUI(WrappedRequest request) {
             String pathInfo = request.getRequestPathInfo();
             String name = null;
             if (pathInfo != null && pathInfo.length() > 0) {
@@ -239,8 +239,8 @@ 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(UI)}. Setting theme to be
+         * Note that this theme can be overridden for a specific UI with
+         * {@link Application#getThemeForUI(UI)}. Setting theme to be
          * <code>null</code> selects the default theme. For the available theme
          * names, see the contents of the VAADIN/themes directory.
          * </p>
@@ -272,30 +272,30 @@ public class Application implements Terminal.ErrorListener, Serializable {
          */
 
         @Override
-        public String getThemeForRoot(UI uI) {
+        public String getThemeForUI(UI uI) {
             return theme;
         }
 
         /**
          * <p>
-         * Gets a root by name. Returns <code>null</code> if the application is
+         * Gets a UI by name. Returns <code>null</code> if the application is
          * not running or it does not contain a window corresponding to the
          * name.
          * </p>
          * 
          * @param name
          *            the name of the requested window
-         * @return a root corresponding to the name, or <code>null</code> to use
+         * @return a UI corresponding to the name, or <code>null</code> to use
          *         the default window
          */
         public UI.LegacyWindow getWindow(String name) {
-            return legacyRootNames.get(name);
+            return legacyUINames.get(name);
         }
 
         /**
          * Counter to get unique names for windows with no explicit name
          */
-        private int namelessRootIndex = 0;
+        private int namelessUIIndex = 0;
 
         /**
          * Adds a new browser level window to this application. Please note that
@@ -303,25 +303,25 @@ public class Application implements Terminal.ErrorListener, Serializable {
          * window you should instead use {@link #addWindow(UI, String)}
          * 
          * @param uI
-         *            the root window to add to the application
+         *            the UI window to add to the application
          * @return returns the name that has been assigned to the window
          * 
          * @see #addWindow(UI, String)
          */
         public void addWindow(UI.LegacyWindow uI) {
             if (uI.getName() == null) {
-                String name = Integer.toString(namelessRootIndex++);
+                String name = Integer.toString(namelessUIIndex++);
                 uI.setName(name);
             }
 
-            legacyRootNames.put(uI.getName(), uI);
+            legacyUINames.put(uI.getName(), uI);
             uI.setApplication(this);
         }
 
         /**
          * Removes the specified window from the application. This also removes
-         * all name mappings for the window (see
-         * {@link #addWindow(UI, String) and #getWindowName(UI)}.
+         * all name mappings for the window (see {@link #addWindow(UI, String)
+         * and #getWindowName(UI)}.
          * 
          * <p>
          * Note that removing window from the application does not close the
@@ -329,13 +329,13 @@ public class Application implements Terminal.ErrorListener, Serializable {
          * </p>
          * 
          * @param uI
-         *            the root to remove
+         *            the UI to remove
          */
         public void removeWindow(UI.LegacyWindow uI) {
-            for (Entry<String, UI.LegacyWindow> entry : legacyRootNames
+            for (Entry<String, UI.LegacyWindow> entry : legacyUINames
                     .entrySet()) {
                 if (entry.getValue() == uI) {
-                    legacyRootNames.remove(entry.getKey());
+                    legacyUINames.remove(entry.getKey());
                 }
             }
         }
@@ -350,7 +350,7 @@ public class Application implements Terminal.ErrorListener, Serializable {
          * @return the unmodifiable collection of windows.
          */
         public Collection<UI.LegacyWindow> getWindows() {
-            return Collections.unmodifiableCollection(legacyRootNames.values());
+            return Collections.unmodifiableCollection(legacyUINames.values());
         }
     }
 
@@ -489,10 +489,10 @@ public class Application implements Terminal.ErrorListener, Serializable {
 
     private LinkedList<RequestHandler> requestHandlers = new LinkedList<RequestHandler>();
 
-    private int nextRootId = 0;
+    private int nextUIId = 0;
     private Map<Integer, UI> uIs = new HashMap<Integer, UI>();
 
-    private final Map<String, Integer> retainOnRefreshRoots = new HashMap<String, Integer>();
+    private final Map<String, Integer> retainOnRefreshUIs = new HashMap<String, Integer>();
 
     private final EventRouter eventRouter = new EventRouter();
 
@@ -500,12 +500,12 @@ public class Application implements Terminal.ErrorListener, Serializable {
      * Keeps track of which uIs have been inited.
      * <p>
      * TODO Investigate whether this might be derived from the different states
-     * in getRootForRrequest.
+     * in getUIForRrequest.
      * </p>
      */
-    private Set<Integer> initedRoots = new HashSet<Integer>();
+    private Set<Integer> initedUIs = new HashSet<Integer>();
 
-    private List<RootProvider> rootProviders = new LinkedList<RootProvider>();
+    private List<UIProvider> uiProviders = new LinkedList<UIProvider>();
 
     /**
      * Gets the user of the application.
@@ -1830,110 +1830,108 @@ public class Application implements Terminal.ErrorListener, Serializable {
     }
 
     /**
-     * Gets a root for a request for which no root is already known. This method
-     * is called when the framework processes a request that does not originate
-     * from an existing root instance. This typically happens when a host page
-     * is requested.
+     * Gets a UI for a request for which no UI is already known. This method is
+     * called when the framework processes a request that does not originate
+     * from an existing UI instance. This typically happens when a host page is
+     * requested.
      * 
      * <p>
      * Subclasses of Application may override this method to provide custom
-     * logic for choosing how to create a suitable root or for picking an
-     * already created root. If an existing root is picked, care should be taken
-     * to avoid keeping the same root open in multiple browser windows, as that
-     * will cause the states to go out of sync.
+     * logic for choosing how to create a suitable UI or for picking an already
+     * created UI. If an existing UI is picked, care should be taken to avoid
+     * keeping the same UI open in multiple browser windows, as that will cause
+     * the states to go out of sync.
      * </p>
      * 
      * <p>
-     * If {@link BrowserDetails} are required to create a UI, the
-     * implementation can throw a {@link UIRequiresMoreInformationException}
-     * exception. In this case, the framework will instruct the browser to send
-     * the additional details, whereupon this method is invoked again with the
-     * browser details present in the wrapped request. Throwing the exception if
-     * the browser details are already available is not supported.
+     * If {@link BrowserDetails} are required to create a UI, the implementation
+     * can throw a {@link UIRequiresMoreInformationException} exception. In this
+     * case, the framework will instruct the browser to send the additional
+     * details, whereupon this method is invoked again with the browser details
+     * present in the wrapped request. Throwing the exception if the browser
+     * details are already available is not supported.
      * </p>
      * 
      * <p>
      * The default implementation in {@link Application} creates a new instance
-     * of the UI class returned by {@link #getRootClassName(WrappedRequest)},
-     * which in turn uses the {@value #ROOT_PARAMETER} parameter from web.xml.
-     * If {@link DeploymentConfiguration#getClassLoader()} for the request
-     * returns a {@link ClassLoader}, it is used for loading the UI class.
-     * Otherwise the {@link ClassLoader} used to load this class is used.
+     * of the UI class returned by {@link #getUIClassName(WrappedRequest)},
+     * which in turn uses the {@value #UI_PARAMETER} parameter from web.xml. If
+     * {@link DeploymentConfiguration#getClassLoader()} for the request returns
+     * a {@link ClassLoader}, it is used for loading the UI class. Otherwise the
+     * {@link ClassLoader} used to load this class is used.
      * </p>
      * 
      * @param request
-     *            the wrapped request for which a root is needed
-     * @return a root instance to use for the request
+     *            the wrapped request for which a UI is needed
+     * @return a UI instance to use for the request
      * @throws UIRequiresMoreInformationException
      *             may be thrown by an implementation to indicate that
-     *             {@link BrowserDetails} are required to create a root
+     *             {@link BrowserDetails} are required to create a UI
      * 
-     * @see #getRootClassName(WrappedRequest)
+     * @see #getUIClassName(WrappedRequest)
      * @see UI
      * @see UIRequiresMoreInformationException
      * @see WrappedRequest#getBrowserDetails()
      * 
      * @since 7.0
      */
-    protected UI getRoot(WrappedRequest request)
+    protected UI getUI(WrappedRequest request)
             throws UIRequiresMoreInformationException {
 
         // Iterate in reverse order - test check newest provider first
-        for (int i = rootProviders.size() - 1; i >= 0; i--) {
-            RootProvider provider = rootProviders.get(i);
+        for (int i = uiProviders.size() - 1; i >= 0; i--) {
+            UIProvider provider = uiProviders.get(i);
 
-            Class<? extends UI> rootClass = provider.getRootClass(this,
-                    request);
+            Class<? extends UI> uiClass = provider.getUIClass(this, request);
 
-            if (rootClass != null) {
-                return provider.instantiateRoot(this, rootClass, request);
+            if (uiClass != null) {
+                return provider.instantiateUI(this, uiClass, request);
             }
         }
 
         throw new RuntimeException(
-                "No root providers available or providers are not able to find root instance");
+                "No UI providers available or providers are not able to find UI instance");
     }
 
     /**
-     * Finds the theme to use for a specific root. If no specific theme is
+     * Finds the theme to use for a specific UI. If no specific theme is
      * required, <code>null</code> is returned.
      * 
      * TODO Tell what the default implementation does once it does something.
      * 
      * @param uI
-     *            the root to get a theme for
+     *            the UI to get a theme for
      * @return the name of the theme, or <code>null</code> if the default theme
      *         should be used
      * 
      * @since 7.0
      */
-    public String getThemeForRoot(UI uI) {
-        Theme rootTheme = getAnnotationFor(uI.getClass(), Theme.class);
-        if (rootTheme != null) {
-            return rootTheme.value();
+    public String getThemeForUI(UI uI) {
+        Theme uiTheme = getAnnotationFor(uI.getClass(), Theme.class);
+        if (uiTheme != null) {
+            return uiTheme.value();
         } else {
             return null;
         }
     }
 
     /**
-     * Finds the widgetset to use for a specific root. If no specific widgetset
-     * is required, <code>null</code> is returned.
+     * Finds the widgetset to use for a specific UI. If no specific widgetset is
+     * required, <code>null</code> is returned.
      * 
      * TODO Tell what the default implementation does once it does something.
      * 
      * @param uI
-     *            the root to get a widgetset for
+     *            the UI to get a widgetset for
      * @return the name of the widgetset, or <code>null</code> if the default
      *         widgetset should be used
      * 
      * @since 7.0
      */
-    public String getWidgetsetForRoot(UI uI) {
-        Widgetset rootWidgetset = getAnnotationFor(uI.getClass(),
-                Widgetset.class);
-        if (rootWidgetset != null) {
-            return rootWidgetset.value();
+    public String getWidgetsetForUI(UI uI) {
+        Widgetset uiWidgetset = getAnnotationFor(uI.getClass(), Widgetset.class);
+        if (uiWidgetset != null) {
+            return uiWidgetset.value();
         } else {
             return null;
         }
@@ -2087,7 +2085,7 @@ public class Application implements Terminal.ErrorListener, Serializable {
      */
     private static final ThreadLocal<Application> currentApplication = new ThreadLocal<Application>();
 
-    private boolean rootPreserved = false;
+    private boolean uiPreserved = false;
 
     /**
      * Gets the currently used application. The current application is
@@ -2139,112 +2137,110 @@ public class Application implements Terminal.ErrorListener, Serializable {
         return configuration.isProductionMode();
     }
 
-    public void addRootProvider(RootProvider rootProvider) {
-        rootProviders.add(rootProvider);
+    public void addUIProvider(UIProvider uIProvider) {
+        uiProviders.add(uIProvider);
     }
 
-    public void removeRootProvider(RootProvider rootProvider) {
-        rootProviders.remove(rootProvider);
+    public void removeUIProvider(UIProvider uIProvider) {
+        uiProviders.remove(uIProvider);
     }
 
     /**
      * 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
+     * request originates from an existing UI, that UI is returned. In other
+     * cases, the method attempts to create and initialize a new UI and might
      * throw a {@link UIRequiresMoreInformationException} if all required
      * information is not available.
      * <p>
      * Please note that this method can also return a newly created
      * <code>UI</code> which has not yet been initialized. You can use
-     * {@link #isRootInitPending(int)} with the root's id (
-     * {@link UI#getRootId()} to check whether the initialization is still
-     * pending.
+     * {@link #isUIInitPending(int)} with the UI's id ( {@link UI#getUIId()} to
+     * check whether the initialization is still pending.
      * </p>
      * 
      * @param request
-     *            the request for which a root is desired
-     * @return a root belonging to the request
+     *            the request for which a UI is desired
+     * @return a UI belonging to the request
      * @throws UIRequiresMoreInformationException
-     *             if no existing root could be found and creating a new root
+     *             if no existing UI could be found and creating a new UI
      *             requires additional information from the browser
      * 
-     * @see #getRoot(WrappedRequest)
+     * @see #getUI(WrappedRequest)
      * @see UIRequiresMoreInformationException
      * 
      * @since 7.0
      */
-    public UI getRootForRequest(WrappedRequest request)
+    public UI getUIForRequest(WrappedRequest request)
             throws UIRequiresMoreInformationException {
         UI uI = UI.getCurrent();
         if (uI != null) {
             return uI;
         }
-        Integer rootId = getRootId(request);
+        Integer uiId = getUIId(request);
 
         synchronized (this) {
             BrowserDetails browserDetails = request.getBrowserDetails();
             boolean hasBrowserDetails = browserDetails != null
                     && browserDetails.getUriFragment() != null;
 
-            uI = uIs.get(rootId);
+            uI = uIs.get(uiId);
 
-            if (uI == null && isRootPreserved()) {
-                // Check for a known root
-                if (!retainOnRefreshRoots.isEmpty()) {
+            if (uI == null && isUiPreserved()) {
+                // Check for a known UI
+                if (!retainOnRefreshUIs.isEmpty()) {
 
-                    Integer retainedRootId;
+                    Integer retainedUIId;
                     if (!hasBrowserDetails) {
                         throw new UIRequiresMoreInformationException();
                     } else {
                         String windowName = browserDetails.getWindowName();
-                        retainedRootId = retainOnRefreshRoots.get(windowName);
+                        retainedUIId = retainOnRefreshUIs.get(windowName);
                     }
 
-                    if (retainedRootId != null) {
-                        rootId = retainedRootId;
-                        uI = uIs.get(rootId);
+                    if (retainedUIId != null) {
+                        uiId = retainedUIId;
+                        uI = uIs.get(uiId);
                     }
                 }
             }
 
             if (uI == null) {
-                // Throws exception if root can not yet be created
-                uI = getRoot(request);
+                // Throws exception if UI can not yet be created
+                uI = getUI(request);
 
-                // Initialize some fields for a newly created root
+                // Initialize some fields for a newly created UI
                 if (uI.getApplication() == null) {
                     uI.setApplication(this);
                 }
-                if (uI.getRootId() < 0) {
+                if (uI.getUIId() < 0) {
 
-                    if (rootId == null) {
+                    if (uiId == null) {
                         // Get the next id if none defined
-                        rootId = Integer.valueOf(nextRootId++);
+                        uiId = Integer.valueOf(nextUIId++);
                     }
-                    uI.setRootId(rootId.intValue());
-                    uIs.put(rootId, uI);
+                    uI.setUIId(uiId.intValue());
+                    uIs.put(uiId, uI);
                 }
             }
 
             // Set thread local here so it is available in init
             UI.setCurrent(uI);
 
-            if (!initedRoots.contains(rootId)) {
-                boolean initRequiresBrowserDetails = isRootPreserved()
-                        || !uI.getClass()
-                                .isAnnotationPresent(EagerInit.class);
+            if (!initedUIs.contains(uiId)) {
+                boolean initRequiresBrowserDetails = isUiPreserved()
+                        || !uI.getClass().isAnnotationPresent(EagerInit.class);
                 if (!initRequiresBrowserDetails || hasBrowserDetails) {
                     uI.doInit(request);
 
-                    // Remember that this root has been initialized
-                    initedRoots.add(rootId);
+                    // Remember that this UI has been initialized
+                    initedUIs.add(uiId);
 
                     // init() might turn on preserve so do this afterwards
-                    if (isRootPreserved()) {
-                        // Remember this root
+                    if (isUiPreserved()) {
+                        // Remember this UI
                         String windowName = request.getBrowserDetails()
                                 .getWindowName();
-                        retainOnRefreshRoots.put(windowName, rootId);
+                        retainOnRefreshUIs.put(windowName, uiId);
                     }
                 }
             }
@@ -2254,25 +2250,24 @@ public class Application implements Terminal.ErrorListener, Serializable {
     }
 
     /**
-     * Internal helper to finds the root id for a request.
+     * Internal helper to finds the UI id for a request.
      * 
      * @param request
-     *            the request to get the root id for
-     * @return a root id, or <code>null</code> if no root id is defined
+     *            the request to get the UI id for
+     * @return a UI id, or <code>null</code> if no UI id is defined
      * 
      * @since 7.0
      */
-    private static Integer getRootId(WrappedRequest request) {
+    private static Integer getUIId(WrappedRequest request) {
         if (request instanceof CombinedRequest) {
-            // Combined requests has the rootid parameter in the second request
+            // Combined requests has the uiId parameter in the second request
             CombinedRequest combinedRequest = (CombinedRequest) request;
             request = combinedRequest.getSecondRequest();
         }
-        String rootIdString = request
+        String uiIdString = request
                 .getParameter(ApplicationConstants.ROOT_ID_PARAMETER);
-        Integer rootId = rootIdString == null ? null
-                : new Integer(rootIdString);
-        return rootId;
+        Integer uiId = uiIdString == null ? null : new Integer(uiIdString);
+        return uiId;
     }
 
     /**
@@ -2285,14 +2280,14 @@ public class Application implements Terminal.ErrorListener, Serializable {
      * the UI is already shown, as it might not be retained as intended.
      * </p>
      * 
-     * @param rootPreserved
-     *            <code>true</code>if the same UI instance should be reused
-     *            e.g. when the browser window is refreshed.
+     * @param uiPreserved
+     *            <code>true</code>if the same UI instance should be reused e.g.
+     *            when the browser window is refreshed.
      */
-    public void setRootPreserved(boolean rootPreserved) {
-        this.rootPreserved = rootPreserved;
-        if (!rootPreserved) {
-            retainOnRefreshRoots.clear();
+    public void setUiPreserved(boolean uiPreserved) {
+        this.uiPreserved = uiPreserved;
+        if (!uiPreserved) {
+            retainOnRefreshUIs.clear();
         }
     }
 
@@ -2305,41 +2300,41 @@ public class Application implements Terminal.ErrorListener, Serializable {
      * @return <code>true</code>if the same UI instance should be reused e.g.
      *         when the browser window is refreshed.
      */
-    public boolean isRootPreserved() {
-        return rootPreserved;
+    public boolean isUiPreserved() {
+        return uiPreserved;
     }
 
     /**
-     * Checks whether there's a pending initialization for the root with the
-     * given id.
+     * Checks whether there's a pending initialization for the UI with the given
+     * id.
      * 
-     * @param rootId
-     *            root id to check for
+     * @param uiId
+     *            UI id to check for
      * @return <code>true</code> of the initialization is pending,
-     *         <code>false</code> if the root id is not registered or if the
-     *         root has already been initialized
+     *         <code>false</code> if the UI id is not registered or if the UI
+     *         has already been initialized
      * 
-     * @see #getRootForRequest(WrappedRequest)
+     * @see #getUIForRequest(WrappedRequest)
      */
-    public boolean isRootInitPending(int rootId) {
-        return !initedRoots.contains(Integer.valueOf(rootId));
+    public boolean isUIInitPending(int uiId) {
+        return !initedUIs.contains(Integer.valueOf(uiId));
     }
 
     /**
-     * Gets all the uIs of this application. This includes uIs that have
-     * been requested but not yet initialized. Please note, that uIs are not
+     * Gets all the uIs of this application. This includes uIs that have been
+     * requested but not yet initialized. Please note, that uIs are not
      * automatically removed e.g. if the browser window is closed and that there
-     * is no way to manually remove a root. Inactive uIs will thus not be
-     * released for GC until the entire application is released when the session
-     * has timed out (unless there are dangling references). Improved support
-     * for releasing unused uIs is planned for an upcoming alpha release of
-     * Vaadin 7.
+     * is no way to manually remove a UI. Inactive uIs will thus not be released
+     * for GC until the entire application is released when the session has
+     * timed out (unless there are dangling references). Improved support for
+     * releasing unused uIs is planned for an upcoming alpha release of Vaadin
+     * 7.
      * 
      * @return a collection of uIs belonging to this application
      * 
      * @since 7.0
      */
-    public Collection<UI> getRoots() {
+    public Collection<UI> getUIs() {
         return Collections.unmodifiableCollection(uIs.values());
     }
 
@@ -2367,12 +2362,12 @@ public class Application implements Terminal.ErrorListener, Serializable {
      * This is meant for framework internal use.
      * </p>
      * 
-     * @param rootId
-     *            The root id
-     * @return The root with the given id or null if not found
+     * @param uiId
+     *            The UI id
+     * @return The UI with the given id or null if not found
      */
-    public UI getRootById(int rootId) {
-        return uIs.get(rootId);
+    public UI getUIById(int uiId) {
+        return uIs.get(uiId);
     }
 
     /**
index 682d46f207d929d2187fdbc0e6808ddcf8267d41..0d491895e5f534770421c15b0dc491dac5212e3e 100644 (file)
@@ -27,7 +27,7 @@ import com.vaadin.terminal.WrappedRequest.BrowserDetails;
  * This exception may not be thrown if that information is already present in
  * the current WrappedRequest.
  * 
- * @see Application#getRoot(WrappedRequest)
+ * @see Application#getUI(WrappedRequest)
  * @see WrappedRequest#getBrowserDetails()
  * 
  * @since 7.0
index b340c624487ec89b55b0553031101b2df6df8d67..f316a58f15d2ba24c3bface1e3d124c82ee41474 100644 (file)
@@ -19,10 +19,10 @@ package com.vaadin.terminal;
 import com.vaadin.Application;\r
 import com.vaadin.ui.UI;\r
 \r
-public abstract class AbstractRootProvider implements RootProvider {\r
+public abstract class AbstractRootProvider implements UIProvider {\r
 \r
     @Override\r
-    public UI instantiateRoot(Application application,\r
+    public UI instantiateUI(Application application,\r
             Class<? extends UI> type, WrappedRequest request) {\r
         try {\r
             return type.newInstance();\r
index 7e6631be56b3c72a1b13ef17b14878dc3336b8c2..b201be513d76dc18cb1320ac8609aff8c371b464 100644 (file)
@@ -23,10 +23,10 @@ import com.vaadin.ui.UI;
 public class DefaultRootProvider extends AbstractRootProvider {\r
 \r
     @Override\r
-    public Class<? extends UI> getRootClass(Application application,\r
+    public Class<? extends UI> getUIClass(Application application,\r
             WrappedRequest request) throws UIRequiresMoreInformationException {\r
         Object rootClassNameObj = application\r
-                .getProperty(Application.ROOT_PARAMETER);\r
+                .getProperty(Application.UI_PARAMETER);\r
 \r
         if (rootClassNameObj instanceof String) {\r
             String rootClassName = rootClassNameObj.toString();\r
diff --git a/server/src/com/vaadin/terminal/RootProvider.java b/server/src/com/vaadin/terminal/RootProvider.java
deleted file mode 100644 (file)
index 229f2ca..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*\r
- * Copyright 2011 Vaadin Ltd.\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
- * use this file except in compliance with the License. You may obtain a copy of\r
- * the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r
- * License for the specific language governing permissions and limitations under\r
- * the License.\r
- */\r
-\r
-package com.vaadin.terminal;\r
-\r
-import com.vaadin.Application;\r
-import com.vaadin.UIRequiresMoreInformationException;\r
-import com.vaadin.ui.UI;\r
-\r
-public interface RootProvider {\r
-    public Class<? extends UI> getRootClass(Application application,\r
-            WrappedRequest request) throws UIRequiresMoreInformationException;\r
-\r
-    public UI instantiateRoot(Application application,\r
-            Class<? extends UI> type, WrappedRequest request);\r
-}\r
diff --git a/server/src/com/vaadin/terminal/UIProvider.java b/server/src/com/vaadin/terminal/UIProvider.java
new file mode 100644 (file)
index 0000000..27b63fb
--- /dev/null
@@ -0,0 +1,29 @@
+/*\r
+ * Copyright 2011 Vaadin Ltd.\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
+ * use this file except in compliance with the License. You may obtain a copy of\r
+ * the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r
+ * License for the specific language governing permissions and limitations under\r
+ * the License.\r
+ */\r
+\r
+package com.vaadin.terminal;\r
+\r
+import com.vaadin.Application;\r
+import com.vaadin.UIRequiresMoreInformationException;\r
+import com.vaadin.ui.UI;\r
+\r
+public interface UIProvider {\r
+    public Class<? extends UI> getUIClass(Application application,\r
+            WrappedRequest request) throws UIRequiresMoreInformationException;\r
+\r
+    public UI instantiateUI(Application application,\r
+            Class<? extends UI> type, WrappedRequest request);\r
+}\r
index 86668bd91f1f596808c8bf98789137659796f7c2..7a69a4c2b0bbe4e0a66111e8878cc985f8a1c8de 100644 (file)
@@ -499,7 +499,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
                             // and then do a second request
                             try {
                                 uI = application
-                                        .getRootForRequest(wrappedRequest);
+                                        .getUIForRequest(wrappedRequest);
                             } catch (UIRequiresMoreInformationException e) {
                                 // Ignore problem and continue without root
                             }
@@ -517,7 +517,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
                             break;
                         default:
                             uI = application
-                                    .getRootForRequest(wrappedRequest);
+                                    .getUIForRequest(wrappedRequest);
                         }
                         // if window not found, not a problem - use null
                     }
@@ -895,7 +895,7 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
             throws PortletException {
         try {
             final Application application = getApplicationClass().newInstance();
-            application.setRootPreserved(true);
+            application.setUiPreserved(true);
             return application;
         } catch (final IllegalAccessException e) {
             throw new PortletException("getNewApplication failed", e);
index b17ef20cde320656bd296c4b8fd87563221afb32..b71c6ec20ced8d62599fc45a0391f55baeb974c6 100644 (file)
@@ -319,7 +319,7 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
                         response);
                 return;
             } else if (requestType == RequestType.UIDL) {
-                UI uI = application.getRootForRequest(request);
+                UI uI = application.getUIForRequest(request);
                 if (uI == null) {
                     throw new ServletException(ERROR_NO_ROOT_FOUND);
                 }
index 48810d2b08051b9c5bfb483f636a7503506a05d9..7662564233126f7da03d3f8fd970f661e4b4c7ee 100644 (file)
@@ -1390,7 +1390,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
     }
 
     private ClientCache getClientCache(UI uI) {
-        Integer rootId = Integer.valueOf(uI.getRootId());
+        Integer rootId = Integer.valueOf(uI.getUIId());
         ClientCache cache = rootToClientCache.get(rootId);
         if (cache == null) {
             cache = new ClientCache();
@@ -1515,7 +1515,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
     }
 
     private String getTheme(UI uI) {
-        String themeName = uI.getApplication().getThemeForRoot(uI);
+        String themeName = uI.getApplication().getThemeForUI(uI);
         String requestThemeName = getRequestTheme();
 
         if (requestThemeName != null) {
@@ -2353,7 +2353,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
          * handling post
          */
         String paintableId = owner.getConnectorId();
-        int rootId = owner.getRoot().getRootId();
+        int rootId = owner.getRoot().getUIId();
         String key = rootId + "/" + paintableId + "/" + name;
 
         if (pidToNameToStreamVariable == null) {
@@ -2422,13 +2422,13 @@ public abstract class AbstractCommunicationManager implements Serializable {
         try {
             CombinedRequest combinedRequest = new CombinedRequest(request);
 
-            UI uI = application.getRootForRequest(combinedRequest);
+            UI uI = application.getUIForRequest(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, uI.getRootId());
+                    combinedRequest, response, application, uI.getUIId());
 
             String widgetset = context.getWidgetsetName();
             String theme = context.getThemeName();
@@ -2440,7 +2440,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
             params.put("widgetset", widgetset);
             params.put("themeUri", themeUri);
             // UI id might have changed based on e.g. window.name
-            params.put(ApplicationConstants.ROOT_ID_PARAMETER, uI.getRootId());
+            params.put(ApplicationConstants.ROOT_ID_PARAMETER, uI.getUIId());
             if (sendUIDL) {
                 String initialUIDL = getInitialUIDL(combinedRequest, uI);
                 params.put("uidl", initialUIDL);
@@ -2628,7 +2628,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
         String rootId = parts[0];
         String connectorId = parts[1];
         String variableName = parts[2];
-        UI uI = application.getRootById(Integer.parseInt(rootId));
+        UI uI = application.getUIById(Integer.parseInt(rootId));
         UI.setCurrent(uI);
 
         StreamVariable streamVariable = getStreamVariable(connectorId,
index 52885f3fbb1694481ae88f968ce4f220e1402258..14500b01de7e9b6cea1ba103c3713fd5f95c76ce 100644 (file)
@@ -70,7 +70,7 @@ public class ApplicationServlet extends AbstractApplicationServlet {
         // Creates a new application instance
         try {
             final Application application = getApplicationClass().newInstance();
-            application.addRootProvider(new DefaultRootProvider());
+            application.addUIProvider(new DefaultRootProvider());
 
             return application;
         } catch (final IllegalAccessException e) {
index e52c11e2c27558419a7e8de89f8662bd4a5276a3..1dfe9d1685d15db3aa279cd0212a1e4fddfa57da 100644 (file)
@@ -127,13 +127,13 @@ public abstract class BootstrapHandler implements RequestHandler {
         // TODO Should all urls be handled here?
         Integer rootId = null;
         try {
-            UI uI = application.getRootForRequest(request);
+            UI uI = application.getUIForRequest(request);
             if (uI == null) {
                 writeError(response, new Throwable("No UI found"));
                 return true;
             }
 
-            rootId = Integer.valueOf(uI.getRootId());
+            rootId = Integer.valueOf(uI.getUIId());
         } catch (UIRequiresMoreInformationException e) {
             // Just keep going without rootId
         }
@@ -297,7 +297,7 @@ public abstract class BootstrapHandler implements RequestHandler {
         UI uI = context.getRoot();
         WrappedRequest request = context.getRequest();
 
-        String widgetset = uI.getApplication().getWidgetsetForRoot(uI);
+        String widgetset = uI.getApplication().getWidgetsetForUI(uI);
         if (widgetset == null) {
             widgetset = request.getDeploymentConfiguration()
                     .getConfiguredWidgetset(request);
@@ -437,7 +437,7 @@ public abstract class BootstrapHandler implements RequestHandler {
 
         appConfig.put("widgetset", context.getWidgetsetName());
 
-        if (rootId == null || application.isRootInitPending(rootId.intValue())) {
+        if (rootId == null || application.isUIInitPending(rootId.intValue())) {
             appConfig.put("initialPath", context.getRequest()
                     .getRequestPathInfo());
 
@@ -533,7 +533,7 @@ public abstract class BootstrapHandler implements RequestHandler {
      * @return
      */
     public String getThemeName(BootstrapContext context) {
-        return context.getApplication().getThemeForRoot(context.getRoot());
+        return context.getApplication().getThemeForUI(context.getRoot());
     }
 
     /**
index b1a52cf79e93094571c3b70ac85931f13ae3271d..2518f7080ec13d4f1b6f8fc2f233091194131412 100644 (file)
@@ -92,7 +92,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
+     * that if {@link Application#isUiPreserved()} is enabled, a previously
      * created UI with a different id might eventually end up being used.
      * 
      * @return the root id
@@ -108,8 +108,8 @@ public abstract class BootstrapResponse extends EventObject {
      * browser has been sent back. This method will return <code>null</code> if
      * no UI instance is yet available.
      * 
-     * @see Application#isRootPreserved()
-     * @see Application#getRoot(WrappedRequest)
+     * @see Application#isUiPreserved()
+     * @see Application#getUI(WrappedRequest)
      * @see UIRequiresMoreInformationException
      * 
      * @return The UI that will be displayed in the page being generated, or
index 13d558e66e74e51bdb891b50657064e5336dd4e9..7e669d939c04ff2cdd5d17117ee80e2d323f5e2b 100644 (file)
@@ -44,7 +44,7 @@ class ServletPortletHelper implements Serializable {
         String applicationParameter = deploymentConfiguration
                 .getInitParameters().getProperty("application");
         String rootParameter = deploymentConfiguration.getInitParameters()
-                .getProperty(Application.ROOT_PARAMETER);
+                .getProperty(Application.UI_PARAMETER);
         ClassLoader classLoader = deploymentConfiguration.getClassLoader();
 
         if (applicationParameter == null) {
@@ -69,7 +69,7 @@ class ServletPortletHelper implements Serializable {
     private static void verifyRootClass(String className,
             ClassLoader classLoader) throws ApplicationClassException {
         if (className == null) {
-            throw new ApplicationClassException(Application.ROOT_PARAMETER
+            throw new ApplicationClassException(Application.UI_PARAMETER
                     + " init parameter not defined");
         }
 
index e2facefb33bfd043d486d268ebb7459e4a13de4e..957e00385d1a6a618bdf179a6195cc8485e3c339 100644 (file)
@@ -47,27 +47,28 @@ import com.vaadin.terminal.Resource;
 import com.vaadin.terminal.Vaadin6Component;
 import com.vaadin.terminal.WrappedRequest;
 import com.vaadin.terminal.WrappedRequest.BrowserDetails;
+import com.vaadin.terminal.gwt.server.AbstractApplicationServlet;
 import com.vaadin.ui.Window.CloseListener;
 
 /**
- * The topmost component in any component hierarchy. There is one root for every
- * Vaadin instance in a browser window. A root may either represent an entire
+ * The topmost component in any component hierarchy. There is one UI for every
+ * Vaadin instance in a browser window. A UI may either represent an entire
  * browser window (or tab) or some part of a html page where a Vaadin
  * application is embedded.
  * <p>
- * The root is the server side entry point for various client side features that
+ * The UI is the server side entry point for various client side features that
  * are not represented as components added to a layout, e.g notifications, sub
  * windows, and executing javascript in the browser.
  * </p>
  * <p>
- * When a new application instance is needed, typically because the user opens
- * the application in a browser window,
- * {@link Application#gerRoot(WrappedRequest)} is invoked to get a root. That
- * method does by default create a root according to the
- * {@value Application#ROOT_PARAMETER} parameter from web.xml.
+ * When a new UI instance is needed, typically because the user opens a URL in a
+ * browser window which points to {@link AbstractApplicationServlet},
+ * {@link Application#getUIForRequest(WrappedRequest)} is invoked to get a UI.
+ * That method does by default create a root according to the
+ * {@value Application#UI_PARAMETER} parameter from web.xml.
  * </p>
  * <p>
- * After a root has been created by the application, it is initialized using
+ * After a UI has been created by the application, it is initialized using
  * {@link #init(WrappedRequest)}. This method is intended to be overridden by
  * the developer to add components to the user interface and initialize
  * non-component functionality. The component hierarchy is initialized by
@@ -76,13 +77,13 @@ import com.vaadin.ui.Window.CloseListener;
  * </p>
  * <p>
  * If a {@link EagerInit} annotation is present on a class extending
- * <code>UI</code>, the framework will use a faster initialization method
- * which will not ensure that {@link BrowserDetails} are present in the
+ * <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>
  * 
  * @see #init(WrappedRequest)
- * @see Application#getRoot(WrappedRequest)
+ * @see Application#getUI(WrappedRequest)
  * 
  * @since 7.0
  */
@@ -90,7 +91,7 @@ public abstract class UI extends AbstractComponentContainer implements
         Action.Container, Action.Notifier, Vaadin6Component {
 
     /**
-     * Helper class to emulate the main window from Vaadin 6 using roots. This
+     * Helper class to emulate the main window from Vaadin 6 using UIs. This
      * class should be used in the same way as Window used as a browser level
      * window in Vaadin 6 with {@link com.vaadin.Application.LegacyApplication}
      */
@@ -210,11 +211,11 @@ public abstract class UI extends AbstractComponentContainer implements
         }
 
         /**
-         * Opens the given resource in this root. The contents of this UI 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
          * 
          * @deprecated As of 7.0, use getPage().open instead
          */
@@ -294,9 +295,9 @@ public abstract class UI extends AbstractComponentContainer implements
         }
 
         /**
-         * Adds a new {@link BrowserWindowResizeListener} to this root. The
+         * Adds a new {@link BrowserWindowResizeListener} to this UI. The
          * listener will be notified whenever the browser window within which
-         * this root resides is resized.
+         * this UI resides is resized.
          * 
          * @param resizeListener
          *            the listener to add
@@ -312,7 +313,7 @@ public abstract class UI extends AbstractComponentContainer implements
         }
 
         /**
-         * 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.
          * 
@@ -326,7 +327,7 @@ public abstract class UI extends AbstractComponentContainer implements
         }
 
         /**
-         * 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
@@ -338,7 +339,7 @@ public abstract class UI extends AbstractComponentContainer implements
         }
 
         /**
-         * 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
@@ -389,12 +390,12 @@ public abstract class UI extends AbstractComponentContainer implements
     }
 
     /**
-     * The application to which this root belongs
+     * The application to which this UI belongs
      */
     private Application application;
 
     /**
-     * List of windows in this root.
+     * List of windows in this UI.
      */
     private final LinkedHashSet<Window> windows = new LinkedHashSet<Window>();
 
@@ -405,13 +406,13 @@ public abstract class UI extends AbstractComponentContainer implements
     private Component scrollIntoView;
 
     /**
-     * The id of this root, used to find the server side instance of the root
-     * form which a request originates. A negative value indicates that the root
-     * id has not yet been assigned by the Application.
+     * The id of this UI, used to find the server side instance of the UI form
+     * which a request originates. A negative value indicates that the UI id has
+     * not yet been assigned by the Application.
      * 
-     * @see Application#nextRootId
+     * @see Application#nextUIId
      */
-    private int rootId = -1;
+    private int uiId = -1;
 
     /**
      * Keeps track of the Actions added to this component, and manages the
@@ -420,9 +421,9 @@ public abstract class UI extends AbstractComponentContainer implements
     protected ActionManager actionManager;
 
     /**
-     * Thread local for keeping track of the current root.
+     * Thread local for keeping track of the current UI.
      */
-    private static final ThreadLocal<UI> currentRoot = new ThreadLocal<UI>();
+    private static final ThreadLocal<UI> currentUI = new ThreadLocal<UI>();
 
     /** Identifies the click event */
     private ConnectorTracker connectorTracker = new ConnectorTracker(this);
@@ -444,7 +445,7 @@ public abstract class UI extends AbstractComponentContainer implements
     };
 
     /**
-     * Creates a new empty root without a caption. This root will have a
+     * Creates a new empty UI without a caption. This UI will have a
      * {@link VerticalLayout} with margins enabled as its content.
      */
     public UI() {
@@ -452,10 +453,10 @@ public abstract class UI extends AbstractComponentContainer implements
     }
 
     /**
-     * Creates a new root with the given component container as its content.
+     * Creates a new UI with the given component container as its content.
      * 
      * @param content
-     *            the content container to use as this roots content.
+     *            the content container to use as this UIs content.
      * 
      * @see #setContent(ComponentContainer)
      */
@@ -466,11 +467,11 @@ public abstract class UI extends AbstractComponentContainer implements
     }
 
     /**
-     * Creates a new empty root with the given caption. This root will have a
+     * Creates a new empty UI with the given caption. This UI will have a
      * {@link VerticalLayout} with margins enabled as its content.
      * 
      * @param caption
-     *            the caption of the root, used as the page title if there's
+     *            the caption of the UI, used as the page title if there's
      *            nothing but the application on the web page
      * 
      * @see #setCaption(String)
@@ -481,13 +482,13 @@ public abstract class UI extends AbstractComponentContainer implements
     }
 
     /**
-     * Creates a new root with the given caption and content.
+     * Creates a new UI with the given caption and content.
      * 
      * @param caption
-     *            the caption of the root, used as the page title if there's
+     *            the caption of the UI, used as the page title if there's
      *            nothing but the application on the web page
      * @param content
-     *            the content container to use as this roots content.
+     *            the content container to use as this UIs content.
      * 
      * @see #setContent(ComponentContainer)
      * @see #setCaption(String)
@@ -512,7 +513,7 @@ public abstract class UI extends AbstractComponentContainer implements
     /**
      * Overridden to return a value instead of referring to the parent.
      * 
-     * @return this root
+     * @return this UI
      * 
      * @see com.vaadin.ui.AbstractComponent#getRoot()
      */
@@ -622,7 +623,7 @@ public abstract class UI extends AbstractComponentContainer implements
     }
 
     /**
-     * Sets the application to which this root is assigned. It is not legal to
+     * Sets the application to which this UI is assigned. It is not legal to
      * change the application once it has been set nor to set a
      * <code>null</code> application.
      * <p>
@@ -652,46 +653,46 @@ public abstract class UI extends AbstractComponentContainer implements
     }
 
     /**
-     * Sets the id of this root within its application. The root id is used to
-     * route requests to the right root.
+     * Sets the id of this UI within its application. The UI id is used to route
+     * requests to the right UI.
      * <p>
      * This method is mainly intended for internal use by the framework.
      * </p>
      * 
-     * @param rootId
-     *            the id of this root
+     * @param uiId
+     *            the id of this UI
      * 
      * @throws IllegalStateException
-     *             if the root id has already been set
+     *             if the UI id has already been set
      * 
-     * @see #getRootId()
+     * @see #getUIId()
      */
-    public void setRootId(int rootId) {
-        if (this.rootId != -1) {
+    public void setUIId(int uiId) {
+        if (this.uiId != -1) {
             throw new IllegalStateException("UI id has already been defined");
         }
-        this.rootId = rootId;
+        this.uiId = uiId;
     }
 
     /**
-     * Gets the id of the root, used to identify this root within its
-     * application when processing requests. The root id should be present in
-     * every request to the server that originates from this root.
-     * {@link Application#getRootForRequest(WrappedRequest)} uses this id to
-     * find the route to which the request belongs.
+     * Gets the id of the UI, used to identify this UI within its application
+     * when processing requests. The UI id should be present in every request to
+     * the server that originates from this UI.
+     * {@link Application#getUIForRequest(WrappedRequest)} uses this id to find
+     * the route to which the request belongs.
      * 
      * @return
      */
-    public int getRootId() {
-        return rootId;
+    public int getUIId() {
+        return uiId;
     }
 
     /**
-     * Adds a window as a subwindow inside this root. To open a new browser
-     * window or tab, you should instead use {@link open(Resource)} with an url
+     * Adds a window as a subwindow inside this UI. To open a new browser window
+     * or tab, you should instead use {@link open(Resource)} with an url
      * pointing to this application and ensure
-     * {@link Application#getRoot(WrappedRequest)} returns an appropriate root
-     * for the request.
+     * {@link Application#getUI(WrappedRequest)} returns an appropriate UI for
+     * the request.
      * 
      * @param window
      * @throws IllegalArgumentException
@@ -727,7 +728,7 @@ public abstract class UI extends AbstractComponentContainer implements
     }
 
     /**
-     * Remove the given subwindow from this root.
+     * Remove the given subwindow from this UI.
      * 
      * Since Vaadin 6.5, {@link CloseListener}s are called also when explicitly
      * removing a window by calling this method.
@@ -741,7 +742,7 @@ public abstract class UI extends AbstractComponentContainer implements
      */
     public boolean removeWindow(Window window) {
         if (!windows.remove(window)) {
-            // Window window is not a subwindow of this root.
+            // Window window is not a subwindow of this UI.
             return false;
         }
         window.setParent(null);
@@ -752,7 +753,7 @@ public abstract class UI extends AbstractComponentContainer implements
     }
 
     /**
-     * Gets all the windows added to this root.
+     * Gets all the windows added to this UI.
      * 
      * @return an unmodifiable collection of windows
      */
@@ -792,28 +793,28 @@ public abstract class UI extends AbstractComponentContainer implements
     }
 
     /**
-     * Scrolls any component between the component and root to a suitable
-     * position so the component is visible to the user. The given component
-     * must belong to this root.
+     * Scrolls any component between the component and UI to a suitable position
+     * so the component is visible to the user. The given component must belong
+     * to this UI.
      * 
      * @param component
      *            the component to be scrolled into view
      * @throws IllegalArgumentException
-     *             if {@code component} does not belong to this root
+     *             if {@code component} does not belong to this UI
      */
     public void scrollIntoView(Component component)
             throws IllegalArgumentException {
         if (component.getRoot() != this) {
             throw new IllegalArgumentException(
-                    "The component where to scroll must belong to this root.");
+                    "The component where to scroll must belong to this UI.");
         }
         scrollIntoView = component;
         markAsDirty();
     }
 
     /**
-     * Gets the content of this root. The content is a component container that
-     * serves as the outermost item of the visual contents of this root.
+     * Gets the content of this UI. The content is a component container that
+     * serves as the outermost item of the visual contents of this UI.
      * 
      * @return a component container to use as content
      * 
@@ -837,8 +838,8 @@ public abstract class UI extends AbstractComponentContainer implements
     }
 
     /**
-     * Sets the content of this root. The content is a component container that
-     * serves as the outermost item of the visual contents of this root. If no
+     * Sets the content of this UI. The content is a component container that
+     * serves as the outermost item of the visual contents of this UI. If no
      * content has been set, a {@link VerticalLayout} with margins enabled will
      * be used by default - see {@link #createDefaultLayout()}. The content can
      * also be set in a constructor.
@@ -863,11 +864,11 @@ public abstract class UI extends AbstractComponentContainer implements
     }
 
     /**
-     * Adds a component to this root. The component is not added directly to the
-     * root, but instead to the content container ({@link #getContent()}).
+     * Adds a component to this UI. The component is not added directly to the
+     * UI, but instead to the content container ({@link #getContent()}).
      * 
      * @param component
-     *            the component to add to this root
+     *            the component to add to this UI
      * 
      * @see #getContent()
      */
@@ -878,7 +879,7 @@ public abstract class UI extends AbstractComponentContainer implements
 
     /**
      * This implementation removes the component from the content container (
-     * {@link #getContent()}) instead of from the actual root.
+     * {@link #getContent()}) instead of from the actual UI.
      */
     @Override
     public void removeComponent(Component component) {
@@ -887,7 +888,7 @@ public abstract class UI extends AbstractComponentContainer implements
 
     /**
      * This implementation removes the components from the content container (
-     * {@link #getContent()}) instead of from the actual root.
+     * {@link #getContent()}) instead of from the actual UI.
      */
     @Override
     public void removeAllComponents() {
@@ -910,13 +911,13 @@ public abstract class UI extends AbstractComponentContainer implements
     }
 
     /**
-     * Initializes this root. This method is intended to be overridden by
+     * Initializes this UI. This method is intended to be overridden by
      * subclasses to build the view and configure non-component functionality.
      * Performing the initialization in a constructor is not suggested as the
-     * state of the root is not properly set up when the constructor is invoked.
+     * state of the UI is not properly set up when the constructor is invoked.
      * <p>
      * The {@link WrappedRequest} can be used to get information about the
-     * request that caused this root to be created. By default, the
+     * request that caused this UI to be created. By default, the
      * {@link BrowserDetails} will be available in the request. If the browser
      * details are not required, loading the application in the browser can take
      * some shortcuts giving a faster initial rendering. This can be indicated
@@ -924,42 +925,41 @@ public abstract class UI extends AbstractComponentContainer implements
      * </p>
      * 
      * @param request
-     *            the wrapped request that caused this root to be created
+     *            the wrapped request that caused this UI to be created
      */
     protected abstract void init(WrappedRequest request);
 
     /**
-     * Sets the thread local for the current root. This method is used by the
+     * Sets the thread local for the current UI. This method is used by the
      * framework to set the current application whenever a new request is
      * processed and it is cleared when the request has been processed.
      * <p>
      * The application developer can also use this method to define the current
-     * root outside the normal request handling, e.g. when initiating custom
+     * UI outside the normal request handling, e.g. when initiating custom
      * background threads.
      * </p>
      * 
      * @param uI
-     *            the root to register as the current root
+     *            the UI to register as the current UI
      * 
      * @see #getCurrent()
      * @see ThreadLocal
      */
-    public static void setCurrent(UI uI) {
-        currentRoot.set(uI);
+    public static void setCurrent(UI ui) {
+        currentUI.set(ui);
     }
 
     /**
-     * Gets the currently used root. The current root is automatically defined
-     * when processing requests to the server. In other cases, (e.g. from
-     * background threads), the current root is not automatically defined.
+     * Gets the currently used UI. The current UI is automatically defined when
+     * processing requests to the server. In other cases, (e.g. from background
+     * threads), the current UI is not automatically defined.
      * 
-     * @return the current root instance if available, otherwise
-     *         <code>null</code>
+     * @return the current UI instance if available, otherwise <code>null</code>
      * 
      * @see #setCurrent(UI)
      */
     public static UI getCurrent() {
-        return currentRoot.get();
+        return currentUI.get();
     }
 
     public void setScrollTop(int scrollTop) {
@@ -1027,10 +1027,10 @@ public abstract class UI extends AbstractComponentContainer implements
     }
 
     /**
-     * Add a click listener to the UI. The listener is called whenever the
-     * user clicks inside the UI. Also when the click targets a component
-     * inside the UI, provided the targeted component does not prevent the
-     * click event from propagating.
+     * Add a click listener to the UI. The listener is called whenever the user
+     * clicks inside the UI. Also when the click targets a component inside the
+     * UI, provided the targeted component does not prevent the click event from
+     * propagating.
      * 
      * Use {@link #removeListener(ClickListener)} to remove the listener.
      * 
@@ -1082,7 +1082,7 @@ public abstract class UI extends AbstractComponentContainer implements
     }
 
     /**
-     * Shows a notification message on the middle of the root. The message
+     * Shows a notification message on the middle of the UI. The message
      * automatically disappears ("humanized message").
      * 
      * Care should be taken to to avoid XSS vulnerabilities as the caption is
@@ -1105,7 +1105,7 @@ public abstract class UI extends AbstractComponentContainer implements
     }
 
     /**
-     * Shows a notification message the root. The position and behavior of the
+     * Shows a notification message the UI. The position and behavior of the
      * message depends on the type, which is one of the basic types defined in
      * {@link Notification}, for instance Notification.TYPE_WARNING_MESSAGE.
      * 
@@ -1132,8 +1132,8 @@ public abstract class UI extends AbstractComponentContainer implements
 
     /**
      * Shows a notification consisting of a bigger caption and a smaller
-     * description on the middle of the root. The message automatically
-     * disappears ("humanized message").
+     * description on the middle of the UI. The message automatically disappears
+     * ("humanized message").
      * 
      * Care should be taken to to avoid XSS vulnerabilities as the caption and
      * description are rendered as html.
index 27d66ca0d0cde0b8254426bc0b1f26b7cdb0d174..59b1299db256a41ccdb5ed8d1ffb9775da366826 100644 (file)
@@ -56,7 +56,7 @@ public class CustomRootClassLoader extends TestCase {
         application.start(new ApplicationStartEvent(null,
                 createConfigurationMock(), null));
 
-        UI uI = application.getRootForRequest(createRequestMock(null));
+        UI uI = application.getUIForRequest(createRequestMock(null));
         assertTrue(uI instanceof MyRoot);
     }
 
@@ -102,7 +102,7 @@ public class CustomRootClassLoader extends TestCase {
                 createConfigurationMock(), null));
 
         UI uI = application
-                .getRootForRequest(createRequestMock(loggingClassLoader));
+                .getUIForRequest(createRequestMock(loggingClassLoader));
         assertTrue(uI instanceof MyRoot);
         assertEquals(1, loggingClassLoader.requestedClasses.size());
         assertEquals(MyRoot.class.getName(),
@@ -113,12 +113,12 @@ public class CustomRootClassLoader extends TestCase {
     private Application createStubApplication() {
         return new Application() {
             {
-                addRootProvider(new DefaultRootProvider());
+                addUIProvider(new DefaultRootProvider());
             }
 
             @Override
             public String getProperty(String name) {
-                if (name.equals(ROOT_PARAMETER)) {
+                if (name.equals(UI_PARAMETER)) {
                     return MyRoot.class.getName();
                 } else {
                     return super.getProperty(name);
@@ -126,11 +126,11 @@ public class CustomRootClassLoader extends TestCase {
             }
 
             @Override
-            public UI getRootForRequest(WrappedRequest request)
+            public UI getUIForRequest(WrappedRequest request)
                     throws UIRequiresMoreInformationException {
                 // Always create a new root for testing (can't directly use
                 // getRoot as it's protected)
-                return getRoot(request);
+                return getUI(request);
             }
         };
     }
index 43d4ad699e99067fb47421daaf42bfe4aea8a82b..261154620339c1010ec1d6548a7802cddb8c0529 100644 (file)
@@ -112,10 +112,10 @@ public class ApplicationRunnerServlet extends AbstractApplicationServlet {
             final Class<?> classToRun = getClassToRun();
             if (UI.class.isAssignableFrom(classToRun)) {
                 Application application = new Application();
-                application.addRootProvider(new AbstractRootProvider() {
+                application.addUIProvider(new AbstractRootProvider() {
 
                     @Override
-                    public Class<? extends UI> getRootClass(
+                    public Class<? extends UI> getUIClass(
                             Application application, WrappedRequest request)
                             throws UIRequiresMoreInformationException {
                         return (Class<? extends UI>) classToRun;
index deff2bc4869657877e0dc7e85447938408ef4354..b9b9c509c17b7a259a22be5dd32b6bc7ac943487 100644 (file)
@@ -15,17 +15,17 @@ public class RefreshStatePreserve extends AbstractTestApplication {
             getContent().addComponent(
                     new Label("window.name: "
                             + request.getBrowserDetails().getWindowName()));
-            getContent().addComponent(new Label("UI id: " + getRootId()));
+            getContent().addComponent(new Label("UI id: " + getUIId()));
         }
     }
 
     @Override
     public void init() {
         super.init();
-        setRootPreserved(true);
-        addRootProvider(new AbstractRootProvider() {
+        setUiPreserved(true);
+        addUIProvider(new AbstractRootProvider() {
             @Override
-            public Class<? extends UI> getRootClass(Application application,
+            public Class<? extends UI> getUIClass(Application application,
                     WrappedRequest request)
                     throws UIRequiresMoreInformationException {
                 return RefreshStateRoot.class;
index 96380b21859a5bd5e494dca30b8370b457395b87..fa5ab7d100702aa7b4bd852c4930548743414431 100644 (file)
@@ -77,7 +77,7 @@ public class ThreadLocalInstances extends AbstractTestApplication {
     }
 
     @Override
-    protected UI getRoot(WrappedRequest request)
+    protected UI getUI(WrappedRequest request)
             throws UIRequiresMoreInformationException {
         return mainWindow;
     }
index 515734338b715e0258c62a3f015c5c477f16fef4..480c186df750fd1794d7eda457f8b674c6896d82 100644 (file)
@@ -12,7 +12,7 @@ import com.vaadin.ui.UI.LegacyWindow;
 public class LoginFormWithMultipleWindows extends Application {
 
     @Override
-    protected UI getRoot(WrappedRequest request) {
+    protected UI getUI(WrappedRequest request) {
         return new LoginFormWindow();
     }
 
index 3c7862d298b20ae49b7c436e5388397c914f4708..89b43d4bdfeafc6a98193ed04d182060cbd101bf 100644 (file)
@@ -22,7 +22,7 @@ public class LazyInitRoots extends AbstractTestApplication {
     }
 
     @Override
-    public UI getRoot(WrappedRequest request)
+    public UI getUI(WrappedRequest request)
             throws UIRequiresMoreInformationException {
         if (request.getParameter("lazyCreate") != null) {
             // UI created on second request
index 13bef59fe9b8ed01fbff8c5ccd1591dc9d3247f1..238983d9069600ef8b0f052122fec191d6a82922 100644 (file)
@@ -23,9 +23,9 @@ public class RootsInMultipleTabs extends AbstractTestApplication {
     }
 
     public RootsInMultipleTabs() {
-        addRootProvider(new AbstractRootProvider() {
+        addUIProvider(new AbstractRootProvider() {
             @Override
-            public Class<? extends UI> getRootClass(Application application,
+            public Class<? extends UI> getUIClass(Application application,
                     WrappedRequest request)
                     throws UIRequiresMoreInformationException {
                 return TabRoot.class;
index 4181c071f03e469c1cd4101453574d93ab96a068..39b11177b66e5ff0e88c17c9d025aec81d0ad345 100644 (file)
@@ -36,7 +36,7 @@ public class CreatingPreserveState extends UI {
         TextField tf = new TextField("Window #" + (++windowCounter));
         tf.setImmediate(true);
         getContent().addComponent(tf);
-        getApplication().setRootPreserved(true);
+        getApplication().setUiPreserved(true);
     }
 
 }
index 6b25f4674d5e1fd19864c661a7c21c0914380a2e..b0a33c14cf6bf496e2584845262a190877005ca7 100644 (file)
@@ -35,7 +35,7 @@ import com.vaadin.ui.UI;
 public class DifferentFeaturesForDifferentClients extends Application {
 
     @Override
-    protected UI getRoot(WrappedRequest request)
+    protected UI getUI(WrappedRequest request)
             throws UIRequiresMoreInformationException {
         BrowserDetails browserDetails = request.getBrowserDetails();
         // This is a limitation of 7.0.0.alpha1 that there is no better way to