@@ -31,6 +31,7 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand; | |||
import com.google.gwt.user.client.Command; | |||
import com.google.gwt.user.client.Window; | |||
import com.vaadin.shared.ApplicationConstants; | |||
import com.vaadin.shared.ui.ui.UIConstants; | |||
import com.vaadin.terminal.gwt.client.metadata.BundleLoadCallback; | |||
import com.vaadin.terminal.gwt.client.metadata.ConnectorBundleLoader; | |||
import com.vaadin.terminal.gwt.client.metadata.NoDataException; | |||
@@ -202,7 +203,7 @@ public class ApplicationConfiguration implements EntryPoint { | |||
private String id; | |||
private String themeUri; | |||
private String appUri; | |||
private int rootId; | |||
private int uiId; | |||
private boolean standalone; | |||
private ErrorMessage communicationError; | |||
private ErrorMessage authorizationError; | |||
@@ -288,8 +289,8 @@ public class ApplicationConfiguration implements EntryPoint { | |||
* | |||
* @return the root id | |||
*/ | |||
public int getRootId() { | |||
return rootId; | |||
public int getUIId() { | |||
return uiId; | |||
} | |||
public JavaScriptObject getVersionInfoJSObject() { | |||
@@ -314,7 +315,8 @@ public class ApplicationConfiguration implements EntryPoint { | |||
appUri += '/'; | |||
} | |||
themeUri = jsoConfiguration.getConfigString("themeUri"); | |||
rootId = jsoConfiguration.getConfigInteger("rootId").intValue(); | |||
uiId = jsoConfiguration.getConfigInteger(UIConstants.UI_ID_PARAMETER) | |||
.intValue(); | |||
// null -> true | |||
useDebugIdInDom = jsoConfiguration.getConfigBoolean("useDebugIdInDom") != Boolean.FALSE; |
@@ -58,6 +58,7 @@ import com.vaadin.shared.Version; | |||
import com.vaadin.shared.communication.LegacyChangeVariablesInvocation; | |||
import com.vaadin.shared.communication.MethodInvocation; | |||
import com.vaadin.shared.communication.SharedState; | |||
import com.vaadin.shared.ui.ui.UIConstants; | |||
import com.vaadin.terminal.gwt.client.ApplicationConfiguration.ErrorMessage; | |||
import com.vaadin.terminal.gwt.client.ResourceLoader.ResourceLoadEvent; | |||
import com.vaadin.terminal.gwt.client.ResourceLoader.ResourceLoadListener; | |||
@@ -495,8 +496,8 @@ public class ApplicationConnection { | |||
if (extraParams != null && extraParams.length() > 0) { | |||
uri = addGetParameters(uri, extraParams); | |||
} | |||
uri = addGetParameters(uri, ApplicationConstants.ROOT_ID_PARAMETER | |||
+ "=" + configuration.getRootId()); | |||
uri = addGetParameters(uri, UIConstants.UI_ID_PARAMETER + "=" | |||
+ configuration.getUIId()); | |||
doUidlRequest(uri, payload, forceSync); | |||
@@ -36,10 +36,10 @@ import com.google.web.bindery.event.shared.HandlerRegistration; | |||
import com.vaadin.shared.MouseEventDetails; | |||
import com.vaadin.shared.ui.Connect; | |||
import com.vaadin.shared.ui.Connect.LoadStyle; | |||
import com.vaadin.shared.ui.root.PageClientRpc; | |||
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.PageClientRpc; | |||
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.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
@@ -107,7 +107,7 @@ public class UIConnector extends AbstractComponentContainerConnector | |||
getWidget().connection = client; | |||
getWidget().immediate = getState().isImmediate(); | |||
getWidget().resizeLazy = uidl.hasAttribute(RootConstants.RESIZE_LAZY); | |||
getWidget().resizeLazy = uidl.hasAttribute(UIConstants.RESIZE_LAZY); | |||
String newTheme = uidl.getStringAttribute("theme"); | |||
if (getWidget().theme != null && !newTheme.equals(getWidget().theme)) { | |||
// Complete page refresh is needed due css can affect layout | |||
@@ -263,9 +263,9 @@ public class UIConnector extends AbstractComponentContainerConnector | |||
scrollIntoView(connector); | |||
} | |||
if (uidl.hasAttribute(RootConstants.FRAGMENT_VARIABLE)) { | |||
if (uidl.hasAttribute(UIConstants.FRAGMENT_VARIABLE)) { | |||
getWidget().currentFragment = uidl | |||
.getStringAttribute(RootConstants.FRAGMENT_VARIABLE); | |||
.getStringAttribute(UIConstants.FRAGMENT_VARIABLE); | |||
if (!getWidget().currentFragment.equals(History.getToken())) { | |||
History.newItem(getWidget().currentFragment, true); | |||
} | |||
@@ -276,7 +276,7 @@ public class UIConnector extends AbstractComponentContainerConnector | |||
// Include current fragment in the next request | |||
client.updateVariable(getWidget().id, | |||
RootConstants.FRAGMENT_VARIABLE, | |||
UIConstants.FRAGMENT_VARIABLE, | |||
getWidget().currentFragment, false); | |||
} | |||
@@ -33,7 +33,7 @@ import com.google.gwt.user.client.Timer; | |||
import com.google.gwt.user.client.Window; | |||
import com.google.gwt.user.client.ui.SimplePanel; | |||
import com.vaadin.shared.ApplicationConstants; | |||
import com.vaadin.shared.ui.root.RootConstants; | |||
import com.vaadin.shared.ui.ui.UIConstants; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.ComponentConnector; | |||
@@ -130,7 +130,7 @@ public class VUI extends SimplePanel implements ResizeHandler, | |||
// Send the new fragment to the server if it has changed | |||
if (!newFragment.equals(currentFragment) && connection != null) { | |||
currentFragment = newFragment; | |||
connection.updateVariable(id, RootConstants.FRAGMENT_VARIABLE, | |||
connection.updateVariable(id, UIConstants.FRAGMENT_VARIABLE, | |||
newFragment, true); | |||
} | |||
} |
@@ -30,7 +30,7 @@ import com.google.gwt.user.client.Timer; | |||
import com.google.gwt.user.client.ui.HTML; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.shared.Position; | |||
import com.vaadin.shared.ui.root.RootConstants; | |||
import com.vaadin.shared.ui.ui.UIConstants; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
@@ -384,19 +384,19 @@ public class VNotification extends VOverlay { | |||
public static void showNotification(ApplicationConnection client, | |||
final UIDL notification) { | |||
boolean onlyPlainText = notification | |||
.hasAttribute(RootConstants.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED); | |||
.hasAttribute(UIConstants.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED); | |||
String html = ""; | |||
if (notification | |||
.hasAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_ICON)) { | |||
.hasAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_ICON)) { | |||
final String parsedUri = client | |||
.translateVaadinUri(notification | |||
.getStringAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_ICON)); | |||
.getStringAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_ICON)); | |||
html += "<img src=\"" + Util.escapeAttribute(parsedUri) + "\" />"; | |||
} | |||
if (notification | |||
.hasAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_CAPTION)) { | |||
.hasAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_CAPTION)) { | |||
String caption = notification | |||
.getStringAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_CAPTION); | |||
.getStringAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_CAPTION); | |||
if (onlyPlainText) { | |||
caption = Util.escapeHTML(caption); | |||
caption = caption.replaceAll("\\n", "<br />"); | |||
@@ -404,9 +404,9 @@ public class VNotification extends VOverlay { | |||
html += "<h1>" + caption + "</h1>"; | |||
} | |||
if (notification | |||
.hasAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_MESSAGE)) { | |||
.hasAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_MESSAGE)) { | |||
String message = notification | |||
.getStringAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_MESSAGE); | |||
.getStringAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_MESSAGE); | |||
if (onlyPlainText) { | |||
message = Util.escapeHTML(message); | |||
message = message.replaceAll("\\n", "<br />"); | |||
@@ -415,16 +415,16 @@ public class VNotification extends VOverlay { | |||
} | |||
final String style = notification | |||
.hasAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_STYLE) ? notification | |||
.getStringAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_STYLE) | |||
.hasAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_STYLE) ? notification | |||
.getStringAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_STYLE) | |||
: null; | |||
final int pos = notification | |||
.getIntAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_POSITION); | |||
.getIntAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_POSITION); | |||
Position position = Position.values()[pos]; | |||
final int delay = notification | |||
.getIntAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_DELAY); | |||
.getIntAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_DELAY); | |||
createNotification(delay).show(html, position, style); | |||
} | |||
@@ -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; | |||
} |
@@ -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. | |||
* |
@@ -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, |
@@ -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); | |||
} | |||
} | |||
@@ -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(); | |||
} | |||
/** |
@@ -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} | |||
* |
@@ -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, |
@@ -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; |
@@ -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, |
@@ -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) { |
@@ -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; | |||
} | |||
@@ -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; | |||
} |
@@ -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; | |||
} |
@@ -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(); | |||
} | |||
} |
@@ -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 |
@@ -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"; | |||
@@ -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 { |
@@ -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); |
@@ -556,16 +556,6 @@ public abstract class AbstractComponent extends AbstractClientConnector | |||
getState().setReadOnly(readOnly); | |||
} | |||
/* | |||
* 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 | |||
@@ -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. |
@@ -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()); | |||
} | |||
/** |
@@ -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); | |||
} | |||
} |
@@ -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, |
@@ -29,10 +29,6 @@ public class ApplicationConstants { | |||
public static final String APP_PROTOCOL_PREFIX = "app://"; | |||
public static final String CONNECTOR_PROTOCOL_PREFIX = "connector://"; | |||
public static final String UIDL_SECURITY_TOKEN_ID = "Vaadin-Security-Key"; | |||
/** | |||
* Name of the parameter used to transmit root ids back and forth | |||
*/ | |||
public static final String ROOT_ID_PARAMETER = "rootId"; | |||
public static final String PARAM_UNLOADBURST = "onunloadburst"; | |||
@@ -14,7 +14,7 @@ | |||
* the License. | |||
*/ | |||
package com.vaadin.shared.ui.root; | |||
package com.vaadin.shared.ui.ui; | |||
import com.vaadin.shared.communication.ClientRpc; | |||
@@ -13,9 +13,9 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.shared.ui.root; | |||
package com.vaadin.shared.ui.ui; | |||
public class RootConstants { | |||
public class UIConstants { | |||
/** | |||
* Attribute name for the lazy resize setting . | |||
*/ | |||
@@ -41,4 +41,9 @@ public class RootConstants { | |||
@Deprecated | |||
public static final String ATTRIBUTE_NOTIFICATION_DELAY = "delay"; | |||
/** | |||
* Name of the parameter used to transmit UI ids back and forth | |||
*/ | |||
public static final String UI_ID_PARAMETER = "uiId"; | |||
} |
@@ -13,7 +13,7 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.shared.ui.root; | |||
package com.vaadin.shared.ui.ui; | |||
import com.vaadin.shared.annotations.Delayed; | |||
import com.vaadin.shared.communication.ServerRpc; |
@@ -13,7 +13,7 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.shared.ui.root; | |||
package com.vaadin.shared.ui.ui; | |||
import com.vaadin.shared.ComponentState; | |||
import com.vaadin.shared.Connector; |
@@ -11,7 +11,7 @@ import org.easymock.EasyMock; | |||
import com.vaadin.Application; | |||
import com.vaadin.Application.ApplicationStartEvent; | |||
import com.vaadin.UIRequiresMoreInformationException; | |||
import com.vaadin.terminal.DefaultRootProvider; | |||
import com.vaadin.terminal.DefaultUIProvider; | |||
import com.vaadin.terminal.DeploymentConfiguration; | |||
import com.vaadin.terminal.WrappedRequest; | |||
import com.vaadin.ui.UI; | |||
@@ -113,7 +113,7 @@ public class CustomRootClassLoader extends TestCase { | |||
private Application createStubApplication() { | |||
return new Application() { | |||
{ | |||
addUIProvider(new DefaultRootProvider()); | |||
addUIProvider(new DefaultUIProvider()); | |||
} | |||
@Override |
@@ -31,7 +31,7 @@ import javax.servlet.http.HttpServletResponse; | |||
import com.vaadin.Application; | |||
import com.vaadin.UIRequiresMoreInformationException; | |||
import com.vaadin.terminal.AbstractRootProvider; | |||
import com.vaadin.terminal.AbstractUIProvider; | |||
import com.vaadin.terminal.WrappedRequest; | |||
import com.vaadin.terminal.gwt.server.AbstractApplicationServlet; | |||
import com.vaadin.terminal.gwt.server.WrappedHttpServletRequest; | |||
@@ -112,7 +112,7 @@ public class ApplicationRunnerServlet extends AbstractApplicationServlet { | |||
final Class<?> classToRun = getClassToRun(); | |||
if (UI.class.isAssignableFrom(classToRun)) { | |||
Application application = new Application(); | |||
application.addUIProvider(new AbstractRootProvider() { | |||
application.addUIProvider(new AbstractUIProvider() { | |||
@Override | |||
public Class<? extends UI> getUIClass( |
@@ -2,7 +2,7 @@ package com.vaadin.tests.application; | |||
import com.vaadin.Application; | |||
import com.vaadin.UIRequiresMoreInformationException; | |||
import com.vaadin.terminal.AbstractRootProvider; | |||
import com.vaadin.terminal.AbstractUIProvider; | |||
import com.vaadin.terminal.WrappedRequest; | |||
import com.vaadin.tests.components.AbstractTestApplication; | |||
import com.vaadin.ui.Label; | |||
@@ -23,7 +23,7 @@ public class RefreshStatePreserve extends AbstractTestApplication { | |||
public void init() { | |||
super.init(); | |||
setUiPreserved(true); | |||
addUIProvider(new AbstractRootProvider() { | |||
addUIProvider(new AbstractUIProvider() { | |||
@Override | |||
public Class<? extends UI> getUIClass(Application application, | |||
WrappedRequest request) |
@@ -2,7 +2,7 @@ package com.vaadin.tests.components.root; | |||
import com.vaadin.Application; | |||
import com.vaadin.UIRequiresMoreInformationException; | |||
import com.vaadin.terminal.AbstractRootProvider; | |||
import com.vaadin.terminal.AbstractUIProvider; | |||
import com.vaadin.terminal.WrappedRequest; | |||
import com.vaadin.tests.components.AbstractTestApplication; | |||
import com.vaadin.ui.Label; | |||
@@ -23,7 +23,7 @@ public class RootsInMultipleTabs extends AbstractTestApplication { | |||
} | |||
public RootsInMultipleTabs() { | |||
addUIProvider(new AbstractRootProvider() { | |||
addUIProvider(new AbstractUIProvider() { | |||
@Override | |||
public Class<? extends UI> getUIClass(Application application, | |||
WrappedRequest request) |
@@ -42,7 +42,7 @@ public class TestAddonContextListener implements AddonContextListener { | |||
} | |||
private boolean shouldModify(BootstrapResponse response) { | |||
UI uI = response.getRoot(); | |||
UI uI = response.getUI(); | |||
boolean shouldModify = uI != null | |||
&& uI.getClass() == BootstrapModifyRoot.class; | |||
return shouldModify; |