From da176c32c4d92676424021712a7f6d7ee8cedf76 Mon Sep 17 00:00:00 2001
From: Artur Signell
* Note that this theme can be overridden for a specific root with
- * {@link Application#getThemeForRoot(Root)}. Setting theme to be
+ * {@link Application#getThemeForRoot(UI)}. Setting theme to be
*
* Note that removing window from the application does not close the
* browser window - the window is only removed from the server-side.
*
* TODO Investigate whether this might be derived from the different states
* in getRootForRrequest.
@@ -1844,7 +1844,7 @@ public class Application implements Terminal.ErrorListener, Serializable {
*
- * 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 {
*
*
* 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.
*
* Please note that this method can also return a newly created
- * null
selects the default theme. For the available theme
* names, see the contents of the VAADIN/themes directory.
* null
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 null
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)}.
*
* null
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 null
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.
* Root
which has not yet been initialized. You can use
+ * UI
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.
*
true
if the same Root instance should be reused
+ * true
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 true
if the same Root instance should be reused e.g.
+ * @return true
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* This is meant for framework internal use. *
@@ -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, ornull
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. null
is returned if
- * no Root ancestor is found (typically because the connector is not
+ * Finds a UI ancestor of this connector. null
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 null
if none
+ * @return the UI ancestor of this connector, or null
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. null
indicates that the default class
+ * custom UI classes. null
indicates that the default class
* loader should be used.
*
* @return the class loader to use, or null
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 LinkedListnull
*/
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 null
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) {
Iteratornull
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
* null
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
- * 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, null
is returned.
*
null
if it is not
- * attached to a Root
+ * @return the UI of the component or null
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)}.
*
* - * 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. *
* * 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. *
* 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
- * The root is the server side entry point for various client side features that - * are not represented as components added to a layout, e.g notifications, sub - * windows, and executing javascript in the browser. - *
- *- * When a new application instance is needed, typically because the user opens - * the application in a browser window, - * {@link Application#gerRoot(WrappedRequest)} is invoked to get a root. That - * method does by default create a root according to the - * {@value Application#ROOT_PARAMETER} parameter from web.xml. - *
- *- * After a root 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 - * passing a {@link ComponentContainer} with the main layout of the view to - * {@link #setContent(ComponentContainer)}. - *
- *
- * If a {@link EagerInit} annotation is present on a class extending
- * Root
, 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.
- *
- * The name also determines the URL that can be used for direct access - * to a window. All windows can be accessed through - * {@code http://host:port/app/win} where {@code http://host:port/app} - * is the application URL (as returned by {@link Application#getURL()} - * and {@code win} is the window name. - *
- *- * Note! Portlets do not support direct window access through URLs. - *
- * - * @return the Name of the Window. - */ - public String getName() { - return name; - } - - /** - * Sets the unique name of the window. The name of the window is used to - * uniquely identify it inside the application. - *- * The name also determines the URL that can be used for direct access - * to a window. All windows can be accessed through - * {@code http://host:port/app/win} where {@code http://host:port/app} - * is the application URL (as returned by {@link Application#getURL()} - * and {@code win} is the window name. - *
- *- * This method can only be called before the window is added to an - * application. - *
- * Note! Portlets do not support direct window access through URLs. - *
- * - * @param name - * the new name for the window or null if the application - * should automatically assign a name to it - * @throws IllegalStateException - * if the window is attached to an application - */ - public void setName(String name) { - this.name = name; - // The name can not be changed in application - if (getApplication() != null) { - throw new IllegalStateException( - "Window name can not be changed while " - + "the window is in application"); - } - - } - - /** - * Gets the full URL of the window. The returned URL is window specific - * and can be used to directly refer to the window. - *- * Note! This method can not be used for portlets. - *
- * - * @return the URL of the window or null if the window is not attached - * to an application - */ - public URL getURL() { - Application application = getApplication(); - if (application == null) { - return null; - } - - try { - return new URL(application.getURL(), getName() + "/"); - } catch (MalformedURLException e) { - throw new RuntimeException( - "Internal problem getting window URL, please report"); - } - } - - /** - * Opens the given resource in this root. The contents of this Root is - * replaced by the {@code Resource}. - * - * @param resource - * the resource to show in this root - * - * @deprecated As of 7.0, use getPage().open instead - */ - @Deprecated - public void open(Resource resource) { - getPage().open(resource); - } - - /* ********************************************************************* */ - - /** - * Opens the given resource in a window with the given name. - *
- * The supplied {@code windowName} is used as the target name in a
- * window.open call in the client. This means that special values such
- * as "_blank", "_self", "_top", "_parent" have special meaning. An
- * empty or null
window name is also a special case.
- *
- * "", null and "_self" as {@code windowName} all causes the resource to - * be opened in the current window, replacing any old contents. For - * downloadable content you should avoid "_self" as "_self" causes the - * client to skip rendering of any other changes as it considers them - * irrelevant (the page will be replaced by the resource). This can - * speed up the opening of a resource, but it might also put the client - * side into an inconsistent state if the window content is not - * completely replaced e.g., if the resource is downloaded instead of - * displayed in the browser. - *
- *- * "_blank" as {@code windowName} causes the resource to always be - * opened in a new window or tab (depends on the browser and browser - * settings). - *
- *- * "_top" and "_parent" as {@code windowName} works as specified by the - * HTML standard. - *
- *- * Any other {@code windowName} will open the resource in a window with - * that name, either by opening a new window/tab in the browser or by - * replacing the contents of an existing window with that name. - *
- * - * @param resource - * the resource. - * @param windowName - * the name of the window. - * @deprecated As of 7.0, use getPage().open instead - */ - @Deprecated - public void open(Resource resource, String windowName) { - getPage().open(resource, windowName); - } - - /** - * Opens the given resource in a window with the given size, border and - * name. For more information on the meaning of {@code windowName}, see - * {@link #open(Resource, String)}. - * - * @param resource - * the resource. - * @param windowName - * the name of the window. - * @param width - * the width of the window in pixels - * @param height - * the height of the window in pixels - * @param border - * the border style of the window. - * @deprecated As of 7.0, use getPage().open instead - */ - @Deprecated - public void open(Resource resource, String windowName, int width, - int height, BorderStyle border) { - getPage().open(resource, windowName, width, height, border); - } - - /** - * Adds a new {@link BrowserWindowResizeListener} to this root. The - * listener will be notified whenever the browser window within which - * this root resides is resized. - * - * @param resizeListener - * the listener to add - * - * @see BrowserWindowResizeListener#browserWindowResized(BrowserWindowResizeEvent) - * @see #setResizeLazy(boolean) - * - * @deprecated As of 7.0, use the similarly named api in Page instead - */ - @Deprecated - public void addListener(BrowserWindowResizeListener resizeListener) { - getPage().addListener(resizeListener); - } - - /** - * Removes a {@link BrowserWindowResizeListener} from this root. The - * listener will no longer be notified when the browser window is - * resized. - * - * @param resizeListener - * the listener to remove - * @deprecated As of 7.0, use the similarly named api in Page instead - */ - @Deprecated - public void removeListener(BrowserWindowResizeListener resizeListener) { - getPage().removeListener(resizeListener); - } - - /** - * Gets the last known height of the browser window in which this root - * resides. - * - * @return the browser window height in pixels - * @deprecated As of 7.0, use the similarly named api in Page instead - */ - @Deprecated - public int getBrowserWindowHeight() { - return getPage().getBrowserWindowHeight(); - } - - /** - * Gets the last known width of the browser window in which this root - * resides. - * - * @return the browser window width in pixels - * - * @deprecated As of 7.0, use the similarly named api in Page instead - */ - @Deprecated - public int getBrowserWindowWidth() { - return getPage().getBrowserWindowWidth(); - } - - /** - * Executes JavaScript in this window. - * - *- * This method allows one to inject javascript from the server to - * client. A client implementation is not required to implement this - * functionality, but currently all web-based clients do implement this. - *
- * - *- * Executing javascript this way often leads to cross-browser - * compatibility issues and regressions that are hard to resolve. Use of - * this method should be avoided and instead it is recommended to create - * new widgets with GWT. For more info on creating own, reusable - * client-side widgets in Java, read the corresponding chapter in Book - * of Vaadin. - *
- * - * @param script - * JavaScript snippet that will be executed. - * - * @deprecated as of 7.0, use JavaScript.getCurrent().execute(String) - * instead - */ - @Deprecated - public void executeJavaScript(String script) { - getPage().getJavaScript().execute(script); - } - - @Override - public void setCaption(String caption) { - // Override to provide backwards compatibility - getState().setCaption(caption); - getPage().setTitle(caption); - } - - } - - /** - * The application to which this root belongs - */ - private Application application; - - /** - * List of windows in this root. - */ - private final LinkedHashSetnull
application.
- * - * This method is mainly intended for internal use by the framework. - *
- * - * @param application - * the application to set - * - * @throws IllegalStateException - * if the application has already been set - * - * @see #getApplication() - */ - public void setApplication(Application application) { - if ((application == null) == (this.application == null)) { - throw new IllegalStateException("Application has already been set"); - } else { - this.application = application; - } - - if (application != null) { - attach(); - } else { - detach(); - } - } - - /** - * Sets the id of this root within its application. The root id is used to - * route requests to the right root. - *- * This method is mainly intended for internal use by the framework. - *
- * - * @param rootId - * the id of this root - * - * @throws IllegalStateException - * if the root id has already been set - * - * @see #getRootId() - */ - public void setRootId(int rootId) { - if (this.rootId != -1) { - throw new IllegalStateException("Root id has already been defined"); - } - this.rootId = rootId; - } - - /** - * 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. - * - * @return - */ - public int getRootId() { - return rootId; - } - - /** - * 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 - * pointing to this application and ensure - * {@link Application#getRoot(WrappedRequest)} returns an appropriate root - * for the request. - * - * @param window - * @throws IllegalArgumentException - * if the window is already added to an application - * @throws NullPointerException - * if the givenWindow
is null
.
- */
- public void addWindow(Window window) throws IllegalArgumentException,
- NullPointerException {
-
- if (window == null) {
- throw new NullPointerException("Argument must not be null");
- }
-
- if (window.getApplication() != null) {
- throw new IllegalArgumentException(
- "Window is already attached to an application.");
- }
-
- attachWindow(window);
- }
-
- /**
- * Helper method to attach a window.
- *
- * @param w
- * the window to add
- */
- private void attachWindow(Window w) {
- windows.add(w);
- w.setParent(this);
- markAsDirty();
- }
-
- /**
- * Remove the given subwindow from this root.
- *
- * Since Vaadin 6.5, {@link CloseListener}s are called also when explicitly
- * removing a window by calling this method.
- *
- * Since Vaadin 6.5, returns a boolean indicating if the window was removed
- * or not.
- *
- * @param window
- * Window to be removed.
- * @return true if the subwindow was removed, false otherwise
- */
- public boolean removeWindow(Window window) {
- if (!windows.remove(window)) {
- // Window window is not a subwindow of this root.
- return false;
- }
- window.setParent(null);
- window.fireClose();
- markAsDirty();
-
- return true;
- }
-
- /**
- * Gets all the windows added to this root.
- *
- * @return an unmodifiable collection of windows
- */
- public Collection- * The {@link WrappedRequest} can be used to get information about the - * request that caused this root 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 - * by adding the {@link EagerInit} annotation to the Root class. - *
- * - * @param request - * the wrapped request that caused this root to be created - */ - protected abstract void init(WrappedRequest request); - - /** - * Sets the thread local for the current root. This method is used by the - * framework to set the current application whenever a new request is - * processed and it is cleared when the request has been processed. - *- * The application developer can also use this method to define the current - * root outside the normal request handling, e.g. when initiating custom - * background threads. - *
- * - * @param root - * the root to register as the current root - * - * @see #getCurrent() - * @see ThreadLocal - */ - public static void setCurrent(Root root) { - currentRoot.set(root); - } - - /** - * 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. - * - * @return the current root instance if available, otherwise - *null
- *
- * @see #setCurrent(Root)
- */
- public static Root getCurrent() {
- return currentRoot.get();
- }
-
- public void setScrollTop(int scrollTop) {
- throw new RuntimeException("Not yet implemented");
- }
-
- @Override
- protected ActionManager getActionManager() {
- if (actionManager == null) {
- actionManager = new ActionManager(this);
- }
- return actionManager;
- }
-
- @Override
- public
- * Default value: false
- *
- * @param resizeLazy
- * true to use a delay before recalculating sizes, false to
- * calculate immediately.
- */
- public void setResizeLazy(boolean resizeLazy) {
- this.resizeLazy = resizeLazy;
- markAsDirty();
- }
-
- /**
- * Checks whether lazy resize is enabled.
- *
- * @return true
if lazy resize is enabled, false
- * if lazy resize is not enabled
- */
- public boolean isResizeLazy() {
- return resizeLazy;
- }
-
- /**
- * 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
- * click event from propagating.
- *
- * Use {@link #removeListener(ClickListener)} to remove the listener.
- *
- * @param listener
- * The listener to add
- */
- public void addListener(ClickListener listener) {
- addListener(EventId.CLICK_EVENT_IDENTIFIER, ClickEvent.class, listener,
- ClickListener.clickMethod);
- }
-
- /**
- * Remove a click listener from the Root. The listener should earlier have
- * been added using {@link #addListener(ClickListener)}.
- *
- * @param listener
- * The listener to remove
- */
- public void removeListener(ClickListener listener) {
- removeListener(EventId.CLICK_EVENT_IDENTIFIER, ClickEvent.class,
- listener);
- }
-
- @Override
- public boolean isConnectorEnabled() {
- // TODO How can a Root be invisible? What does it mean?
- return isVisible() && isEnabled();
- }
-
- public ConnectorTracker getConnectorTracker() {
- return connectorTracker;
- }
-
- public Page getPage() {
- return page;
- }
-
- /**
- * Setting the caption of a Root 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)}
- */
- @Override
- @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");
- }
-
- /**
- * Shows a notification message on the middle of the root. The message
- * automatically disappears ("humanized message").
- *
- * Care should be taken to to avoid XSS vulnerabilities as the caption is
- * rendered as html.
- *
- * @see #showNotification(Notification)
- * @see Notification
- *
- * @param caption
- * The message
- *
- * @deprecated As of 7.0, use Notification.show instead but be aware that
- * Notification.show does not allow HTML.
- */
- @Deprecated
- public void showNotification(String caption) {
- Notification notification = new Notification(caption);
- notification.setHtmlContentAllowed(true);// Backwards compatibility
- getPage().showNotification(notification);
- }
-
- /**
- * Shows a notification message the root. 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.
- *
- * Care should be taken to to avoid XSS vulnerabilities as the caption is
- * rendered as html.
- *
- * @see #showNotification(Notification)
- * @see Notification
- *
- * @param caption
- * The message
- * @param type
- * The message type
- *
- * @deprecated As of 7.0, use Notification.show instead but be aware that
- * Notification.show does not allow HTML.
- */
- @Deprecated
- public void showNotification(String caption, Notification.Type type) {
- Notification notification = new Notification(caption, type);
- notification.setHtmlContentAllowed(true);// Backwards compatibility
- getPage().showNotification(notification);
- }
-
- /**
- * Shows a notification consisting of a bigger caption and a smaller
- * description on the middle of the root. The message automatically
- * disappears ("humanized message").
- *
- * Care should be taken to to avoid XSS vulnerabilities as the caption and
- * description are rendered as html.
- *
- * @see #showNotification(Notification)
- * @see Notification
- *
- * @param caption
- * The caption of the message
- * @param description
- * The message description
- *
- * @deprecated As of 7.0, use new Notification(...).show(Page) instead but
- * be aware that HTML by default not allowed.
- */
- @Deprecated
- public void showNotification(String caption, String description) {
- Notification notification = new Notification(caption, description);
- notification.setHtmlContentAllowed(true);// Backwards compatibility
- getPage().showNotification(notification);
- }
-
- /**
- * Shows a notification consisting of a bigger caption and a smaller
- * description. 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.
- *
- * Care should be taken to to avoid XSS vulnerabilities as the caption and
- * description are rendered as html.
- *
- * @see #showNotification(Notification)
- * @see Notification
- *
- * @param caption
- * The caption of the message
- * @param description
- * The message description
- * @param type
- * The message type
- *
- * @deprecated As of 7.0, use new Notification(...).show(Page) instead but
- * be aware that HTML by default not allowed.
- */
- @Deprecated
- public void showNotification(String caption, String description,
- Notification.Type type) {
- Notification notification = new Notification(caption, description, type);
- notification.setHtmlContentAllowed(true);// Backwards compatibility
- getPage().showNotification(notification);
- }
-
- /**
- * Shows a notification consisting of a bigger caption and a smaller
- * description. 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.
- *
- * Care should be taken to avoid XSS vulnerabilities if html content is
- * allowed.
- *
- * @see #showNotification(Notification)
- * @see Notification
- *
- * @param caption
- * The message caption
- * @param description
- * The message description
- * @param type
- * The type of message
- * @param htmlContentAllowed
- * Whether html in the caption and description should be
- * displayed as html or as plain text
- *
- * @deprecated As of 7.0, use new Notification(...).show(Page).
- */
- @Deprecated
- public void showNotification(String caption, String description,
- Notification.Type type, boolean htmlContentAllowed) {
- getPage()
- .showNotification(
- new Notification(caption, description, type,
- htmlContentAllowed));
- }
-
- /**
- * Shows a notification message.
- *
- * @see Notification
- * @see #showNotification(String)
- * @see #showNotification(String, int)
- * @see #showNotification(String, String)
- * @see #showNotification(String, String, int)
- *
- * @param notification
- * The notification message to show
- *
- * @deprecated As of 7.0, use Notification.show instead
- */
- @Deprecated
- public void showNotification(Notification notification) {
- getPage().showNotification(notification);
- }
-
-}
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
new file mode 100644
index 0000000000..33eefff485
--- /dev/null
+++ b/server/src/com/vaadin/ui/UI.java
@@ -0,0 +1,1241 @@
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.ui;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map;
+
+import com.vaadin.Application;
+import com.vaadin.annotations.EagerInit;
+import com.vaadin.event.Action;
+import com.vaadin.event.Action.Handler;
+import com.vaadin.event.ActionManager;
+import com.vaadin.event.MouseEvents.ClickEvent;
+import com.vaadin.event.MouseEvents.ClickListener;
+import com.vaadin.shared.EventId;
+import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.BorderStyle;
+import com.vaadin.shared.ui.root.RootConstants;
+import com.vaadin.shared.ui.root.RootServerRpc;
+import com.vaadin.shared.ui.root.RootState;
+import com.vaadin.terminal.Page;
+import com.vaadin.terminal.Page.BrowserWindowResizeEvent;
+import com.vaadin.terminal.Page.BrowserWindowResizeListener;
+import com.vaadin.terminal.PaintException;
+import com.vaadin.terminal.PaintTarget;
+import com.vaadin.terminal.Resource;
+import com.vaadin.terminal.Vaadin6Component;
+import com.vaadin.terminal.WrappedRequest;
+import com.vaadin.terminal.WrappedRequest.BrowserDetails;
+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
+ * browser window (or tab) or some part of a html page where a Vaadin
+ * application is embedded.
+ *
+ * The root is the server side entry point for various client side features that + * are not represented as components added to a layout, e.g notifications, sub + * windows, and executing javascript in the browser. + *
+ *+ * When a new application instance is needed, typically because the user opens + * the application in a browser window, + * {@link Application#gerRoot(WrappedRequest)} is invoked to get a root. That + * method does by default create a root according to the + * {@value Application#ROOT_PARAMETER} parameter from web.xml. + *
+ *+ * After a root 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 + * passing a {@link ComponentContainer} with the main layout of the view to + * {@link #setContent(ComponentContainer)}. + *
+ *
+ * If a {@link EagerInit} annotation is present on a class extending
+ * UI
, the framework will use a faster initialization method
+ * which will not ensure that {@link BrowserDetails} are present in the
+ * {@link WrappedRequest} passed to the init method.
+ *
+ * The name also determines the URL that can be used for direct access + * to a window. All windows can be accessed through + * {@code http://host:port/app/win} where {@code http://host:port/app} + * is the application URL (as returned by {@link Application#getURL()} + * and {@code win} is the window name. + *
+ *+ * Note! Portlets do not support direct window access through URLs. + *
+ * + * @return the Name of the Window. + */ + public String getName() { + return name; + } + + /** + * Sets the unique name of the window. The name of the window is used to + * uniquely identify it inside the application. + *+ * The name also determines the URL that can be used for direct access + * to a window. All windows can be accessed through + * {@code http://host:port/app/win} where {@code http://host:port/app} + * is the application URL (as returned by {@link Application#getURL()} + * and {@code win} is the window name. + *
+ *+ * This method can only be called before the window is added to an + * application. + *
+ * Note! Portlets do not support direct window access through URLs. + *
+ * + * @param name + * the new name for the window or null if the application + * should automatically assign a name to it + * @throws IllegalStateException + * if the window is attached to an application + */ + public void setName(String name) { + this.name = name; + // The name can not be changed in application + if (getApplication() != null) { + throw new IllegalStateException( + "Window name can not be changed while " + + "the window is in application"); + } + + } + + /** + * Gets the full URL of the window. The returned URL is window specific + * and can be used to directly refer to the window. + *+ * Note! This method can not be used for portlets. + *
+ * + * @return the URL of the window or null if the window is not attached + * to an application + */ + public URL getURL() { + Application application = getApplication(); + if (application == null) { + return null; + } + + try { + return new URL(application.getURL(), getName() + "/"); + } catch (MalformedURLException e) { + throw new RuntimeException( + "Internal problem getting window URL, please report"); + } + } + + /** + * Opens the given resource in this root. The contents of this UI is + * replaced by the {@code Resource}. + * + * @param resource + * the resource to show in this root + * + * @deprecated As of 7.0, use getPage().open instead + */ + @Deprecated + public void open(Resource resource) { + getPage().open(resource); + } + + /* ********************************************************************* */ + + /** + * Opens the given resource in a window with the given name. + *
+ * The supplied {@code windowName} is used as the target name in a
+ * window.open call in the client. This means that special values such
+ * as "_blank", "_self", "_top", "_parent" have special meaning. An
+ * empty or null
window name is also a special case.
+ *
+ * "", null and "_self" as {@code windowName} all causes the resource to + * be opened in the current window, replacing any old contents. For + * downloadable content you should avoid "_self" as "_self" causes the + * client to skip rendering of any other changes as it considers them + * irrelevant (the page will be replaced by the resource). This can + * speed up the opening of a resource, but it might also put the client + * side into an inconsistent state if the window content is not + * completely replaced e.g., if the resource is downloaded instead of + * displayed in the browser. + *
+ *+ * "_blank" as {@code windowName} causes the resource to always be + * opened in a new window or tab (depends on the browser and browser + * settings). + *
+ *+ * "_top" and "_parent" as {@code windowName} works as specified by the + * HTML standard. + *
+ *+ * Any other {@code windowName} will open the resource in a window with + * that name, either by opening a new window/tab in the browser or by + * replacing the contents of an existing window with that name. + *
+ * + * @param resource + * the resource. + * @param windowName + * the name of the window. + * @deprecated As of 7.0, use getPage().open instead + */ + @Deprecated + public void open(Resource resource, String windowName) { + getPage().open(resource, windowName); + } + + /** + * Opens the given resource in a window with the given size, border and + * name. For more information on the meaning of {@code windowName}, see + * {@link #open(Resource, String)}. + * + * @param resource + * the resource. + * @param windowName + * the name of the window. + * @param width + * the width of the window in pixels + * @param height + * the height of the window in pixels + * @param border + * the border style of the window. + * @deprecated As of 7.0, use getPage().open instead + */ + @Deprecated + public void open(Resource resource, String windowName, int width, + int height, BorderStyle border) { + getPage().open(resource, windowName, width, height, border); + } + + /** + * Adds a new {@link BrowserWindowResizeListener} to this root. The + * listener will be notified whenever the browser window within which + * this root resides is resized. + * + * @param resizeListener + * the listener to add + * + * @see BrowserWindowResizeListener#browserWindowResized(BrowserWindowResizeEvent) + * @see #setResizeLazy(boolean) + * + * @deprecated As of 7.0, use the similarly named api in Page instead + */ + @Deprecated + public void addListener(BrowserWindowResizeListener resizeListener) { + getPage().addListener(resizeListener); + } + + /** + * Removes a {@link BrowserWindowResizeListener} from this root. The + * listener will no longer be notified when the browser window is + * resized. + * + * @param resizeListener + * the listener to remove + * @deprecated As of 7.0, use the similarly named api in Page instead + */ + @Deprecated + public void removeListener(BrowserWindowResizeListener resizeListener) { + getPage().removeListener(resizeListener); + } + + /** + * Gets the last known height of the browser window in which this root + * resides. + * + * @return the browser window height in pixels + * @deprecated As of 7.0, use the similarly named api in Page instead + */ + @Deprecated + public int getBrowserWindowHeight() { + return getPage().getBrowserWindowHeight(); + } + + /** + * Gets the last known width of the browser window in which this root + * resides. + * + * @return the browser window width in pixels + * + * @deprecated As of 7.0, use the similarly named api in Page instead + */ + @Deprecated + public int getBrowserWindowWidth() { + return getPage().getBrowserWindowWidth(); + } + + /** + * Executes JavaScript in this window. + * + *+ * This method allows one to inject javascript from the server to + * client. A client implementation is not required to implement this + * functionality, but currently all web-based clients do implement this. + *
+ * + *+ * Executing javascript this way often leads to cross-browser + * compatibility issues and regressions that are hard to resolve. Use of + * this method should be avoided and instead it is recommended to create + * new widgets with GWT. For more info on creating own, reusable + * client-side widgets in Java, read the corresponding chapter in Book + * of Vaadin. + *
+ * + * @param script + * JavaScript snippet that will be executed. + * + * @deprecated as of 7.0, use JavaScript.getCurrent().execute(String) + * instead + */ + @Deprecated + public void executeJavaScript(String script) { + getPage().getJavaScript().execute(script); + } + + @Override + public void setCaption(String caption) { + // Override to provide backwards compatibility + getState().setCaption(caption); + getPage().setTitle(caption); + } + + } + + /** + * The application to which this root belongs + */ + private Application application; + + /** + * List of windows in this root. + */ + private final LinkedHashSetnull
application.
+ * + * This method is mainly intended for internal use by the framework. + *
+ * + * @param application + * the application to set + * + * @throws IllegalStateException + * if the application has already been set + * + * @see #getApplication() + */ + public void setApplication(Application application) { + if ((application == null) == (this.application == null)) { + throw new IllegalStateException("Application has already been set"); + } else { + this.application = application; + } + + if (application != null) { + attach(); + } else { + detach(); + } + } + + /** + * Sets the id of this root within its application. The root id is used to + * route requests to the right root. + *+ * This method is mainly intended for internal use by the framework. + *
+ * + * @param rootId + * the id of this root + * + * @throws IllegalStateException + * if the root id has already been set + * + * @see #getRootId() + */ + public void setRootId(int rootId) { + if (this.rootId != -1) { + throw new IllegalStateException("UI id has already been defined"); + } + this.rootId = rootId; + } + + /** + * 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. + * + * @return + */ + public int getRootId() { + return rootId; + } + + /** + * 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 + * pointing to this application and ensure + * {@link Application#getRoot(WrappedRequest)} returns an appropriate root + * for the request. + * + * @param window + * @throws IllegalArgumentException + * if the window is already added to an application + * @throws NullPointerException + * if the givenWindow
is null
.
+ */
+ public void addWindow(Window window) throws IllegalArgumentException,
+ NullPointerException {
+
+ if (window == null) {
+ throw new NullPointerException("Argument must not be null");
+ }
+
+ if (window.getApplication() != null) {
+ throw new IllegalArgumentException(
+ "Window is already attached to an application.");
+ }
+
+ attachWindow(window);
+ }
+
+ /**
+ * Helper method to attach a window.
+ *
+ * @param w
+ * the window to add
+ */
+ private void attachWindow(Window w) {
+ windows.add(w);
+ w.setParent(this);
+ markAsDirty();
+ }
+
+ /**
+ * Remove the given subwindow from this root.
+ *
+ * Since Vaadin 6.5, {@link CloseListener}s are called also when explicitly
+ * removing a window by calling this method.
+ *
+ * Since Vaadin 6.5, returns a boolean indicating if the window was removed
+ * or not.
+ *
+ * @param window
+ * Window to be removed.
+ * @return true if the subwindow was removed, false otherwise
+ */
+ public boolean removeWindow(Window window) {
+ if (!windows.remove(window)) {
+ // Window window is not a subwindow of this root.
+ return false;
+ }
+ window.setParent(null);
+ window.fireClose();
+ markAsDirty();
+
+ return true;
+ }
+
+ /**
+ * Gets all the windows added to this root.
+ *
+ * @return an unmodifiable collection of windows
+ */
+ public Collection+ * The {@link WrappedRequest} can be used to get information about the + * request that caused this root 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 + * by adding the {@link EagerInit} annotation to the UI class. + *
+ * + * @param request + * the wrapped request that caused this root to be created + */ + protected abstract void init(WrappedRequest request); + + /** + * Sets the thread local for the current root. This method is used by the + * framework to set the current application whenever a new request is + * processed and it is cleared when the request has been processed. + *+ * The application developer can also use this method to define the current + * root outside the normal request handling, e.g. when initiating custom + * background threads. + *
+ * + * @param uI + * the root to register as the current root + * + * @see #getCurrent() + * @see ThreadLocal + */ + public static void setCurrent(UI uI) { + currentRoot.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. + * + * @return the current root instance if available, otherwise + *null
+ *
+ * @see #setCurrent(UI)
+ */
+ public static UI getCurrent() {
+ return currentRoot.get();
+ }
+
+ public void setScrollTop(int scrollTop) {
+ throw new RuntimeException("Not yet implemented");
+ }
+
+ @Override
+ protected ActionManager getActionManager() {
+ if (actionManager == null) {
+ actionManager = new ActionManager(this);
+ }
+ return actionManager;
+ }
+
+ @Override
+ public
+ * Default value: false
+ *
+ * @param resizeLazy
+ * true to use a delay before recalculating sizes, false to
+ * calculate immediately.
+ */
+ public void setResizeLazy(boolean resizeLazy) {
+ this.resizeLazy = resizeLazy;
+ markAsDirty();
+ }
+
+ /**
+ * Checks whether lazy resize is enabled.
+ *
+ * @return true
if lazy resize is enabled, false
+ * if lazy resize is not enabled
+ */
+ public boolean isResizeLazy() {
+ return resizeLazy;
+ }
+
+ /**
+ * 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.
+ *
+ * @param listener
+ * The listener to add
+ */
+ public void addListener(ClickListener listener) {
+ addListener(EventId.CLICK_EVENT_IDENTIFIER, ClickEvent.class, listener,
+ ClickListener.clickMethod);
+ }
+
+ /**
+ * Remove a click listener from the UI. The listener should earlier have
+ * been added using {@link #addListener(ClickListener)}.
+ *
+ * @param listener
+ * The listener to remove
+ */
+ public void removeListener(ClickListener listener) {
+ removeListener(EventId.CLICK_EVENT_IDENTIFIER, ClickEvent.class,
+ listener);
+ }
+
+ @Override
+ public boolean isConnectorEnabled() {
+ // TODO How can a UI be invisible? What does it mean?
+ return isVisible() && isEnabled();
+ }
+
+ public ConnectorTracker getConnectorTracker() {
+ return connectorTracker;
+ }
+
+ public Page getPage() {
+ return page;
+ }
+
+ /**
+ * 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)}
+ */
+ @Override
+ @Deprecated
+ public void setCaption(String caption) {
+ throw new IllegalStateException(
+ "You can not set the title of a UI. To set the title of the HTML page, use Page.setTitle");
+ }
+
+ /**
+ * Shows a notification message on the middle of the root. The message
+ * automatically disappears ("humanized message").
+ *
+ * Care should be taken to to avoid XSS vulnerabilities as the caption is
+ * rendered as html.
+ *
+ * @see #showNotification(Notification)
+ * @see Notification
+ *
+ * @param caption
+ * The message
+ *
+ * @deprecated As of 7.0, use Notification.show instead but be aware that
+ * Notification.show does not allow HTML.
+ */
+ @Deprecated
+ public void showNotification(String caption) {
+ Notification notification = new Notification(caption);
+ notification.setHtmlContentAllowed(true);// Backwards compatibility
+ getPage().showNotification(notification);
+ }
+
+ /**
+ * Shows a notification message the root. 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.
+ *
+ * Care should be taken to to avoid XSS vulnerabilities as the caption is
+ * rendered as html.
+ *
+ * @see #showNotification(Notification)
+ * @see Notification
+ *
+ * @param caption
+ * The message
+ * @param type
+ * The message type
+ *
+ * @deprecated As of 7.0, use Notification.show instead but be aware that
+ * Notification.show does not allow HTML.
+ */
+ @Deprecated
+ public void showNotification(String caption, Notification.Type type) {
+ Notification notification = new Notification(caption, type);
+ notification.setHtmlContentAllowed(true);// Backwards compatibility
+ getPage().showNotification(notification);
+ }
+
+ /**
+ * Shows a notification consisting of a bigger caption and a smaller
+ * description on the middle of the root. The message automatically
+ * disappears ("humanized message").
+ *
+ * Care should be taken to to avoid XSS vulnerabilities as the caption and
+ * description are rendered as html.
+ *
+ * @see #showNotification(Notification)
+ * @see Notification
+ *
+ * @param caption
+ * The caption of the message
+ * @param description
+ * The message description
+ *
+ * @deprecated As of 7.0, use new Notification(...).show(Page) instead but
+ * be aware that HTML by default not allowed.
+ */
+ @Deprecated
+ public void showNotification(String caption, String description) {
+ Notification notification = new Notification(caption, description);
+ notification.setHtmlContentAllowed(true);// Backwards compatibility
+ getPage().showNotification(notification);
+ }
+
+ /**
+ * Shows a notification consisting of a bigger caption and a smaller
+ * description. 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.
+ *
+ * Care should be taken to to avoid XSS vulnerabilities as the caption and
+ * description are rendered as html.
+ *
+ * @see #showNotification(Notification)
+ * @see Notification
+ *
+ * @param caption
+ * The caption of the message
+ * @param description
+ * The message description
+ * @param type
+ * The message type
+ *
+ * @deprecated As of 7.0, use new Notification(...).show(Page) instead but
+ * be aware that HTML by default not allowed.
+ */
+ @Deprecated
+ public void showNotification(String caption, String description,
+ Notification.Type type) {
+ Notification notification = new Notification(caption, description, type);
+ notification.setHtmlContentAllowed(true);// Backwards compatibility
+ getPage().showNotification(notification);
+ }
+
+ /**
+ * Shows a notification consisting of a bigger caption and a smaller
+ * description. 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.
+ *
+ * Care should be taken to avoid XSS vulnerabilities if html content is
+ * allowed.
+ *
+ * @see #showNotification(Notification)
+ * @see Notification
+ *
+ * @param caption
+ * The message caption
+ * @param description
+ * The message description
+ * @param type
+ * The type of message
+ * @param htmlContentAllowed
+ * Whether html in the caption and description should be
+ * displayed as html or as plain text
+ *
+ * @deprecated As of 7.0, use new Notification(...).show(Page).
+ */
+ @Deprecated
+ public void showNotification(String caption, String description,
+ Notification.Type type, boolean htmlContentAllowed) {
+ getPage()
+ .showNotification(
+ new Notification(caption, description, type,
+ htmlContentAllowed));
+ }
+
+ /**
+ * Shows a notification message.
+ *
+ * @see Notification
+ * @see #showNotification(String)
+ * @see #showNotification(String, int)
+ * @see #showNotification(String, String)
+ * @see #showNotification(String, String, int)
+ *
+ * @param notification
+ * The notification message to show
+ *
+ * @deprecated As of 7.0, use Notification.show instead
+ */
+ @Deprecated
+ public void showNotification(Notification notification) {
+ getPage().showNotification(notification);
+ }
+
+}
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)}.
* 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; *
** 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. *
* * @author Vaadin Ltd. @@ -222,14 +222,14 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * */ 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, **/ 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); -- cgit v1.2.3