diff options
author | Artur Signell <artur@vaadin.com> | 2012-08-24 11:47:50 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-08-24 13:23:20 +0300 |
commit | 5c557b50bc5f7f754d60a2ed435907b897b6750b (patch) | |
tree | 7a9db946a00c955a75035db121b3109fece20574 /server | |
parent | 0b0ddb86876a965f68c6160fe7a499412b6c199d (diff) | |
download | vaadin-framework-5c557b50bc5f7f754d60a2ed435907b897b6750b.tar.gz vaadin-framework-5c557b50bc5f7f754d60a2ed435907b897b6750b.zip |
Remaining Root -> UI renames (#8908)
Diffstat (limited to 'server')
22 files changed, 159 insertions, 174 deletions
diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java index 1827a55b72..96d38e31cf 100644 --- a/server/src/com/vaadin/Application.java +++ b/server/src/com/vaadin/Application.java @@ -51,7 +51,7 @@ import com.vaadin.data.util.converter.ConverterFactory; import com.vaadin.data.util.converter.DefaultConverterFactory; import com.vaadin.event.EventRouter; import com.vaadin.service.ApplicationContext; -import com.vaadin.shared.ApplicationConstants; +import com.vaadin.shared.ui.ui.UIConstants; import com.vaadin.terminal.AbstractErrorMessage; import com.vaadin.terminal.ApplicationResource; import com.vaadin.terminal.CombinedRequest; @@ -2264,8 +2264,7 @@ public class Application implements Terminal.ErrorListener, Serializable { CombinedRequest combinedRequest = (CombinedRequest) request; request = combinedRequest.getSecondRequest(); } - String uiIdString = request - .getParameter(ApplicationConstants.ROOT_ID_PARAMETER); + String uiIdString = request.getParameter(UIConstants.UI_ID_PARAMETER); Integer uiId = uiIdString == null ? null : new Integer(uiIdString); return uiId; } diff --git a/server/src/com/vaadin/UIRequiresMoreInformationException.java b/server/src/com/vaadin/UIRequiresMoreInformationException.java index 0d491895e5..493c31acb6 100644 --- a/server/src/com/vaadin/UIRequiresMoreInformationException.java +++ b/server/src/com/vaadin/UIRequiresMoreInformationException.java @@ -20,7 +20,7 @@ import com.vaadin.terminal.WrappedRequest; import com.vaadin.terminal.WrappedRequest.BrowserDetails; /** - * Exception that is thrown to indicate that creating or initializing the root + * Exception that is thrown to indicate that creating or initializing the UI * requires information detailed from the web browser ({@link BrowserDetails}) * to be present. * diff --git a/server/src/com/vaadin/terminal/AbstractRootProvider.java b/server/src/com/vaadin/terminal/AbstractUIProvider.java index f316a58f15..5bb4d35b30 100644 --- a/server/src/com/vaadin/terminal/AbstractRootProvider.java +++ b/server/src/com/vaadin/terminal/AbstractUIProvider.java @@ -19,7 +19,7 @@ package com.vaadin.terminal; import com.vaadin.Application;
import com.vaadin.ui.UI;
-public abstract class AbstractRootProvider implements UIProvider {
+public abstract class AbstractUIProvider implements UIProvider {
@Override
public UI instantiateUI(Application application,
diff --git a/server/src/com/vaadin/terminal/DefaultRootProvider.java b/server/src/com/vaadin/terminal/DefaultUIProvider.java index b201be513d..8713c45b31 100644 --- a/server/src/com/vaadin/terminal/DefaultRootProvider.java +++ b/server/src/com/vaadin/terminal/DefaultUIProvider.java @@ -20,16 +20,16 @@ import com.vaadin.Application; import com.vaadin.UIRequiresMoreInformationException;
import com.vaadin.ui.UI;
-public class DefaultRootProvider extends AbstractRootProvider {
+public class DefaultUIProvider extends AbstractUIProvider {
@Override
public Class<? extends UI> getUIClass(Application application,
WrappedRequest request) throws UIRequiresMoreInformationException {
- Object rootClassNameObj = application
+ Object uiClassNameObj = application
.getProperty(Application.UI_PARAMETER);
- if (rootClassNameObj instanceof String) {
- String rootClassName = rootClassNameObj.toString();
+ if (uiClassNameObj instanceof String) {
+ String uiClassName = uiClassNameObj.toString();
ClassLoader classLoader = request.getDeploymentConfiguration()
.getClassLoader();
@@ -37,12 +37,12 @@ public class DefaultRootProvider extends AbstractRootProvider { classLoader = getClass().getClassLoader();
}
try {
- Class<? extends UI> rootClass = Class.forName(rootClassName,
- true, classLoader).asSubclass(UI.class);
+ Class<? extends UI> uiClass = Class.forName(uiClassName, true,
+ classLoader).asSubclass(UI.class);
- return rootClass;
+ return uiClass;
} catch (ClassNotFoundException e) {
- throw new RuntimeException("Could not find root class", e);
+ throw new RuntimeException("Could not find UI class", e);
}
}
diff --git a/server/src/com/vaadin/terminal/Page.java b/server/src/com/vaadin/terminal/Page.java index 95f9a7b3ec..66ef7da296 100644 --- a/server/src/com/vaadin/terminal/Page.java +++ b/server/src/com/vaadin/terminal/Page.java @@ -25,8 +25,8 @@ import java.util.List; import com.vaadin.event.EventRouter; import com.vaadin.shared.ui.BorderStyle; -import com.vaadin.shared.ui.root.PageClientRpc; -import com.vaadin.shared.ui.root.RootConstants; +import com.vaadin.shared.ui.ui.PageClientRpc; +import com.vaadin.shared.ui.ui.UIConstants; import com.vaadin.terminal.WrappedRequest.BrowserDetails; import com.vaadin.terminal.gwt.server.WebApplicationContext; import com.vaadin.terminal.gwt.server.WebBrowser; @@ -474,32 +474,32 @@ public class Page implements Serializable { target.startTag("notification"); if (n.getCaption() != null) { target.addAttribute( - RootConstants.ATTRIBUTE_NOTIFICATION_CAPTION, + UIConstants.ATTRIBUTE_NOTIFICATION_CAPTION, n.getCaption()); } if (n.getDescription() != null) { target.addAttribute( - RootConstants.ATTRIBUTE_NOTIFICATION_MESSAGE, + UIConstants.ATTRIBUTE_NOTIFICATION_MESSAGE, n.getDescription()); } if (n.getIcon() != null) { target.addAttribute( - RootConstants.ATTRIBUTE_NOTIFICATION_ICON, + UIConstants.ATTRIBUTE_NOTIFICATION_ICON, n.getIcon()); } if (!n.isHtmlContentAllowed()) { target.addAttribute( - RootConstants.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED, + UIConstants.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED, true); } target.addAttribute( - RootConstants.ATTRIBUTE_NOTIFICATION_POSITION, n + UIConstants.ATTRIBUTE_NOTIFICATION_POSITION, n .getPosition().ordinal()); - target.addAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_DELAY, + target.addAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_DELAY, n.getDelayMsec()); if (n.getStyleName() != null) { target.addAttribute( - RootConstants.ATTRIBUTE_NOTIFICATION_STYLE, + UIConstants.ATTRIBUTE_NOTIFICATION_STYLE, n.getStyleName()); } target.endTag("notification"); @@ -509,7 +509,7 @@ public class Page implements Serializable { } if (fragment != null) { - target.addAttribute(RootConstants.FRAGMENT_VARIABLE, fragment); + target.addAttribute(UIConstants.FRAGMENT_VARIABLE, fragment); } } @@ -632,11 +632,11 @@ public class Page implements Serializable { * <code>null</code> */ public static Page getCurrent() { - UI currentRoot = UI.getCurrent(); - if (currentRoot == null) { + UI currentUI = UI.getCurrent(); + if (currentUI == null) { return null; } - return currentRoot.getPage(); + return currentUI.getPage(); } /** diff --git a/server/src/com/vaadin/terminal/WrappedRequest.java b/server/src/com/vaadin/terminal/WrappedRequest.java index 9ef98fcc41..343a60848e 100644 --- a/server/src/com/vaadin/terminal/WrappedRequest.java +++ b/server/src/com/vaadin/terminal/WrappedRequest.java @@ -219,8 +219,9 @@ public interface WrappedRequest extends Serializable { * for instance using javascript in the browser. * * This information is only guaranteed to be available in some special - * cases, for instance when {@link Application#getRoot} is called again - * after throwing {@link UIRequiresMoreInformationException} or in + * cases, for instance when + * {@link Application#getUIForRequest(WrappedRequest)} is called again after + * throwing {@link UIRequiresMoreInformationException} or in * {@link UI#init(WrappedRequest)} for a UI class not annotated with * {@link EagerInit} * diff --git a/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java b/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java index 7a69a4c2b0..a9e6028090 100644 --- a/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java +++ b/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java @@ -501,23 +501,22 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet uI = application .getUIForRequest(wrappedRequest); } catch (UIRequiresMoreInformationException e) { - // Ignore problem and continue without root + // Ignore problem and continue without UI } break; case BROWSER_DETAILS: - // Should not try to find a root here as the - // combined request details might change the root + // Should not try to find a UI here as the + // combined request details might change the UI break; case FILE_UPLOAD: // no window break; case APPLICATION_RESOURCE: // use main window - should not need any window - // root = application.getRoot(); + // UI = application.getUI(); break; default: - uI = application - .getUIForRequest(wrappedRequest); + uI = application.getUIForRequest(wrappedRequest); } // if window not found, not a problem - use null } @@ -534,9 +533,8 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet uI, (ActionRequest) request, (ActionResponse) response); } else if (request instanceof EventRequest) { - applicationContext.firePortletEventRequest(application, - uI, (EventRequest) request, - (EventResponse) response); + applicationContext.firePortletEventRequest(application, uI, + (EventRequest) request, (EventResponse) response); } else if (request instanceof ResourceRequest) { applicationContext.firePortletResourceRequest(application, uI, (ResourceRequest) request, diff --git a/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java b/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java index b71c6ec20c..6cf9b76b0d 100644 --- a/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java +++ b/server/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java @@ -321,14 +321,14 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements } else if (requestType == RequestType.UIDL) { UI uI = application.getUIForRequest(request); if (uI == null) { - throw new ServletException(ERROR_NO_ROOT_FOUND); + throw new ServletException(ERROR_NO_UI_FOUND); } // Handles AJAX UIDL requests applicationManager.handleUidlRequest(request, response, servletWrapper, uI); return; } else if (requestType == RequestType.BROWSER_DETAILS) { - // Browser details - not related to a specific root + // Browser details - not related to a specific UI applicationManager.handleBrowserDetailsRequest(request, response, application); return; diff --git a/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index e19cfc4de6..87eadd5df7 100644 --- a/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/server/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -74,6 +74,7 @@ import com.vaadin.shared.communication.LegacyChangeVariablesInvocation; import com.vaadin.shared.communication.MethodInvocation; import com.vaadin.shared.communication.SharedState; import com.vaadin.shared.communication.UidlValue; +import com.vaadin.shared.ui.ui.UIConstants; import com.vaadin.terminal.AbstractClientConnector; import com.vaadin.terminal.CombinedRequest; import com.vaadin.terminal.LegacyPaint; @@ -146,7 +147,7 @@ public abstract class AbstractCommunicationManager implements Serializable { public static final char VAR_ESCAPE_CHARACTER = '\u001b'; - private final HashMap<Integer, ClientCache> rootToClientCache = new HashMap<Integer, ClientCache>(); + private final HashMap<Integer, ClientCache> uiToClientCache = new HashMap<Integer, ClientCache>(); private static final int MAX_BUFFER_SIZE = 64 * 1024; @@ -570,7 +571,7 @@ public abstract class AbstractCommunicationManager implements Serializable { if (uI == null) { // This should not happen, no windows exists but // application is still open. - getLogger().warning("Could not get root for application"); + getLogger().warning("Could not get UI for application"); return; } } else { @@ -810,17 +811,17 @@ public abstract class AbstractCommunicationManager implements Serializable { @SuppressWarnings("unchecked") public void writeUidlResponse(WrappedRequest request, boolean repaintAll, - final PrintWriter outWriter, UI uI, boolean analyzeLayouts) + final PrintWriter outWriter, UI ui, boolean analyzeLayouts) throws PaintException, JSONException { ArrayList<ClientConnector> dirtyVisibleConnectors = new ArrayList<ClientConnector>(); - Application application = uI.getApplication(); + Application application = ui.getApplication(); // Paints components - ConnectorTracker rootConnectorTracker = uI.getConnectorTracker(); + ConnectorTracker uiConnectorTracker = ui.getConnectorTracker(); getLogger().log(Level.FINE, "* Creating response to client"); if (repaintAll) { - getClientCache(uI).clear(); - rootConnectorTracker.markAllConnectorsDirty(); - rootConnectorTracker.markAllClientSidesUninitialized(); + getClientCache(ui).clear(); + uiConnectorTracker.markAllConnectorsDirty(); + uiConnectorTracker.markAllClientSidesUninitialized(); // Reset sent locales locales = null; @@ -828,18 +829,18 @@ public abstract class AbstractCommunicationManager implements Serializable { } dirtyVisibleConnectors - .addAll(getDirtyVisibleConnectors(rootConnectorTracker)); + .addAll(getDirtyVisibleConnectors(uiConnectorTracker)); getLogger().log( Level.FINE, "Found " + dirtyVisibleConnectors.size() + " dirty connectors to paint"); for (ClientConnector connector : dirtyVisibleConnectors) { - boolean initialized = rootConnectorTracker + boolean initialized = uiConnectorTracker .isClientSideInitialized(connector); connector.beforeClientResponse(!initialized); } - rootConnectorTracker.markAllConnectorsClean(); + uiConnectorTracker.markAllConnectorsClean(); outWriter.print("\"changes\":["); @@ -851,12 +852,11 @@ public abstract class AbstractCommunicationManager implements Serializable { if (analyzeLayouts) { invalidComponentRelativeSizes = ComponentSizeValidator - .validateComponentRelativeSizes(uI.getContent(), null, - null); + .validateComponentRelativeSizes(ui.getContent(), null, null); // Also check any existing subwindows - if (uI.getWindows() != null) { - for (Window subWindow : uI.getWindows()) { + if (ui.getWindows() != null) { + for (Window subWindow : ui.getWindows()) { invalidComponentRelativeSizes = ComponentSizeValidator .validateComponentRelativeSizes( subWindow.getContent(), @@ -951,10 +951,10 @@ public abstract class AbstractCommunicationManager implements Serializable { outWriter.append(hierarchyInfo.toString()); outWriter.print(", "); // close hierarchy - // send server to client RPC calls for components in the root, in call + // send server to client RPC calls for components in the UI, in call // order - // collect RPC calls from components in the root in the order in + // collect RPC calls from components in the UI in the order in // which they were performed, remove the calls from components LinkedList<ClientConnector> rpcPendingQueue = new LinkedList<ClientConnector>( @@ -985,7 +985,7 @@ public abstract class AbstractCommunicationManager implements Serializable { // } paramJson.put(JsonCodec.encode( invocation.getParameters()[i], referenceParameter, - parameterType, uI.getConnectorTracker())); + parameterType, ui.getConnectorTracker())); } invocationJson.put(paramJson); rpcCalls.put(invocationJson); @@ -1087,7 +1087,7 @@ public abstract class AbstractCommunicationManager implements Serializable { final String resource = (String) i.next(); InputStream is = null; try { - is = getThemeResourceAsStream(uI, getTheme(uI), resource); + is = getThemeResourceAsStream(ui, getTheme(ui), resource); } catch (final Exception e) { // FIXME: Handle exception getLogger().log(Level.FINER, @@ -1124,7 +1124,7 @@ public abstract class AbstractCommunicationManager implements Serializable { Collection<Class<? extends ClientConnector>> usedClientConnectors = paintTarget .getUsedClientConnectors(); boolean typeMappingsOpen = false; - ClientCache clientCache = getClientCache(uI); + ClientCache clientCache = getClientCache(ui); List<Class<? extends ClientConnector>> newConnectorTypes = new ArrayList<Class<? extends ClientConnector>>(); @@ -1237,7 +1237,7 @@ public abstract class AbstractCommunicationManager implements Serializable { } for (ClientConnector connector : dirtyVisibleConnectors) { - rootConnectorTracker.markClientSideInitialized(connector); + uiConnectorTracker.markClientSideInitialized(connector); } writePerformanceData(outWriter); @@ -1390,11 +1390,11 @@ public abstract class AbstractCommunicationManager implements Serializable { } private ClientCache getClientCache(UI uI) { - Integer rootId = Integer.valueOf(uI.getUIId()); - ClientCache cache = rootToClientCache.get(rootId); + Integer uiId = Integer.valueOf(uI.getUIId()); + ClientCache cache = uiToClientCache.get(uiId); if (cache == null) { cache = new ClientCache(); - rootToClientCache.put(rootId, cache); + uiToClientCache.put(uiId, cache); } return cache; } @@ -1633,14 +1633,13 @@ public abstract class AbstractCommunicationManager implements Serializable { * * @param source * @param uI - * the root receiving the burst + * the UI receiving the burst * @param burst * the content of the burst as a String to be parsed * @return true if the processing of the burst was successful and there were * no messages to non-existent components */ - public boolean handleBurst(WrappedRequest source, UI uI, - final String burst) { + public boolean handleBurst(WrappedRequest source, UI uI, final String burst) { boolean success = true; try { Set<Connector> enabledConnectors = new HashSet<Connector>(); @@ -1878,8 +1877,7 @@ public abstract class AbstractCommunicationManager implements Serializable { } protected ClientConnector getConnector(UI uI, String connectorId) { - ClientConnector c = uI.getConnectorTracker() - .getConnector(connectorId); + ClientConnector c = uI.getConnectorTracker().getConnector(connectorId); if (c == null && connectorId.equals(getDragAndDropService().getConnectorId())) { return getDragAndDropService(); @@ -2231,7 +2229,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * invisible subtrees are omitted. * * @param w - * root window for which dirty components is to be fetched + * UI window for which dirty components is to be fetched * @return */ private ArrayList<ClientConnector> getDirtyVisibleConnectors( @@ -2344,7 +2342,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * We will use the same APP/* URI space as ApplicationResources but * prefix url with UPLOAD * - * eg. APP/UPLOAD/[ROOTID]/[PID]/[NAME]/[SECKEY] + * eg. APP/UPLOAD/[UIID]/[PID]/[NAME]/[SECKEY] * * SECKEY is created on each paint to make URL's unpredictable (to * prevent CSRF attacks). @@ -2353,8 +2351,8 @@ public abstract class AbstractCommunicationManager implements Serializable { * handling post */ String paintableId = owner.getConnectorId(); - int rootId = owner.getUI().getUIId(); - String key = rootId + "/" + paintableId + "/" + name; + int uiId = owner.getUI().getUIId(); + String key = uiId + "/" + paintableId + "/" + name; if (pidToNameToStreamVariable == null) { pidToNameToStreamVariable = new HashMap<String, Map<String, StreamVariable>>(); @@ -2415,7 +2413,7 @@ public abstract class AbstractCommunicationManager implements Serializable { WrappedResponse response, Application application) throws IOException { - // if we do not yet have a currentRoot, it should be initialized + // if we do not yet have a currentUI, it should be initialized // shortly, and we should send the initial UIDL boolean sendUIDL = UI.getCurrent() == null; @@ -2425,7 +2423,7 @@ public abstract class AbstractCommunicationManager implements Serializable { UI uI = application.getUIForRequest(combinedRequest); response.setContentType("application/json; charset=UTF-8"); - // Use the same logic as for determined roots + // Use the same logic as for determined UIs BootstrapHandler bootstrapHandler = getBootstrapHandler(); BootstrapContext context = bootstrapHandler.createContext( combinedRequest, response, application, uI.getUIId()); @@ -2434,13 +2432,13 @@ public abstract class AbstractCommunicationManager implements Serializable { String theme = context.getThemeName(); String themeUri = bootstrapHandler.getThemeUri(context, theme); - // TODO These are not required if it was only the init of the root + // TODO These are not required if it was only the init of the UI // that was delayed JSONObject params = new JSONObject(); 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.getUIId()); + params.put(UIConstants.UI_ID_PARAMETER, uI.getUIId()); if (sendUIDL) { String initialUIDL = getInitialUIDL(combinedRequest, uI); params.put("uidl", initialUIDL); @@ -2474,7 +2472,7 @@ public abstract class AbstractCommunicationManager implements Serializable { * @param request * the request that caused the initialization * @param uI - * the root for which the UIDL should be generated + * the UI for which the UIDL should be generated * @return a string with the initial UIDL message * @throws PaintException * if an exception occurs while painting @@ -2523,7 +2521,7 @@ public abstract class AbstractCommunicationManager implements Serializable { final String mimetype = response.getDeploymentConfiguration() .getMimeType(resourceName); - // Security check: avoid accidentally serving from the root of the + // Security check: avoid accidentally serving from the UI of the // classpath instead of relative to the context class if (resourceName.startsWith("/")) { getLogger().warning( @@ -2598,8 +2596,8 @@ public abstract class AbstractCommunicationManager implements Serializable { /** * Handles file upload request submitted via Upload component. * - * @param root - * The root for this request + * @param UI + * The UI for this request * * @see #getStreamVariableTargetUrl(ReceiverOwner, String, StreamVariable) * @@ -2613,7 +2611,7 @@ public abstract class AbstractCommunicationManager implements Serializable { throws IOException, InvalidUIDLSecurityKeyException { /* - * URI pattern: APP/UPLOAD/[ROOTID]/[PID]/[NAME]/[SECKEY] See + * URI pattern: APP/UPLOAD/[UIID]/[PID]/[NAME]/[SECKEY] See * #createReceiverUrl */ @@ -2623,12 +2621,12 @@ public abstract class AbstractCommunicationManager implements Serializable { .indexOf(ServletPortletHelper.UPLOAD_URL_PREFIX) + ServletPortletHelper.UPLOAD_URL_PREFIX.length(); String uppUri = pathInfo.substring(startOfData); - String[] parts = uppUri.split("/", 4); // 0= rootid, 1 = cid, 2= name, 3 + String[] parts = uppUri.split("/", 4); // 0= UIid, 1 = cid, 2= name, 3 // = sec key - String rootId = parts[0]; + String uiId = parts[0]; String connectorId = parts[1]; String variableName = parts[2]; - UI uI = application.getUIById(Integer.parseInt(rootId)); + UI uI = application.getUIById(Integer.parseInt(uiId)); UI.setCurrent(uI); StreamVariable streamVariable = getStreamVariable(connectorId, diff --git a/server/src/com/vaadin/terminal/gwt/server/ApplicationServlet.java b/server/src/com/vaadin/terminal/gwt/server/ApplicationServlet.java index 14500b01de..857c7c738c 100644 --- a/server/src/com/vaadin/terminal/gwt/server/ApplicationServlet.java +++ b/server/src/com/vaadin/terminal/gwt/server/ApplicationServlet.java @@ -20,7 +20,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import com.vaadin.Application; -import com.vaadin.terminal.DefaultRootProvider; +import com.vaadin.terminal.DefaultUIProvider; import com.vaadin.terminal.gwt.server.ServletPortletHelper.ApplicationClassException; /** @@ -70,7 +70,7 @@ public class ApplicationServlet extends AbstractApplicationServlet { // Creates a new application instance try { final Application application = getApplicationClass().newInstance(); - application.addUIProvider(new DefaultRootProvider()); + application.addUIProvider(new DefaultUIProvider()); return application; } catch (final IllegalAccessException e) { diff --git a/server/src/com/vaadin/terminal/gwt/server/BootstrapFragmentResponse.java b/server/src/com/vaadin/terminal/gwt/server/BootstrapFragmentResponse.java index df77600150..6f69086523 100644 --- a/server/src/com/vaadin/terminal/gwt/server/BootstrapFragmentResponse.java +++ b/server/src/com/vaadin/terminal/gwt/server/BootstrapFragmentResponse.java @@ -48,17 +48,16 @@ public class BootstrapFragmentResponse extends BootstrapResponse { * @param application * the application for which the bootstrap page should be * generated - * @param rootId - * the generated id of the UI that will be displayed on the - * page + * @param uiId + * the generated id of the UI that will be displayed on the page * @param fragmentNodes * a mutable list containing the DOM nodes that will make up the * application HTML */ public BootstrapFragmentResponse(BootstrapHandler handler, - WrappedRequest request, Application application, Integer rootId, + WrappedRequest request, Application application, Integer uiId, List<Node> fragmentNodes) { - super(handler, request, application, rootId); + super(handler, request, application, uiId); this.fragmentNodes = fragmentNodes; } diff --git a/server/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java b/server/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java index 1dfe9d1685..d329159d95 100644 --- a/server/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java +++ b/server/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java @@ -42,6 +42,7 @@ import com.vaadin.external.json.JSONException; import com.vaadin.external.json.JSONObject; import com.vaadin.shared.ApplicationConstants; import com.vaadin.shared.Version; +import com.vaadin.shared.ui.ui.UIConstants; import com.vaadin.terminal.DeploymentConfiguration; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.RequestHandler; @@ -78,19 +79,19 @@ public abstract class BootstrapHandler implements RequestHandler { return bootstrapResponse.getApplication(); } - public Integer getRootId() { - return bootstrapResponse.getRootId(); + public Integer getUIId() { + return bootstrapResponse.getUIId(); } - public UI getRoot() { - return bootstrapResponse.getRoot(); + public UI getUI() { + return bootstrapResponse.getUI(); } public String getWidgetsetName() { if (widgetsetName == null) { - UI uI = getRoot(); + UI uI = getUI(); if (uI != null) { - widgetsetName = getWidgetsetForRoot(this); + widgetsetName = getWidgetsetForUI(this); } } return widgetsetName; @@ -98,7 +99,7 @@ public abstract class BootstrapHandler implements RequestHandler { public String getThemeName() { if (themeName == null) { - UI uI = getRoot(); + UI uI = getUI(); if (uI != null) { themeName = findAndEscapeThemeName(this); } @@ -125,7 +126,7 @@ public abstract class BootstrapHandler implements RequestHandler { throws IOException { // TODO Should all urls be handled here? - Integer rootId = null; + Integer uiId = null; try { UI uI = application.getUIForRequest(request); if (uI == null) { @@ -133,14 +134,14 @@ public abstract class BootstrapHandler implements RequestHandler { return true; } - rootId = Integer.valueOf(uI.getUIId()); + uiId = Integer.valueOf(uI.getUIId()); } catch (UIRequiresMoreInformationException e) { - // Just keep going without rootId + // Just keep going without uiId } try { BootstrapContext context = createContext(request, response, - application, rootId); + application, uiId); setupMainDiv(context); BootstrapFragmentResponse fragmentResponse = context @@ -170,8 +171,8 @@ public abstract class BootstrapHandler implements RequestHandler { Map<String, Object> headers = new LinkedHashMap<String, Object>(); Document document = Document.createShell(""); BootstrapPageResponse pageResponse = new BootstrapPageResponse( - this, request, context.getApplication(), context.getRootId(), document, - headers); + this, request, context.getApplication(), context.getUIId(), + document, headers); List<Node> fragmentNodes = fragmentResponse.getFragmentNodes(); Element body = document.body(); for (Node node : fragmentNodes) { @@ -246,7 +247,7 @@ public abstract class BootstrapHandler implements RequestHandler { head.appendElement("meta").attr("http-equiv", "X-UA-Compatible") .attr("content", "chrome=1"); - UI uI = context.getRoot(); + UI uI = context.getUI(); String title = ((uI == null || uI.getCaption() == null) ? "" : uI .getCaption()); head.appendElement("title").appendText(title); @@ -272,10 +273,10 @@ public abstract class BootstrapHandler implements RequestHandler { } public BootstrapContext createContext(WrappedRequest request, - WrappedResponse response, Application application, Integer rootId) { + WrappedResponse response, Application application, Integer uiId) { BootstrapContext context = new BootstrapContext(response, - new BootstrapFragmentResponse(this, request, - application, rootId, new ArrayList<Node>())); + new BootstrapFragmentResponse(this, request, application, uiId, + new ArrayList<Node>())); return context; } @@ -293,8 +294,8 @@ public abstract class BootstrapHandler implements RequestHandler { */ protected abstract String getApplicationId(BootstrapContext context); - public String getWidgetsetForRoot(BootstrapContext context) { - UI uI = context.getRoot(); + public String getWidgetsetForUI(BootstrapContext context) { + UI uI = context.getUI(); WrappedRequest request = context.getRequest(); String widgetset = uI.getApplication().getWidgetsetForUI(uI); @@ -417,12 +418,12 @@ public abstract class BootstrapHandler implements RequestHandler { protected JSONObject getApplicationParameters(BootstrapContext context) throws JSONException, PaintException { Application application = context.getApplication(); - Integer rootId = context.getRootId(); + Integer uiId = context.getUIId(); JSONObject appConfig = new JSONObject(); - if (rootId != null) { - appConfig.put(ApplicationConstants.ROOT_ID_PARAMETER, rootId); + if (uiId != null) { + appConfig.put(UIConstants.UI_ID_PARAMETER, uiId); } if (context.getThemeName() != null) { @@ -437,7 +438,7 @@ public abstract class BootstrapHandler implements RequestHandler { appConfig.put("widgetset", context.getWidgetsetName()); - if (rootId == null || application.isUIInitPending(rootId.intValue())) { + if (uiId == null || application.isUIInitPending(uiId.intValue())) { appConfig.put("initialPath", context.getRequest() .getRequestPathInfo()); @@ -447,7 +448,7 @@ public abstract class BootstrapHandler implements RequestHandler { } else { // write the initial UIDL into the config appConfig.put("uidl", - getInitialUIDL(context.getRequest(), context.getRoot())); + getInitialUIDL(context.getRequest(), context.getUI())); } return appConfig; @@ -533,7 +534,7 @@ public abstract class BootstrapHandler implements RequestHandler { * @return */ public String getThemeName(BootstrapContext context) { - return context.getApplication().getThemeForUI(context.getRoot()); + return context.getApplication().getThemeForUI(context.getUI()); } /** @@ -568,15 +569,15 @@ public abstract class BootstrapHandler implements RequestHandler { * * @param request * the originating request - * @param uI - * the root for which the UIDL should be generated + * @param ui + * the UI for which the UIDL should be generated * @return a string with the initial UIDL message * @throws PaintException * if an exception occurs while painting the components * @throws JSONException * if an exception occurs while formatting the output */ - protected abstract String getInitialUIDL(WrappedRequest request, UI uI) + protected abstract String getInitialUIDL(WrappedRequest request, UI ui) throws PaintException, JSONException; } diff --git a/server/src/com/vaadin/terminal/gwt/server/BootstrapPageResponse.java b/server/src/com/vaadin/terminal/gwt/server/BootstrapPageResponse.java index 535ab23c92..847578ef97 100644 --- a/server/src/com/vaadin/terminal/gwt/server/BootstrapPageResponse.java +++ b/server/src/com/vaadin/terminal/gwt/server/BootstrapPageResponse.java @@ -51,7 +51,7 @@ public class BootstrapPageResponse extends BootstrapResponse { * @param application * the application for which the bootstrap page should be * generated - * @param rootId + * @param uiId * the generated id of the UI that will be displayed on the * page * @param document @@ -60,9 +60,9 @@ public class BootstrapPageResponse extends BootstrapResponse { * a map into which header data can be added */ public BootstrapPageResponse(BootstrapHandler handler, - WrappedRequest request, Application application, Integer rootId, + WrappedRequest request, Application application, Integer uiId, Document document, Map<String, Object> headers) { - super(handler, request, application, rootId); + super(handler, request, application, uiId); this.headers = headers; this.document = document; } diff --git a/server/src/com/vaadin/terminal/gwt/server/BootstrapResponse.java b/server/src/com/vaadin/terminal/gwt/server/BootstrapResponse.java index 2518f7080e..a422cba345 100644 --- a/server/src/com/vaadin/terminal/gwt/server/BootstrapResponse.java +++ b/server/src/com/vaadin/terminal/gwt/server/BootstrapResponse.java @@ -33,7 +33,7 @@ import com.vaadin.ui.UI; public abstract class BootstrapResponse extends EventObject { private final WrappedRequest request; private final Application application; - private final Integer rootId; + private final Integer uiId; /** * Creates a new bootstrap event. @@ -46,16 +46,15 @@ public abstract class BootstrapResponse extends EventObject { * @param application * the application for which the bootstrap page should be * generated - * @param rootId - * the generated id of the UI that will be displayed on the - * page + * @param uiId + * the generated id of the UI that will be displayed on the page */ public BootstrapResponse(BootstrapHandler handler, WrappedRequest request, - Application application, Integer rootId) { + Application application, Integer uiId) { super(handler); this.request = request; this.application = application; - this.rootId = rootId; + this.uiId = uiId; } /** @@ -91,20 +90,20 @@ public abstract class BootstrapResponse extends EventObject { } /** - * Gets the root id that has been generated for this response. Please note + * Gets the UI id that has been generated for this response. Please note * 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 + * @return the UI id */ - public Integer getRootId() { - return rootId; + public Integer getUIId() { + return uiId; } /** * Gets the UI for which this page is being rendered, if available. Some - * features of the framework will postpone the UI selection until after - * the bootstrap page has been rendered and required information from the + * features of the framework will postpone the UI selection until after the + * bootstrap page has been rendered and required information from the * browser has been sent back. This method will return <code>null</code> if * no UI instance is yet available. * @@ -116,7 +115,7 @@ public abstract class BootstrapResponse extends EventObject { * <code>null</code> if all required information is not yet * available. */ - public UI getRoot() { + public UI getUI() { 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 1a5019a7c1..c2fbbe37d4 100644 --- a/server/src/com/vaadin/terminal/gwt/server/ClientConnector.java +++ b/server/src/com/vaadin/terminal/gwt/server/ClientConnector.java @@ -175,7 +175,7 @@ public interface ClientConnector extends Connector, RpcTarget { public void removeExtension(Extension extension); /** - * Returns the root this connector is attached to + * Returns the UI this connector is attached to * * @return The UI this connector is attached to or null if it is not * attached to any UI diff --git a/server/src/com/vaadin/terminal/gwt/server/Constants.java b/server/src/com/vaadin/terminal/gwt/server/Constants.java index 78c043da69..40386d6eb7 100644 --- a/server/src/com/vaadin/terminal/gwt/server/Constants.java +++ b/server/src/com/vaadin/terminal/gwt/server/Constants.java @@ -78,7 +78,7 @@ public interface Constants { // Widget set parameter name static final String PARAMETER_WIDGETSET = "widgetset"; - static final String ERROR_NO_ROOT_FOUND = "Application did not return a root for the request and did not request extra information either. Something is wrong."; + static final String ERROR_NO_UI_FOUND = "No UIProvider returned a UI for the request."; static final String DEFAULT_THEME_NAME = "reindeer"; diff --git a/server/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java b/server/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java index a5a3e94954..8538d42604 100644 --- a/server/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java +++ b/server/src/com/vaadin/terminal/gwt/server/PortletApplicationContext2.java @@ -395,7 +395,7 @@ public class PortletApplicationContext2 extends AbstractWebApplicationContext { PortletURL url = ((MimeResponse) response).createRenderURL(); url.setPortletMode(portletMode); throw new RuntimeException("UI.open has not yet been implemented"); - // root.open(new ExternalResource(url.toString())); + // UI.open(new ExternalResource(url.toString())); } else if (response instanceof StateAwareResponse) { ((StateAwareResponse) response).setPortletMode(portletMode); } else { diff --git a/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java b/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java index 7e669d939c..403cffb47c 100644 --- a/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java +++ b/server/src/com/vaadin/terminal/gwt/server/ServletPortletHelper.java @@ -9,7 +9,7 @@ import com.vaadin.terminal.WrappedRequest; import com.vaadin.ui.UI; /* - * Copyright 2011 Vaadin Ltd. + * 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 @@ -43,14 +43,14 @@ class ServletPortletHelper implements Serializable { throws ApplicationClassException { String applicationParameter = deploymentConfiguration .getInitParameters().getProperty("application"); - String rootParameter = deploymentConfiguration.getInitParameters() + String uiParameter = deploymentConfiguration.getInitParameters() .getProperty(Application.UI_PARAMETER); ClassLoader classLoader = deploymentConfiguration.getClassLoader(); if (applicationParameter == null) { // Validate the parameter value - verifyRootClass(rootParameter, classLoader); + verifyUIClass(uiParameter, classLoader); // Application can be used if a valid rootLayout is defined return Application.class; @@ -66,22 +66,22 @@ class ServletPortletHelper implements Serializable { } } - private static void verifyRootClass(String className, - ClassLoader classLoader) throws ApplicationClassException { + private static void verifyUIClass(String className, ClassLoader classLoader) + throws ApplicationClassException { if (className == null) { throw new ApplicationClassException(Application.UI_PARAMETER + " init parameter not defined"); } - // Check that the root layout class can be found + // Check that the UI layout class can be found try { - Class<?> rootClass = classLoader.loadClass(className); - if (!UI.class.isAssignableFrom(rootClass)) { + Class<?> uiClass = classLoader.loadClass(className); + if (!UI.class.isAssignableFrom(uiClass)) { throw new ApplicationClassException(className + " does not implement UI"); } // Try finding a default constructor, else throw exception - rootClass.getConstructor(); + uiClass.getConstructor(); } catch (ClassNotFoundException e) { throw new ApplicationClassException(className + " could not be loaded", e); diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index 0b97e1667d..a52a07f266 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -557,16 +557,6 @@ public abstract class AbstractComponent extends AbstractClientConnector } /* - * Gets the parent window of the component. Don't add a JavaDoc comment - * here, we use the default documentation from implemented interface. - */ - @Override - public UI getUI() { - // Just make method from implemented Component interface public - return super.getUI(); - } - - /* * Notify the component that it's attached to a window. Don't add a JavaDoc * comment here, we use the default documentation from implemented * interface. @@ -1304,7 +1294,7 @@ public abstract class AbstractComponent extends AbstractClientConnector /** * Set a viewer for the action manager to be the parent sub window (if the - * component is in a window) or the root (otherwise). This is still a + * component is in a window) or the UI (otherwise). This is still a * simplification of the real case as this should be handled by the parent * VOverlay (on the client side) if the component is inside an VOverlay * component. diff --git a/server/src/com/vaadin/ui/ConnectorTracker.java b/server/src/com/vaadin/ui/ConnectorTracker.java index c7c7bc9784..ad5990137c 100644 --- a/server/src/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/com/vaadin/ui/ConnectorTracker.java @@ -210,7 +210,7 @@ public class ConnectorTracker implements Serializable { while (iterator.hasNext()) { String connectorId = iterator.next(); ClientConnector connector = connectorIdToConnector.get(connectorId); - if (getRootForConnector(connector) != uI) { + if (getUIForConnector(connector) != uI) { // If connector is no longer part of this uI, // remove it from the map. If it is re-attached to the // application at some point it will be re-added through @@ -239,7 +239,7 @@ public class ConnectorTracker implements Serializable { * @return The uI the connector is attached to or null if it is not * attached to any uI. */ - private UI getRootForConnector(ClientConnector connector) { + private UI getUIForConnector(ClientConnector connector) { if (connector == null) { return null; } @@ -247,7 +247,7 @@ public class ConnectorTracker implements Serializable { return ((Component) connector).getUI(); } - return getRootForConnector(connector.getParent()); + return getUIForConnector(connector.getParent()); } /** diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index c0b3ed9929..aede1af54b 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -35,9 +35,9 @@ 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.UIServerRpc; -import com.vaadin.shared.ui.root.UIState; +import com.vaadin.shared.ui.ui.UIConstants; +import com.vaadin.shared.ui.ui.UIServerRpc; +import com.vaadin.shared.ui.ui.UIState; import com.vaadin.terminal.Page; import com.vaadin.terminal.Page.BrowserWindowResizeEvent; import com.vaadin.terminal.Page.BrowserWindowResizeListener; @@ -64,7 +64,7 @@ import com.vaadin.ui.Window.CloseListener; * 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 + * That method does by default create a UI according to the * {@value Application#UI_PARAMETER} parameter from web.xml. * </p> * <p> @@ -544,8 +544,8 @@ public abstract class UI extends AbstractComponentContainer implements if (pendingFocus != null) { // ensure focused component is still attached to this main window if (pendingFocus.getUI() == this - || (pendingFocus.getUI() != null && pendingFocus - .getUI().getParent() == this)) { + || (pendingFocus.getUI() != null && pendingFocus.getUI() + .getParent() == this)) { target.addAttribute("focused", pendingFocus); } pendingFocus = null; @@ -556,7 +556,7 @@ public abstract class UI extends AbstractComponentContainer implements } if (isResizeLazy()) { - target.addAttribute(RootConstants.RESIZE_LAZY, true); + target.addAttribute(UIConstants.RESIZE_LAZY, true); } } @@ -585,9 +585,9 @@ public abstract class UI extends AbstractComponentContainer implements actionManager.handleActions(variables, this); } - if (variables.containsKey(RootConstants.FRAGMENT_VARIABLE)) { + if (variables.containsKey(UIConstants.FRAGMENT_VARIABLE)) { String fragment = (String) variables - .get(RootConstants.FRAGMENT_VARIABLE); + .get(UIConstants.FRAGMENT_VARIABLE); getPage().setFragment(fragment, true); } } diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java index ad2bbd0576..6102350566 100644 --- a/server/src/com/vaadin/ui/Window.java +++ b/server/src/com/vaadin/ui/Window.java @@ -224,11 +224,11 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, public void close() { UI uI = getUI(); - // Don't do anything if not attached to a root + // Don't do anything if not attached to a UI if (uI != null) { // focus is restored to the parent window uI.focus(); - // subwindow is removed from the root + // subwindow is removed from the UI uI.removeWindow(this); } } @@ -470,7 +470,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * If there are currently several windows visible, calling this method makes * this window topmost. * <p> - * This method can only be called if this window connected a root. Else an + * This method can only be called if this window connected a UI. Else an * illegal state exception is thrown. Also if there are modal windows and * this window is not modal, and illegal state exception is thrown. * <p> @@ -485,7 +485,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, 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."); + "The UI contains modal windows, non-modal window cannot be brought to front."); } if (w.bringToFront != null) { maxBringToFront = Math.max(maxBringToFront, |