aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebContent/WEB-INF/web.xml2
-rw-r--r--client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java4
-rw-r--r--client/src/com/vaadin/client/ApplicationConfiguration.java6
-rw-r--r--client/src/com/vaadin/client/ApplicationConnection.java219
-rw-r--r--client/src/com/vaadin/client/ComponentConnector.java4
-rw-r--r--client/src/com/vaadin/client/ComponentLocator.java6
-rw-r--r--client/src/com/vaadin/client/MeasuredSize.java35
-rw-r--r--client/src/com/vaadin/client/Util.java4
-rw-r--r--client/src/com/vaadin/client/VCaption.java4
-rw-r--r--client/src/com/vaadin/client/communication/RpcProxy.java2
-rw-r--r--client/src/com/vaadin/client/extensions/FileDownloaderConnector.java2
-rw-r--r--client/src/com/vaadin/client/metadata/Method.java4
-rw-r--r--client/src/com/vaadin/client/metadata/TypeDataStore.java10
-rw-r--r--client/src/com/vaadin/client/ui/AbstractComponentConnector.java8
-rw-r--r--client/src/com/vaadin/client/ui/VFilterSelect.java4
-rw-r--r--client/src/com/vaadin/client/ui/VFormLayout.java8
-rw-r--r--client/src/com/vaadin/client/ui/VPopupCalendar.java33
-rw-r--r--client/src/com/vaadin/client/ui/VScrollTable.java4
-rw-r--r--client/src/com/vaadin/client/ui/VTabsheet.java4
-rw-r--r--client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java7
-rw-r--r--client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java4
-rw-r--r--server/src/com/vaadin/data/util/converter/ConverterUtil.java8
-rw-r--r--server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java4
-rw-r--r--server/src/com/vaadin/event/EventRouter.java3
-rw-r--r--server/src/com/vaadin/event/ListenerMethod.java3
-rw-r--r--server/src/com/vaadin/server/AbstractClientConnector.java90
-rw-r--r--server/src/com/vaadin/server/AbstractCommunicationManager.java149
-rw-r--r--server/src/com/vaadin/server/AbstractJavaScriptExtension.java4
-rw-r--r--server/src/com/vaadin/server/AddonContext.java2
-rw-r--r--server/src/com/vaadin/server/BootstrapFragmentResponse.java4
-rw-r--r--server/src/com/vaadin/server/BootstrapHandler.java20
-rw-r--r--server/src/com/vaadin/server/BootstrapPageResponse.java4
-rw-r--r--server/src/com/vaadin/server/BootstrapResponse.java6
-rw-r--r--server/src/com/vaadin/server/BrowserPopupUIProvider.java2
-rw-r--r--server/src/com/vaadin/server/ClientConnector.java12
-rw-r--r--server/src/com/vaadin/server/CommunicationManager.java4
-rw-r--r--server/src/com/vaadin/server/ConnectorResourceHandler.java10
-rw-r--r--server/src/com/vaadin/server/Constants.java2
-rw-r--r--server/src/com/vaadin/server/DefaultDeploymentConfiguration.java17
-rw-r--r--server/src/com/vaadin/server/DefaultErrorListener.java3
-rw-r--r--server/src/com/vaadin/server/DefaultSystemMessagesProvider.java4
-rw-r--r--server/src/com/vaadin/server/DefaultUIProvider.java4
-rw-r--r--server/src/com/vaadin/server/DeploymentConfiguration.java19
-rw-r--r--server/src/com/vaadin/server/DragAndDropService.java2
-rw-r--r--server/src/com/vaadin/server/ErrorEvent.java30
-rw-r--r--server/src/com/vaadin/server/ErrorListener.java (renamed from server/src/com/vaadin/server/RpcTarget.java)28
-rw-r--r--server/src/com/vaadin/server/FileResource.java3
-rw-r--r--server/src/com/vaadin/server/GAEVaadinServlet.java13
-rw-r--r--server/src/com/vaadin/server/GlobalResourceHandler.java8
-rw-r--r--server/src/com/vaadin/server/JsonCodec.java4
-rw-r--r--server/src/com/vaadin/server/LegacyApplication.java12
-rw-r--r--server/src/com/vaadin/server/LegacyApplicationUIProvider.java12
-rw-r--r--server/src/com/vaadin/server/LegacyPaint.java28
-rw-r--r--server/src/com/vaadin/server/LegacyVaadinPortlet.java1
-rw-r--r--server/src/com/vaadin/server/LegacyVaadinServlet.java3
-rw-r--r--server/src/com/vaadin/server/Page.java18
-rw-r--r--server/src/com/vaadin/server/PortletCommunicationManager.java4
-rw-r--r--server/src/com/vaadin/server/RequestHandler.java4
-rw-r--r--server/src/com/vaadin/server/RequestTimer.java4
-rw-r--r--server/src/com/vaadin/server/ServerRpcManager.java9
-rw-r--r--server/src/com/vaadin/server/ServerRpcMethodInvocation.java29
-rw-r--r--server/src/com/vaadin/server/ServletPortletHelper.java21
-rw-r--r--server/src/com/vaadin/server/SessionDestroyEvent.java7
-rw-r--r--server/src/com/vaadin/server/SessionInitEvent.java8
-rw-r--r--server/src/com/vaadin/server/StreamVariable.java2
-rw-r--r--server/src/com/vaadin/server/SystemMessages.java5
-rw-r--r--server/src/com/vaadin/server/SystemMessagesInfo.java53
-rw-r--r--server/src/com/vaadin/server/SystemMessagesProvider.java19
-rw-r--r--server/src/com/vaadin/server/Terminal.java58
-rw-r--r--server/src/com/vaadin/server/UnsupportedBrowserHandler.java6
-rw-r--r--server/src/com/vaadin/server/VaadinPortlet.java36
-rw-r--r--server/src/com/vaadin/server/VaadinPortletRequest.java105
-rw-r--r--server/src/com/vaadin/server/VaadinPortletResponse.java8
-rw-r--r--server/src/com/vaadin/server/VaadinPortletService.java8
-rw-r--r--server/src/com/vaadin/server/VaadinPortletSession.java2
-rw-r--r--server/src/com/vaadin/server/VaadinRequest.java254
-rw-r--r--server/src/com/vaadin/server/VaadinResponse.java13
-rw-r--r--server/src/com/vaadin/server/VaadinService.java61
-rw-r--r--server/src/com/vaadin/server/VaadinServlet.java27
-rw-r--r--server/src/com/vaadin/server/VaadinServletRequest.java5
-rw-r--r--server/src/com/vaadin/server/VaadinServletService.java6
-rw-r--r--server/src/com/vaadin/server/VaadinSession.java (renamed from server/src/com/vaadin/server/VaadinServiceSession.java)122
-rw-r--r--server/src/com/vaadin/server/VariableOwner.java2
-rw-r--r--server/src/com/vaadin/server/WebBrowser.java10
-rw-r--r--server/src/com/vaadin/server/WrappedHttpSession.java25
-rw-r--r--server/src/com/vaadin/server/WrappedPortletSession.java25
-rw-r--r--server/src/com/vaadin/server/WrappedSession.java79
-rw-r--r--server/src/com/vaadin/ui/AbstractComponent.java20
-rw-r--r--server/src/com/vaadin/ui/AbstractComponentContainer.java11
-rw-r--r--server/src/com/vaadin/ui/AbstractJavaScriptComponent.java4
-rw-r--r--server/src/com/vaadin/ui/AbstractSingleComponentContainer.java11
-rw-r--r--server/src/com/vaadin/ui/ConnectorTracker.java3
-rw-r--r--server/src/com/vaadin/ui/CustomField.java5
-rw-r--r--server/src/com/vaadin/ui/Form.java5
-rw-r--r--server/src/com/vaadin/ui/HasComponents.java19
-rw-r--r--server/src/com/vaadin/ui/Panel.java11
-rw-r--r--server/src/com/vaadin/ui/PopupDateField.java31
-rw-r--r--server/src/com/vaadin/ui/SelectiveRenderer.java50
-rw-r--r--server/src/com/vaadin/ui/TabSheet.java4
-rw-r--r--server/src/com/vaadin/ui/Table.java5
-rw-r--r--server/src/com/vaadin/ui/UI.java65
-rw-r--r--server/src/com/vaadin/ui/Window.java14
-rw-r--r--server/tests/src/com/vaadin/tests/VaadinClasses.java4
-rw-r--r--server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java18
-rw-r--r--server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java8
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java8
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java6
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java8
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java4
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java10
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java4
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java10
-rw-r--r--server/tests/src/com/vaadin/ui/LabelDataSource.java8
-rw-r--r--shared/src/com/vaadin/shared/AbstractComponentState.java (renamed from shared/src/com/vaadin/shared/ComponentState.java)7
-rw-r--r--shared/src/com/vaadin/shared/annotations/Delayed.java4
-rw-r--r--shared/src/com/vaadin/shared/communication/LegacyChangeVariablesInvocation.java4
-rw-r--r--shared/src/com/vaadin/shared/communication/MethodInvocation.java6
-rw-r--r--shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/AbstractLayoutState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/AbstractMediaState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/BrowserPopupExtensionState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/ComponentStateUtil.java14
-rw-r--r--shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/TabIndexState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/button/ButtonState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/datefield/PopupDateFieldState.java3
-rw-r--r--shared/src/com/vaadin/shared/ui/label/LabelState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/link/LinkState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/menubar/MenuBarState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/panel/PanelState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java4
-rw-r--r--shared/src/com/vaadin/shared/ui/ui/UIServerRpc.java2
-rw-r--r--shared/src/com/vaadin/shared/ui/ui/UIState.java4
-rw-r--r--theme-compiler/src/com/vaadin/sass/SassCompiler.java16
-rw-r--r--theme-compiler/src/com/vaadin/sass/ScssStylesheet.java9
-rw-r--r--theme-compiler/src/com/vaadin/sass/tree/VariableNode.java2
-rw-r--r--theme-compiler/src/com/vaadin/sass/visitor/BlockNodeHandler.java4
-rw-r--r--theme-compiler/src/com/vaadin/sass/visitor/MixinNodeHandler.java1
-rw-r--r--theme-compiler/src/com/vaadin/sass/visitor/ParentSelectorHandler.java15
-rw-r--r--theme-compiler/tests/resources/css/parent-selector.css4
-rw-r--r--theme-compiler/tests/resources/css/variables.css1
-rw-r--r--theme-compiler/tests/resources/scss/parent-selector.scss3
-rw-r--r--theme-compiler/tests/resources/scss/variables.scss3
-rw-r--r--theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentSelector.java6
-rw-r--r--theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Variables.java6
-rw-r--r--uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java4
-rw-r--r--uitest/src/com/vaadin/tests/ModalWindow.java2
-rw-r--r--uitest/src/com/vaadin/tests/Parameters.java8
-rw-r--r--uitest/src/com/vaadin/tests/TestBench.java2
-rw-r--r--uitest/src/com/vaadin/tests/TreeFilesystem.java4
-rw-r--r--uitest/src/com/vaadin/tests/TreeFilesystemContainer.java4
-rw-r--r--uitest/src/com/vaadin/tests/appengine/GAESyncTest.java3
-rw-r--r--uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.html2
-rw-r--r--uitest/src/com/vaadin/tests/application/NavigateWithOngoingXHR.java116
-rw-r--r--uitest/src/com/vaadin/tests/application/TerminalErrorNotification.java3
-rw-r--r--uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java8
-rw-r--r--uitest/src/com/vaadin/tests/applicationservlet/InitParamUIProvider.java2
-rw-r--r--uitest/src/com/vaadin/tests/applicationservlet/SystemMessagesTest.html52
-rw-r--r--uitest/src/com/vaadin/tests/applicationservlet/SystemMessagesTest.java90
-rw-r--r--uitest/src/com/vaadin/tests/components/AbstractComponentTest.java3
-rw-r--r--uitest/src/com/vaadin/tests/components/AbstractTestCase.java4
-rw-r--r--uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java4
-rw-r--r--uitest/src/com/vaadin/tests/components/FileDownloaderTest.html36
-rw-r--r--uitest/src/com/vaadin/tests/components/FileDownloaderTest.java36
-rw-r--r--uitest/src/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java4
-rw-r--r--uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java3
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTest.html102
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTest.java13
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java43
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.html112
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.java56
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java6
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7a1/FindCurrentUI.java4
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7a1/UsingXyzWhenInitializing.java2
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7b1/Addition.java4
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket1589.java8
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket1921.java6
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket2292.java8
-rw-r--r--uitest/src/com/vaadin/tests/util/SampleDirectory.java4
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/DelegateState.java4
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/LabelState.java4
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ComponentInStateState.java4
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentState.java4
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7b1/CapsLockWarningRpc.java2
187 files changed, 2301 insertions, 920 deletions
diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml
index 820eb2cbce..cd1f0a75cc 100644
--- a/WebContent/WEB-INF/web.xml
+++ b/WebContent/WEB-INF/web.xml
@@ -61,7 +61,7 @@
<param-value>3601</param-value>
</init-param>
<init-param>
- <param-name>closeIdleUIs</param-name>
+ <param-name>closeIdleSessions</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java b/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java
index 0e29c07405..652eb38b5c 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java
@@ -337,8 +337,8 @@ public class ConnectorBundleLoaderFactory extends Generator {
w.print(escape(method.getName()));
w.println("\");");
- if (annotation.lastonly()) {
- w.print("store.setLastonly(");
+ if (annotation.lastOnly()) {
+ w.print("store.setLastOnly(");
writeClassLiteral(w, type);
w.print(", \"");
w.print(escape(method.getName()));
diff --git a/client/src/com/vaadin/client/ApplicationConfiguration.java b/client/src/com/vaadin/client/ApplicationConfiguration.java
index 4159b38211..1f35c408ae 100644
--- a/client/src/com/vaadin/client/ApplicationConfiguration.java
+++ b/client/src/com/vaadin/client/ApplicationConfiguration.java
@@ -199,6 +199,7 @@ public class ApplicationConfiguration implements EntryPoint {
private boolean standalone;
private ErrorMessage communicationError;
private ErrorMessage authorizationError;
+ private ErrorMessage sessionExpiredError;
private int heartbeatInterval;
private HashMap<Integer, String> unknownComponents;
@@ -314,6 +315,10 @@ public class ApplicationConfiguration implements EntryPoint {
return authorizationError;
}
+ public ErrorMessage getSessionExpiredError() {
+ return sessionExpiredError;
+ }
+
/**
* Reads the configuration values defined by the bootstrap javascript.
*/
@@ -353,6 +358,7 @@ public class ApplicationConfiguration implements EntryPoint {
communicationError = jsoConfiguration.getConfigError("comErrMsg");
authorizationError = jsoConfiguration.getConfigError("authErrMsg");
+ sessionExpiredError = jsoConfiguration.getConfigError("sessExpMsg");
// boostrap sets initPending to false if it has sent the browser details
if (jsoConfiguration.getConfigBoolean("initPending") == Boolean.FALSE) {
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index e35fd82424..4c3eaff6aa 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -56,6 +56,9 @@ import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.Window.ClosingEvent;
+import com.google.gwt.user.client.Window.ClosingHandler;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.ApplicationConfiguration.ErrorMessage;
@@ -81,7 +84,7 @@ import com.vaadin.client.ui.dd.VDragAndDropManager;
import com.vaadin.client.ui.ui.UIConnector;
import com.vaadin.client.ui.window.WindowConnector;
import com.vaadin.shared.ApplicationConstants;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.Version;
import com.vaadin.shared.communication.LegacyChangeVariablesInvocation;
import com.vaadin.shared.communication.MethodInvocation;
@@ -146,7 +149,7 @@ public class ApplicationConnection {
* The pending method invocations that will be send to the server by
* {@link #sendPendingCommand}. The key is defined differently based on
* whether the method invocation is enqueued with lastonly. With lastonly
- * enabled, the method signature ( {@link MethodInvocation#getLastonlyTag()}
+ * enabled, the method signature ( {@link MethodInvocation#getLastOnlyTag()}
* ) is used as the key to make enable removing a previously enqueued
* invocation. Without lastonly, an incremental id based on
* {@link #lastInvocationTag} is used to get unique values.
@@ -170,6 +173,23 @@ public class ApplicationConnection {
private boolean hasActiveRequest = false;
+ /**
+ * Some browsers cancel pending XHR requests when a request that might
+ * navigate away from the page starts (indicated by a beforeunload event).
+ * In that case, we should just send the request again without displaying
+ * any error.
+ */
+ private boolean retryCanceledActiveRequest = false;
+
+ /**
+ * Webkit will ignore outgoing requests while waiting for a response to a
+ * navigation event (indicated by a beforeunload event). When this happens,
+ * we should keep trying to send the request every now and then until there
+ * is a response or until it throws an exception saying that it is already
+ * being sent.
+ */
+ private boolean webkitMaybeIgnoringRequests = false;
+
protected boolean cssLoaded = false;
/** Parameters for this application connection loaded from the web-page */
@@ -199,10 +219,10 @@ public class ApplicationConnection {
private final RpcManager rpcManager;
/**
- * If renderingLocks contains any objects, rendering is to be suspended
- * until the collection is empty or a timeout has occurred.
+ * If responseHandlingLocks contains any objects, response handling is
+ * suspended until the collection is empty or a timeout has occurred.
*/
- private Set<Object> renderingLocks = new HashSet<Object>();
+ private Set<Object> responseHandlingLocks = new HashSet<Object>();
/**
* Data structure holding information about pending UIDL messages.
@@ -231,10 +251,10 @@ public class ApplicationConnection {
}
}
- /** Contains all UIDL messages received while the rendering is suspended */
+ /** Contains all UIDL messages received while response handling is suspended */
private List<PendingUIDLMessage> pendingUIDLMessages = new ArrayList<PendingUIDLMessage>();
- /** The max timeout the rendering phase may be suspended */
+ /** The max timeout that response handling may be suspended */
private static final int MAX_SUSPENDED_TIMEOUT = 5000;
/** Event bus for communication events */
@@ -378,6 +398,21 @@ public class ApplicationConnection {
showLoadingIndicator();
scheduleHeartbeat();
+
+ Window.addWindowClosingHandler(new ClosingHandler() {
+ @Override
+ public void onWindowClosing(ClosingEvent event) {
+ /*
+ * Set some flags to avoid potential problems with XHR requests,
+ * see javadocs of the flags for details
+ */
+ if (hasActiveRequest()) {
+ retryCanceledActiveRequest = true;
+ }
+
+ webkitMaybeIgnoringRequests = true;
+ }
+ });
}
/**
@@ -668,9 +703,21 @@ public class ApplicationConnection {
switch (statusCode) {
case 0:
- handleCommunicationError(
- "Invalid status code 0 (server down?)",
- statusCode);
+ if (retryCanceledActiveRequest) {
+ /*
+ * Request was most likely canceled because the
+ * browser is maybe navigating away from the page.
+ * Just send the request again without displaying
+ * any error in case the navigation isn't carried
+ * through.
+ */
+ retryCanceledActiveRequest = false;
+ doUidlRequest(uri, payload, synchronous);
+ } else {
+ handleCommunicationError(
+ "Invalid status code 0 (server down?)",
+ statusCode);
+ }
return;
case 401:
@@ -814,9 +861,38 @@ public class ApplicationConnection {
rb.setRequestData(payload);
rb.setCallback(requestCallback);
- rb.send();
+ final Request request = rb.send();
+ if (webkitMaybeIgnoringRequests && BrowserInfo.get().isWebkit()) {
+ final int retryTimeout = 250;
+ new Timer() {
+ @Override
+ public void run() {
+ // Use native js to access private field in Request
+ if (resendRequest(request) && webkitMaybeIgnoringRequests) {
+ // Schedule retry if still needed
+ schedule(retryTimeout);
+ }
+ }
+ }.schedule(retryTimeout);
+ }
}
+ private static native boolean resendRequest(Request request)
+ /*-{
+ var xhr = request.@com.google.gwt.http.client.Request::xmlHttpRequest
+ if (xhr.readyState != 1) {
+ // Progressed to some other readyState -> no longer blocked
+ return false;
+ }
+ try {
+ xhr.send();
+ return true;
+ } catch (e) {
+ // send throws exception if it is running for real
+ return false;
+ }
+ }-*/;
+
int cssWaits = 0;
/**
@@ -884,9 +960,7 @@ public class ApplicationConnection {
*/
protected void showCommunicationError(String details, int statusCode) {
VConsole.error("Communication error: " + details);
- ErrorMessage communicationError = configuration.getCommunicationError();
- showError(details, communicationError.getCaption(),
- communicationError.getMessage(), communicationError.getUrl());
+ showError(details, configuration.getCommunicationError());
}
/**
@@ -897,9 +971,31 @@ public class ApplicationConnection {
*/
protected void showAuthenticationError(String details) {
VConsole.error("Authentication error: " + details);
- ErrorMessage authorizationError = configuration.getAuthorizationError();
- showError(details, authorizationError.getCaption(),
- authorizationError.getMessage(), authorizationError.getUrl());
+ showError(details, configuration.getAuthorizationError());
+ }
+
+ /**
+ * Shows the session expiration notification.
+ *
+ * @param details
+ * Optional details for debugging.
+ */
+ protected void showSessionExpiredError(String details) {
+ VConsole.error("Session expired: " + details);
+ showError(details, configuration.getSessionExpiredError());
+ }
+
+ /**
+ * Shows an error notification.
+ *
+ * @param details
+ * Optional details for debugging.
+ * @param message
+ * An ErrorMessage describing the error.
+ */
+ protected void showError(String details, ErrorMessage message) {
+ showError(details, message.getCaption(), message.getMessage(),
+ message.getUrl());
}
/**
@@ -926,9 +1022,11 @@ public class ApplicationConnection {
if (html.length() > 0) {
// Add error description
- html.append("<br/><p><I style=\"font-size:0.7em\">");
- html.append(details);
- html.append("</I></p>");
+ if (details != null) {
+ html.append("<p><i style=\"font-size:0.7em\">");
+ html.append(details);
+ html.append("</i></p>");
+ }
VNotification n = VNotification.createNotification(1000 * 60 * 45,
uIConnector.getWidget());
@@ -977,6 +1075,10 @@ public class ApplicationConnection {
// the call. Active requests used to be tracked with an integer counter,
// so setting it after used to work but not with the #8505 changes.
hasActiveRequest = false;
+
+ retryCanceledActiveRequest = false;
+ webkitMaybeIgnoringRequests = false;
+
if (applicationRunning) {
checkForPendingVariableBursts();
runPostRequestHooks(configuration.getRootPanelId());
@@ -1140,7 +1242,7 @@ public class ApplicationConnection {
protected void handleUIDLMessage(final Date start, final String jsonText,
final ValueMap json) {
- if (!renderingLocks.isEmpty()) {
+ if (!responseHandlingLocks.isEmpty()) {
// Some component is doing something that can't be interrupted
// (e.g. animation that should be smooth). Enqueue the UIDL
// message for later processing.
@@ -1362,32 +1464,11 @@ public class ApplicationConnection {
if (meta != null) {
if (meta.containsKey("appError")) {
ValueMap error = meta.getValueMap("appError");
- String html = "";
- if (error.containsKey("caption")
- && error.getString("caption") != null) {
- html += "<h1>" + error.getAsString("caption")
- + "</h1>";
- }
- if (error.containsKey("message")
- && error.getString("message") != null) {
- html += "<p>" + error.getAsString("message")
- + "</p>";
- }
- String url = null;
- if (error.containsKey("url")) {
- url = error.getString("url");
- }
- if (html.length() != 0) {
- /* 45 min */
- VNotification n = VNotification.createNotification(
- 1000 * 60 * 45, uIConnector.getWidget());
- n.addEventListener(new NotificationRedirect(url));
- n.show(html, VNotification.CENTERED_TOP,
- VNotification.STYLE_SYSTEM);
- } else {
- redirect(url);
- }
+ showError(null, error.getString("caption"),
+ error.getString("message"),
+ error.getString("url"));
+
applicationRunning = false;
}
if (validatingLayouts) {
@@ -2091,7 +2172,7 @@ public class ApplicationConnection {
* request), <code>true</code> to let the framework delay sending
* of RPC calls and variable changes until the next non-delayed
* change
- * @param lastonly
+ * @param lastOnly
* <code>true</code> to remove all previously delayed invocations
* of the same method that were also enqueued with lastonly set
* to <code>true</code>. <code>false</code> to add invocation to
@@ -2099,11 +2180,11 @@ public class ApplicationConnection {
* invocations.
*/
public void addMethodInvocationToQueue(MethodInvocation invocation,
- boolean delayed, boolean lastonly) {
+ boolean delayed, boolean lastOnly) {
String tag;
- if (lastonly) {
- tag = invocation.getLastonlyTag();
- assert !tag.matches("\\d+") : "getLastonlyTag value must have at least one non-digit character";
+ if (lastOnly) {
+ tag = invocation.getLastOnlyTag();
+ assert !tag.matches("\\d+") : "getLastOnlyTag value must have at least one non-digit character";
pendingInvocations.remove(tag);
} else {
tag = Integer.toString(lastInvocationTag++);
@@ -2809,7 +2890,7 @@ public class ApplicationConnection {
* @return true if at least one listener has been registered on server side
* for the event identified by eventIdentifier.
* @deprecated as of Vaadin 7. Use
- * {@link ComponentState#hasEventListener(String)} instead
+ * {@link AbstractComponentState#hasEventListener(String)} instead
*/
@Deprecated
public boolean hasEventListeners(ComponentConnector paintable,
@@ -2909,7 +2990,7 @@ public class ApplicationConnection {
/**
* @deprecated as of Vaadin 7. Use
- * {@link ComponentState#hasEventListener(String)} instead
+ * {@link AbstractComponentState#hasEventListener(String)} instead
*/
@Deprecated
public boolean hasEventListeners(Widget widget, String eventIdentifier) {
@@ -2947,7 +3028,7 @@ public class ApplicationConnection {
* <p>
* Heartbeat requests are used to inform the server that the client-side is
* still alive. If the client page is closed or the connection lost, the
- * server will eventually close the inactive Root.
+ * server will eventually close the inactive UI.
* <p>
* <b>TODO</b>: Improved error handling, like in doUidlRequest().
*
@@ -2971,16 +3052,17 @@ public class ApplicationConnection {
// TODO Permit retry in some error situations
VConsole.log("Heartbeat response OK");
scheduleHeartbeat();
+ } else if (status == Response.SC_GONE) {
+ showSessionExpiredError(null);
} else {
- VConsole.error("Heartbeat request failed with status code "
+ VConsole.error("Failed sending heartbeat to server. Error code: "
+ status);
}
}
@Override
public void onError(Request request, Throwable exception) {
- VConsole.error("Heartbeat request resulted in exception");
- VConsole.error(exception);
+ VConsole.error("Exception sending heartbeat: " + exception);
}
};
@@ -2995,14 +3077,14 @@ public class ApplicationConnection {
}
/**
- * Timer used to make sure that no misbehaving components can lock the
- * rendering phase forever.
+ * Timer used to make sure that no misbehaving components can delay response
+ * handling forever.
*/
Timer forceHandleMessage = new Timer() {
@Override
public void run() {
- VConsole.log("WARNING: rendering was never resumed, forcing reload...");
- renderingLocks.clear();
+ VConsole.log("WARNING: reponse handling was never resumed, forcibly removing locks...");
+ responseHandlingLocks.clear();
handlePendingMessages();
}
};
@@ -3013,8 +3095,8 @@ public class ApplicationConnection {
*
* @param lock
*/
- public void suspendRendering(Object lock) {
- renderingLocks.add(lock);
+ public void suspendReponseHandling(Object lock) {
+ responseHandlingLocks.add(lock);
}
/**
@@ -3022,18 +3104,17 @@ public class ApplicationConnection {
*
* @param lock
*/
- public void resumeRendering(Object lock) {
- VConsole.log("...resuming UIDL handling.");
- renderingLocks.remove(lock);
- if (renderingLocks.isEmpty()) {
- VConsole.log("No more rendering locks, rendering pending requests.");
+ public void resumeResponseHandling(Object lock) {
+ responseHandlingLocks.remove(lock);
+ if (responseHandlingLocks.isEmpty()) {
+ VConsole.log("No more response handling locks, handling pending requests.");
forceHandleMessage.cancel();
handlePendingMessages();
}
}
/**
- * Handles all pending UIDL messages queued while the rendering was
+ * Handles all pending UIDL messages queued while response handling was
* suspended.
*/
private void handlePendingMessages() {
diff --git a/client/src/com/vaadin/client/ComponentConnector.java b/client/src/com/vaadin/client/ComponentConnector.java
index 9858ff6abd..ae889c1dbd 100644
--- a/client/src/com/vaadin/client/ComponentConnector.java
+++ b/client/src/com/vaadin/client/ComponentConnector.java
@@ -18,7 +18,7 @@ package com.vaadin.client;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
/**
* An interface used by client-side widgets or paintable parts to receive
@@ -36,7 +36,7 @@ public interface ComponentConnector extends ServerConnector {
* @see com.vaadin.client.VPaintable#getState()
*/
@Override
- public ComponentState getState();
+ public AbstractComponentState getState();
/**
* Returns the widget for this {@link ComponentConnector}
diff --git a/client/src/com/vaadin/client/ComponentLocator.java b/client/src/com/vaadin/client/ComponentLocator.java
index 99f973c467..854c8535c4 100644
--- a/client/src/com/vaadin/client/ComponentLocator.java
+++ b/client/src/com/vaadin/client/ComponentLocator.java
@@ -34,7 +34,7 @@ import com.vaadin.client.ui.VTabsheetPanel;
import com.vaadin.client.ui.VUI;
import com.vaadin.client.ui.VWindow;
import com.vaadin.client.ui.window.WindowConnector;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.Connector;
import com.vaadin.shared.communication.SharedState;
@@ -694,8 +694,8 @@ public class ComponentLocator {
private ServerConnector findConnectorById(ServerConnector root, String id) {
SharedState state = root.getState();
- if (state instanceof ComponentState
- && id.equals(((ComponentState) state).id)) {
+ if (state instanceof AbstractComponentState
+ && id.equals(((AbstractComponentState) state).id)) {
return root;
}
for (ServerConnector child : root.getChildren()) {
diff --git a/client/src/com/vaadin/client/MeasuredSize.java b/client/src/com/vaadin/client/MeasuredSize.java
index 48585ae7c5..ccc8a5058c 100644
--- a/client/src/com/vaadin/client/MeasuredSize.java
+++ b/client/src/com/vaadin/client/MeasuredSize.java
@@ -19,6 +19,8 @@ import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.dom.client.Element;
public class MeasuredSize {
+ private final static boolean debugSizeChanges = false;
+
public static class MeasureResult {
private final boolean widthChanged;
private final boolean heightChanged;
@@ -189,46 +191,79 @@ public class MeasuredSize {
ComputedStyle computedStyle = new ComputedStyle(element);
int[] paddings = computedStyle.getPadding();
if (!heightChanged && hasHeightChanged(this.paddings, paddings)) {
+ debugSizeChange(element, "Height (padding)", this.paddings,
+ paddings);
heightChanged = true;
}
if (!widthChanged && hasWidthChanged(this.paddings, paddings)) {
+ debugSizeChange(element, "Width (padding)", this.paddings, paddings);
widthChanged = true;
}
this.paddings = paddings;
int[] margins = computedStyle.getMargin();
if (!heightChanged && hasHeightChanged(this.margins, margins)) {
+ debugSizeChange(element, "Height (margins)", this.margins, margins);
heightChanged = true;
}
if (!widthChanged && hasWidthChanged(this.margins, margins)) {
+ debugSizeChange(element, "Width (margins)", this.margins, margins);
widthChanged = true;
}
this.margins = margins;
int[] borders = computedStyle.getBorder();
if (!heightChanged && hasHeightChanged(this.borders, borders)) {
+ debugSizeChange(element, "Height (borders)", this.borders, borders);
heightChanged = true;
}
if (!widthChanged && hasWidthChanged(this.borders, borders)) {
+ debugSizeChange(element, "Width (borders)", this.borders, borders);
widthChanged = true;
}
this.borders = borders;
int requiredHeight = Util.getRequiredHeight(element);
int marginHeight = sumHeights(margins);
+ int oldHeight = height;
+ int oldWidth = width;
if (setOuterHeight(requiredHeight + marginHeight)) {
+ debugSizeChange(element, "Height (outer)", oldHeight, height);
heightChanged = true;
}
int requiredWidth = Util.getRequiredWidth(element);
int marginWidth = sumWidths(margins);
if (setOuterWidth(requiredWidth + marginWidth)) {
+ debugSizeChange(element, "Width (outer)", oldWidth, width);
widthChanged = true;
}
return new MeasureResult(widthChanged, heightChanged);
}
+ private void debugSizeChange(Element element, String sizeChangeType,
+ int[] changedFrom, int[] changedTo) {
+ debugSizeChange(element, sizeChangeType,
+ java.util.Arrays.asList(changedFrom).toString(),
+ java.util.Arrays.asList(changedTo).toString());
+ }
+
+ private void debugSizeChange(Element element, String sizeChangeType,
+ int changedFrom, int changedTo) {
+ debugSizeChange(element, sizeChangeType, String.valueOf(changedFrom),
+ String.valueOf(changedTo));
+ }
+
+ private void debugSizeChange(Element element, String sizeChangeType,
+ String changedFrom, String changedTo) {
+ if (debugSizeChanges) {
+ VConsole.log(sizeChangeType + " has changed for "
+ + element.toString() + " from " + changedFrom + " to "
+ + changedTo);
+ }
+ }
+
private static boolean hasWidthChanged(int[] sizes1, int[] sizes2) {
return sizes1[1] != sizes2[1] || sizes1[3] != sizes2[3];
}
diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java
index d111bd3093..7548cfe42a 100644
--- a/client/src/com/vaadin/client/Util.java
+++ b/client/src/com/vaadin/client/Util.java
@@ -45,7 +45,7 @@ import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.RenderInformation.FloatSize;
import com.vaadin.client.ui.VOverlay;
import com.vaadin.shared.ApplicationConstants;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.communication.MethodInvocation;
import com.vaadin.shared.ui.ComponentStateUtil;
@@ -523,7 +523,7 @@ public class Util {
* @param state
* @return
*/
- public static FloatSize parseRelativeSize(ComponentState state) {
+ public static FloatSize parseRelativeSize(AbstractComponentState state) {
if (ComponentStateUtil.isUndefinedHeight(state)
&& ComponentStateUtil.isUndefinedWidth(state)) {
return null;
diff --git a/client/src/com/vaadin/client/VCaption.java b/client/src/com/vaadin/client/VCaption.java
index aadc7b88ad..a662ef4a7b 100644
--- a/client/src/com/vaadin/client/VCaption.java
+++ b/client/src/com/vaadin/client/VCaption.java
@@ -24,7 +24,7 @@ import com.vaadin.client.ui.AbstractFieldConnector;
import com.vaadin.client.ui.Icon;
import com.vaadin.shared.AbstractFieldState;
import com.vaadin.shared.ComponentConstants;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.ui.ComponentStateUtil;
public class VCaption extends HTML {
@@ -393,7 +393,7 @@ public class VCaption extends HTML {
}
}
- public static boolean isNeeded(ComponentState state) {
+ public static boolean isNeeded(AbstractComponentState state) {
if (state.caption != null) {
return true;
}
diff --git a/client/src/com/vaadin/client/communication/RpcProxy.java b/client/src/com/vaadin/client/communication/RpcProxy.java
index 0e53ea0013..9196155063 100644
--- a/client/src/com/vaadin/client/communication/RpcProxy.java
+++ b/client/src/com/vaadin/client/communication/RpcProxy.java
@@ -59,7 +59,7 @@ public class RpcProxy {
connector.getConnectorId(), rpcInterface.getName(),
method.getName(), params);
connector.getConnection().addMethodInvocationToQueue(invocation,
- method.isDelayed(), method.isLastonly());
+ method.isDelayed(), method.isLastOnly());
// No RPC iface should have a return value
return null;
}
diff --git a/client/src/com/vaadin/client/extensions/FileDownloaderConnector.java b/client/src/com/vaadin/client/extensions/FileDownloaderConnector.java
index 6308de9c05..61a8bee9d3 100644
--- a/client/src/com/vaadin/client/extensions/FileDownloaderConnector.java
+++ b/client/src/com/vaadin/client/extensions/FileDownloaderConnector.java
@@ -69,7 +69,7 @@ public class FileDownloaderConnector extends AbstractExtensionConnector
@Override
public void setParent(ServerConnector parent) {
super.setParent(parent);
- if (parent == null) {
+ if (parent == null && iframe != null) {
iframe.removeFromParent();
}
}
diff --git a/client/src/com/vaadin/client/metadata/Method.java b/client/src/com/vaadin/client/metadata/Method.java
index 902205cea1..365bd43898 100644
--- a/client/src/com/vaadin/client/metadata/Method.java
+++ b/client/src/com/vaadin/client/metadata/Method.java
@@ -64,8 +64,8 @@ public class Method {
return TypeDataStore.isDelayed(this);
}
- public boolean isLastonly() {
- return TypeDataStore.isLastonly(this);
+ public boolean isLastOnly() {
+ return TypeDataStore.isLastOnly(this);
}
}
diff --git a/client/src/com/vaadin/client/metadata/TypeDataStore.java b/client/src/com/vaadin/client/metadata/TypeDataStore.java
index 27054c5aeb..c30ee8803c 100644
--- a/client/src/com/vaadin/client/metadata/TypeDataStore.java
+++ b/client/src/com/vaadin/client/metadata/TypeDataStore.java
@@ -23,7 +23,7 @@ public class TypeDataStore {
private final Map<Type, Collection<Property>> properties = new HashMap<Type, Collection<Property>>();
private final Set<Method> delayedMethods = new HashSet<Method>();
- private final Set<Method> lastonlyMethods = new HashSet<Method>();
+ private final Set<Method> lastOnlyMethods = new HashSet<Method>();
private final Map<Method, Type> returnTypes = new HashMap<Method, Type>();
private final Map<Method, Invoker> invokers = new HashMap<Method, Invoker>();
@@ -159,12 +159,12 @@ public class TypeDataStore {
delayedMethods.add(getType(type).getMethod(methodName));
}
- public static boolean isLastonly(Method method) {
- return get().lastonlyMethods.contains(method);
+ public static boolean isLastOnly(Method method) {
+ return get().lastOnlyMethods.contains(method);
}
- public void setLastonly(Class<?> clazz, String methodName) {
- lastonlyMethods.add(getType(clazz).getMethod(methodName));
+ public void setLastOnly(Class<?> clazz, String methodName) {
+ lastOnlyMethods.add(getType(clazz).getMethod(methodName));
}
public static Collection<Property> getProperties(Type type)
diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
index 8b6c4fb8aa..49e879a681 100644
--- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
+++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
@@ -41,7 +41,7 @@ import com.vaadin.client.metadata.TypeData;
import com.vaadin.client.ui.datefield.PopupDateFieldConnector;
import com.vaadin.client.ui.ui.UIConnector;
import com.vaadin.shared.ComponentConstants;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.Connector;
import com.vaadin.shared.ui.ComponentStateUtil;
import com.vaadin.shared.ui.TabIndexState;
@@ -116,8 +116,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector
}
@Override
- public ComponentState getState() {
- return (ComponentState) super.getState();
+ public AbstractComponentState getState() {
+ return (AbstractComponentState) super.getState();
}
@Override
@@ -267,7 +267,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector
* </p>
*/
protected void updateWidgetStyleNames() {
- ComponentState state = getState();
+ AbstractComponentState state = getState();
String primaryStyleName = getWidget().getStylePrimaryName();
if (state.primaryStyleName != null) {
diff --git a/client/src/com/vaadin/client/ui/VFilterSelect.java b/client/src/com/vaadin/client/ui/VFilterSelect.java
index 54498c432f..bca68a86f3 100644
--- a/client/src/com/vaadin/client/ui/VFilterSelect.java
+++ b/client/src/com/vaadin/client/ui/VFilterSelect.java
@@ -68,7 +68,7 @@ import com.vaadin.client.Util;
import com.vaadin.client.VConsole;
import com.vaadin.client.ui.menubar.MenuBar;
import com.vaadin.client.ui.menubar.MenuItem;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.EventId;
import com.vaadin.shared.ui.ComponentStateUtil;
import com.vaadin.shared.ui.combobox.FilteringMode;
@@ -598,7 +598,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* @param componentState
* shared state of the combo box
*/
- public void updateStyleNames(UIDL uidl, ComponentState componentState) {
+ public void updateStyleNames(UIDL uidl, AbstractComponentState componentState) {
setStyleName(VFilterSelect.this.getStylePrimaryName()
+ "-suggestpopup");
menu.setStyleName(VFilterSelect.this.getStylePrimaryName()
diff --git a/client/src/com/vaadin/client/ui/VFormLayout.java b/client/src/com/vaadin/client/ui/VFormLayout.java
index a46a0a41c8..49c991b39c 100644
--- a/client/src/com/vaadin/client/ui/VFormLayout.java
+++ b/client/src/com/vaadin/client/ui/VFormLayout.java
@@ -35,7 +35,7 @@ import com.vaadin.client.Focusable;
import com.vaadin.client.StyleConstants;
import com.vaadin.client.VTooltip;
import com.vaadin.shared.ComponentConstants;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.ui.ComponentStateUtil;
import com.vaadin.shared.ui.MarginInfo;
@@ -65,7 +65,7 @@ public class VFormLayout extends SimplePanel {
* @param enabled
* @return An array of stylenames
*/
- private String[] getStylesFromState(ComponentState state, boolean enabled) {
+ private String[] getStylesFromState(AbstractComponentState state, boolean enabled) {
List<String> styles = new ArrayList<String>();
if (ComponentStateUtil.hasStyles(state)) {
for (String name : state.styles) {
@@ -188,7 +188,7 @@ public class VFormLayout extends SimplePanel {
}
- public void updateCaption(Widget widget, ComponentState state,
+ public void updateCaption(Widget widget, AbstractComponentState state,
boolean enabled) {
final Caption c = widgetToCaption.get(widget);
if (c != null) {
@@ -249,7 +249,7 @@ public class VFormLayout extends SimplePanel {
setStyleName(styleName);
}
- public void updateCaption(ComponentState state, boolean enabled) {
+ public void updateCaption(AbstractComponentState state, boolean enabled) {
// Update styles as they might have changed when the caption changed
setStyles(getStylesFromState(state, enabled));
diff --git a/client/src/com/vaadin/client/ui/VPopupCalendar.java b/client/src/com/vaadin/client/ui/VPopupCalendar.java
index 941978d129..c5680e3662 100644
--- a/client/src/com/vaadin/client/ui/VPopupCalendar.java
+++ b/client/src/com/vaadin/client/ui/VPopupCalendar.java
@@ -66,6 +66,8 @@ public class VPopupCalendar extends VTextualDate implements Field,
private boolean open = false;
+ private boolean textFieldEnabled = true;
+
public VPopupCalendar() {
super();
@@ -156,6 +158,34 @@ public class VPopupCalendar extends VTextualDate implements Field,
}
}
+ /**
+ * Checks whether the text field is enabled.
+ *
+ * @see VPopupCalendar#setTextFieldEnabled(boolean)
+ * @return The current state of the text field.
+ */
+ public boolean isTextFieldEnabled() {
+ return textFieldEnabled;
+ }
+
+ /**
+ * Sets the state of the text field of this component. By default the text
+ * field is enabled. Disabling it causes only the button for date selection
+ * to be active, thus preventing the user from entering invalid dates. See
+ * {@link http://dev.vaadin.com/ticket/6790}.
+ *
+ * @param state
+ */
+ public void setTextFieldEnabled(boolean textFieldEnabled) {
+ this.textFieldEnabled = textFieldEnabled;
+ text.setEnabled(textFieldEnabled);
+ if (textFieldEnabled) {
+ calendarToggle.setTabIndex(-1);
+ } else {
+ calendarToggle.setTabIndex(0);
+ }
+ }
+
/*
* (non-Javadoc)
*
@@ -335,6 +365,9 @@ public class VPopupCalendar extends VTextualDate implements Field,
if (!parsable) {
setText(previousValue);
}
+
+ // superclass sets the text field independently when building date
+ text.setEnabled(isEnabled() && isTextFieldEnabled());
}
/**
diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java
index 601c93428c..9b06b711cb 100644
--- a/client/src/com/vaadin/client/ui/VScrollTable.java
+++ b/client/src/com/vaadin/client/ui/VScrollTable.java
@@ -92,7 +92,7 @@ import com.vaadin.client.ui.dd.VDragAndDropManager;
import com.vaadin.client.ui.dd.VDragEvent;
import com.vaadin.client.ui.dd.VHasDropHandler;
import com.vaadin.client.ui.dd.VTransferable;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.ui.dd.VerticalDropLocation;
import com.vaadin.shared.ui.table.TableConstants;
@@ -1113,7 +1113,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
}
/** For internal use only. May be removed or replaced in the future. */
- public void updateSelectionProperties(UIDL uidl, ComponentState state,
+ public void updateSelectionProperties(UIDL uidl, AbstractComponentState state,
boolean readOnly) {
setMultiSelectMode(uidl.hasAttribute("multiselectmode") ? uidl
.getIntAttribute("multiselectmode") : MULTISELECT_MODE_DEFAULT);
diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java
index d74665bb6d..63aeaa2fc7 100644
--- a/client/src/com/vaadin/client/ui/VTabsheet.java
+++ b/client/src/com/vaadin/client/ui/VTabsheet.java
@@ -55,7 +55,7 @@ import com.vaadin.client.TooltipInfo;
import com.vaadin.client.UIDL;
import com.vaadin.client.Util;
import com.vaadin.client.VCaption;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.EventId;
import com.vaadin.shared.ui.ComponentStateUtil;
import com.vaadin.shared.ui.tabsheet.TabsheetBaseConstants;
@@ -743,7 +743,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable,
}
/** For internal use only. May be removed or replaced in the future. */
- public void handleStyleNames(UIDL uidl, ComponentState state) {
+ public void handleStyleNames(UIDL uidl, AbstractComponentState state) {
// Add proper stylenames for all elements (easier to prevent unwanted
// style inheritance)
if (ComponentStateUtil.hasStyles(state)) {
diff --git a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
index 3859a22046..1ff1e58e72 100644
--- a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
+++ b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
@@ -21,6 +21,7 @@ import java.util.Date;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.DateTimeService;
import com.vaadin.client.UIDL;
+import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.VCalendarPanel.FocusChangeListener;
import com.vaadin.client.ui.VCalendarPanel.TimeChangeListener;
import com.vaadin.client.ui.VPopupCalendar;
@@ -132,6 +133,12 @@ public class PopupDateFieldConnector extends TextualDateConnector {
}
@Override
+ public void onStateChanged(StateChangeEvent stateChangeEvent) {
+ super.onStateChanged(stateChangeEvent);
+ getWidget().setTextFieldEnabled(getState().textFieldEnabled);
+ }
+
+ @Override
protected void setWidgetStyleName(String styleName, boolean add) {
super.setWidgetStyleName(styleName, add);
diff --git a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
index b94488896e..67555e8331 100644
--- a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
+++ b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
@@ -28,7 +28,7 @@ import com.vaadin.client.ServerConnector;
import com.vaadin.client.Util;
import com.vaadin.client.VConsole;
import com.vaadin.client.ui.ManagedLayout;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
public class LayoutDependencyTree {
private class LayoutDependency {
@@ -309,7 +309,7 @@ public class LayoutDependencyTree {
} else {
s += "Horizontal";
}
- ComponentState state = connector.getState();
+ AbstractComponentState state = connector.getState();
s += " sizing: "
+ getSizeDefinition(direction == VERTICAL ? state.height
: state.width) + "\n";
diff --git a/server/src/com/vaadin/data/util/converter/ConverterUtil.java b/server/src/com/vaadin/data/util/converter/ConverterUtil.java
index 6f2fecb9a2..5944b505ab 100644
--- a/server/src/com/vaadin/data/util/converter/ConverterUtil.java
+++ b/server/src/com/vaadin/data/util/converter/ConverterUtil.java
@@ -18,7 +18,7 @@ package com.vaadin.data.util.converter;
import java.io.Serializable;
import java.util.Locale;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
public class ConverterUtil implements Serializable {
@@ -26,7 +26,7 @@ public class ConverterUtil implements Serializable {
* Finds a converter that can convert from the given presentation type to
* the given model type and back. Uses the given application to find a
* {@link ConverterFactory} or, if application is null, uses the
- * {@link VaadinServiceSession#getCurrent()}.
+ * {@link VaadinSession#getCurrent()}.
*
* @param <PRESENTATIONTYPE>
* The presentation type
@@ -44,10 +44,10 @@ public class ConverterUtil implements Serializable {
*/
public static <PRESENTATIONTYPE, MODELTYPE> Converter<PRESENTATIONTYPE, MODELTYPE> getConverter(
Class<PRESENTATIONTYPE> presentationType,
- Class<MODELTYPE> modelType, VaadinServiceSession session) {
+ Class<MODELTYPE> modelType, VaadinSession session) {
Converter<PRESENTATIONTYPE, MODELTYPE> converter = null;
if (session == null) {
- session = VaadinServiceSession.getCurrent();
+ session = VaadinSession.getCurrent();
}
if (session != null) {
diff --git a/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java b/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java
index 55d78c21b1..17b89ccb20 100644
--- a/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java
+++ b/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java
@@ -19,14 +19,14 @@ package com.vaadin.data.util.converter;
import java.util.Date;
import java.util.logging.Logger;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
/**
* Default implementation of {@link ConverterFactory}. Provides converters for
* standard types like {@link String}, {@link Double} and {@link Date}. </p>
* <p>
* Custom converters can be provided by extending this class and using
- * {@link VaadinServiceSession#setConverterFactory(ConverterFactory)}.
+ * {@link VaadinSession#setConverterFactory(ConverterFactory)}.
* </p>
*
* @author Vaadin Ltd
diff --git a/server/src/com/vaadin/event/EventRouter.java b/server/src/com/vaadin/event/EventRouter.java
index 18f13b0ea2..80c6e5294d 100644
--- a/server/src/com/vaadin/event/EventRouter.java
+++ b/server/src/com/vaadin/event/EventRouter.java
@@ -31,11 +31,8 @@ import java.util.List;
*
* @author Vaadin Ltd.
* @since 3.0
- * @deprecated The EventRouter will be replaced by an EventRouter which does not
- * use reflection in Vaadin 7.0.0. See #8640.
*/
@SuppressWarnings("serial")
-@Deprecated
public class EventRouter implements MethodEventSource {
/**
diff --git a/server/src/com/vaadin/event/ListenerMethod.java b/server/src/com/vaadin/event/ListenerMethod.java
index 199c02e091..2c43b31390 100644
--- a/server/src/com/vaadin/event/ListenerMethod.java
+++ b/server/src/com/vaadin/event/ListenerMethod.java
@@ -49,10 +49,7 @@ import java.util.logging.Logger;
*
* @author Vaadin Ltd.
* @since 3.0
- * @deprecated The EventRouter will be replaced by an EventRouter which does not
- * use reflection in Vaadin 7.0.0. See #8640.
*/
-@Deprecated
@SuppressWarnings("serial")
public class ListenerMethod implements EventListener, Serializable {
diff --git a/server/src/com/vaadin/server/AbstractClientConnector.java b/server/src/com/vaadin/server/AbstractClientConnector.java
index b7ba48d8d5..ecdab22160 100644
--- a/server/src/com/vaadin/server/AbstractClientConnector.java
+++ b/server/src/com/vaadin/server/AbstractClientConnector.java
@@ -55,10 +55,10 @@ import com.vaadin.ui.UI;
public abstract class AbstractClientConnector implements ClientConnector,
MethodEventSource {
/**
- * A map from client to server RPC interface class to the RPC call manager
- * that handles incoming RPC calls for that interface.
+ * A map from client to server RPC interface class name to the RPC call
+ * manager that handles incoming RPC calls for that interface.
*/
- private Map<Class<?>, RpcManager> rpcManagerMap = new HashMap<Class<?>, RpcManager>();
+ private Map<String, RpcManager> rpcManagerMap = new HashMap<String, RpcManager>();
/**
* A map from server to client RPC interface class to the RPC proxy that
@@ -87,11 +87,7 @@ public abstract class AbstractClientConnector implements ClientConnector,
/**
* The EventRouter used for the event model.
- *
- * @deprecated The EventRouter will be replaced by an EventRouter which does
- * not use reflection in Vaadin 7.0.0. See #8640.
*/
- @Deprecated
private EventRouter eventRouter = null;
/**
@@ -126,8 +122,9 @@ public abstract class AbstractClientConnector implements ClientConnector,
* RPC interface class for which the implementation should be
* registered
*/
- protected <T> void registerRpc(T implementation, Class<T> rpcInterfaceType) {
- rpcManagerMap.put(rpcInterfaceType, new ServerRpcManager<T>(
+ protected <T extends ServerRpc> void registerRpc(T implementation,
+ Class<T> rpcInterfaceType) {
+ rpcManagerMap.put(rpcInterfaceType.getName(), new ServerRpcManager<T>(
implementation, rpcInterfaceType));
}
@@ -161,17 +158,44 @@ public abstract class AbstractClientConnector implements ClientConnector,
registerRpc(implementation, type);
}
+ /**
+ * Returns the shared state for this connector. The shared state object is
+ * shared between the server connector and the client connector. Changes are
+ * only communicated from the server to the client and not in the other
+ * direction.
+ * <p>
+ * As a side effect, marks the connector dirty so any changes done to the
+ * state will be sent to the client. Use {@code getState(false)} to avoid
+ * marking the connector as dirty.
+ * </p>
+ *
+ * @return The shared state for this connector. Never null.
+ */
protected SharedState getState() {
+ return getState(true);
+ }
+
+ /**
+ * Returns the shared state for this connector.
+ *
+ * @param markAsDirty
+ * true if the connector should automatically be marked dirty,
+ * false otherwise
+ *
+ * @return The shared state for this connector. Never null.
+ * @see #getState()
+ */
+ protected SharedState getState(boolean markAsDirty) {
if (null == sharedState) {
sharedState = createState();
}
-
- UI uI = getUI();
- if (uI != null && !uI.getConnectorTracker().isWritingResponse()
- && !uI.getConnectorTracker().isDirty(this)) {
- markAsDirty();
+ if (markAsDirty) {
+ UI ui = getUI();
+ if (ui != null && !ui.getConnectorTracker().isWritingResponse()
+ && !ui.getConnectorTracker().isDirty(this)) {
+ markAsDirty();
+ }
}
-
return sharedState;
}
@@ -337,18 +361,9 @@ public abstract class AbstractClientConnector implements ClientConnector,
requestRepaint();
}
- /**
- * @see RpcTarget#getRpcManager(Class)
- *
- * @param rpcInterface
- * RPC interface for which a call was made
- * @return RPC Manager handling calls for the interface
- *
- * @since 7.0
- */
@Override
- public RpcManager getRpcManager(Class<?> rpcInterface) {
- return rpcManagerMap.get(rpcInterface);
+ public RpcManager getRpcManager(String rpcInterfaceName) {
+ return rpcManagerMap.get(rpcInterfaceName);
}
@Override
@@ -375,12 +390,12 @@ public abstract class AbstractClientConnector implements ClientConnector,
}
/**
- * Finds the {@link VaadinServiceSession} to which this connector belongs.
- * If the connector has not been attached, <code>null</code> is returned.
+ * Finds the {@link VaadinSession} to which this connector belongs. If the
+ * connector has not been attached, <code>null</code> is returned.
*
* @return The connector's session, or <code>null</code> if not attached
*/
- protected VaadinServiceSession getSession() {
+ protected VaadinSession getSession() {
UI uI = getUI();
if (uI == null) {
return null;
@@ -675,10 +690,7 @@ public abstract class AbstractClientConnector implements ClientConnector,
* the activation method.
*
* @since 6.2
- * @deprecated The EventRouter will be replaced by an EventRouter which does
- * not use reflection in Vaadin 7.0.0. See #8640.
*/
- @Deprecated
protected void addListener(String eventIdentifier, Class<?> eventType,
Object target, Method method) {
if (eventRouter == null) {
@@ -764,11 +776,8 @@ public abstract class AbstractClientConnector implements ClientConnector,
* @param method
* the activation method.
*
- * @deprecated The EventRouter will be replaced by an EventRouter which does
- * not use reflection in Vaadin 7.0.0. See #8640.
*/
@Override
- @Deprecated
public void addListener(Class<?> eventType, Object target, Method method) {
if (eventRouter == null) {
eventRouter = new EventRouter();
@@ -809,8 +818,9 @@ public abstract class AbstractClientConnector implements ClientConnector,
* the object instance who owns the activation method.
* @param methodName
* the name of the activation method.
- * @deprecated The EventRouter will be replaced by an EventRouter which does
- * not use reflection in Vaadin 7.0.0. See #8640.
+ * @deprecated This method should be avoided. Use
+ * {@link #addListener(Class, Object, Method)} or
+ * {@link #addListener(String, Class, Object, Method)} instead.
*/
@Override
@Deprecated
@@ -864,11 +874,8 @@ public abstract class AbstractClientConnector implements ClientConnector,
* @param method
* the method owned by <code>target</code> that's registered to
* listen to events of type <code>eventType</code>.
- * @deprecated The EventRouter will be replaced by an EventRouter which does
- * not use reflection in Vaadin 7.0.0. See #8640.
*/
@Override
- @Deprecated
public void removeListener(Class<?> eventType, Object target, Method method) {
if (eventRouter != null) {
eventRouter.removeListener(eventType, target, method);
@@ -902,7 +909,10 @@ public abstract class AbstractClientConnector implements ClientConnector,
* @param methodName
* the name of the method owned by <code>target</code> that's
* registered to listen to events of type <code>eventType</code>.
+ * @deprecated This method should be avoided. Use
+ * {@link #removeListener(Class, Object, Method)} instead.
*/
+ @Deprecated
@Override
public void removeListener(Class<?> eventType, Object target,
String methodName) {
diff --git a/server/src/com/vaadin/server/AbstractCommunicationManager.java b/server/src/com/vaadin/server/AbstractCommunicationManager.java
index 202c7cf780..b0199a3886 100644
--- a/server/src/com/vaadin/server/AbstractCommunicationManager.java
+++ b/server/src/com/vaadin/server/AbstractCommunicationManager.java
@@ -67,14 +67,13 @@ import com.vaadin.server.ComponentSizeValidator.InvalidLayout;
import com.vaadin.server.RpcManager.RpcInvocationException;
import com.vaadin.server.StreamVariable.StreamingEndEvent;
import com.vaadin.server.StreamVariable.StreamingErrorEvent;
-import com.vaadin.server.Terminal.ErrorEvent;
-import com.vaadin.server.Terminal.ErrorListener;
import com.vaadin.shared.ApplicationConstants;
import com.vaadin.shared.Connector;
import com.vaadin.shared.JavaScriptConnectorState;
import com.vaadin.shared.Version;
import com.vaadin.shared.communication.LegacyChangeVariablesInvocation;
import com.vaadin.shared.communication.MethodInvocation;
+import com.vaadin.shared.communication.ServerRpc;
import com.vaadin.shared.communication.SharedState;
import com.vaadin.shared.communication.UidlValue;
import com.vaadin.shared.ui.ui.UIConstants;
@@ -84,6 +83,7 @@ import com.vaadin.ui.ConnectorTracker;
import com.vaadin.ui.HasComponents;
import com.vaadin.ui.LegacyComponent;
import com.vaadin.ui.LegacyWindow;
+import com.vaadin.ui.SelectiveRenderer;
import com.vaadin.ui.UI;
import com.vaadin.ui.Window;
@@ -147,7 +147,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
/**
* The session this communication manager is used for
*/
- private final VaadinServiceSession session;
+ private final VaadinSession session;
private List<String> locales;
@@ -174,7 +174,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
*
* @param session
*/
- public AbstractCommunicationManager(VaadinServiceSession session) {
+ public AbstractCommunicationManager(VaadinSession session) {
this.session = session;
session.addRequestHandler(getBootstrapHandler());
session.addRequestHandler(UNSUPPORTED_BROWSER_HANDLER);
@@ -182,7 +182,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
requireLocale(session.getLocale().toString());
}
- protected VaadinServiceSession getSession() {
+ protected VaadinSession getSession() {
return session;
}
@@ -374,7 +374,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
"StreamVariable for the post not found");
}
- final VaadinServiceSession session = getSession();
+ final VaadinSession session = getSession();
OutputStream out = null;
int totalBytes = 0;
@@ -512,7 +512,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
* Internally process a UIDL request from the client.
*
* This method calls
- * {@link #handleVariables(VaadinRequest, VaadinResponse, Callback, VaadinServiceSession, UI)}
+ * {@link #handleVariables(VaadinRequest, VaadinResponse, Callback, VaadinSession, UI)}
* to process any changes to variables by the client and then repaints
* affected components using {@link #paintAfterVariableChanges()}.
*
@@ -582,15 +582,14 @@ public abstract class AbstractCommunicationManager implements Serializable {
return;
}
- // Keep the UI alive
- uI.setLastUidlRequestTime(System.currentTimeMillis());
+ session.setLastRequestTimestamp(System.currentTimeMillis());
// Change all variables based on request parameters
if (!handleVariables(request, response, callback, session, uI)) {
// var inconsistency; the client is probably out-of-sync
SystemMessages ci = response.getService().getSystemMessages(
- uI.getLocale());
+ uI.getLocale(), request);
String msg = ci.getOutOfSyncMessage();
String cap = ci.getOutOfSyncCaption();
if (msg != null || cap != null) {
@@ -705,7 +704,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
}
sb.append("\nConnector hierarchy:\n");
- VaadinServiceSession session2 = connector.getUI().getSession();
+ VaadinSession session2 = connector.getUI().getSession();
sb.append(session2.getClass().getName());
sb.append("(");
sb.append(session2.getClass().getSimpleName());
@@ -808,7 +807,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
final PrintWriter outWriter, UI ui, boolean analyzeLayouts)
throws PaintException, JSONException {
ArrayList<ClientConnector> dirtyVisibleConnectors = new ArrayList<ClientConnector>();
- VaadinServiceSession session = ui.getSession();
+ VaadinSession session = ui.getSession();
// Paints components
ConnectorTracker uiConnectorTracker = ui.getConnectorTracker();
getLogger().log(Level.FINE, "* Creating response to client");
@@ -933,7 +932,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
for (ClientConnector child : AbstractClientConnector
.getAllChildrenIterable(connector)) {
- if (isVisible(child)) {
+ if (isConnectorVisibleToClient(child)) {
children.put(child.getConnectorId());
}
}
@@ -1042,7 +1041,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
}
SystemMessages ci = request.getService().getSystemMessages(
- ui.getLocale());
+ ui.getLocale(), request);
// meta instruction for client to enable auto-forward to
// sessionExpiredURL after timer expires.
@@ -1332,7 +1331,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
*/
private void writePerformanceData(final PrintWriter outWriter) {
outWriter.write(String.format(", \"timings\":[%d, %d]",
- session.getTotalSessionTime(), session.getLastRequestTime()));
+ session.getCumulativeRequestDuration(), session.getLastRequestDuration()));
}
private void legacyPaint(PaintTarget paintTarget,
@@ -1402,53 +1401,59 @@ public abstract class AbstractCommunicationManager implements Serializable {
/**
* Checks if the connector is visible in context. For Components,
- * {@link #isVisible(Component)} is used. For other types of connectors, the
- * contextual visibility of its first Component ancestor is used. If no
- * Component ancestor is found, the connector is not visible.
+ * {@link #isComponentVisibleToClient(Component)} is used. For other types
+ * of connectors, the contextual visibility of its first Component ancestor
+ * is used. If no Component ancestor is found, the connector is not visible.
*
* @param connector
* The connector to check
* @return <code>true</code> if the connector is visible to the client,
* <code>false</code> otherwise
*/
- public static boolean isVisible(ClientConnector connector) {
+ public static boolean isConnectorVisibleToClient(ClientConnector connector) {
if (connector instanceof Component) {
- return isVisible((Component) connector);
+ return isComponentVisibleToClient((Component) connector);
} else {
ClientConnector parent = connector.getParent();
if (parent == null) {
return false;
} else {
- return isVisible(parent);
+ return isConnectorVisibleToClient(parent);
}
}
}
/**
- * Checks if the component is visible in context, i.e. returns false if the
- * child is hidden, the parent is hidden or the parent says the child should
- * not be rendered (using
- * {@link HasComponents#isComponentVisible(Component)}
+ * Checks if the component should be visible to the client. Returns false if
+ * the child should not be sent to the client, true otherwise.
*
* @param child
* The child to check
* @return true if the child is visible to the client, false otherwise
*/
- static boolean isVisible(Component child) {
+ public static boolean isComponentVisibleToClient(Component child) {
if (!child.isVisible()) {
return false;
}
-
HasComponents parent = child.getParent();
- if (parent == null) {
+
+ if (parent instanceof SelectiveRenderer) {
+ if (!((SelectiveRenderer) parent).isRendered(child)) {
+ return false;
+ }
+ }
+
+ if (parent != null) {
+ return isComponentVisibleToClient(parent);
+ } else {
if (child instanceof UI) {
- return child.isVisible();
+ // UI has no parent and visibility was checked above
+ return true;
} else {
+ // Component which is not attached to any UI
return false;
}
}
-
- return parent.isComponentVisible(child) && isVisible(parent);
}
private static class NullIterator<E> implements Iterator<E> {
@@ -1538,7 +1543,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
* @param session
* @return false if the XSRF is turned off, true otherwise
*/
- public boolean isXSRFEnabled(VaadinServiceSession session) {
+ public boolean isXSRFEnabled(VaadinSession session) {
return session.getConfiguration().isXsrfProtectionEnabled();
}
@@ -1552,9 +1557,9 @@ public abstract class AbstractCommunicationManager implements Serializable {
* @return true if successful, false if there was an inconsistency
*/
private boolean handleVariables(VaadinRequest request,
- VaadinResponse response, Callback callback,
- VaadinServiceSession session, UI uI) throws IOException,
- InvalidUIDLSecurityKeyException, JSONException {
+ VaadinResponse response, Callback callback, VaadinSession session,
+ UI uI) throws IOException, InvalidUIDLSecurityKeyException,
+ JSONException {
boolean success = true;
String changes = getRequestPayload(request);
@@ -1662,17 +1667,6 @@ public abstract class AbstractCommunicationManager implements Serializable {
final ClientConnector connector = getConnector(uI,
invocation.getConnectorId());
- if (connector == null) {
- getLogger().log(
- Level.WARNING,
- "RPC call to " + invocation.getInterfaceName()
- + "." + invocation.getMethodName()
- + " received for connector "
- + invocation.getConnectorId()
- + " but no such connector could be found");
- continue;
- }
-
if (!enabledConnectors.contains(connector)) {
if (invocation instanceof LegacyChangeVariablesInvocation) {
@@ -1790,8 +1784,9 @@ public abstract class AbstractCommunicationManager implements Serializable {
MethodInvocation invocation = parseInvocation(invocationJson,
previousInvocation, connectorTracker);
if (invocation != null) {
- // Can be null iff the invocation was a legacy invocation and it
- // was merged with the previous one
+ // Can be null if the invocation was a legacy invocation and it
+ // was merged with the previous one or if the invocation was
+ // rejected because of an error.
invocations.add(invocation);
previousInvocation = invocation;
}
@@ -1806,6 +1801,15 @@ public abstract class AbstractCommunicationManager implements Serializable {
String interfaceName = invocationJson.getString(1);
String methodName = invocationJson.getString(2);
+ if (connectorTracker.getConnector(connectorId) == null) {
+ getLogger().log(
+ Level.WARNING,
+ "RPC call to " + interfaceName + "." + methodName
+ + " received for connector " + connectorId
+ + " but no such connector could be found");
+ return null;
+ }
+
JSONArray parametersJson = invocationJson.getJSONArray(3);
if (LegacyChangeVariablesInvocation.isLegacyVariableChange(
@@ -1855,8 +1859,30 @@ public abstract class AbstractCommunicationManager implements Serializable {
String connectorId, String interfaceName, String methodName,
JSONArray parametersJson, ConnectorTracker connectorTracker)
throws JSONException {
+ ClientConnector connector = connectorTracker.getConnector(connectorId);
+
+ RpcManager rpcManager = connector.getRpcManager(interfaceName);
+ if (!(rpcManager instanceof ServerRpcManager)) {
+ /*
+ * Security: Don't even decode the json parameters if no RpcManager
+ * corresponding to the received method invocation has been
+ * registered.
+ */
+ getLogger().warning(
+ "Ignoring RPC call to " + interfaceName + "." + methodName
+ + " in connector " + connector.getClass().getName()
+ + "(" + connectorId
+ + ") as no RPC implementation is regsitered");
+ return null;
+ }
+
+ // Use interface from RpcManager instead of loading the class based on
+ // the string name to avoid problems with OSGi
+ Class<? extends ServerRpc> rpcInterface = ((ServerRpcManager<?>) rpcManager)
+ .getRpcInterface();
+
ServerRpcMethodInvocation invocation = new ServerRpcMethodInvocation(
- connectorId, interfaceName, methodName, parametersJson.length());
+ connectorId, rpcInterface, methodName, parametersJson.length());
Object[] parameters = new Object[parametersJson.length()];
Type[] declaredRpcMethodParameterTypes = invocation.getMethod()
@@ -1960,7 +1986,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
* @param m
* map from variable names to values
*/
- private void handleChangeVariablesError(VaadinServiceSession session,
+ private void handleChangeVariablesError(VaadinSession session,
Component owner, Throwable t, Map<String, Object> m) {
boolean handled = false;
ChangeVariablesErrorEvent errorEvent = new ChangeVariablesErrorEvent(
@@ -2198,7 +2224,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
ConnectorTracker connectorTracker) {
ArrayList<ClientConnector> dirtyConnectors = new ArrayList<ClientConnector>();
for (ClientConnector c : connectorTracker.getDirtyConnectors()) {
- if (isVisible(c)) {
+ if (isConnectorVisibleToClient(c)) {
dirtyConnectors.add(c);
}
}
@@ -2395,7 +2421,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
* @throws IOException
* if a handler throws an exception
*
- * @see VaadinServiceSession#addRequestHandler(RequestHandler)
+ * @see VaadinSession#addRequestHandler(RequestHandler)
* @see RequestHandler
*
* @since 7.0
@@ -2414,8 +2440,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
}
public void handleBrowserDetailsRequest(VaadinRequest request,
- VaadinResponse response, VaadinServiceSession session)
- throws IOException {
+ VaadinResponse response, VaadinSession session) throws IOException {
session.getLock().lock();
@@ -2450,8 +2475,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
}
}
- private UI getBrowserDetailsUI(VaadinRequest request,
- VaadinServiceSession session) {
+ private UI getBrowserDetailsUI(VaadinRequest request, VaadinSession session) {
VaadinService vaadinService = request.getService();
List<UIProvider> uiProviders = session.getUIProviders();
@@ -2613,7 +2637,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
public void serveDependencyResource(VaadinRequest request,
VaadinResponse response) throws IOException {
- String pathInfo = request.getRequestPathInfo();
+ String pathInfo = request.getPathInfo();
// + 2 to also remove beginning and ending slashes
String resourceName = pathInfo
.substring(ApplicationConstants.DEPENDENCY_RESOURCE_PREFIX
@@ -2706,8 +2730,8 @@ public abstract class AbstractCommunicationManager implements Serializable {
* @throws IOException
* @throws InvalidUIDLSecurityKeyException
*/
- public void handleFileUpload(VaadinServiceSession session,
- VaadinRequest request, VaadinResponse response) throws IOException,
+ public void handleFileUpload(VaadinSession session, VaadinRequest request,
+ VaadinResponse response) throws IOException,
InvalidUIDLSecurityKeyException {
/*
@@ -2715,7 +2739,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
* #createReceiverUrl
*/
- String pathInfo = request.getRequestPathInfo();
+ String pathInfo = request.getPathInfo();
// strip away part until the data we are interested starts
int startOfData = pathInfo
.indexOf(ServletPortletHelper.UPLOAD_URL_PREFIX)
@@ -2768,8 +2792,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
* @throws IOException
*/
public void handleHeartbeatRequest(VaadinRequest request,
- VaadinResponse response, VaadinServiceSession session)
- throws IOException {
+ VaadinResponse response, VaadinSession session) throws IOException {
UI ui = null;
try {
int uiId = Integer.parseInt(request
@@ -2779,7 +2802,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
// null-check below handles this as well
}
if (ui != null) {
- ui.setLastHeartbeatTime(System.currentTimeMillis());
+ ui.setLastHeartbeatTimestamp(System.currentTimeMillis());
} else {
response.sendError(HttpServletResponse.SC_NOT_FOUND, "UI not found");
}
diff --git a/server/src/com/vaadin/server/AbstractJavaScriptExtension.java b/server/src/com/vaadin/server/AbstractJavaScriptExtension.java
index 1f67631203..af814e6c19 100644
--- a/server/src/com/vaadin/server/AbstractJavaScriptExtension.java
+++ b/server/src/com/vaadin/server/AbstractJavaScriptExtension.java
@@ -17,6 +17,7 @@
package com.vaadin.server;
import com.vaadin.shared.JavaScriptExtensionState;
+import com.vaadin.shared.communication.ServerRpc;
import com.vaadin.ui.JavaScriptFunction;
/**
@@ -125,7 +126,8 @@ public abstract class AbstractJavaScriptExtension extends AbstractExtension {
this);
@Override
- protected <T> void registerRpc(T implementation, Class<T> rpcInterfaceType) {
+ protected <T extends ServerRpc> void registerRpc(T implementation,
+ Class<T> rpcInterfaceType) {
super.registerRpc(implementation, rpcInterfaceType);
callbackHelper.registerRpc(rpcInterfaceType);
}
diff --git a/server/src/com/vaadin/server/AddonContext.java b/server/src/com/vaadin/server/AddonContext.java
index 3465e16960..088366c541 100644
--- a/server/src/com/vaadin/server/AddonContext.java
+++ b/server/src/com/vaadin/server/AddonContext.java
@@ -111,7 +111,7 @@ public class AddonContext implements Serializable {
* Shorthand for adding a bootstrap listener that will be added to every new
* service session.
*
- * @see VaadinServiceSession#addBootstrapListener(BootstrapListener)
+ * @see VaadinSession#addBootstrapListener(BootstrapListener)
*
* @param listener
* the bootstrap listener that should be added to all new
diff --git a/server/src/com/vaadin/server/BootstrapFragmentResponse.java b/server/src/com/vaadin/server/BootstrapFragmentResponse.java
index 0df99e04e2..09d443ce30 100644
--- a/server/src/com/vaadin/server/BootstrapFragmentResponse.java
+++ b/server/src/com/vaadin/server/BootstrapFragmentResponse.java
@@ -37,7 +37,7 @@ public class BootstrapFragmentResponse extends BootstrapResponse {
* Crate a new bootstrap fragment response.
*
* @see BootstrapResponse#BootstrapResponse(BootstrapHandler, VaadinRequest,
- * VaadinServiceSession, Class)
+ * VaadinSession, Class)
*
* @param handler
* the bootstrap handler that is firing the event
@@ -56,7 +56,7 @@ public class BootstrapFragmentResponse extends BootstrapResponse {
* the UI provider for the bootstrap
*/
public BootstrapFragmentResponse(BootstrapHandler handler,
- VaadinRequest request, VaadinServiceSession session,
+ VaadinRequest request, VaadinSession session,
Class<? extends UI> uiClass, List<Node> fragmentNodes,
UIProvider uiProvider) {
super(handler, request, session, uiClass, uiProvider);
diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java
index df0ace78db..1ab4390351 100644
--- a/server/src/com/vaadin/server/BootstrapHandler.java
+++ b/server/src/com/vaadin/server/BootstrapHandler.java
@@ -76,7 +76,7 @@ public abstract class BootstrapHandler implements RequestHandler {
return bootstrapResponse.getRequest();
}
- public VaadinServiceSession getSession() {
+ public VaadinSession getSession() {
return bootstrapResponse.getSession();
}
@@ -113,8 +113,8 @@ public abstract class BootstrapHandler implements RequestHandler {
}
@Override
- public boolean handleRequest(VaadinServiceSession session,
- VaadinRequest request, VaadinResponse response) throws IOException {
+ public boolean handleRequest(VaadinSession session, VaadinRequest request,
+ VaadinResponse response) throws IOException {
try {
List<UIProvider> uiProviders = session.getUIProviders();
@@ -393,7 +393,7 @@ public abstract class BootstrapHandler implements RequestHandler {
protected JSONObject getApplicationParameters(BootstrapContext context)
throws JSONException, PaintException {
VaadinRequest request = context.getRequest();
- VaadinServiceSession session = context.getSession();
+ VaadinSession session = context.getSession();
VaadinService vaadinService = request.getService();
JSONObject appConfig = new JSONObject();
@@ -413,7 +413,8 @@ public abstract class BootstrapHandler implements RequestHandler {
Locale locale = ServletPortletHelper.findLocale(null,
context.getSession(), context.getRequest());
// Get system messages
- SystemMessages systemMessages = vaadinService.getSystemMessages(locale);
+ SystemMessages systemMessages = vaadinService.getSystemMessages(locale,
+ request);
if (systemMessages != null) {
// Write the CommunicationError -message to client
JSONObject comErrMsg = new JSONObject();
@@ -433,6 +434,15 @@ public abstract class BootstrapHandler implements RequestHandler {
authErrMsg.put("url", systemMessages.getAuthenticationErrorURL());
appConfig.put("authErrMsg", authErrMsg);
+
+ JSONObject sessExpMsg = new JSONObject();
+ sessExpMsg
+ .put("caption", systemMessages.getSessionExpiredCaption());
+ sessExpMsg
+ .put("message", systemMessages.getSessionExpiredMessage());
+ sessExpMsg.put("url", systemMessages.getSessionExpiredURL());
+
+ appConfig.put("sessExpMsg", sessExpMsg);
}
// getStaticFileLocation documented to never end with a slash
diff --git a/server/src/com/vaadin/server/BootstrapPageResponse.java b/server/src/com/vaadin/server/BootstrapPageResponse.java
index 3c368764cc..19afca0e83 100644
--- a/server/src/com/vaadin/server/BootstrapPageResponse.java
+++ b/server/src/com/vaadin/server/BootstrapPageResponse.java
@@ -39,7 +39,7 @@ public class BootstrapPageResponse extends BootstrapResponse {
* Crate a new bootstrap page response.
*
* @see BootstrapResponse#BootstrapResponse(BootstrapHandler, VaadinRequest,
- * VaadinServiceSession, Class)
+ * VaadinSession, Class)
*
* @param handler
* the bootstrap handler that is firing the event
@@ -59,7 +59,7 @@ public class BootstrapPageResponse extends BootstrapResponse {
* the UI provider for the bootstrap
*/
public BootstrapPageResponse(BootstrapHandler handler,
- VaadinRequest request, VaadinServiceSession session,
+ VaadinRequest request, VaadinSession session,
Class<? extends UI> uiClass, Document document,
Map<String, Object> headers, UIProvider uiProvider) {
super(handler, request, session, uiClass, uiProvider);
diff --git a/server/src/com/vaadin/server/BootstrapResponse.java b/server/src/com/vaadin/server/BootstrapResponse.java
index e8ddd19569..15c7c9e048 100644
--- a/server/src/com/vaadin/server/BootstrapResponse.java
+++ b/server/src/com/vaadin/server/BootstrapResponse.java
@@ -29,7 +29,7 @@ import com.vaadin.ui.UI;
*/
public abstract class BootstrapResponse extends EventObject {
private final VaadinRequest request;
- private final VaadinServiceSession session;
+ private final VaadinSession session;
private final Class<? extends UI> uiClass;
private final UIProvider uiProvider;
@@ -49,7 +49,7 @@ public abstract class BootstrapResponse extends EventObject {
* the UI provider for the bootstrap
*/
public BootstrapResponse(BootstrapHandler handler, VaadinRequest request,
- VaadinServiceSession session, Class<? extends UI> uiClass,
+ VaadinSession session, Class<? extends UI> uiClass,
UIProvider uiProvider) {
super(handler);
this.request = request;
@@ -86,7 +86,7 @@ public abstract class BootstrapResponse extends EventObject {
*
* @return the Vaadin service session
*/
- public VaadinServiceSession getSession() {
+ public VaadinSession getSession() {
return session;
}
diff --git a/server/src/com/vaadin/server/BrowserPopupUIProvider.java b/server/src/com/vaadin/server/BrowserPopupUIProvider.java
index 23036dabed..6259fb605d 100644
--- a/server/src/com/vaadin/server/BrowserPopupUIProvider.java
+++ b/server/src/com/vaadin/server/BrowserPopupUIProvider.java
@@ -40,7 +40,7 @@ public class BrowserPopupUIProvider extends UIProvider {
@Override
public Class<? extends UI> getUIClass(UIClassSelectionEvent event) {
- String requestPathInfo = event.getRequest().getRequestPathInfo();
+ String requestPathInfo = event.getRequest().getPathInfo();
if (path.equals(requestPathInfo)) {
return uiClass;
} else {
diff --git a/server/src/com/vaadin/server/ClientConnector.java b/server/src/com/vaadin/server/ClientConnector.java
index b38f2a9037..b46ef58fcd 100644
--- a/server/src/com/vaadin/server/ClientConnector.java
+++ b/server/src/com/vaadin/server/ClientConnector.java
@@ -36,7 +36,7 @@ import com.vaadin.ui.UI;
* @since 7.0.0
*
*/
-public interface ClientConnector extends Connector, RpcTarget {
+public interface ClientConnector extends Connector {
/**
* Returns the list of pending server to client RPC calls and clears the
* list.
@@ -239,4 +239,14 @@ public interface ClientConnector extends Connector, RpcTarget {
*/
public boolean handleConnectorRequest(VaadinRequest request,
VaadinResponse response, String path) throws IOException;
+
+ /**
+ * Returns the RPC manager instance to use when receiving calls for an RPC
+ * interface.
+ *
+ * @param rpcInterfaceName
+ * name of the interface for which the call was made
+ * @return RpcManager or null if none found for the interface
+ */
+ public RpcManager getRpcManager(String rpcInterfaceName);
}
diff --git a/server/src/com/vaadin/server/CommunicationManager.java b/server/src/com/vaadin/server/CommunicationManager.java
index 6cfaf37092..6d60789be7 100644
--- a/server/src/com/vaadin/server/CommunicationManager.java
+++ b/server/src/com/vaadin/server/CommunicationManager.java
@@ -44,7 +44,7 @@ public class CommunicationManager extends AbstractCommunicationManager {
*
* @param session
*/
- public CommunicationManager(VaadinServiceSession session) {
+ public CommunicationManager(VaadinSession session) {
super(session);
}
@@ -53,7 +53,7 @@ public class CommunicationManager extends AbstractCommunicationManager {
return new BootstrapHandler() {
@Override
protected String getServiceUrl(BootstrapContext context) {
- String pathInfo = context.getRequest().getRequestPathInfo();
+ String pathInfo = context.getRequest().getPathInfo();
if (pathInfo == null) {
return null;
} else {
diff --git a/server/src/com/vaadin/server/ConnectorResourceHandler.java b/server/src/com/vaadin/server/ConnectorResourceHandler.java
index dc112a2d5b..5cd218471c 100644
--- a/server/src/com/vaadin/server/ConnectorResourceHandler.java
+++ b/server/src/com/vaadin/server/ConnectorResourceHandler.java
@@ -24,9 +24,9 @@ public class ConnectorResourceHandler implements RequestHandler {
}
@Override
- public boolean handleRequest(VaadinServiceSession session,
- VaadinRequest request, VaadinResponse response) throws IOException {
- String requestPath = request.getRequestPathInfo();
+ public boolean handleRequest(VaadinSession session, VaadinRequest request,
+ VaadinResponse response) throws IOException {
+ String requestPath = request.getPathInfo();
if (requestPath == null) {
return false;
}
@@ -43,7 +43,7 @@ public class ConnectorResourceHandler implements RequestHandler {
}
UI.setCurrent(ui);
- VaadinServiceSession.setCurrent(ui.getSession());
+ VaadinSession.setCurrent(ui.getSession());
ClientConnector connector = ui.getConnectorTracker().getConnector(
cid);
@@ -80,7 +80,7 @@ public class ConnectorResourceHandler implements RequestHandler {
VaadinResponse response, String logMessage) throws IOException {
getLogger().log(Level.WARNING, logMessage);
response.sendError(HttpServletResponse.SC_NOT_FOUND,
- request.getRequestPathInfo() + " can not be found");
+ request.getPathInfo() + " can not be found");
// Request handled (though not in a nice way)
return true;
diff --git a/server/src/com/vaadin/server/Constants.java b/server/src/com/vaadin/server/Constants.java
index b6bfcc0495..faf24b4bce 100644
--- a/server/src/com/vaadin/server/Constants.java
+++ b/server/src/com/vaadin/server/Constants.java
@@ -62,7 +62,7 @@ public interface Constants {
static final String SERVLET_PARAMETER_DISABLE_XSRF_PROTECTION = "disable-xsrf-protection";
static final String SERVLET_PARAMETER_RESOURCE_CACHE_TIME = "resourceCacheTime";
static final String SERVLET_PARAMETER_HEARTBEAT_INTERVAL = "heartbeatInterval";
- static final String SERVLET_PARAMETER_CLOSE_IDLE_UIS = "closeIdleUIs";
+ static final String SERVLET_PARAMETER_CLOSE_IDLE_SESSIONS = "closeIdleSessions";
static final String SERVLET_PARAMETER_UI_PROVIDER = "UIProvider";
// Configurable parameter names
diff --git a/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java b/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java
index 985ae16f28..13218f6e45 100644
--- a/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java
+++ b/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java
@@ -19,7 +19,6 @@ package com.vaadin.server;
import java.util.Properties;
import java.util.logging.Logger;
-
/**
* The default implementation of {@link DeploymentConfiguration} based on a base
* class for resolving system properties and a set of init parameters.
@@ -33,7 +32,7 @@ public class DefaultDeploymentConfiguration implements DeploymentConfiguration {
private boolean xsrfProtectionEnabled;
private int resourceCacheTime;
private int heartbeatInterval;
- private boolean idleUICleanupEnabled;
+ private boolean closeIdleSessions;
private final Class<?> systemPropertyBaseClass;
/**
@@ -55,7 +54,7 @@ public class DefaultDeploymentConfiguration implements DeploymentConfiguration {
checkXsrfProtection();
checkResourceCacheTime();
checkHeartbeatInterval();
- checkIdleUICleanup();
+ checkCloseIdleSessions();
}
@Override
@@ -169,8 +168,8 @@ public class DefaultDeploymentConfiguration implements DeploymentConfiguration {
}
@Override
- public boolean isIdleUICleanupEnabled() {
- return idleUICleanupEnabled;
+ public boolean isCloseIdleSessions() {
+ return closeIdleSessions;
}
/**
@@ -226,10 +225,10 @@ public class DefaultDeploymentConfiguration implements DeploymentConfiguration {
}
}
- private void checkIdleUICleanup() {
- idleUICleanupEnabled = getApplicationOrSystemProperty(
- Constants.SERVLET_PARAMETER_CLOSE_IDLE_UIS, "false").equals(
- "true");
+ private void checkCloseIdleSessions() {
+ closeIdleSessions = getApplicationOrSystemProperty(
+ Constants.SERVLET_PARAMETER_CLOSE_IDLE_SESSIONS, "false")
+ .equals("true");
}
private Logger getLogger() {
diff --git a/server/src/com/vaadin/server/DefaultErrorListener.java b/server/src/com/vaadin/server/DefaultErrorListener.java
index f007bdad63..71fccf8d0c 100644
--- a/server/src/com/vaadin/server/DefaultErrorListener.java
+++ b/server/src/com/vaadin/server/DefaultErrorListener.java
@@ -20,10 +20,9 @@ import java.net.SocketException;
import java.util.logging.Level;
import java.util.logging.Logger;
-import com.vaadin.server.Terminal.ErrorEvent;
import com.vaadin.ui.AbstractComponent;
-public class DefaultErrorListener implements Terminal.ErrorListener {
+public class DefaultErrorListener implements ErrorListener {
@Override
public void terminalError(ErrorEvent event) {
doDefault(event);
diff --git a/server/src/com/vaadin/server/DefaultSystemMessagesProvider.java b/server/src/com/vaadin/server/DefaultSystemMessagesProvider.java
index 08042d3848..7111a8bbbb 100644
--- a/server/src/com/vaadin/server/DefaultSystemMessagesProvider.java
+++ b/server/src/com/vaadin/server/DefaultSystemMessagesProvider.java
@@ -16,7 +16,6 @@
package com.vaadin.server;
-import java.util.Locale;
/**
* System messages provider using the built-in default system messages. This
@@ -34,7 +33,8 @@ public class DefaultSystemMessagesProvider implements SystemMessagesProvider {
}
@Override
- public SystemMessages getSystemMessages(Locale locale) {
+ public SystemMessages getSystemMessages(
+ SystemMessagesInfo systemMessagesInfo) {
return ServletPortletHelper.DEFAULT_SYSTEM_MESSAGES;
}
diff --git a/server/src/com/vaadin/server/DefaultUIProvider.java b/server/src/com/vaadin/server/DefaultUIProvider.java
index e02e5dc860..919f781d3d 100644
--- a/server/src/com/vaadin/server/DefaultUIProvider.java
+++ b/server/src/com/vaadin/server/DefaultUIProvider.java
@@ -27,8 +27,8 @@ public class DefaultUIProvider extends UIProvider {
Object uiClassNameObj = request
.getService()
.getDeploymentConfiguration()
- .getApplicationOrSystemProperty(
- VaadinServiceSession.UI_PARAMETER, null);
+ .getApplicationOrSystemProperty(VaadinSession.UI_PARAMETER,
+ null);
if (uiClassNameObj instanceof String) {
String uiClassName = uiClassNameObj.toString();
diff --git a/server/src/com/vaadin/server/DeploymentConfiguration.java b/server/src/com/vaadin/server/DeploymentConfiguration.java
index 09405d6004..65f0393883 100644
--- a/server/src/com/vaadin/server/DeploymentConfiguration.java
+++ b/server/src/com/vaadin/server/DeploymentConfiguration.java
@@ -58,19 +58,24 @@ public interface DeploymentConfiguration extends Serializable {
public int getHeartbeatInterval();
/**
- * Returns whether UIs that have no other activity than heartbeat requests
- * should be removed from the session after they have been idle the maximum
- * inactivity time enforced by the session.
+ * Returns whether a session should be closed when all its open UIs have
+ * been idle for longer than its configured maximum inactivity time.
+ * <p>
+ * A UI is idle if it is open on the client side but has no activity other
+ * than heartbeat requests. If {@code isCloseIdleSessions() == false},
+ * heartbeat requests cause the session to stay open for as long as there
+ * are open UIs on the client side. If it is {@code true}, the session is
+ * eventually closed if the open UIs do not have any user interaction.
*
* @see WrappedSession#getMaxInactiveInterval()
*
* @since 7.0.0
*
- * @return True if UIs receiving only heartbeat requests are eventually
- * removed; false if heartbeat requests extend UI lifetime
- * indefinitely.
+ * @return True if UIs and sessions receiving only heartbeat requests are
+ * eventually closed; false if heartbeat requests extend UI and
+ * session lifetime indefinitely.
*/
- public boolean isIdleUICleanupEnabled();
+ public boolean isCloseIdleSessions();
/**
* Gets the properties configured for the deployment, e.g. as init
diff --git a/server/src/com/vaadin/server/DragAndDropService.java b/server/src/com/vaadin/server/DragAndDropService.java
index 69ab997b18..a864f8fb16 100644
--- a/server/src/com/vaadin/server/DragAndDropService.java
+++ b/server/src/com/vaadin/server/DragAndDropService.java
@@ -252,7 +252,7 @@ public class DragAndDropService implements VariableOwner, ClientConnector {
}
@Override
- public RpcManager getRpcManager(Class<?> rpcInterface) {
+ public RpcManager getRpcManager(String interfaceName) {
// TODO Use rpc for drag'n'drop
return null;
}
diff --git a/server/src/com/vaadin/server/ErrorEvent.java b/server/src/com/vaadin/server/ErrorEvent.java
new file mode 100644
index 0000000000..b570271cf7
--- /dev/null
+++ b/server/src/com/vaadin/server/ErrorEvent.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.server;
+
+import java.io.Serializable;
+
+/**
+ * An error event implementation for Terminal.
+ */
+public interface ErrorEvent extends Serializable {
+
+ /**
+ * Gets the contained throwable, the cause of the error.
+ */
+ public Throwable getThrowable();
+
+} \ No newline at end of file
diff --git a/server/src/com/vaadin/server/RpcTarget.java b/server/src/com/vaadin/server/ErrorListener.java
index c491707995..07400852e0 100644
--- a/server/src/com/vaadin/server/RpcTarget.java
+++ b/server/src/com/vaadin/server/ErrorListener.java
@@ -1,38 +1,32 @@
/*
* Copyright 2011 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
-
package com.vaadin.server;
import java.io.Serializable;
/**
- * Marker interface for server side classes that can receive RPC calls.
- *
- * This plays a role similar to that of {@link VariableOwner}.
- *
- * @since 7.0
+ * Interface for listening to Terminal errors.
*/
-public interface RpcTarget extends Serializable {
+public interface ErrorListener extends Serializable {
+
/**
- * Returns the RPC manager instance to use when receiving calls for an RPC
- * interface.
+ * Invoked when a terminal error occurs.
*
- * @param rpcInterface
- * interface for which the call was made
- * @return RpcManager or null if none found for the interface
+ * @param event
+ * the fired event.
*/
- public RpcManager getRpcManager(Class<?> rpcInterface);
-}
+ public void terminalError(ErrorEvent event);
+} \ No newline at end of file
diff --git a/server/src/com/vaadin/server/FileResource.java b/server/src/com/vaadin/server/FileResource.java
index ec3f775d00..c413bb471d 100644
--- a/server/src/com/vaadin/server/FileResource.java
+++ b/server/src/com/vaadin/server/FileResource.java
@@ -20,7 +20,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import com.vaadin.server.Terminal.ErrorEvent;
import com.vaadin.util.FileTypeResolver;
/**
@@ -73,7 +72,7 @@ public class FileResource implements ConnectorResource {
return ds;
} catch (final FileNotFoundException e) {
// Log the exception using the application error handler
- VaadinServiceSession.getCurrent().getErrorHandler()
+ VaadinSession.getCurrent().getErrorHandler()
.terminalError(new ErrorEvent() {
@Override
diff --git a/server/src/com/vaadin/server/GAEVaadinServlet.java b/server/src/com/vaadin/server/GAEVaadinServlet.java
index d2c53c6fcb..e493c9546d 100644
--- a/server/src/com/vaadin/server/GAEVaadinServlet.java
+++ b/server/src/com/vaadin/server/GAEVaadinServlet.java
@@ -240,7 +240,7 @@ public class GAEVaadinServlet extends VaadinServlet {
}
// de-serialize or create application context, store in session
- VaadinServiceSession ctx = getApplicationContext(request, memcache);
+ VaadinSession ctx = getApplicationContext(request, memcache);
super.service(request, response);
@@ -290,9 +290,8 @@ public class GAEVaadinServlet extends VaadinServlet {
}
}
- protected VaadinServiceSession getApplicationContext(
- HttpServletRequest request, MemcacheService memcache)
- throws ServletException {
+ protected VaadinSession getApplicationContext(HttpServletRequest request,
+ MemcacheService memcache) throws ServletException {
HttpSession session = request.getSession();
String id = AC_BASE + session.getId();
byte[] serializedAC = (byte[]) memcache.get(id);
@@ -320,7 +319,7 @@ public class GAEVaadinServlet extends VaadinServlet {
ObjectInputStream ois;
try {
ois = new ObjectInputStream(bais);
- VaadinServiceSession applicationContext = (VaadinServiceSession) ois
+ VaadinSession applicationContext = (VaadinSession) ois
.readObject();
applicationContext.storeInSession(getService(),
new WrappedHttpSession(session));
@@ -367,8 +366,8 @@ public class GAEVaadinServlet extends VaadinServlet {
if (wrappedSession == null) {
return;
}
- VaadinServiceSession serviceSession = VaadinServiceSession
- .getForSession(getService(), wrappedSession);
+ VaadinSession serviceSession = VaadinSession.getForSession(
+ getService(), wrappedSession);
if (serviceSession == null) {
return;
}
diff --git a/server/src/com/vaadin/server/GlobalResourceHandler.java b/server/src/com/vaadin/server/GlobalResourceHandler.java
index 4ba3e25e28..119f9cdae0 100644
--- a/server/src/com/vaadin/server/GlobalResourceHandler.java
+++ b/server/src/com/vaadin/server/GlobalResourceHandler.java
@@ -66,9 +66,9 @@ public class GlobalResourceHandler implements RequestHandler {
"");
@Override
- public boolean handleRequest(VaadinServiceSession session,
- VaadinRequest request, VaadinResponse response) throws IOException {
- String pathInfo = request.getRequestPathInfo();
+ public boolean handleRequest(VaadinSession session, VaadinRequest request,
+ VaadinResponse response) throws IOException {
+ String pathInfo = request.getPathInfo();
if (pathInfo == null) {
return false;
}
@@ -229,7 +229,7 @@ public class GlobalResourceHandler implements RequestHandler {
VaadinResponse response, String logMessage) throws IOException {
getLogger().log(Level.WARNING, logMessage);
response.sendError(HttpServletResponse.SC_NOT_FOUND,
- request.getRequestPathInfo() + " can not be found");
+ request.getPathInfo() + " can not be found");
// Request handled (though not in a nice way)
return true;
diff --git a/server/src/com/vaadin/server/JsonCodec.java b/server/src/com/vaadin/server/JsonCodec.java
index 55e0fd69ed..89ef060ef0 100644
--- a/server/src/com/vaadin/server/JsonCodec.java
+++ b/server/src/com/vaadin/server/JsonCodec.java
@@ -654,7 +654,7 @@ public class JsonCodec implements Serializable {
Connector connector = (Connector) value;
if (value instanceof Component
&& !(AbstractCommunicationManager
- .isVisible((Component) value))) {
+ .isComponentVisibleToClient((Component) value))) {
return encodeNull();
}
return new EncodeResult(connector.getConnectorId());
@@ -847,7 +847,7 @@ public class JsonCodec implements Serializable {
for (Entry<?, ?> entry : map.entrySet()) {
ClientConnector key = (ClientConnector) entry.getKey();
- if (AbstractCommunicationManager.isVisible(key)) {
+ if (AbstractCommunicationManager.isConnectorVisibleToClient(key)) {
EncodeResult encodedValue = encode(entry.getValue(), null,
valueType, connectorTracker);
jsonMap.put(key.getConnectorId(),
diff --git a/server/src/com/vaadin/server/LegacyApplication.java b/server/src/com/vaadin/server/LegacyApplication.java
index 6ac7ad2e0c..6307b9f0c2 100644
--- a/server/src/com/vaadin/server/LegacyApplication.java
+++ b/server/src/com/vaadin/server/LegacyApplication.java
@@ -23,8 +23,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
-import com.vaadin.server.Terminal.ErrorEvent;
-import com.vaadin.server.Terminal.ErrorListener;
import com.vaadin.ui.LegacyWindow;
import com.vaadin.ui.UI;
@@ -81,7 +79,7 @@ public abstract class LegacyApplication implements ErrorListener {
public void doInit(URL url) {
this.url = url;
- VaadinServiceSession.getCurrent().setErrorHandler(this);
+ VaadinSession.getCurrent().setErrorHandler(this);
init();
}
@@ -108,7 +106,7 @@ public abstract class LegacyApplication implements ErrorListener {
* Sets the application's theme.
* <p>
* Note that this theme can be overridden for a specific UI with
- * {@link VaadinServiceSession#getThemeForUI(UI)}. Setting theme to be
+ * {@link VaadinSession#getThemeForUI(UI)}. Setting theme to be
* <code>null</code> selects the default theme. For the available theme
* names, see the contents of the VAADIN/themes directory.
* </p>
@@ -172,7 +170,7 @@ public abstract class LegacyApplication implements ErrorListener {
uI.setApplication(this);
legacyUINames.put(uI.getName(), uI);
- uI.setSession(VaadinServiceSession.getCurrent());
+ uI.setSession(VaadinSession.getCurrent());
}
/**
@@ -214,8 +212,8 @@ public abstract class LegacyApplication implements ErrorListener {
DefaultErrorListener.doDefault(event);
}
- public VaadinServiceSession getContext() {
- return VaadinServiceSession.getCurrent();
+ public VaadinSession getContext() {
+ return VaadinSession.getCurrent();
}
public void close() {
diff --git a/server/src/com/vaadin/server/LegacyApplicationUIProvider.java b/server/src/com/vaadin/server/LegacyApplicationUIProvider.java
index 467e1c4a5e..d139ee19f6 100644
--- a/server/src/com/vaadin/server/LegacyApplicationUIProvider.java
+++ b/server/src/com/vaadin/server/LegacyApplicationUIProvider.java
@@ -76,7 +76,7 @@ public abstract class LegacyApplicationUIProvider extends UIProvider {
private UI getUIInstance(UIProviderEvent event) {
VaadinRequest request = event.getRequest();
- String pathInfo = request.getRequestPathInfo();
+ String pathInfo = request.getPathInfo();
String name = null;
if (pathInfo != null && pathInfo.length() > 0) {
Matcher matcher = WINDOW_NAME_PATTERN.matcher(pathInfo);
@@ -117,15 +117,15 @@ public abstract class LegacyApplicationUIProvider extends UIProvider {
}
private LegacyApplication getApplication() {
- LegacyApplication application = VaadinServiceSession.getCurrent()
+ LegacyApplication application = VaadinSession.getCurrent()
.getAttribute(LegacyApplication.class);
if (application == null) {
application = createApplication();
if (application == null) {
return null;
}
- VaadinServiceSession.getCurrent().setAttribute(
- LegacyApplication.class, application);
+ VaadinSession.getCurrent().setAttribute(LegacyApplication.class,
+ application);
URL applicationUrl;
try {
@@ -138,8 +138,8 @@ public abstract class LegacyApplicationUIProvider extends UIProvider {
}
if (application != null && !application.isRunning()) {
- VaadinServiceSession.getCurrent().setAttribute(
- LegacyApplication.class, null);
+ VaadinSession.getCurrent().setAttribute(LegacyApplication.class,
+ null);
// Run again without a current application
return getApplication();
}
diff --git a/server/src/com/vaadin/server/LegacyPaint.java b/server/src/com/vaadin/server/LegacyPaint.java
index 971aec682f..17c02955f4 100644
--- a/server/src/com/vaadin/server/LegacyPaint.java
+++ b/server/src/com/vaadin/server/LegacyPaint.java
@@ -19,7 +19,6 @@ import java.io.Serializable;
import com.vaadin.server.PaintTarget.PaintStatus;
import com.vaadin.ui.Component;
-import com.vaadin.ui.HasComponents;
import com.vaadin.ui.LegacyComponent;
public class LegacyPaint implements Serializable {
@@ -51,7 +50,7 @@ public class LegacyPaint implements Serializable {
public static void paint(Component component, PaintTarget target)
throws PaintException {
// Only paint content of visible components.
- if (!isVisibleInContext(component)) {
+ if (!AbstractCommunicationManager.isComponentVisibleToClient(component)) {
return;
}
@@ -65,34 +64,9 @@ public class LegacyPaint implements Serializable {
if (component instanceof LegacyComponent) {
((LegacyComponent) component).paintContent(target);
}
-
}
target.endPaintable(component);
}
- /**
- * Checks if the component is visible and its parent is visible,
- * recursively.
- * <p>
- * This is only a helper until paint is moved away from this class.
- *
- * @return
- */
- protected static boolean isVisibleInContext(Component c) {
- HasComponents p = c.getParent();
- while (p != null) {
- if (!p.isVisible()) {
- return false;
- }
- p = p.getParent();
- }
- if (c.getParent() != null && !c.getParent().isComponentVisible(c)) {
- return false;
- }
-
- // All parents visible, return this state
- return c.isVisible();
- }
-
}
diff --git a/server/src/com/vaadin/server/LegacyVaadinPortlet.java b/server/src/com/vaadin/server/LegacyVaadinPortlet.java
index 92079653c7..23bf9c9263 100644
--- a/server/src/com/vaadin/server/LegacyVaadinPortlet.java
+++ b/server/src/com/vaadin/server/LegacyVaadinPortlet.java
@@ -20,7 +20,6 @@ import javax.portlet.PortletConfig;
import javax.portlet.PortletException;
import javax.portlet.PortletRequest;
-
public class LegacyVaadinPortlet extends VaadinPortlet {
private static final LegacyApplicationUIProvider provider = new LegacyApplicationUIProvider() {
diff --git a/server/src/com/vaadin/server/LegacyVaadinServlet.java b/server/src/com/vaadin/server/LegacyVaadinServlet.java
index 8ee10f5176..8951ee1f79 100644
--- a/server/src/com/vaadin/server/LegacyVaadinServlet.java
+++ b/server/src/com/vaadin/server/LegacyVaadinServlet.java
@@ -20,7 +20,6 @@ import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
-
public class LegacyVaadinServlet extends VaadinServlet {
private static final UIProvider provider = new LegacyApplicationUIProvider() {
@@ -87,7 +86,7 @@ public class LegacyVaadinServlet extends VaadinServlet {
}
private void onVaadinSessionStarted(VaadinRequest request,
- VaadinServiceSession session) throws ServletException {
+ VaadinSession session) throws ServletException {
session.addUIProvider(provider);
}
diff --git a/server/src/com/vaadin/server/Page.java b/server/src/com/vaadin/server/Page.java
index cf77c09324..501172f80a 100644
--- a/server/src/com/vaadin/server/Page.java
+++ b/server/src/com/vaadin/server/Page.java
@@ -436,15 +436,27 @@ public class Page implements Serializable {
public void init(VaadinRequest request) {
// Extract special parameter sent by vaadinBootstrap.js
- String loc = request.getParameter("loc");
- if (loc != null) {
+ String location = request.getParameter("loc");
+ String clientWidth = request.getParameter("cw");
+ String clientHeight = request.getParameter("ch");
+
+ if (location != null) {
try {
- location = new URI(loc);
+ this.location = new URI(location);
} catch (URISyntaxException e) {
throw new RuntimeException(
"Invalid location URI received from client", e);
}
}
+ if (clientWidth != null && clientHeight != null) {
+ try {
+ browserWindowWidth = Integer.parseInt(clientWidth);
+ browserWindowHeight = Integer.parseInt(clientHeight);
+ } catch (NumberFormatException e) {
+ throw new RuntimeException(
+ "Invalid window size received from client", e);
+ }
+ }
}
public WebBrowser getWebBrowser() {
diff --git a/server/src/com/vaadin/server/PortletCommunicationManager.java b/server/src/com/vaadin/server/PortletCommunicationManager.java
index 8b1b14e568..84d48fdf83 100644
--- a/server/src/com/vaadin/server/PortletCommunicationManager.java
+++ b/server/src/com/vaadin/server/PortletCommunicationManager.java
@@ -44,7 +44,7 @@ import com.vaadin.ui.UI;
@SuppressWarnings("serial")
public class PortletCommunicationManager extends AbstractCommunicationManager {
- public PortletCommunicationManager(VaadinServiceSession session) {
+ public PortletCommunicationManager(VaadinSession session) {
super(session);
}
@@ -52,7 +52,7 @@ public class PortletCommunicationManager extends AbstractCommunicationManager {
protected BootstrapHandler createBootstrapHandler() {
return new BootstrapHandler() {
@Override
- public boolean handleRequest(VaadinServiceSession session,
+ public boolean handleRequest(VaadinSession session,
VaadinRequest request, VaadinResponse response)
throws IOException {
PortletRequest portletRequest = ((VaadinPortletRequest) request)
diff --git a/server/src/com/vaadin/server/RequestHandler.java b/server/src/com/vaadin/server/RequestHandler.java
index ea5c25c9ea..861f587239 100644
--- a/server/src/com/vaadin/server/RequestHandler.java
+++ b/server/src/com/vaadin/server/RequestHandler.java
@@ -22,7 +22,7 @@ import java.io.Serializable;
/**
* Handler for producing a response to non-UIDL requests. Handlers can be added
* to service sessions using
- * {@link VaadinServiceSession#addRequestHandler(RequestHandler)}
+ * {@link VaadinSession#addRequestHandler(RequestHandler)}
*/
public interface RequestHandler extends Serializable {
@@ -41,7 +41,7 @@ public interface RequestHandler extends Serializable {
* handlers should be called, otherwise false
* @throws IOException
*/
- boolean handleRequest(VaadinServiceSession session, VaadinRequest request,
+ boolean handleRequest(VaadinSession session, VaadinRequest request,
VaadinResponse response) throws IOException;
}
diff --git a/server/src/com/vaadin/server/RequestTimer.java b/server/src/com/vaadin/server/RequestTimer.java
index 4ab855a0cb..bfe5362afe 100644
--- a/server/src/com/vaadin/server/RequestTimer.java
+++ b/server/src/com/vaadin/server/RequestTimer.java
@@ -43,13 +43,13 @@ public class RequestTimer implements Serializable {
*
* @param context
*/
- public void stop(VaadinServiceSession context) {
+ public void stop(VaadinSession context) {
// Measure and store the total handling time. This data can be
// used in TestBench 3 tests.
long time = (System.nanoTime() - requestStartTime) / 1000000;
// The timings must be stored in the context, since a new
// RequestTimer is created for every request.
- context.setLastRequestTime(time);
+ context.setLastRequestDuration(time);
}
}
diff --git a/server/src/com/vaadin/server/ServerRpcManager.java b/server/src/com/vaadin/server/ServerRpcManager.java
index 8ef165e084..c063761c7f 100644
--- a/server/src/com/vaadin/server/ServerRpcManager.java
+++ b/server/src/com/vaadin/server/ServerRpcManager.java
@@ -24,6 +24,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import com.vaadin.shared.Connector;
+import com.vaadin.shared.communication.ServerRpc;
/**
* Server side RPC manager that handles RPC calls coming from the client.
@@ -34,7 +35,7 @@ import com.vaadin.shared.Connector;
*
* @since 7.0
*/
-public class ServerRpcManager<T> implements RpcManager {
+public class ServerRpcManager<T extends ServerRpc> implements RpcManager {
private final T implementation;
private final Class<T> rpcInterface;
@@ -80,10 +81,10 @@ public class ServerRpcManager<T> implements RpcManager {
* method invocation to perform
* @throws RpcInvocationException
*/
- public static void applyInvocation(RpcTarget target,
+ public static void applyInvocation(ClientConnector target,
ServerRpcMethodInvocation invocation) throws RpcInvocationException {
- RpcManager manager = target.getRpcManager(invocation
- .getInterfaceClass());
+ RpcManager manager = target
+ .getRpcManager(invocation.getInterfaceName());
if (manager != null) {
manager.applyInvocation(invocation);
} else {
diff --git a/server/src/com/vaadin/server/ServerRpcMethodInvocation.java b/server/src/com/vaadin/server/ServerRpcMethodInvocation.java
index 761db687bb..3af58fa351 100644
--- a/server/src/com/vaadin/server/ServerRpcMethodInvocation.java
+++ b/server/src/com/vaadin/server/ServerRpcMethodInvocation.java
@@ -29,33 +29,20 @@ public class ServerRpcMethodInvocation extends MethodInvocation {
private final Method method;
- private Class<? extends ServerRpc> interfaceClass;
+ private final Class<? extends ServerRpc> interfaceClass;
- public ServerRpcMethodInvocation(String connectorId, String interfaceName,
- String methodName, int parameterCount) {
- super(connectorId, interfaceName, methodName);
+ public ServerRpcMethodInvocation(String connectorId,
+ Class<? extends ServerRpc> interfaceClass, String methodName,
+ int parameterCount) {
+ super(connectorId, interfaceClass.getName(), methodName);
+
+ assert ServerRpc.class.isAssignableFrom(interfaceClass);
+ this.interfaceClass = interfaceClass;
- interfaceClass = findClass();
method = findInvocationMethod(interfaceClass, methodName,
parameterCount);
}
- private Class<? extends ServerRpc> findClass() {
- try {
- Class<?> rpcInterface = Class.forName(getInterfaceName());
- if (!ServerRpc.class.isAssignableFrom(rpcInterface)) {
- throw new IllegalArgumentException("The interface "
- + getInterfaceName() + "is not a server RPC interface.");
- }
- return (Class<? extends ServerRpc>) rpcInterface;
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException("The server RPC interface "
- + getInterfaceName() + " could not be found", e);
- } finally {
-
- }
- }
-
public Class<? extends ServerRpc> getInterfaceClass() {
return interfaceClass;
}
diff --git a/server/src/com/vaadin/server/ServletPortletHelper.java b/server/src/com/vaadin/server/ServletPortletHelper.java
index 1bcfdf8692..07218f9abd 100644
--- a/server/src/com/vaadin/server/ServletPortletHelper.java
+++ b/server/src/com/vaadin/server/ServletPortletHelper.java
@@ -55,7 +55,7 @@ class ServletPortletHelper implements Serializable {
private static void verifyUIClass(String className, ClassLoader classLoader)
throws ServiceException {
if (className == null) {
- throw new ServiceException(VaadinServiceSession.UI_PARAMETER
+ throw new ServiceException(VaadinSession.UI_PARAMETER
+ " init parameter not defined");
}
@@ -79,7 +79,7 @@ class ServletPortletHelper implements Serializable {
}
private static boolean hasPathPrefix(VaadinRequest request, String prefix) {
- String pathInfo = request.getRequestPathInfo();
+ String pathInfo = request.getPathInfo();
if (pathInfo == null) {
return false;
@@ -119,11 +119,11 @@ class ServletPortletHelper implements Serializable {
ApplicationConstants.HEARTBEAT_REQUEST_PATH);
}
- public static void initDefaultUIProvider(VaadinServiceSession session,
+ public static void initDefaultUIProvider(VaadinSession session,
VaadinService vaadinService) throws ServiceException {
String uiProperty = vaadinService.getDeploymentConfiguration()
- .getApplicationOrSystemProperty(
- VaadinServiceSession.UI_PARAMETER, null);
+ .getApplicationOrSystemProperty(VaadinSession.UI_PARAMETER,
+ null);
// Add provider for UI parameter first to give it lower priority
// (providers are FILO)
@@ -165,13 +165,12 @@ class ServletPortletHelper implements Serializable {
}
}
- public static void checkUiProviders(VaadinServiceSession session,
+ public static void checkUiProviders(VaadinSession session,
VaadinService vaadinService) throws ServiceException {
if (session.getUIProviders().isEmpty()) {
throw new ServiceException(
"No UIProvider has been added and there is no \""
- + VaadinServiceSession.UI_PARAMETER
- + "\" init parameter.");
+ + VaadinSession.UI_PARAMETER + "\" init parameter.");
}
}
@@ -182,13 +181,13 @@ class ServletPortletHelper implements Serializable {
* <li>The passed component (or UI) if not null</li>
* <li>{@link UI#getCurrent()} if defined</li>
* <li>The passed session if not null</li>
- * <li>{@link VaadinServiceSession#getCurrent()} if defined</li>
+ * <li>{@link VaadinSession#getCurrent()} if defined</li>
* <li>The passed request if not null</li>
* <li>{@link VaadinService#getCurrentRequest()} if defined</li>
* <li>{@link Locale#getDefault()}</li>
* </ol>
*/
- static Locale findLocale(Component component, VaadinServiceSession session,
+ static Locale findLocale(Component component, VaadinSession session,
VaadinRequest request) {
if (component == null) {
component = UI.getCurrent();
@@ -201,7 +200,7 @@ class ServletPortletHelper implements Serializable {
}
if (session == null) {
- session = VaadinServiceSession.getCurrent();
+ session = VaadinSession.getCurrent();
}
if (session != null) {
Locale locale = session.getLocale();
diff --git a/server/src/com/vaadin/server/SessionDestroyEvent.java b/server/src/com/vaadin/server/SessionDestroyEvent.java
index c502ade7cb..25147a29a1 100644
--- a/server/src/com/vaadin/server/SessionDestroyEvent.java
+++ b/server/src/com/vaadin/server/SessionDestroyEvent.java
@@ -28,7 +28,7 @@ import java.util.EventObject;
*/
public class SessionDestroyEvent extends EventObject {
- private final VaadinServiceSession session;
+ private final VaadinSession session;
/**
* Creates a new event.
@@ -38,8 +38,7 @@ public class SessionDestroyEvent extends EventObject {
* @param session
* the Vaadin service session that is no longer used
*/
- public SessionDestroyEvent(VaadinService service,
- VaadinServiceSession session) {
+ public SessionDestroyEvent(VaadinService service, VaadinSession session) {
super(service);
this.session = session;
}
@@ -63,7 +62,7 @@ public class SessionDestroyEvent extends EventObject {
*
* @return the Vaadin service session
*/
- public VaadinServiceSession getSession() {
+ public VaadinSession getSession() {
return session;
}
diff --git a/server/src/com/vaadin/server/SessionInitEvent.java b/server/src/com/vaadin/server/SessionInitEvent.java
index a33e5fa8dd..7994ae23de 100644
--- a/server/src/com/vaadin/server/SessionInitEvent.java
+++ b/server/src/com/vaadin/server/SessionInitEvent.java
@@ -34,7 +34,7 @@ import java.util.EventObject;
*/
public class SessionInitEvent extends EventObject {
- private final VaadinServiceSession session;
+ private final VaadinSession session;
private final VaadinRequest request;
/**
@@ -47,8 +47,8 @@ public class SessionInitEvent extends EventObject {
* @param request
* the request that triggered the initialization
*/
- public SessionInitEvent(VaadinService service,
- VaadinServiceSession session, VaadinRequest request) {
+ public SessionInitEvent(VaadinService service, VaadinSession session,
+ VaadinRequest request) {
super(service);
this.session = session;
this.request = request;
@@ -73,7 +73,7 @@ public class SessionInitEvent extends EventObject {
*
* @return the Vaadin service session
*/
- public VaadinServiceSession getSession() {
+ public VaadinSession getSession() {
return session;
}
diff --git a/server/src/com/vaadin/server/StreamVariable.java b/server/src/com/vaadin/server/StreamVariable.java
index 3c20315b04..a75cc2f0d7 100644
--- a/server/src/com/vaadin/server/StreamVariable.java
+++ b/server/src/com/vaadin/server/StreamVariable.java
@@ -151,7 +151,7 @@ public interface StreamVariable extends Serializable {
* the streaming ended before the end of the input. The streaming may fail
* due an interruption by {@link } or due an other unknown exception in
* communication. In the latter case the exception is also passed to
- * {@link VaadinServiceSession#terminalError(com.vaadin.server.Terminal.ErrorEvent)}
+ * {@link VaadinSession#terminalError(com.vaadin.server.Terminal.ErrorEvent)}
* .
*/
public interface StreamingErrorEvent extends StreamingEvent {
diff --git a/server/src/com/vaadin/server/SystemMessages.java b/server/src/com/vaadin/server/SystemMessages.java
index 59cee3831e..f36a8e8570 100644
--- a/server/src/com/vaadin/server/SystemMessages.java
+++ b/server/src/com/vaadin/server/SystemMessages.java
@@ -22,9 +22,8 @@ import java.io.Serializable;
* Contains the system messages used to notify the user about various critical
* situations that can occur.
* <p>
- * Customize by overriding the static
- * {@link VaadinServiceSession#getSystemMessages()} and returning
- * {@link CustomizedSystemMessages}.
+ * Use {@link VaadinService#setSystemMessagesProvider(SystemMessagesProvider)}
+ * to customize.
* </p>
* <p>
* The defaults defined in this class are:
diff --git a/server/src/com/vaadin/server/SystemMessagesInfo.java b/server/src/com/vaadin/server/SystemMessagesInfo.java
new file mode 100644
index 0000000000..30a6e82a90
--- /dev/null
+++ b/server/src/com/vaadin/server/SystemMessagesInfo.java
@@ -0,0 +1,53 @@
+package com.vaadin.server;
+
+import java.io.Serializable;
+import java.util.Locale;
+
+public class SystemMessagesInfo implements Serializable {
+
+ private Locale locale;
+ private VaadinRequest request;
+ private VaadinService service;
+
+ /**
+ * The locale of the UI related to the {@link SystemMessages} request.
+ *
+ * @return The Locale or null if the locale is not known
+ */
+ public Locale getLocale() {
+ return locale;
+ }
+
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+ /**
+ * Gets the request currently in progress.
+ *
+ * @return The request currently in progress or null if no request is in
+ * progress.
+ */
+ public VaadinRequest getRequest() {
+ return request;
+ }
+
+ public void setRequest(VaadinRequest request) {
+ this.request = request;
+ }
+
+ /**
+ * Returns the service this SystemMessages request comes from.
+ *
+ * @return The service which triggered this request or null of not triggered
+ * from a service.
+ */
+ public VaadinService getService() {
+ return service;
+ }
+
+ public void setService(VaadinService service) {
+ this.service = service;
+ }
+
+}
diff --git a/server/src/com/vaadin/server/SystemMessagesProvider.java b/server/src/com/vaadin/server/SystemMessagesProvider.java
index 82d1014b9f..caef8de420 100644
--- a/server/src/com/vaadin/server/SystemMessagesProvider.java
+++ b/server/src/com/vaadin/server/SystemMessagesProvider.java
@@ -17,7 +17,6 @@
package com.vaadin.server;
import java.io.Serializable;
-import java.util.Locale;
import com.vaadin.ui.UI;
@@ -30,16 +29,16 @@ import com.vaadin.ui.UI;
*/
public interface SystemMessagesProvider extends Serializable {
/**
- * Gets the system messages to use in the given context. Locale is the only
- * piece of information guaranteed to be available, but in most cases some
- * or all of {@link VaadinService#getCurrent()},
- * {@link VaadinService#getCurrentRequest()},
- * {@link VaadinServiceSession#getCurrent()} and {@link UI#getCurrent()} can
- * also be used to find more information to help the decision.
+ * Gets the system messages to use in the given context. The
+ * {@link SystemMessagesInfo} object contains available information but in
+ * most cases some or both of {@link VaadinSession#getCurrent()} and
+ * {@link UI#getCurrent()} can also be used to find more information to help
+ * the decision.
*
- * @param locale
- * the desired locale of the system messages
+ * @param systemMessagesInfo
+ * Locale, current request and other information available.
* @return a system messages object
*/
- public SystemMessages getSystemMessages(Locale locale);
+ public SystemMessages getSystemMessages(
+ SystemMessagesInfo systemMessagesInfo);
}
diff --git a/server/src/com/vaadin/server/Terminal.java b/server/src/com/vaadin/server/Terminal.java
deleted file mode 100644
index 265668aa42..0000000000
--- a/server/src/com/vaadin/server/Terminal.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.server;
-
-import java.io.Serializable;
-
-/**
- * An interface that provides information about the user's terminal.
- * Implementors typically provide additional information using methods not in
- * this interface. </p>
- *
- * @author Vaadin Ltd.
- * @since 3.0
- * @deprecated Currently only a container for ErrorEvent and ErrorListener
- */
-@Deprecated
-public interface Terminal extends Serializable {
-
- /**
- * An error event implementation for Terminal.
- */
- public interface ErrorEvent extends Serializable {
-
- /**
- * Gets the contained throwable, the cause of the error.
- */
- public Throwable getThrowable();
-
- }
-
- /**
- * Interface for listening to Terminal errors.
- */
- public interface ErrorListener extends Serializable {
-
- /**
- * Invoked when a terminal error occurs.
- *
- * @param event
- * the fired event.
- */
- public void terminalError(Terminal.ErrorEvent event);
- }
-}
diff --git a/server/src/com/vaadin/server/UnsupportedBrowserHandler.java b/server/src/com/vaadin/server/UnsupportedBrowserHandler.java
index cd3498fd57..36796b84b2 100644
--- a/server/src/com/vaadin/server/UnsupportedBrowserHandler.java
+++ b/server/src/com/vaadin/server/UnsupportedBrowserHandler.java
@@ -34,8 +34,8 @@ public class UnsupportedBrowserHandler implements RequestHandler {
public static final String FORCE_LOAD_COOKIE = "vaadinforceload=1";
@Override
- public boolean handleRequest(VaadinServiceSession session,
- VaadinRequest request, VaadinResponse response) throws IOException {
+ public boolean handleRequest(VaadinSession session, VaadinRequest request,
+ VaadinResponse response) throws IOException {
// Check if the browser is supported
// If Chrome Frame is available we'll assume it's ok
@@ -62,7 +62,7 @@ public class UnsupportedBrowserHandler implements RequestHandler {
protected void writeBrowserTooOldPage(VaadinRequest request,
VaadinResponse response) throws IOException {
Writer page = response.getWriter();
- WebBrowser b = VaadinServiceSession.getCurrent().getBrowser();
+ WebBrowser b = VaadinSession.getCurrent().getBrowser();
page.write("<html><body><h1>I'm sorry, but your browser is not supported</h1>"
+ "<p>The version ("
diff --git a/server/src/com/vaadin/server/VaadinPortlet.java b/server/src/com/vaadin/server/VaadinPortlet.java
index 818cde2879..caa15b7ffd 100644
--- a/server/src/com/vaadin/server/VaadinPortlet.java
+++ b/server/src/com/vaadin/server/VaadinPortlet.java
@@ -97,6 +97,16 @@ public class VaadinPortlet extends GenericPortlet implements Constants {
}
@Override
+ public String getRemoteHost() {
+ return originalRequest.getRemoteHost();
+ }
+
+ @Override
+ public int getRemotePort() {
+ return originalRequest.getRemotePort();
+ }
+
+ @Override
public String getHeader(String name) {
String header = super.getHeader(name);
if (header == null) {
@@ -106,6 +116,24 @@ public class VaadinPortlet extends GenericPortlet implements Constants {
}
@Override
+ public Enumeration<String> getHeaderNames() {
+ Enumeration<String> headerNames = super.getHeaderNames();
+ if (headerNames == null) {
+ headerNames = originalRequest.getHeaderNames();
+ }
+ return headerNames;
+ }
+
+ @Override
+ public Enumeration<String> getHeaders(String name) {
+ Enumeration<String> headers = super.getHeaders(name);
+ if (headers == null) {
+ headers = originalRequest.getHeaders(name);
+ }
+ return headers;
+ }
+
+ @Override
public Map<String, String[]> getParameterMap() {
Map<String, String[]> parameterMap = super.getParameterMap();
if (parameterMap == null) {
@@ -534,7 +562,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants {
*/
private void handleOtherRequest(VaadinPortletRequest request,
VaadinResponse response, RequestType requestType,
- VaadinServiceSession vaadinSession,
+ VaadinSession vaadinSession,
PortletCommunicationManager communicationManager)
throws PortletException, IOException, MalformedURLException {
if (requestType == RequestType.APP || requestType == RequestType.RENDER) {
@@ -619,7 +647,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants {
}
private void handleServiceException(VaadinPortletRequest request,
- VaadinPortletResponse response, VaadinServiceSession vaadinSession,
+ VaadinPortletResponse response, VaadinSession vaadinSession,
Throwable e) throws IOException, PortletException {
// TODO Check that this error handler is working when running inside a
// portlet
@@ -628,7 +656,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants {
if (getRequestType(request) == RequestType.UIDL) {
SystemMessages ci = getService().getSystemMessages(
ServletPortletHelper.findLocale(null, vaadinSession,
- request));
+ request), request);
criticalNotification(request, response,
ci.getInternalErrorCaption(), ci.getInternalErrorMessage(),
null, ci.getInternalErrorURL());
@@ -646,7 +674,7 @@ public class VaadinPortlet extends GenericPortlet implements Constants {
}
@SuppressWarnings("serial")
- public class RequestError implements Terminal.ErrorEvent, Serializable {
+ public class RequestError implements ErrorEvent, Serializable {
private final Throwable throwable;
diff --git a/server/src/com/vaadin/server/VaadinPortletRequest.java b/server/src/com/vaadin/server/VaadinPortletRequest.java
index f4ad040321..7243a610c9 100644
--- a/server/src/com/vaadin/server/VaadinPortletRequest.java
+++ b/server/src/com/vaadin/server/VaadinPortletRequest.java
@@ -16,15 +16,17 @@
package com.vaadin.server;
+import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Locale;
-import java.util.Map;
+import java.text.ParseException;
+import java.util.Enumeration;
import javax.portlet.ClientDataRequest;
import javax.portlet.PortletRequest;
import javax.portlet.PortletSession;
import javax.portlet.ResourceRequest;
+import javax.portlet.filter.PortletRequestWrapper;
import com.vaadin.shared.ApplicationConstants;
@@ -37,9 +39,9 @@ import com.vaadin.shared.ApplicationConstants;
* @see VaadinRequest
* @see VaadinPortletResponse
*/
-public class VaadinPortletRequest implements VaadinRequest {
+public class VaadinPortletRequest extends PortletRequestWrapper implements
+ VaadinRequest {
- private final PortletRequest request;
private final VaadinPortletService vaadinService;
/**
@@ -52,19 +54,14 @@ public class VaadinPortletRequest implements VaadinRequest {
*/
public VaadinPortletRequest(PortletRequest request,
VaadinPortletService vaadinService) {
- this.request = request;
+ super(request);
this.vaadinService = vaadinService;
}
@Override
- public Object getAttribute(String name) {
- return request.getAttribute(name);
- }
-
- @Override
public int getContentLength() {
try {
- return ((ClientDataRequest) request).getContentLength();
+ return ((ClientDataRequest) getRequest()).getContentLength();
} catch (ClassCastException e) {
throw new IllegalStateException(
"Content lenght only available for ClientDataRequests");
@@ -74,7 +71,7 @@ public class VaadinPortletRequest implements VaadinRequest {
@Override
public InputStream getInputStream() throws IOException {
try {
- return ((ClientDataRequest) request).getPortletInputStream();
+ return ((ClientDataRequest) getRequest()).getPortletInputStream();
} catch (ClassCastException e) {
throw new IllegalStateException(
"Input data only available for ClientDataRequests");
@@ -82,22 +79,18 @@ public class VaadinPortletRequest implements VaadinRequest {
}
@Override
- public String getParameter(String name) {
- return request.getParameter(name);
- }
-
- @Override
- public Map<String, String[]> getParameterMap() {
- return request.getParameterMap();
- }
-
- @Override
- public void setAttribute(String name, Object o) {
- request.setAttribute(name, o);
+ public BufferedReader getReader() throws IOException {
+ try {
+ return ((ClientDataRequest) getRequest()).getReader();
+ } catch (ClassCastException e) {
+ throw new IllegalStateException(
+ "Reader only available for ClientDataRequests");
+ }
}
@Override
- public String getRequestPathInfo() {
+ public String getPathInfo() {
+ PortletRequest request = getRequest();
if (request instanceof ResourceRequest) {
ResourceRequest resourceRequest = (ResourceRequest) request;
String resourceID = resourceRequest.getResourceID();
@@ -119,8 +112,7 @@ public class VaadinPortletRequest implements VaadinRequest {
@Override
public WrappedSession getWrappedSession(boolean allowSessionCreation) {
- PortletSession session = request
- .getPortletSession(allowSessionCreation);
+ PortletSession session = getPortletSession(allowSessionCreation);
if (session != null) {
return new WrappedPortletSession(session);
} else {
@@ -134,13 +126,13 @@ public class VaadinPortletRequest implements VaadinRequest {
* @return the unwrapped portlet request
*/
public PortletRequest getPortletRequest() {
- return request;
+ return getRequest();
}
@Override
public String getContentType() {
try {
- return ((ResourceRequest) request).getContentType();
+ return ((ResourceRequest) getRequest()).getContentType();
} catch (ClassCastException e) {
throw new IllegalStateException(
"Content type only available for ResourceRequests");
@@ -148,8 +140,23 @@ public class VaadinPortletRequest implements VaadinRequest {
}
@Override
- public Locale getLocale() {
- return request.getLocale();
+ public String getCharacterEncoding() {
+ try {
+ return ((ClientDataRequest) getRequest()).getCharacterEncoding();
+ } catch (ClassCastException e) {
+ throw new IllegalStateException(
+ "Character encoding only available for ClientDataRequest");
+ }
+ }
+
+ @Override
+ public String getMethod() {
+ try {
+ return ((ClientDataRequest) getRequest()).getMethod();
+ } catch (ClassCastException e) {
+ throw new IllegalStateException(
+ "Method only available for ClientDataRequest");
+ }
}
@Override
@@ -158,8 +165,13 @@ public class VaadinPortletRequest implements VaadinRequest {
}
@Override
- public boolean isSecure() {
- return request.isSecure();
+ public String getRemoteHost() {
+ return null;
+ }
+
+ @Override
+ public int getRemotePort() {
+ return -1;
}
@Override
@@ -176,7 +188,7 @@ public class VaadinPortletRequest implements VaadinRequest {
* the property is not defined
*/
public String getPortalProperty(String name) {
- return request.getPortalContext().getProperty(name);
+ return getRequest().getPortalContext().getProperty(name);
}
@Override
@@ -185,7 +197,28 @@ public class VaadinPortletRequest implements VaadinRequest {
}
@Override
- public String getContextPath() {
- return request.getContextPath();
+ public long getDateHeader(String name) {
+ String header = getHeader(name);
+ if (header == null) {
+ return -1;
+ } else {
+ try {
+ return VaadinPortletResponse.HTTP_DATE_FORMAT.parse(header)
+ .getTime();
+ } catch (ParseException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ }
+
+ @Override
+ public Enumeration<String> getHeaderNames() {
+ return null;
+ }
+
+ @Override
+ public Enumeration<String> getHeaders(String name) {
+ return null;
}
+
}
diff --git a/server/src/com/vaadin/server/VaadinPortletResponse.java b/server/src/com/vaadin/server/VaadinPortletResponse.java
index d9fe828bff..ab0fff486b 100644
--- a/server/src/com/vaadin/server/VaadinPortletResponse.java
+++ b/server/src/com/vaadin/server/VaadinPortletResponse.java
@@ -28,6 +28,7 @@ import java.util.TimeZone;
import javax.portlet.MimeResponse;
import javax.portlet.PortletResponse;
import javax.portlet.ResourceResponse;
+import javax.servlet.http.Cookie;
/**
* Wrapper for {@link PortletResponse} and its subclasses.
@@ -39,7 +40,7 @@ import javax.portlet.ResourceResponse;
* @see VaadinPortletRequest
*/
public class VaadinPortletResponse implements VaadinResponse {
- private static final DateFormat HTTP_DATE_FORMAT = new SimpleDateFormat(
+ static final DateFormat HTTP_DATE_FORMAT = new SimpleDateFormat(
"EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH);
static {
HTTP_DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT"));
@@ -117,4 +118,9 @@ public class VaadinPortletResponse implements VaadinResponse {
public VaadinPortletService getService() {
return vaadinService;
}
+
+ @Override
+ public void addCookie(Cookie cookie) {
+ response.addProperty(cookie);
+ }
} \ No newline at end of file
diff --git a/server/src/com/vaadin/server/VaadinPortletService.java b/server/src/com/vaadin/server/VaadinPortletService.java
index bc51fdd2a5..5651d033be 100644
--- a/server/src/com/vaadin/server/VaadinPortletService.java
+++ b/server/src/com/vaadin/server/VaadinPortletService.java
@@ -182,7 +182,7 @@ public class VaadinPortletService extends VaadinService {
@Override
protected AbstractCommunicationManager createCommunicationManager(
- VaadinServiceSession session) {
+ VaadinSession session) {
return new PortletCommunicationManager(session);
}
@@ -200,7 +200,7 @@ public class VaadinPortletService extends VaadinService {
}
@Override
- protected VaadinServiceSession createVaadinSession(VaadinRequest request)
+ protected VaadinSession createVaadinSession(VaadinRequest request)
throws ServiceException {
return new VaadinPortletSession(this);
}
@@ -219,8 +219,8 @@ public class VaadinPortletService extends VaadinService {
}
@Override
- public String getMainDivId(VaadinServiceSession session,
- VaadinRequest request, Class<? extends UI> uiClass) {
+ public String getMainDivId(VaadinSession session, VaadinRequest request,
+ Class<? extends UI> uiClass) {
PortletRequest portletRequest = ((VaadinPortletRequest) request)
.getPortletRequest();
/*
diff --git a/server/src/com/vaadin/server/VaadinPortletSession.java b/server/src/com/vaadin/server/VaadinPortletSession.java
index 6b89342b2b..af7b0f32bf 100644
--- a/server/src/com/vaadin/server/VaadinPortletSession.java
+++ b/server/src/com/vaadin/server/VaadinPortletSession.java
@@ -56,7 +56,7 @@ import com.vaadin.util.CurrentInstance;
*/
@Deprecated
@SuppressWarnings("serial")
-public class VaadinPortletSession extends VaadinServiceSession {
+public class VaadinPortletSession extends VaadinSession {
private final Set<PortletListener> portletListeners = new LinkedHashSet<PortletListener>();
diff --git a/server/src/com/vaadin/server/VaadinRequest.java b/server/src/com/vaadin/server/VaadinRequest.java
index f5786c9b80..ebf405d4f3 100644
--- a/server/src/com/vaadin/server/VaadinRequest.java
+++ b/server/src/com/vaadin/server/VaadinRequest.java
@@ -16,14 +16,20 @@
package com.vaadin.server;
+import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
+import javax.portlet.ClientDataRequest;
import javax.portlet.PortletRequest;
import javax.servlet.ServletRequest;
+import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
/**
@@ -122,7 +128,7 @@ public interface VaadinRequest extends Serializable {
*
* @see javax.servlet.http.HttpServletRequest#getPathInfo()
*/
- public String getRequestPathInfo();
+ public String getPathInfo();
/**
* Returns the portion of the request URI that indicates the context of the
@@ -233,4 +239,250 @@ public interface VaadinRequest extends Serializable {
*/
public VaadinService getService();
+ /**
+ * Returns an array containing all of the <code>Cookie</code> objects the
+ * client sent with this request. This method returns <code>null</code> if
+ * no cookies were sent.
+ *
+ * @return an array of all the <code>Cookies</code> included with this
+ * request, or <code>null</code> if the request has no cookies
+ *
+ * @see HttpServletRequest#getCookies()
+ * @see PortletRequest#getCookies()
+ */
+ public Cookie[] getCookies();
+
+ /**
+ * Returns the name of the authentication scheme used for the connection
+ * between client and server, for example, <code>BASIC_AUTH</code>,
+ * <code>CLIENT_CERT_AUTH</code>, a custom one or <code>null</code> if there
+ * was no authentication.
+ *
+ * @return a string indicating the authentication scheme, or
+ * <code>null</code> if the request was not authenticated.
+ *
+ * @see HttpServletRequest#getAuthType()
+ * @see PortletRequest#getAuthType()
+ */
+ public String getAuthType();
+
+ /**
+ * Returns the login of the user making this request, if the user has been
+ * authenticated, or null if the user has not been authenticated. Whether
+ * the user name is sent with each subsequent request depends on the browser
+ * and type of authentication.
+ *
+ * @return a String specifying the login of the user making this request, or
+ * <code>null</code> if the user login is not known.
+ *
+ * @see HttpServletRequest#getRemoteUser()
+ * @see PortletRequest#getRemoteUser()
+ */
+ public String getRemoteUser();
+
+ /**
+ * Returns a <code>java.security.Principal</code> object containing the name
+ * of the current authenticated user. If the user has not been
+ * authenticated, the method returns <code>null</code>.
+ *
+ * @return a <code>java.security.Principal</code> containing the name of the
+ * user making this request; <code>null</code> if the user has not
+ * been authenticated
+ *
+ * @see HttpServletRequest#getUserPrincipal()
+ * @see PortletRequest#getUserPrincipal()
+ */
+ public Principal getUserPrincipal();
+
+ /**
+ * Returns a boolean indicating whether the authenticated user is included
+ * in the specified logical "role". Roles and role membership can be defined
+ * using deployment descriptors. If the user has not been authenticated, the
+ * method returns <code>false</code>.
+ *
+ * @param role
+ * a String specifying the name of the role
+ * @return a boolean indicating whether the user making this request belongs
+ * to a given role; <code>false</code> if the user has not been
+ * authenticated
+ *
+ * @see HttpServletRequest#isUserInRole(String)
+ * @see PortletRequest#isUserInRole(String)
+ */
+ public boolean isUserInRole(String role);
+
+ /**
+ * Removes an attribute from this request. This method is not generally
+ * needed as attributes only persist as long as the request is being
+ * handled.
+ *
+ * @param name
+ * a String specifying the name of the attribute to remove
+ *
+ * @see ServletRequest#removeAttribute(String)
+ * @see PortletRequest#removeAttribute(String)
+ */
+ public void removeAttribute(String name);
+
+ /**
+ * Returns an Enumeration containing the names of the attributes available
+ * to this request. This method returns an empty Enumeration if the request
+ * has no attributes available to it.
+ *
+ * @return an Enumeration of strings containing the names of the request's
+ * attributes
+ *
+ * @see ServletRequest#getAttributeNames()
+ * @see PortletRequest#getAttributeNames()
+ */
+ public Enumeration<String> getAttributeNames();
+
+ /**
+ * Returns an Enumeration of Locale objects indicating, in decreasing order
+ * starting with the preferred locale, the locales that are acceptable to
+ * the client based on the Accept-Language header. If the client request
+ * doesn't provide an Accept-Language header, this method returns an
+ * Enumeration containing one Locale, the default locale for the server.
+ *
+ * @return an Enumeration of preferred Locale objects for the client
+ *
+ * @see HttpServletRequest#getLocales()
+ * @see PortletRequest#getLocales()
+ */
+ public Enumeration<Locale> getLocales();
+
+ /**
+ * Returns the fully qualified name of the client or the last proxy that
+ * sent the request. If the engine cannot or chooses not to resolve the
+ * hostname (to improve performance), this method returns the dotted-string
+ * form of the IP address.
+ *
+ * @return a String containing the fully qualified name of the client, or
+ * <code>null</code> if the information is not available.
+ *
+ * @see HttpServletRequest#getRemoteHost()
+ */
+ public String getRemoteHost();
+
+ /**
+ * Returns the Internet Protocol (IP) source port of the client or last
+ * proxy that sent the request.
+ *
+ * @return an integer specifying the port number, or -1 if the information
+ * is not available.
+ *
+ * @see ServletRequest#getRemotePort()
+ */
+ public int getRemotePort();
+
+ /**
+ * Returns the name of the character encoding used in the body of this
+ * request. This method returns <code>null</code> if the request does not
+ * specify a character encoding.
+ *
+ * @return a String containing the name of the character encoding, or null
+ * if the request does not specify a character encoding
+ *
+ * @see ServletRequest#getCharacterEncoding()
+ * @see ClientDataRequest#getCharacterEncoding()
+ */
+ public String getCharacterEncoding();
+
+ /**
+ * Retrieves the body of the request as character data using a
+ * <code>BufferedReader</code>. The reader translates the character data
+ * according to the character encoding used on the body. Either this method
+ * or {@link #getInputStream()} may be called to read the body, not both.
+ *
+ * @return a BufferedReader containing the body of the request
+ *
+ * @throws UnsupportedEncodingException
+ * - if the character set encoding used is not supported and the
+ * text cannot be decoded
+ * @throws IllegalStateException
+ * - if {@link #getInputStream()} method has been called on this
+ * request
+ * @throws IOException
+ * if an input or output exception occurred
+ *
+ * @see ServletRequest#getReader()
+ * @see ClientDataRequest#getReader()
+ */
+ public BufferedReader getReader() throws IOException;
+
+ /**
+ * Returns the name of the HTTP method with which this request was made, for
+ * example, GET, POST, or PUT.
+ *
+ * @return a String specifying the name of the method with which this
+ * request was made
+ *
+ * @see HttpServletRequest#getMethod()
+ * @see ClientDataRequest#getMethod()
+ */
+ public String getMethod();
+
+ /**
+ * Returns the value of the specified request header as a long value that
+ * represents a Date object. Use this method with headers that contain
+ * dates, such as If-Modified-Since.
+ * <p>
+ * The date is returned as the number of milliseconds since January 1, 1970
+ * GMT. The header name is case insensitive.
+ * <p>
+ * If the request did not have a header of the specified name, this method
+ * returns -1. If the header can't be converted to a date, the method throws
+ * an IllegalArgumentException.
+ *
+ * @param name
+ * a String specifying the name of the header
+ * @return a long value representing the date specified in the header
+ * expressed as the number of milliseconds since January 1, 1970
+ * GMT, or -1 if the named header was not included with the request
+ * @throws IllegalArgumentException
+ * If the header value can't be converted to a date
+ * @see HttpServletRequest#getDateHeader(String)
+ */
+ public long getDateHeader(String name);
+
+ /**
+ * Returns an enumeration of all the header names this request contains. If
+ * the request has no headers, this method returns an empty enumeration.
+ * <p>
+ * Some implementations do not allow access headers using this method, in
+ * which case this method returns <code>null</code>
+ *
+ * @return an enumeration of all the header names sent with this request; if
+ * the request has no headers, an empty enumeration; if the
+ * implementation does not allow this method, <code>null</code>
+ * @see HttpServletRequest#getHeaderNames()
+ */
+ public Enumeration<String> getHeaderNames();
+
+ /**
+ * Returns all the values of the specified request header as an Enumeration
+ * of String objects.
+ * <p>
+ * Some headers, such as <code>Accept-Language</code> can be sent by clients
+ * as several headers each with a different value rather than sending the
+ * header as a comma separated list.
+ * <p>
+ * If the request did not include any headers of the specified name, this
+ * method returns an empty Enumeration. If the request does not support
+ * accessing headers, this method returns <code>null</code>.
+ * <p>
+ * The header name is case insensitive. You can use this method with any
+ * request header.
+ *
+ *
+ * @param name
+ * a String specifying the header name
+ * @return an Enumeration containing the values of the requested header. If
+ * the request does not have any headers of that name return an
+ * empty enumeration. If the header information is not available,
+ * return <code>null</code>
+ * @see HttpServletRequest#getHeaders(String)
+ */
+ public Enumeration<String> getHeaders(String name);
+
}
diff --git a/server/src/com/vaadin/server/VaadinResponse.java b/server/src/com/vaadin/server/VaadinResponse.java
index d1b2ac1254..5b1df09ab8 100644
--- a/server/src/com/vaadin/server/VaadinResponse.java
+++ b/server/src/com/vaadin/server/VaadinResponse.java
@@ -25,6 +25,7 @@ import javax.portlet.MimeResponse;
import javax.portlet.PortletResponse;
import javax.portlet.ResourceResponse;
import javax.servlet.ServletResponse;
+import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
/**
@@ -156,4 +157,16 @@ public interface VaadinResponse extends Serializable {
* @see VaadinService
*/
public VaadinService getService();
+
+ /**
+ * Adds the specified cookie to the response. This method can be called
+ * multiple times to set more than one cookie.
+ *
+ * @param cookie
+ * the Cookie to return to the client
+ *
+ * @see HttpServletResponse#addCookie(Cookie)
+ * @see PortletResponse#addProperty(Cookie)
+ */
+ public void addCookie(Cookie cookie);
}
diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java
index d79210206b..a4caf6cdd6 100644
--- a/server/src/com/vaadin/server/VaadinService.java
+++ b/server/src/com/vaadin/server/VaadinService.java
@@ -250,10 +250,16 @@ public abstract class VaadinService implements Serializable {
*
* @param locale
* the desired locale for the system messages
+ * @param request
* @return the system messages to use
*/
- public SystemMessages getSystemMessages(Locale locale) {
- return getSystemMessagesProvider().getSystemMessages(locale);
+ public SystemMessages getSystemMessages(Locale locale, VaadinRequest request) {
+ SystemMessagesInfo systemMessagesInfo = new SystemMessagesInfo();
+ systemMessagesInfo.setLocale(locale);
+ systemMessagesInfo.setService(this);
+ systemMessagesInfo.setRequest(request);
+ return getSystemMessagesProvider()
+ .getSystemMessages(systemMessagesInfo);
}
/**
@@ -318,7 +324,7 @@ public abstract class VaadinService implements Serializable {
SESSION_DESTROY_METHOD);
}
- public void fireSessionDestroy(VaadinServiceSession vaadinSession) {
+ public void fireSessionDestroy(VaadinSession vaadinSession) {
// Ignore if the session is being moved to a different backing session
if (vaadinSession.getAttribute(REINITIALIZING_SESSION_MARKER) == Boolean.TRUE) {
return;
@@ -350,32 +356,31 @@ public abstract class VaadinService implements Serializable {
* @param request
* the request to get a vaadin service session for.
*
- * @see VaadinServiceSession
+ * @see VaadinSession
*
* @return the vaadin service session for the request, or <code>null</code>
* if no session is found and this is a request for which a new
* session shouldn't be created.
*/
- public VaadinServiceSession findVaadinSession(VaadinRequest request)
+ public VaadinSession findVaadinSession(VaadinRequest request)
throws ServiceException, SessionExpiredException {
- VaadinServiceSession vaadinSession = findOrCreateVaadinSession(request);
+ VaadinSession vaadinSession = findOrCreateVaadinSession(request);
if (vaadinSession == null) {
return null;
}
- VaadinServiceSession.setCurrent(vaadinSession);
- request.setAttribute(VaadinServiceSession.class.getName(),
- vaadinSession);
+ VaadinSession.setCurrent(vaadinSession);
+ request.setAttribute(VaadinSession.class.getName(), vaadinSession);
return vaadinSession;
}
- private VaadinServiceSession findOrCreateVaadinSession(VaadinRequest request)
+ private VaadinSession findOrCreateVaadinSession(VaadinRequest request)
throws SessionExpiredException, ServiceException {
boolean requestCanCreateSession = requestCanCreateSession(request);
/* Find an existing session for this request. */
- VaadinServiceSession session = getExistingSession(request,
+ VaadinSession session = getExistingSession(request,
requestCanCreateSession);
if (session != null) {
@@ -418,11 +423,11 @@ public abstract class VaadinService implements Serializable {
}
- private VaadinServiceSession createAndRegisterSession(VaadinRequest request)
+ private VaadinSession createAndRegisterSession(VaadinRequest request)
throws ServiceException {
- VaadinServiceSession session = createVaadinSession(request);
+ VaadinSession session = createVaadinSession(request);
- VaadinServiceSession.setCurrent(session);
+ VaadinSession.setCurrent(session);
session.storeInSession(this, request.getWrappedSession());
@@ -465,7 +470,7 @@ public abstract class VaadinService implements Serializable {
* @return a new communication manager
*/
protected abstract AbstractCommunicationManager createCommunicationManager(
- VaadinServiceSession session);
+ VaadinSession session);
/**
* Creates a new Vaadin service session.
@@ -475,19 +480,19 @@ public abstract class VaadinService implements Serializable {
* @throws ServletException
* @throws MalformedURLException
*/
- protected VaadinServiceSession createVaadinSession(VaadinRequest request)
+ protected VaadinSession createVaadinSession(VaadinRequest request)
throws ServiceException {
- return new VaadinServiceSession(this);
+ return new VaadinSession(this);
}
private void onVaadinSessionStarted(VaadinRequest request,
- VaadinServiceSession session) throws ServiceException {
+ VaadinSession session) throws ServiceException {
eventRouter.fireEvent(new SessionInitEvent(this, session, request));
ServletPortletHelper.checkUiProviders(session, this);
}
- private void closeSession(VaadinServiceSession vaadinSession,
+ private void closeSession(VaadinSession vaadinSession,
WrappedSession session) {
if (vaadinSession == null) {
return;
@@ -498,7 +503,7 @@ public abstract class VaadinService implements Serializable {
}
}
- protected VaadinServiceSession getExistingSession(VaadinRequest request,
+ protected VaadinSession getExistingSession(VaadinRequest request,
boolean allowSessionCreation) throws SessionExpiredException {
// Ensures that the session is still valid
@@ -508,7 +513,7 @@ public abstract class VaadinService implements Serializable {
throw new SessionExpiredException();
}
- VaadinServiceSession vaadinSession = VaadinServiceSession
+ VaadinSession vaadinSession = VaadinSession
.getForSession(this, session);
if (vaadinSession == null) {
@@ -629,7 +634,7 @@ public abstract class VaadinService implements Serializable {
*
*/
public UI findUI(VaadinRequest request) {
- VaadinServiceSession session = VaadinServiceSession.getForSession(this,
+ VaadinSession session = VaadinSession.getForSession(this,
request.getWrappedSession());
// Get UI id from the request
@@ -690,9 +695,9 @@ public abstract class VaadinService implements Serializable {
HashMap<String, Object> attrs = new HashMap<String, Object>();
for (String name : oldSession.getAttributeNames()) {
Object value = oldSession.getAttribute(name);
- if (value instanceof VaadinServiceSession) {
+ if (value instanceof VaadinSession) {
// set flag to avoid cleanup
- VaadinServiceSession serviceSession = (VaadinServiceSession) value;
+ VaadinSession serviceSession = (VaadinSession) value;
serviceSession.setAttribute(REINITIALIZING_SESSION_MARKER,
Boolean.TRUE);
}
@@ -712,8 +717,8 @@ public abstract class VaadinService implements Serializable {
newSession.setAttribute(name, value);
// Ensure VaadinServiceSession knows where it's stored
- if (value instanceof VaadinServiceSession) {
- VaadinServiceSession serviceSession = (VaadinServiceSession) value;
+ if (value instanceof VaadinSession) {
+ VaadinSession serviceSession = (VaadinSession) value;
serviceSession.storeInSession(serviceSession.getService(),
newSession);
serviceSession
@@ -736,7 +741,7 @@ public abstract class VaadinService implements Serializable {
*
* @return the id to use in the DOM
*/
- public abstract String getMainDivId(VaadinServiceSession session,
+ public abstract String getMainDivId(VaadinSession session,
VaadinRequest request, Class<? extends UI> uiClass);
/**
@@ -753,7 +758,7 @@ public abstract class VaadinService implements Serializable {
* @param session
* the session to close
*/
- public void closeSession(VaadinServiceSession session) {
+ public void closeSession(VaadinSession session) {
session.removeFromSession(this);
}
}
diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java
index eb84e54d85..47c2944b10 100644
--- a/server/src/com/vaadin/server/VaadinServlet.java
+++ b/server/src/com/vaadin/server/VaadinServlet.java
@@ -271,7 +271,7 @@ public class VaadinServlet extends HttpServlet implements Constants {
return;
}
- VaadinServiceSession vaadinSession = null;
+ VaadinSession vaadinSession = null;
try {
// If a duplicate "close application" URL is received for an
@@ -418,7 +418,8 @@ public class VaadinServlet extends HttpServlet implements Constants {
if (request.getRequestedSessionId() == null) {
// User has cookies disabled
SystemMessages systemMessages = getService().getSystemMessages(
- ServletPortletHelper.findLocale(null, null, request));
+ ServletPortletHelper.findLocale(null, null, request),
+ request);
criticalNotification(request, response,
systemMessages.getCookiesDisabledCaption(),
systemMessages.getCookiesDisabledMessage(), null,
@@ -570,13 +571,13 @@ public class VaadinServlet extends HttpServlet implements Constants {
}
private void handleServiceException(VaadinServletRequest request,
- VaadinServletResponse response, VaadinServiceSession vaadinSession,
+ VaadinServletResponse response, VaadinSession vaadinSession,
Throwable e) throws IOException, ServletException {
// if this was an UIDL request, response UIDL back to client
if (getRequestType(request) == RequestType.UIDL) {
SystemMessages ci = getService().getSystemMessages(
ServletPortletHelper.findLocale(null, vaadinSession,
- request));
+ request), request);
criticalNotification(request, response,
ci.getInternalErrorCaption(), ci.getInternalErrorMessage(),
null, ci.getInternalErrorURL());
@@ -652,7 +653,8 @@ public class VaadinServlet extends HttpServlet implements Constants {
try {
SystemMessages ci = getService().getSystemMessages(
- ServletPortletHelper.findLocale(null, null, request));
+ ServletPortletHelper.findLocale(null, null, request),
+ request);
RequestType requestType = getRequestType(request);
if (requestType == RequestType.UIDL) {
/*
@@ -702,7 +704,7 @@ public class VaadinServlet extends HttpServlet implements Constants {
* this case so just use the info provided in the request.
*/
SystemMessages ci = getService().getSystemMessages(
- request.getLocale());
+ request.getLocale(), request);
RequestType requestType = getRequestType(request);
if (requestType == RequestType.UIDL) {
// send uidl redirect
@@ -935,6 +937,17 @@ public class VaadinServlet extends HttpServlet implements Constants {
String realFilename = sc.getRealPath(scssFilename);
ScssStylesheet scss = ScssStylesheet.get(realFilename);
if (scss == null) {
+ // Not a file in the file system (WebContent directory). Use the
+ // identifier directly (VAADIN/themes/.../styles.css) so
+ // ScssStylesheet will try using the class loader.
+ if (scssFilename.startsWith("/")) {
+ scssFilename = scssFilename.substring(1);
+ }
+
+ scss = ScssStylesheet.get(scssFilename);
+ }
+
+ if (scss == null) {
getLogger()
.warning(
"Scss file "
@@ -1204,7 +1217,7 @@ public class VaadinServlet extends HttpServlet implements Constants {
return u;
}
- public class RequestError implements Terminal.ErrorEvent, Serializable {
+ public class RequestError implements ErrorEvent, Serializable {
private final Throwable throwable;
diff --git a/server/src/com/vaadin/server/VaadinServletRequest.java b/server/src/com/vaadin/server/VaadinServletRequest.java
index 5b4b876244..e0ad94c18c 100644
--- a/server/src/com/vaadin/server/VaadinServletRequest.java
+++ b/server/src/com/vaadin/server/VaadinServletRequest.java
@@ -49,11 +49,6 @@ public class VaadinServletRequest extends HttpServletRequestWrapper implements
}
@Override
- public String getRequestPathInfo() {
- return getPathInfo();
- }
-
- @Override
public WrappedSession getWrappedSession() {
return getWrappedSession(true);
}
diff --git a/server/src/com/vaadin/server/VaadinServletService.java b/server/src/com/vaadin/server/VaadinServletService.java
index faec287166..e1b51fa8ed 100644
--- a/server/src/com/vaadin/server/VaadinServletService.java
+++ b/server/src/com/vaadin/server/VaadinServletService.java
@@ -160,7 +160,7 @@ public class VaadinServletService extends VaadinService {
@Override
protected AbstractCommunicationManager createCommunicationManager(
- VaadinServiceSession session) {
+ VaadinSession session) {
return new CommunicationManager(session);
}
@@ -183,8 +183,8 @@ public class VaadinServletService extends VaadinService {
}
@Override
- public String getMainDivId(VaadinServiceSession session,
- VaadinRequest request, Class<? extends UI> uiClass) {
+ public String getMainDivId(VaadinSession session, VaadinRequest request,
+ Class<? extends UI> uiClass) {
String appId = null;
try {
URL appUrl = getServlet().getApplicationUrl(
diff --git a/server/src/com/vaadin/server/VaadinServiceSession.java b/server/src/com/vaadin/server/VaadinSession.java
index 109a2f391b..74e3bd360d 100644
--- a/server/src/com/vaadin/server/VaadinServiceSession.java
+++ b/server/src/com/vaadin/server/VaadinSession.java
@@ -51,16 +51,15 @@ import com.vaadin.util.ReflectTools;
* typically stored in a {@link HttpSession} or {@link PortletSession}, but
* others storage mechanisms might also be used.
* <p>
- * Everything inside a {@link VaadinServiceSession} should be serializable to
- * ensure compatibility with schemes using serialization for persisting the
- * session data.
+ * Everything inside a {@link VaadinSession} should be serializable to ensure
+ * compatibility with schemes using serialization for persisting the session
+ * data.
*
* @author Vaadin Ltd
* @since 7.0.0
*/
@SuppressWarnings("serial")
-public class VaadinServiceSession implements HttpSessionBindingListener,
- Serializable {
+public class VaadinSession implements HttpSessionBindingListener, Serializable {
/**
* The name of the parameter that is by default used in e.g. web.xml to
@@ -91,7 +90,7 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
* Session wide error handler which is used by default if an error is left
* unhandled.
*/
- private Terminal.ErrorListener errorHandler = new DefaultErrorListener();
+ private ErrorListener errorHandler = new DefaultErrorListener();
/**
* The converter factory that is used to provide default converters for the
@@ -114,9 +113,11 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
private AbstractCommunicationManager communicationManager;
- private long totalSessionTime = 0;
+ private long cumulativeRequestDuration = 0;
- private long lastRequestTime = -1;
+ private long lastRequestDuration = -1;
+
+ private long lastRequestTimestamp = System.currentTimeMillis();
private transient WrappedSession session;
@@ -132,7 +133,7 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
* @param service
* the Vaadin service for the new session
*/
- public VaadinServiceSession(VaadinService service) {
+ public VaadinSession(VaadinService service) {
this.service = service;
}
@@ -168,10 +169,11 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
}
/**
- * @return The total time spent servicing requests in this session.
+ * @return The total time spent servicing requests in this session, in
+ * milliseconds.
*/
- public long getTotalSessionTime() {
- return totalSessionTime;
+ public long getCumulativeRequestDuration() {
+ return cumulativeRequestDuration;
}
/**
@@ -179,18 +181,31 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
* the total time spent servicing requests in this session.
*
* @param time
- * the time spent in the last request.
+ * The time spent in the last request, in milliseconds.
+ */
+ public void setLastRequestDuration(long time) {
+ lastRequestDuration = time;
+ cumulativeRequestDuration += time;
+ }
+
+ /**
+ * @return The time spent servicing the last request in this session, in
+ * milliseconds.
*/
- public void setLastRequestTime(long time) {
- lastRequestTime = time;
- totalSessionTime += time;
+ public long getLastRequestDuration() {
+ return lastRequestDuration;
}
/**
- * @return the time spent servicing the last request in this session.
+ * Sets the time when the last UIDL request was serviced in this session.
+ *
+ * @param timestamp
+ * The time when the last request was handled, in milliseconds
+ * since the epoch.
+ *
*/
- public long getLastRequestTime() {
- return lastRequestTime;
+ public void setLastRequestTimestamp(long timestamp) {
+ lastRequestTimestamp = timestamp;
}
/**
@@ -222,13 +237,12 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
* @deprecated might be refactored or removed before 7.0.0
*/
@Deprecated
- public static VaadinServiceSession getForSession(VaadinService service,
+ public static VaadinSession getForSession(VaadinService service,
WrappedSession underlyingSession) {
- Object attribute = underlyingSession
- .getAttribute(VaadinServiceSession.class.getName() + "."
- + service.getServiceName());
- if (attribute instanceof VaadinServiceSession) {
- VaadinServiceSession vaadinSession = (VaadinServiceSession) attribute;
+ Object attribute = underlyingSession.getAttribute(VaadinSession.class
+ .getName() + "." + service.getServiceName());
+ if (attribute instanceof VaadinSession) {
+ VaadinSession vaadinSession = (VaadinSession) attribute;
vaadinSession.session = underlyingSession;
return vaadinSession;
}
@@ -246,8 +260,9 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
public void removeFromSession(VaadinService service) {
assert (getForSession(service, session) == this);
- session.setAttribute(VaadinServiceSession.class.getName() + "."
- + service.getServiceName(), null);
+ session.setAttribute(
+ VaadinSession.class.getName() + "." + service.getServiceName(),
+ null);
}
/**
@@ -257,8 +272,9 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
*/
@Deprecated
public void storeInSession(VaadinService service, WrappedSession session) {
- session.setAttribute(VaadinServiceSession.class.getName() + "."
- + service.getServiceName(), this);
+ session.setAttribute(
+ VaadinSession.class.getName() + "." + service.getServiceName(),
+ this);
this.session = session;
}
@@ -322,7 +338,7 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
*
* @return the current error handler
*/
- public Terminal.ErrorListener getErrorHandler() {
+ public ErrorListener getErrorHandler() {
return errorHandler;
}
@@ -331,7 +347,7 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
*
* @param errorHandler
*/
- public void setErrorHandler(Terminal.ErrorListener errorHandler) {
+ public void setErrorHandler(ErrorListener errorHandler) {
this.errorHandler = errorHandler;
}
@@ -379,7 +395,7 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
* should be used. This indicates that the problem is caused by the
* application - not by the user.
*/
- public class ApplicationError implements Terminal.ErrorEvent {
+ public class ApplicationError implements ErrorEvent {
private final Throwable throwable;
public ApplicationError(Throwable throwable) {
@@ -453,12 +469,12 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
* @return the current session instance if available, otherwise
* <code>null</code>
*
- * @see #setCurrent(VaadinServiceSession)
+ * @see #setCurrent(VaadinSession)
*
* @since 7.0
*/
- public static VaadinServiceSession getCurrent() {
- return CurrentInstance.get(VaadinServiceSession.class);
+ public static VaadinSession getCurrent() {
+ return CurrentInstance.get(VaadinSession.class);
}
/**
@@ -478,8 +494,8 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
*
* @since 7.0
*/
- public static void setCurrent(VaadinServiceSession session) {
- CurrentInstance.setInheritable(VaadinServiceSession.class, session);
+ public static void setCurrent(VaadinSession session) {
+ CurrentInstance.setInheritable(VaadinSession.class, session);
}
/**
@@ -513,7 +529,7 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
}
private static final Logger getLogger() {
- return Logger.getLogger(VaadinServiceSession.class.getName());
+ return Logger.getLogger(VaadinSession.class.getName());
}
/**
@@ -596,11 +612,17 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
*/
@Deprecated
public void cleanupInactiveUIs() {
- for (UI ui : new ArrayList<UI>(uIs.values())) {
- if (!isUIAlive(ui)) {
- cleanupUI(ui);
- getLogger().fine(
- "Closed UI #" + ui.getUIId() + " due to inactivity");
+ if (getUidlRequestTimeout() >= 0
+ && System.currentTimeMillis() - lastRequestTimestamp > 1000 * getUidlRequestTimeout()) {
+ close();
+ } else {
+ for (UI ui : new ArrayList<UI>(uIs.values())) {
+ if (!isUIAlive(ui)) {
+ cleanupUI(ui);
+ getLogger()
+ .fine("Closed UI #" + ui.getUIId()
+ + " due to inactivity");
+ }
}
}
}
@@ -655,7 +677,7 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
* otherwise heartbeat requests are enough to extend UI lifetime
* indefinitely.
*
- * @see DeploymentConfiguration#isIdleUICleanupEnabled()
+ * @see DeploymentConfiguration#isCloseIdleSessions()
* @see #getHeartbeatTimeout()
* @see #cleanupInactiveUIs()
*
@@ -665,7 +687,7 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
* timeout never occurs.
*/
protected int getUidlRequestTimeout() {
- return configuration.isIdleUICleanupEnabled() ? getSession()
+ return configuration.isCloseIdleSessions() ? getSession()
.getMaxInactiveInterval() : -1;
}
@@ -688,11 +710,7 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
protected boolean isUIAlive(UI ui) {
long now = System.currentTimeMillis();
if (getHeartbeatTimeout() >= 0
- && now - ui.getLastHeartbeatTime() > 1000 * getHeartbeatTimeout()) {
- return false;
- }
- if (getUidlRequestTimeout() >= 0
- && now - ui.getLastUidlRequestTime() > 1000 * getUidlRequestTimeout()) {
+ && now - ui.getLastHeartbeatTimestamp() > 1000 * getHeartbeatTimeout()) {
return false;
}
return true;
@@ -926,9 +944,9 @@ public class VaadinServiceSession implements HttpSessionBindingListener,
* browser unload the invalidated UI.
* <p>
* This method is just a shorthand to
- * {@link VaadinService#closeSession(VaadinServiceSession)}
+ * {@link VaadinService#closeSession(VaadinSession)}
*
- * @see VaadinService#closeSession(VaadinServiceSession)
+ * @see VaadinService#closeSession(VaadinSession)
*
*/
public void close() {
diff --git a/server/src/com/vaadin/server/VariableOwner.java b/server/src/com/vaadin/server/VariableOwner.java
index 704b4cdae9..e4319cfaf3 100644
--- a/server/src/com/vaadin/server/VariableOwner.java
+++ b/server/src/com/vaadin/server/VariableOwner.java
@@ -84,7 +84,7 @@ public interface VariableOwner extends Serializable {
/**
* VariableOwner error event.
*/
- public interface ErrorEvent extends Terminal.ErrorEvent {
+ public interface ErrorEvent extends com.vaadin.server.ErrorEvent {
/**
* Gets the source VariableOwner.
diff --git a/server/src/com/vaadin/server/WebBrowser.java b/server/src/com/vaadin/server/WebBrowser.java
index 676375a693..468b36921c 100644
--- a/server/src/com/vaadin/server/WebBrowser.java
+++ b/server/src/com/vaadin/server/WebBrowser.java
@@ -32,8 +32,8 @@ import com.vaadin.shared.VBrowserDetails;
*/
public class WebBrowser implements Serializable {
- private int screenHeight = 0;
- private int screenWidth = 0;
+ private int screenHeight = -1;
+ private int screenWidth = -1;
private String browserApplication = null;
private Locale locale;
private String address;
@@ -267,7 +267,7 @@ public class WebBrowser implements Serializable {
* @see WebBrowser#getRawTimezoneOffset()
* @return timezone offset in milliseconds, 0 if not available
*/
- public Integer getTimezoneOffset() {
+ public int getTimezoneOffset() {
return timezoneOffset;
}
@@ -288,7 +288,7 @@ public class WebBrowser implements Serializable {
*
* @return timezone offset in milliseconds excluding DST, 0 if not available
*/
- public Integer getRawTimezoneOffset() {
+ public int getRawTimezoneOffset() {
return rawTimezoneOffset;
}
@@ -364,7 +364,7 @@ public class WebBrowser implements Serializable {
screenHeight = Integer.parseInt(sh);
screenWidth = Integer.parseInt(sw);
} catch (final NumberFormatException e) {
- screenHeight = screenWidth = 0;
+ screenHeight = screenWidth = -1;
}
}
if (tzo != null) {
diff --git a/server/src/com/vaadin/server/WrappedHttpSession.java b/server/src/com/vaadin/server/WrappedHttpSession.java
index 65db010ba9..dbf3761987 100644
--- a/server/src/com/vaadin/server/WrappedHttpSession.java
+++ b/server/src/com/vaadin/server/WrappedHttpSession.java
@@ -93,4 +93,29 @@ public class WrappedHttpSession implements WrappedSession {
return session.getId();
}
+ @Override
+ public long getCreationTime() {
+ return session.getCreationTime();
+ }
+
+ @Override
+ public long getLastAccessedTime() {
+ return session.getLastAccessedTime();
+ }
+
+ @Override
+ public boolean isNew() {
+ return session.isNew();
+ }
+
+ @Override
+ public void removeAttribute(String name) {
+ session.removeAttribute(name);
+ }
+
+ @Override
+ public void setMaxInactiveInterval(int interval) {
+ session.setMaxInactiveInterval(interval);
+ }
+
}
diff --git a/server/src/com/vaadin/server/WrappedPortletSession.java b/server/src/com/vaadin/server/WrappedPortletSession.java
index f4a6003ed5..dd9a1558f8 100644
--- a/server/src/com/vaadin/server/WrappedPortletSession.java
+++ b/server/src/com/vaadin/server/WrappedPortletSession.java
@@ -79,4 +79,29 @@ public class WrappedPortletSession implements WrappedSession {
public String getId() {
return session.getId();
}
+
+ @Override
+ public long getCreationTime() {
+ return session.getCreationTime();
+ }
+
+ @Override
+ public long getLastAccessedTime() {
+ return session.getLastAccessedTime();
+ }
+
+ @Override
+ public boolean isNew() {
+ return session.isNew();
+ }
+
+ @Override
+ public void removeAttribute(String name) {
+ session.removeAttribute(name);
+ }
+
+ @Override
+ public void setMaxInactiveInterval(int interval) {
+ session.setMaxInactiveInterval(interval);
+ }
}
diff --git a/server/src/com/vaadin/server/WrappedSession.java b/server/src/com/vaadin/server/WrappedSession.java
index cf0b1a2fbd..49c9d1643c 100644
--- a/server/src/com/vaadin/server/WrappedSession.java
+++ b/server/src/com/vaadin/server/WrappedSession.java
@@ -91,6 +91,85 @@ public interface WrappedSession {
* Gets a string with a unique identifier for the session.
*
* @return a unique session id string
+ *
+ * @see HttpSession#getId()
+ * @see PortletSession#getId()
*/
public String getId();
+
+ /**
+ * Returns the time when this session was created, measured in milliseconds
+ * since midnight January 1, 1970 GMT.
+ *
+ * @return a long specifying when this session was created, expressed in
+ * milliseconds since 1/1/1970 GMT
+ *
+ * @throws IllegalStateException
+ * if this method is called on an invalidated session
+ * @see HttpSession#getCreationTime()
+ * @see PortletSession#getCreationTime()
+ */
+ public long getCreationTime();
+
+ /**
+ * Returns the last time the client sent a request associated with this
+ * session, as the number of milliseconds since midnight January 1, 1970
+ * GMT, and marked by the time the container received the request.
+ * <p>
+ * Actions that your application takes, such as getting or setting a value
+ * associated with the session, do not affect the access time.
+ *
+ * @return a long representing the last time the client sent a request
+ * associated with this session, expressed in milliseconds since
+ * 1/1/1970 GMT
+ *
+ * @throws IllegalStateException
+ * if this method is called on an invalidated session
+ *
+ * @see HttpSession#getLastAccessedTime()
+ * @see PortletSession#getLastAccessedTime()
+ */
+ public long getLastAccessedTime();
+
+ /**
+ * Returns true if the client does not yet know about the session or if the
+ * client chooses not to join the session. For example, if the server used
+ * only cookie-based sessions, and the client had disabled the use of
+ * cookies, then a session would be new on each request.
+ *
+ * @return true if the server has created a session, but the client has not
+ * yet joined
+ * @throws IllegalStateException
+ * if this method is called on an invalidated session
+ * @see HttpSession#isNew()
+ * @see PortletSession#isNew()
+ */
+ public boolean isNew();
+
+ /**
+ * Removes the object bound with the specified name from this session. If
+ * the session does not have an object bound with the specified name, this
+ * method does nothing.
+ *
+ * @param name
+ * the name of the object to remove from this session
+ * @throws IllegalStateException
+ * if this method is called on an invalidated session
+ * @see HttpSession#removeAttribute(String)
+ * @see PortletSession#removeAttribute(String)
+ */
+ public void removeAttribute(String name);
+
+ /**
+ * Specifies the time, in seconds, between client requests before the
+ * servlet container will invalidate this session. A negative time indicates
+ * the session should never timeout.
+ *
+ * @param interval
+ * An integer specifying the number of seconds
+ * @see HttpSession#setMaxInactiveInterval(int)
+ * @see PortletSession#setMaxInactiveInterval(int)
+ */
+ public void setMaxInactiveInterval(int interval);
+
}
diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java
index 5589223ac5..0902924e4b 100644
--- a/server/src/com/vaadin/ui/AbstractComponent.java
+++ b/server/src/com/vaadin/ui/AbstractComponent.java
@@ -32,10 +32,9 @@ import com.vaadin.server.ClientConnector;
import com.vaadin.server.ComponentSizeValidator;
import com.vaadin.server.ErrorMessage;
import com.vaadin.server.Resource;
-import com.vaadin.server.Terminal;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.shared.ComponentConstants;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.ui.ComponentStateUtil;
import com.vaadin.util.ReflectTools;
@@ -262,7 +261,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
if (parent != null) {
return parent.getLocale();
}
- final VaadinServiceSession session = getSession();
+ final VaadinSession session = getSession();
if (session != null) {
return session.getLocale();
}
@@ -323,7 +322,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
*/
@Override
public boolean isEnabled() {
- return getState().enabled;
+ return getState(false).enabled;
}
/*
@@ -349,7 +348,8 @@ public abstract class AbstractComponent extends AbstractClientConnector
return false;
} else if (!super.isConnectorEnabled()) {
return false;
- } else if (!getParent().isComponentVisible(this)) {
+ } else if ((getParent() instanceof SelectiveRenderer)
+ && !((SelectiveRenderer) getParent()).isRendered(this)) {
return false;
} else {
return true;
@@ -569,7 +569,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
*/
protected void focus() {
if (this instanceof Focusable) {
- final VaadinServiceSession session = getSession();
+ final VaadinSession session = getSession();
if (session != null) {
getUI().setFocusedComponent((Focusable) this);
delayedFocus = false;
@@ -617,8 +617,8 @@ public abstract class AbstractComponent extends AbstractClientConnector
* @return updated component shared state
*/
@Override
- protected ComponentState getState() {
- return (ComponentState) super.getState();
+ protected AbstractComponentState getState() {
+ return (AbstractComponentState) super.getState();
}
@Override
@@ -891,7 +891,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
}
}
- public interface ComponentErrorEvent extends Terminal.ErrorEvent {
+ public interface ComponentErrorEvent extends com.vaadin.server.ErrorEvent {
}
public interface ComponentErrorHandler extends Serializable {
diff --git a/server/src/com/vaadin/ui/AbstractComponentContainer.java b/server/src/com/vaadin/ui/AbstractComponentContainer.java
index c60f312293..b5cc3da861 100644
--- a/server/src/com/vaadin/ui/AbstractComponentContainer.java
+++ b/server/src/com/vaadin/ui/AbstractComponentContainer.java
@@ -343,15 +343,4 @@ public abstract class AbstractComponentContainer extends AbstractComponent
public Iterator<Component> getComponentIterator() {
return iterator();
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * com.vaadin.ui.HasComponents#isComponentVisible(com.vaadin.ui.Component)
- */
- @Override
- public boolean isComponentVisible(Component childComponent) {
- return true;
- }
} \ No newline at end of file
diff --git a/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java b/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java
index 47420334d7..91547dc79f 100644
--- a/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java
+++ b/server/src/com/vaadin/ui/AbstractJavaScriptComponent.java
@@ -16,6 +16,7 @@
package com.vaadin.ui;
import com.vaadin.server.JavaScriptCallbackHelper;
+import com.vaadin.shared.communication.ServerRpc;
import com.vaadin.shared.ui.JavaScriptComponentState;
/**
@@ -128,7 +129,8 @@ public abstract class AbstractJavaScriptComponent extends AbstractComponent {
this);
@Override
- protected <T> void registerRpc(T implementation, Class<T> rpcInterfaceType) {
+ protected <T extends ServerRpc> void registerRpc(T implementation,
+ Class<T> rpcInterfaceType) {
super.registerRpc(implementation, rpcInterfaceType);
callbackHelper.registerRpc(rpcInterfaceType);
}
diff --git a/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java b/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java
index 20660ce955..7297318e95 100644
--- a/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java
+++ b/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java
@@ -102,17 +102,6 @@ public abstract class AbstractSingleComponentContainer extends
fireEvent(new ComponentDetachEvent(this, component));
}
- /*
- * (non-Javadoc)
- *
- * @see
- * com.vaadin.ui.HasComponents#isComponentVisible(com.vaadin.ui.Component)
- */
- @Override
- public boolean isComponentVisible(Component childComponent) {
- return true;
- }
-
@Override
public void setVisible(boolean visible) {
if (isVisible() == visible) {
diff --git a/server/src/com/vaadin/ui/ConnectorTracker.java b/server/src/com/vaadin/ui/ConnectorTracker.java
index ddb02129d4..8b1a940c4b 100644
--- a/server/src/com/vaadin/ui/ConnectorTracker.java
+++ b/server/src/com/vaadin/ui/ConnectorTracker.java
@@ -247,7 +247,8 @@ public class ConnectorTracker implements Serializable {
uninitializedConnectors.remove(connector);
diffStates.remove(connector);
iterator.remove();
- } else if (!AbstractCommunicationManager.isVisible(connector)
+ } else if (!AbstractCommunicationManager
+ .isConnectorVisibleToClient(connector)
&& !uninitializedConnectors.contains(connector)) {
uninitializedConnectors.add(connector);
diffStates.remove(connector);
diff --git a/server/src/com/vaadin/ui/CustomField.java b/server/src/com/vaadin/ui/CustomField.java
index 23460d824e..c3331609a5 100644
--- a/server/src/com/vaadin/ui/CustomField.java
+++ b/server/src/com/vaadin/ui/CustomField.java
@@ -150,9 +150,4 @@ public abstract class CustomField<T> extends AbstractField<T> implements
public Iterator<Component> iterator() {
return new ComponentIterator();
}
-
- @Override
- public boolean isComponentVisible(Component childComponent) {
- return true;
- }
}
diff --git a/server/src/com/vaadin/ui/Form.java b/server/src/com/vaadin/ui/Form.java
index 94a9f9b73a..62a6de4fe6 100644
--- a/server/src/com/vaadin/ui/Form.java
+++ b/server/src/com/vaadin/ui/Form.java
@@ -1375,11 +1375,6 @@ public class Form extends AbstractField<Object> implements Item.Editor,
}
@Override
- public boolean isComponentVisible(Component childComponent) {
- return true;
- };
-
- @Override
public void setVisible(boolean visible) {
if (isVisible() == visible) {
return;
diff --git a/server/src/com/vaadin/ui/HasComponents.java b/server/src/com/vaadin/ui/HasComponents.java
index 4f6320f6b2..d2ca45fa42 100644
--- a/server/src/com/vaadin/ui/HasComponents.java
+++ b/server/src/com/vaadin/ui/HasComponents.java
@@ -41,25 +41,6 @@ public interface HasComponents extends Component, Iterable<Component> {
public Iterator<Component> iterator();
/**
- * Checks if the child component is visible. This method allows hiding a
- * child component from updates and communication to and from the client.
- * This is useful for components that show only a limited number of its
- * children at any given time and want to allow updates only for the
- * children that are visible (e.g. TabSheet has one tab open at a time).
- * <p>
- * Note that this will prevent updates from reaching the child even though
- * the child itself is set to visible. Also if a child is set to invisible
- * this will not force it to be visible.
- * </p>
- *
- * @param childComponent
- * The child component to check
- * @return true if the child component is visible to the user, false
- * otherwise
- */
- public boolean isComponentVisible(Component childComponent);
-
- /**
* Interface for {@link HasComponents} implementations that support sending
* attach and detach events for components.
*
diff --git a/server/src/com/vaadin/ui/Panel.java b/server/src/com/vaadin/ui/Panel.java
index b5cfe04407..472aefd5e0 100644
--- a/server/src/com/vaadin/ui/Panel.java
+++ b/server/src/com/vaadin/ui/Panel.java
@@ -56,20 +56,19 @@ public class Panel extends AbstractSingleComponentContainer implements
};
/**
- * Creates a new empty panel. A VerticalLayout is used as content.
+ * Creates a new empty panel.
*/
public Panel() {
this((ComponentContainer) null);
}
/**
- * Creates a new empty panel which contains the given content. The content
- * cannot be null.
+ * Creates a new empty panel which contains the given content.
*
* @param content
* the content for the panel.
*/
- public Panel(ComponentContainer content) {
+ public Panel(Component content) {
registerRpc(rpc);
setContent(content);
setWidth(100, Unit.PERCENTAGE);
@@ -77,7 +76,7 @@ public class Panel extends AbstractSingleComponentContainer implements
}
/**
- * Creates a new empty panel with caption. Default layout is used.
+ * Creates a new empty panel with caption.
*
* @param caption
* the caption used in the panel (HTML).
@@ -94,7 +93,7 @@ public class Panel extends AbstractSingleComponentContainer implements
* @param content
* the content used in the panel.
*/
- public Panel(String caption, ComponentContainer content) {
+ public Panel(String caption, Component content) {
this(content);
setCaption(caption);
}
diff --git a/server/src/com/vaadin/ui/PopupDateField.java b/server/src/com/vaadin/ui/PopupDateField.java
index 39e0578301..8d26fa8e25 100644
--- a/server/src/com/vaadin/ui/PopupDateField.java
+++ b/server/src/com/vaadin/ui/PopupDateField.java
@@ -21,6 +21,7 @@ import java.util.Date;
import com.vaadin.data.Property;
import com.vaadin.server.PaintException;
import com.vaadin.server.PaintTarget;
+import com.vaadin.shared.ui.datefield.PopupDateFieldState;
/**
* <p>
@@ -87,4 +88,34 @@ public class PopupDateField extends DateField {
markAsDirty();
}
+ @Override
+ protected PopupDateFieldState getState() {
+ return (PopupDateFieldState) super.getState();
+ }
+
+ /**
+ * Checks whether the text field is enabled (default) or not.
+ *
+ * @see PopupDateField#setTextFieldEnabled(boolean);
+ *
+ * @return <b>true</b> if the text field is enabled, <b>false</b> otherwise.
+ */
+ public boolean isTextFieldEnabled() {
+ return getState().textFieldEnabled;
+ }
+
+ /**
+ * Enables or disables the text field. By default the text field is enabled.
+ * Disabling it causes only the button for date selection to be active, thus
+ * preventing the user from entering invalid dates.
+ *
+ * See {@link http://dev.vaadin.com/ticket/6790}.
+ *
+ * @param state
+ * <b>true</b> to enable text field, <b>false</b> to disable it.
+ */
+ public void setTextFieldEnabled(boolean state) {
+ getState().textFieldEnabled = state;
+ }
+
}
diff --git a/server/src/com/vaadin/ui/SelectiveRenderer.java b/server/src/com/vaadin/ui/SelectiveRenderer.java
new file mode 100644
index 0000000000..47fd9bf0ee
--- /dev/null
+++ b/server/src/com/vaadin/ui/SelectiveRenderer.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui;
+
+/**
+ * Interface implemented by {@link HasComponents} implementors that wish to
+ * dynamically be able to prevent given child components from reaching the
+ * client side.
+ *
+ * @author Vaadin Ltd
+ * @version @VERSION@
+ * @since 7.0
+ *
+ */
+public interface SelectiveRenderer extends HasComponents {
+ /**
+ * Checks if the child component should be rendered (sent to the client
+ * side). This method allows hiding a child component from updates and
+ * communication to and from the client. It is mostly useful for parents
+ * which show only a limited number of their children at any given time and
+ * want to allow updates only for the visible children (e.g. TabSheet has
+ * one tab open at a time).
+ * <p>
+ * This method can only prevent updates from reaching the client, not force
+ * child components to reach the client. If the child is set to visible,
+ * returning false will prevent the child from being sent to the client. If
+ * a child is set to invisible, this method has no effect.
+ * </p>
+ *
+ * @param childComponent
+ * The child component to check
+ * @return true if the child component may be sent to the client, false
+ * otherwise
+ */
+ public boolean isRendered(Component childComponent);
+
+}
diff --git a/server/src/com/vaadin/ui/TabSheet.java b/server/src/com/vaadin/ui/TabSheet.java
index 227743e9f4..1a76aa88bc 100644
--- a/server/src/com/vaadin/ui/TabSheet.java
+++ b/server/src/com/vaadin/ui/TabSheet.java
@@ -70,7 +70,7 @@ import com.vaadin.ui.themes.Runo;
* @since 3.0
*/
public class TabSheet extends AbstractComponentContainer implements Focusable,
- FocusNotifier, BlurNotifier, LegacyComponent {
+ FocusNotifier, BlurNotifier, LegacyComponent, SelectiveRenderer {
/**
* List of component tabs (tab contents). In addition to being on this list,
@@ -1290,7 +1290,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
}
@Override
- public boolean isComponentVisible(Component childComponent) {
+ public boolean isRendered(Component childComponent) {
return childComponent == getSelectedTab();
}
diff --git a/server/src/com/vaadin/ui/Table.java b/server/src/com/vaadin/ui/Table.java
index 352b9212a7..f224e13dfd 100644
--- a/server/src/com/vaadin/ui/Table.java
+++ b/server/src/com/vaadin/ui/Table.java
@@ -5579,11 +5579,6 @@ public class Table extends AbstractSelect implements Action.Container,
return iterator();
}
- @Override
- public boolean isComponentVisible(Component childComponent) {
- return true;
- }
-
private final Logger getLogger() {
if (logger == null) {
logger = Logger.getLogger(Table.class.getName());
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index e4cee9386a..83936a7478 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -37,7 +37,7 @@ import com.vaadin.server.PaintTarget;
import com.vaadin.server.UIProvider;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinService;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.server.VaadinServlet;
import com.vaadin.shared.EventId;
import com.vaadin.shared.MouseEventDetails;
@@ -60,10 +60,9 @@ import com.vaadin.util.ReflectTools;
* <p>
* When a new UI instance is needed, typically because the user opens a URL in a
* browser window which points to e.g. {@link VaadinServlet}, all
- * {@link UIProvider}s registered to the current {@link VaadinServiceSession}
- * are queried for the UI class that should be used. The selection is by defaylt
- * based on the {@value VaadinServiceSession#UI_PARAMETER} parameter from
- * web.xml.
+ * {@link UIProvider}s registered to the current {@link VaadinSession} are
+ * queried for the UI class that should be used. The selection is by defaylt
+ * based on the {@value VaadinSession#UI_PARAMETER} parameter from web.xml.
* </p>
* <p>
* After a UI has been created by the application, it is initialized using
@@ -121,7 +120,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements
/**
* The application to which this UI belongs
*/
- private VaadinServiceSession session;
+ private VaadinSession session;
/**
* List of windows in this UI.
@@ -139,7 +138,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements
* which a request originates. A negative value indicates that the UI id has
* not yet been assigned by the Application.
*
- * @see VaadinServiceSession#getNextUIid()
+ * @see VaadinSession#getNextUIid()
*/
private int uiId = -1;
@@ -173,9 +172,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements
* current time whenever the application receives a heartbeat or UIDL
* request from the client for this UI.
*/
- private long lastHeartbeat = System.currentTimeMillis();
-
- private long lastUidlRequest = System.currentTimeMillis();
+ private long lastHeartbeatTimestamp = System.currentTimeMillis();
/**
* Creates a new empty UI without a caption. The content of the UI must be
@@ -235,8 +232,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements
* <p>
* Getting a null value is often a problem in constructors of regular
* components and in the initializers of custom composite components. A
- * standard workaround is to use {@link VaadinServiceSession#getCurrent()}
- * to retrieve the application instance that the current request relates to.
+ * standard workaround is to use {@link VaadinSession#getCurrent()} to
+ * retrieve the application instance that the current request relates to.
* Another way is to move the problematic initialization to
* {@link #attach()}, as described in the documentation of the method.
* </p>
@@ -245,7 +242,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements
* @see #attach()
*/
@Override
- public VaadinServiceSession getSession() {
+ public VaadinSession getSession() {
return session;
}
@@ -365,7 +362,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements
*
* @see #getSession()
*/
- public void setSession(VaadinServiceSession session) {
+ public void setSession(VaadinSession session) {
if ((session == null) == (this.session == null)) {
throw new IllegalStateException(
"VaadinServiceSession has already been set. Old session: "
@@ -384,7 +381,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements
}
}
- private static String getSessionDetails(VaadinServiceSession session) {
+ private static String getSessionDetails(VaadinSession session) {
if (session == null) {
return null;
} else {
@@ -943,43 +940,29 @@ public abstract class UI extends AbstractSingleComponentContainer implements
}
/**
- * Returns the timestamp (milliseconds since the epoch) of the last received
- * heartbeat for this UI.
+ * Returns the timestamp of the last received heartbeat for this UI.
*
* @see #heartbeat()
- * @see VaadinServiceSession#cleanupInactiveUIs()
- *
- * @return The time the last heartbeat request occurred.
- */
- public long getLastHeartbeatTime() {
- return lastHeartbeat;
- }
-
- /**
- * Returns the timestamp (milliseconds since the epoch) of the last received
- * UIDL request for this UI.
+ * @see VaadinSession#cleanupInactiveUIs()
*
- * @return
+ * @return The time the last heartbeat request occurred, in milliseconds
+ * since the epoch.
*/
- public long getLastUidlRequestTime() {
- return lastUidlRequest;
+ public long getLastHeartbeatTimestamp() {
+ return lastHeartbeatTimestamp;
}
/**
* Sets the last heartbeat request timestamp for this UI. Called by the
* framework whenever the application receives a valid heartbeat request for
* this UI.
+ *
+ * @param lastHeartbeat
+ * The time the last heartbeat request occurred, in milliseconds
+ * since the epoch.
*/
- public void setLastHeartbeatTime(long lastHeartbeat) {
- this.lastHeartbeat = lastHeartbeat;
- }
-
- /**
- * Sets the last UIDL request timestamp for this UI. Called by the framework
- * whenever the application receives a valid UIDL request for this UI.
- */
- public void setLastUidlRequestTime(long lastUidlRequest) {
- this.lastUidlRequest = lastUidlRequest;
+ public void setLastHeartbeatTimestamp(long lastHeartbeat) {
+ lastHeartbeatTimestamp = lastHeartbeat;
}
/**
diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java
index 3f6091aa90..338c77239a 100644
--- a/server/src/com/vaadin/ui/Window.java
+++ b/server/src/com/vaadin/ui/Window.java
@@ -42,10 +42,8 @@ import com.vaadin.shared.ui.window.WindowState;
* {@link UI}. A window is added to a {@code UI} using
* {@link UI#addWindow(Window)}. </p>
* <p>
- * The contents of a window is set using {@link #setContent(ComponentContainer)}
- * or by using the {@link #Window(String, ComponentContainer)} constructor. The
- * contents can in turn contain other components. By default, a
- * {@link VerticalLayout} is used as content.
+ * The contents of a window is set using {@link #setContent(Component)} or by
+ * using the {@link #Window(String, Component)} constructor.
* </p>
* <p>
* A window can be positioned on the screen using absolute coordinates (pixels)
@@ -75,14 +73,14 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
};
/**
- * Creates a new unnamed window with a default layout.
+ * Creates a new, empty sub window
*/
public Window() {
this("", null);
}
/**
- * Creates a new unnamed window with a default layout and given title.
+ * Creates a new, empty sub window with a given title.
*
* @param caption
* the title of the window.
@@ -92,14 +90,14 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
}
/**
- * Creates a new unnamed window with the given content and title.
+ * Creates a new, empty sub window with the given content and title.
*
* @param caption
* the title of the window.
* @param content
* the contents of the window
*/
- public Window(String caption, ComponentContainer content) {
+ public Window(String caption, Component content) {
super(caption, content);
registerRpc(rpc);
setSizeUndefined();
diff --git a/server/tests/src/com/vaadin/tests/VaadinClasses.java b/server/tests/src/com/vaadin/tests/VaadinClasses.java
index b0d06ea897..e88786432c 100644
--- a/server/tests/src/com/vaadin/tests/VaadinClasses.java
+++ b/server/tests/src/com/vaadin/tests/VaadinClasses.java
@@ -17,7 +17,7 @@ import java.util.jar.JarEntry;
import org.junit.Test;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.ui.Component;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.CustomComponent;
@@ -144,7 +144,7 @@ public class VaadinClasses {
String basePackage, String[] ignoredPackages) throws IOException {
List<Class<? extends T>> classes = new ArrayList<Class<? extends T>>();
String basePackageDirName = "/" + basePackage.replace('.', '/');
- URL location = VaadinServiceSession.class
+ URL location = VaadinSession.class
.getResource(basePackageDirName);
if (location.getProtocol().equals("file")) {
try {
diff --git a/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java b/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java
index 0ba7779e79..e074b60f73 100644
--- a/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java
+++ b/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java
@@ -21,7 +21,7 @@ import junit.framework.TestCase;
import com.vaadin.data.util.converter.Converter;
import com.vaadin.data.util.converter.DefaultConverterFactory;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.ui.TextField;
public class ConverterFactory extends TestCase {
@@ -65,15 +65,15 @@ public class ConverterFactory extends TestCase {
}
public void testApplicationConverterFactoryInBackgroundThread() {
- VaadinServiceSession.setCurrent(null);
- final VaadinServiceSession appWithCustomIntegerConverter = new VaadinServiceSession(
+ VaadinSession.setCurrent(null);
+ final VaadinSession appWithCustomIntegerConverter = new VaadinSession(
null);
appWithCustomIntegerConverter
.setConverterFactory(new ConverterFactory42());
TextField tf = new TextField("", "123") {
@Override
- public VaadinServiceSession getSession() {
+ public VaadinSession getSession() {
return appWithCustomIntegerConverter;
};
};
@@ -84,11 +84,11 @@ public class ConverterFactory extends TestCase {
}
public void testApplicationConverterFactoryForDetachedComponent() {
- final VaadinServiceSession appWithCustomIntegerConverter = new VaadinServiceSession(
+ final VaadinSession appWithCustomIntegerConverter = new VaadinSession(
null);
appWithCustomIntegerConverter
.setConverterFactory(new ConverterFactory42());
- VaadinServiceSession.setCurrent(appWithCustomIntegerConverter);
+ VaadinSession.setCurrent(appWithCustomIntegerConverter);
TextField tf = new TextField("", "123");
tf.setConverter(Integer.class);
@@ -98,15 +98,15 @@ public class ConverterFactory extends TestCase {
}
public void testApplicationConverterFactoryForDifferentThanCurrentApplication() {
- final VaadinServiceSession fieldAppWithCustomIntegerConverter = new VaadinServiceSession(
+ final VaadinSession fieldAppWithCustomIntegerConverter = new VaadinSession(
null);
fieldAppWithCustomIntegerConverter
.setConverterFactory(new ConverterFactory42());
- VaadinServiceSession.setCurrent(new VaadinServiceSession(null));
+ VaadinSession.setCurrent(new VaadinSession(null));
TextField tf = new TextField("", "123") {
@Override
- public VaadinServiceSession getSession() {
+ public VaadinSession getSession() {
return fieldAppWithCustomIntegerConverter;
}
};
diff --git a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java
index 5c74077ca9..f8dceca363 100644
--- a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java
+++ b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java
@@ -7,7 +7,7 @@ import org.easymock.EasyMock;
import com.vaadin.server.CommunicationManager;
import com.vaadin.server.StreamVariable;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.ui.UI;
import com.vaadin.ui.Upload;
@@ -21,7 +21,7 @@ public class TestStreamVariableMapping extends TestCase {
@Override
protected void setUp() throws Exception {
- final VaadinServiceSession application = new VaadinServiceSession(null);
+ final VaadinSession application = new VaadinSession(null);
final UI uI = new UI() {
@Override
protected void init(VaadinRequest request) {
@@ -30,7 +30,7 @@ public class TestStreamVariableMapping extends TestCase {
}
@Override
- public VaadinServiceSession getSession() {
+ public VaadinSession getSession() {
return application;
}
};
@@ -66,7 +66,7 @@ public class TestStreamVariableMapping extends TestCase {
}
private CommunicationManager createCommunicationManager() {
- return new CommunicationManager(new VaadinServiceSession(null));
+ return new CommunicationManager(new VaadinSession(null));
}
}
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
index 83224861b6..16c7c4060d 100644
--- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
@@ -12,7 +12,7 @@ import com.vaadin.data.util.ObjectProperty;
import com.vaadin.data.util.converter.Converter;
import com.vaadin.data.util.converter.Converter.ConversionException;
import com.vaadin.data.util.converter.StringToIntegerConverter;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.tests.data.bean.Address;
import com.vaadin.tests.data.bean.Country;
import com.vaadin.tests.data.bean.Person;
@@ -157,11 +157,11 @@ public class AbstractFieldValueConversions extends TestCase {
}
public void testNumberDoubleConverterChange() {
- final VaadinServiceSession a = new VaadinServiceSession(null);
- VaadinServiceSession.setCurrent(a);
+ final VaadinSession a = new VaadinSession(null);
+ VaadinSession.setCurrent(a);
TextField tf = new TextField() {
@Override
- public VaadinServiceSession getSession() {
+ public VaadinSession getSession() {
return a;
}
};
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java
index 43a7d90922..9338d74f05 100644
--- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java
@@ -6,7 +6,7 @@ import java.util.Locale;
import junit.framework.TestCase;
import com.vaadin.data.util.MethodProperty;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.tests.data.bean.Address;
import com.vaadin.tests.data.bean.Country;
import com.vaadin.tests.data.bean.Person;
@@ -26,8 +26,8 @@ public class DefaultConverterFactory extends TestCase {
}
public void testDefaultNumberConversion() {
- VaadinServiceSession app = new VaadinServiceSession(null);
- VaadinServiceSession.setCurrent(app);
+ VaadinSession app = new VaadinSession(null);
+ VaadinSession.setCurrent(app);
TextField tf = new TextField();
tf.setLocale(new Locale("en", "US"));
tf.setPropertyDataSource(new MethodProperty<Integer>(paulaBean,
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
index e81f4ac6f7..577275b4d9 100644
--- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
@@ -8,7 +8,7 @@ import com.vaadin.data.Property;
import com.vaadin.data.util.AbstractProperty;
import com.vaadin.data.util.converter.Converter.ConversionException;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.UI;
@@ -18,7 +18,7 @@ public class RemoveListenersOnDetach {
int numReadOnlyChanges = 0;
AbstractField field = new AbstractField() {
- final private VaadinServiceSession application = new VaadinServiceSession(
+ final private VaadinSession application = new VaadinSession(
null);
private UI uI = new UI() {
@@ -28,7 +28,7 @@ public class RemoveListenersOnDetach {
}
@Override
- public VaadinServiceSession getSession() {
+ public VaadinSession getSession() {
return application;
}
@@ -58,7 +58,7 @@ public class RemoveListenersOnDetach {
};
@Override
- public VaadinServiceSession getSession() {
+ public VaadinSession getSession() {
return application;
};
};
diff --git a/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java b/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java
index 68e983f8a5..5a27a192c2 100644
--- a/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java
+++ b/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java
@@ -19,7 +19,7 @@ import junit.framework.TestCase;
import com.vaadin.data.Property;
import com.vaadin.data.util.MethodProperty;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.tests.data.bean.Person;
import com.vaadin.ui.Label;
@@ -37,7 +37,7 @@ public class LabelConverters extends TestCase {
}
public void testIntegerDataSource() {
- VaadinServiceSession.setCurrent(new VaadinServiceSession(null));
+ VaadinSession.setCurrent(new VaadinSession(null));
Label l = new Label("Foo");
Property ds = new MethodProperty<Integer>(Person.createTestPerson1(),
"age");
diff --git a/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java b/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java
index 71749ed964..e02fafeaff 100644
--- a/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java
+++ b/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java
@@ -14,7 +14,7 @@ import com.vaadin.server.DeploymentConfiguration;
import com.vaadin.server.UIClassSelectionEvent;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinService;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.ui.UI;
public class CustomUIClassLoader extends TestCase {
@@ -53,7 +53,7 @@ public class CustomUIClassLoader extends TestCase {
* if thrown
*/
public void testWithNullClassLoader() throws Exception {
- VaadinServiceSession application = createStubApplication();
+ VaadinSession application = createStubApplication();
application.setConfiguration(createConfigurationMock());
DefaultUIProvider uiProvider = new DefaultUIProvider();
@@ -65,7 +65,7 @@ public class CustomUIClassLoader extends TestCase {
private static DeploymentConfiguration createConfigurationMock() {
Properties properties = new Properties();
- properties.put(VaadinServiceSession.UI_PARAMETER, MyUI.class.getName());
+ properties.put(VaadinSession.UI_PARAMETER, MyUI.class.getName());
return new DefaultDeploymentConfiguration(CustomUIClassLoader.class,
properties);
}
@@ -111,8 +111,8 @@ public class CustomUIClassLoader extends TestCase {
}
- private VaadinServiceSession createStubApplication() {
- return new VaadinServiceSession(null) {
+ private VaadinSession createStubApplication() {
+ return new VaadinSession(null) {
@Override
public DeploymentConfiguration getConfiguration() {
return createConfigurationMock();
diff --git a/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java b/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java
index 031b332ee7..bf6d127a83 100644
--- a/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java
+++ b/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java
@@ -7,7 +7,7 @@ import static org.junit.Assert.assertTrue;
import org.junit.Test;
import com.vaadin.server.LegacyApplication;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.ui.LegacyWindow;
import com.vaadin.ui.UI;
import com.vaadin.ui.Window;
@@ -25,7 +25,7 @@ public class AddRemoveSubWindow {
@Test
public void addSubWindow() {
- VaadinServiceSession.setCurrent(new VaadinServiceSession(null));
+ VaadinSession.setCurrent(new VaadinSession(null));
TestApp app = new TestApp();
app.init();
Window subWindow = new Window("Sub window");
diff --git a/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java b/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java
index a00e5e0996..63a58bcab3 100644
--- a/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java
+++ b/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java
@@ -7,7 +7,7 @@ import org.junit.Test;
import com.vaadin.server.ClientConnector;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
@@ -15,7 +15,7 @@ import com.vaadin.ui.Window;
public class AttachDetachWindow {
- private VaadinServiceSession testApp = new VaadinServiceSession(null);
+ private VaadinSession testApp = new VaadinSession(null);
private interface TestContainer {
public boolean attachCalled();
@@ -24,7 +24,7 @@ public class AttachDetachWindow {
public TestContent getTestContent();
- public VaadinServiceSession getSession();
+ public VaadinSession getSession();
}
private class TestWindow extends Window implements TestContainer {
@@ -64,7 +64,7 @@ public class AttachDetachWindow {
}
@Override
- public VaadinServiceSession getSession() {
+ public VaadinSession getSession() {
return super.getSession();
}
}
@@ -243,7 +243,7 @@ public class AttachDetachWindow {
getSession(win.getTestContent().child), null);
}
- private VaadinServiceSession getSession(ClientConnector testContainer) {
+ private VaadinSession getSession(ClientConnector testContainer) {
UI ui = testContainer.getUI();
if (ui != null) {
return ui.getSession();
diff --git a/server/tests/src/com/vaadin/ui/LabelDataSource.java b/server/tests/src/com/vaadin/ui/LabelDataSource.java
index 7ef8d67c2a..4240735f63 100644
--- a/server/tests/src/com/vaadin/ui/LabelDataSource.java
+++ b/server/tests/src/com/vaadin/ui/LabelDataSource.java
@@ -23,7 +23,7 @@ import org.junit.Test;
import com.vaadin.data.util.ObjectProperty;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
public class LabelDataSource {
@@ -35,12 +35,12 @@ public class LabelDataSource {
private static final Object INTEGER_STRING_VALUE_DE = "1.587";
ObjectProperty<String> stringDataSource;
private ObjectProperty<Integer> integerDataSource;
- VaadinServiceSession vaadinSession;
+ VaadinSession vaadinSession;
@Before
public void setup() {
- vaadinSession = new VaadinServiceSession(null);
- VaadinServiceSession.setCurrent(vaadinSession);
+ vaadinSession = new VaadinSession(null);
+ VaadinSession.setCurrent(vaadinSession);
label = new Label();
stringDataSource = new ObjectProperty<String>(STRING_DS_VALUE);
diff --git a/shared/src/com/vaadin/shared/ComponentState.java b/shared/src/com/vaadin/shared/AbstractComponentState.java
index d8b5fec587..e1f7916874 100644
--- a/shared/src/com/vaadin/shared/ComponentState.java
+++ b/shared/src/com/vaadin/shared/AbstractComponentState.java
@@ -19,15 +19,16 @@ package com.vaadin.shared;
import java.util.List;
import com.vaadin.shared.communication.SharedState;
+import com.vaadin.ui.AbstractComponent;
/**
- * Default shared state implementation for UI components.
+ * Default shared state implementation for {@link AbstractComponent}.
*
- * State classes of concrete components should extend this class.
+ * State classes of components should typically extend this class.
*
* @since 7.0
*/
-public class ComponentState extends SharedState {
+public class AbstractComponentState extends SharedState {
public String height = "";
public String width = "";
public boolean readOnly = false;
diff --git a/shared/src/com/vaadin/shared/annotations/Delayed.java b/shared/src/com/vaadin/shared/annotations/Delayed.java
index 706ffc1c53..a9914ac35f 100644
--- a/shared/src/com/vaadin/shared/annotations/Delayed.java
+++ b/shared/src/com/vaadin/shared/annotations/Delayed.java
@@ -37,7 +37,7 @@ import com.vaadin.shared.communication.ServerRpc;
@Documented
public @interface Delayed {
/**
- * By setting lastonly to <code>true</code>, any previous invocations of the
+ * By setting lastOnly to <code>true</code>, any previous invocations of the
* same method will be removed from the queue when a new invocation is
* added. This can be used in cases where only the last value is of
* interest.
@@ -50,5 +50,5 @@ public @interface Delayed {
* method should be sent to the server, <code>false</code> if all
* enqueued invocations should be sent.
*/
- public boolean lastonly() default false;
+ public boolean lastOnly() default false;
}
diff --git a/shared/src/com/vaadin/shared/communication/LegacyChangeVariablesInvocation.java b/shared/src/com/vaadin/shared/communication/LegacyChangeVariablesInvocation.java
index 2ffc56dd71..c41087e284 100644
--- a/shared/src/com/vaadin/shared/communication/LegacyChangeVariablesInvocation.java
+++ b/shared/src/com/vaadin/shared/communication/LegacyChangeVariablesInvocation.java
@@ -48,9 +48,9 @@ public class LegacyChangeVariablesInvocation extends MethodInvocation {
}
@Override
- public String getLastonlyTag() {
+ public String getLastOnlyTag() {
assert variableChanges.size() == 1;
- return super.getLastonlyTag()
+ return super.getLastOnlyTag()
+ variableChanges.keySet().iterator().next();
}
diff --git a/shared/src/com/vaadin/shared/communication/MethodInvocation.java b/shared/src/com/vaadin/shared/communication/MethodInvocation.java
index c4da937c27..1e683ce231 100644
--- a/shared/src/com/vaadin/shared/communication/MethodInvocation.java
+++ b/shared/src/com/vaadin/shared/communication/MethodInvocation.java
@@ -74,14 +74,14 @@ public class MethodInvocation implements Serializable {
/**
* Gets a String tag that is used to uniquely identify previous method
* invocations that should be purged from the queue if
- * <code>{@literal @}Delay(lastonly = true)</code> is used.
+ * <code>{@literal @}Delay(lastOnly = true)</code> is used.
* <p>
* The returned string should contain at least one non-number char to ensure
- * it doesn't collide with the keys used for invocations without lastonly.
+ * it doesn't collide with the keys used for invocations without lastOnly.
*
* @return a string identifying this method invocation
*/
- public String getLastonlyTag() {
+ public String getLastOnlyTag() {
return connectorId + "-" + getInterfaceName() + "-" + getMethodName();
}
diff --git a/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java b/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java
index 608152cc54..b7e689f8bc 100644
--- a/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java
+++ b/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java
@@ -1,8 +1,8 @@
package com.vaadin.shared.ui;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
-public class AbstractEmbeddedState extends ComponentState {
+public class AbstractEmbeddedState extends AbstractComponentState {
public static final String SOURCE_RESOURCE = "source";
diff --git a/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java b/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java
index 4fc865626c..cbb02ceaa4 100644
--- a/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java
+++ b/shared/src/com/vaadin/shared/ui/AbstractLayoutState.java
@@ -15,8 +15,8 @@
*/
package com.vaadin.shared.ui;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
-public class AbstractLayoutState extends ComponentState {
+public class AbstractLayoutState extends AbstractComponentState {
} \ No newline at end of file
diff --git a/shared/src/com/vaadin/shared/ui/AbstractMediaState.java b/shared/src/com/vaadin/shared/ui/AbstractMediaState.java
index 76d4e1b000..56c1989d5b 100644
--- a/shared/src/com/vaadin/shared/ui/AbstractMediaState.java
+++ b/shared/src/com/vaadin/shared/ui/AbstractMediaState.java
@@ -18,10 +18,10 @@ package com.vaadin.shared.ui;
import java.util.ArrayList;
import java.util.List;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.communication.URLReference;
-public class AbstractMediaState extends ComponentState {
+public class AbstractMediaState extends AbstractComponentState {
public boolean showControls;
public String altText;
diff --git a/shared/src/com/vaadin/shared/ui/BrowserPopupExtensionState.java b/shared/src/com/vaadin/shared/ui/BrowserPopupExtensionState.java
index a9ca6841d8..199de54f8f 100644
--- a/shared/src/com/vaadin/shared/ui/BrowserPopupExtensionState.java
+++ b/shared/src/com/vaadin/shared/ui/BrowserPopupExtensionState.java
@@ -16,9 +16,9 @@
package com.vaadin.shared.ui;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
-public class BrowserPopupExtensionState extends ComponentState {
+public class BrowserPopupExtensionState extends AbstractComponentState {
public String target = "_blank";
diff --git a/shared/src/com/vaadin/shared/ui/ComponentStateUtil.java b/shared/src/com/vaadin/shared/ui/ComponentStateUtil.java
index 33f841fa09..8106e8af98 100644
--- a/shared/src/com/vaadin/shared/ui/ComponentStateUtil.java
+++ b/shared/src/com/vaadin/shared/ui/ComponentStateUtil.java
@@ -2,7 +2,7 @@ package com.vaadin.shared.ui;
import java.util.HashSet;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.communication.SharedState;
public final class ComponentStateUtil {
@@ -11,27 +11,27 @@ public final class ComponentStateUtil {
// Util class is not instantiable
}
- public static final boolean isUndefinedWidth(ComponentState state) {
+ public static final boolean isUndefinedWidth(AbstractComponentState state) {
return state.width == null || "".equals(state.width);
}
- public static final boolean isUndefinedHeight(ComponentState state) {
+ public static final boolean isUndefinedHeight(AbstractComponentState state) {
return state.height == null || "".equals(state.height);
}
- public static final boolean hasDescription(ComponentState state) {
+ public static final boolean hasDescription(AbstractComponentState state) {
return state.description != null && !"".equals(state.description);
}
- public static final boolean hasStyles(ComponentState state) {
+ public static final boolean hasStyles(AbstractComponentState state) {
return state.styles != null && !state.styles.isEmpty();
}
- public static final boolean isRelativeWidth(ComponentState state) {
+ public static final boolean isRelativeWidth(AbstractComponentState state) {
return state.width != null && state.width.endsWith("%");
}
- public static final boolean isRelativeHeight(ComponentState state) {
+ public static final boolean isRelativeHeight(AbstractComponentState state) {
return state.height != null && state.height.endsWith("%");
}
diff --git a/shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java b/shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java
index 7a2eedd95d..1252b7f235 100644
--- a/shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java
+++ b/shared/src/com/vaadin/shared/ui/JavaScriptComponentState.java
@@ -21,10 +21,10 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.JavaScriptConnectorState;
-public class JavaScriptComponentState extends ComponentState implements
+public class JavaScriptComponentState extends AbstractComponentState implements
JavaScriptConnectorState {
private Set<String> callbackNames = new HashSet<String>();
diff --git a/shared/src/com/vaadin/shared/ui/TabIndexState.java b/shared/src/com/vaadin/shared/ui/TabIndexState.java
index a9cb56e5ed..bb446829be 100644
--- a/shared/src/com/vaadin/shared/ui/TabIndexState.java
+++ b/shared/src/com/vaadin/shared/ui/TabIndexState.java
@@ -15,7 +15,7 @@
*/
package com.vaadin.shared.ui;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
/**
* Interface implemented by state classes that support tab indexes.
@@ -24,7 +24,7 @@ import com.vaadin.shared.ComponentState;
* @since 7.0.0
*
*/
-public class TabIndexState extends ComponentState {
+public class TabIndexState extends AbstractComponentState {
/**
* The <i>tabulator index</i> of the field.
diff --git a/shared/src/com/vaadin/shared/ui/button/ButtonState.java b/shared/src/com/vaadin/shared/ui/button/ButtonState.java
index e7272379bb..48feb596dc 100644
--- a/shared/src/com/vaadin/shared/ui/button/ButtonState.java
+++ b/shared/src/com/vaadin/shared/ui/button/ButtonState.java
@@ -16,14 +16,14 @@
package com.vaadin.shared.ui.button;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.ui.TabIndexState;
/**
* Shared state for {@link com.vaadin.ui.Button} and
* {@link com.vaadin.ui.NativeButton}.
*
- * @see ComponentState
+ * @see AbstractComponentState
*
* @since 7.0
*/
diff --git a/shared/src/com/vaadin/shared/ui/datefield/PopupDateFieldState.java b/shared/src/com/vaadin/shared/ui/datefield/PopupDateFieldState.java
index c0d3b20c28..deed182d8e 100644
--- a/shared/src/com/vaadin/shared/ui/datefield/PopupDateFieldState.java
+++ b/shared/src/com/vaadin/shared/ui/datefield/PopupDateFieldState.java
@@ -4,4 +4,7 @@ public class PopupDateFieldState extends TextualDateFieldState {
{
primaryStyleName = "v-datefield";
}
+
+ public boolean textFieldEnabled = true;
+
}
diff --git a/shared/src/com/vaadin/shared/ui/label/LabelState.java b/shared/src/com/vaadin/shared/ui/label/LabelState.java
index 2cccc310aa..72cdcaad62 100644
--- a/shared/src/com/vaadin/shared/ui/label/LabelState.java
+++ b/shared/src/com/vaadin/shared/ui/label/LabelState.java
@@ -15,9 +15,9 @@
*/
package com.vaadin.shared.ui.label;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
-public class LabelState extends ComponentState {
+public class LabelState extends AbstractComponentState {
{
primaryStyleName = "v-label";
}
diff --git a/shared/src/com/vaadin/shared/ui/link/LinkState.java b/shared/src/com/vaadin/shared/ui/link/LinkState.java
index 96b4600000..3e4436f5e3 100644
--- a/shared/src/com/vaadin/shared/ui/link/LinkState.java
+++ b/shared/src/com/vaadin/shared/ui/link/LinkState.java
@@ -1,8 +1,8 @@
package com.vaadin.shared.ui.link;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
-public class LinkState extends ComponentState {
+public class LinkState extends AbstractComponentState {
{
primaryStyleName = "v-link";
}
diff --git a/shared/src/com/vaadin/shared/ui/menubar/MenuBarState.java b/shared/src/com/vaadin/shared/ui/menubar/MenuBarState.java
index cf1ef99c06..192dfa2e0f 100644
--- a/shared/src/com/vaadin/shared/ui/menubar/MenuBarState.java
+++ b/shared/src/com/vaadin/shared/ui/menubar/MenuBarState.java
@@ -1,8 +1,8 @@
package com.vaadin.shared.ui.menubar;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
-public class MenuBarState extends ComponentState {
+public class MenuBarState extends AbstractComponentState {
{
primaryStyleName = "v-menubar";
}
diff --git a/shared/src/com/vaadin/shared/ui/panel/PanelState.java b/shared/src/com/vaadin/shared/ui/panel/PanelState.java
index 9d502df8fe..433bef72a5 100644
--- a/shared/src/com/vaadin/shared/ui/panel/PanelState.java
+++ b/shared/src/com/vaadin/shared/ui/panel/PanelState.java
@@ -15,9 +15,9 @@
*/
package com.vaadin.shared.ui.panel;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
-public class PanelState extends ComponentState {
+public class PanelState extends AbstractComponentState {
{
primaryStyleName = "v-panel";
}
diff --git a/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java b/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java
index 0f83d0fcd4..2af516daac 100644
--- a/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java
+++ b/shared/src/com/vaadin/shared/ui/popupview/PopupViewState.java
@@ -1,8 +1,8 @@
package com.vaadin.shared.ui.popupview;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
-public class PopupViewState extends ComponentState {
+public class PopupViewState extends AbstractComponentState {
public String html;
public boolean hideOnMouseOut;
diff --git a/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java b/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java
index 8bddffdfd6..fb1b4c1262 100644
--- a/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java
+++ b/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java
@@ -17,10 +17,10 @@ package com.vaadin.shared.ui.splitpanel;
import java.io.Serializable;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.Connector;
-public class AbstractSplitPanelState extends ComponentState {
+public class AbstractSplitPanelState extends AbstractComponentState {
public Connector firstChild = null;
public Connector secondChild = null;
public SplitterState splitterState = new SplitterState();
diff --git a/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java
index a36acca9dc..c89a20bb22 100644
--- a/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java
+++ b/shared/src/com/vaadin/shared/ui/tabsheet/TabsheetState.java
@@ -1,8 +1,8 @@
package com.vaadin.shared.ui.tabsheet;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
-public class TabsheetState extends ComponentState {
+public class TabsheetState extends AbstractComponentState {
{
primaryStyleName = "v-tabsheet";
}
diff --git a/shared/src/com/vaadin/shared/ui/ui/UIServerRpc.java b/shared/src/com/vaadin/shared/ui/ui/UIServerRpc.java
index ef28a12415..11a400bbe0 100644
--- a/shared/src/com/vaadin/shared/ui/ui/UIServerRpc.java
+++ b/shared/src/com/vaadin/shared/ui/ui/UIServerRpc.java
@@ -20,7 +20,7 @@ import com.vaadin.shared.communication.ServerRpc;
import com.vaadin.shared.ui.ClickRpc;
public interface UIServerRpc extends ClickRpc, ServerRpc {
- @Delayed(lastonly = true)
+ @Delayed(lastOnly = true)
public void resize(int viewWidth, int viewHeight, int windowWidth,
int windowHeight);
} \ No newline at end of file
diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java
index 028218409f..59eff36435 100644
--- a/shared/src/com/vaadin/shared/ui/ui/UIState.java
+++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java
@@ -15,9 +15,9 @@
*/
package com.vaadin.shared.ui.ui;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
-public class UIState extends ComponentState {
+public class UIState extends AbstractComponentState {
{
primaryStyleName = "v-ui";
}
diff --git a/theme-compiler/src/com/vaadin/sass/SassCompiler.java b/theme-compiler/src/com/vaadin/sass/SassCompiler.java
index e6ac31b865..07d6eb01f1 100644
--- a/theme-compiler/src/com/vaadin/sass/SassCompiler.java
+++ b/theme-compiler/src/com/vaadin/sass/SassCompiler.java
@@ -25,14 +25,20 @@ public class SassCompiler {
public static void main(String[] args) throws Exception {
String input = null;
String output = null;
- if (args.length == 0) {
+ if (args.length < 1 || args.length > 2) {
System.out
.println("usage: SassCompile <scss file to compile> <css file to write>");
return;
- } else if (args.length == 1) {
- input = args[0];
- } else {
- input = args[0];
+ }
+
+ File in = new File(args[0]);
+ if (!in.canRead()) {
+ System.err.println(in.getCanonicalPath() + " could not be read!");
+ return;
+ }
+ input = in.getCanonicalPath();
+
+ if (args.length == 2) {
output = args[1];
}
diff --git a/theme-compiler/src/com/vaadin/sass/ScssStylesheet.java b/theme-compiler/src/com/vaadin/sass/ScssStylesheet.java
index 45578deb19..5f46844641 100644
--- a/theme-compiler/src/com/vaadin/sass/ScssStylesheet.java
+++ b/theme-compiler/src/com/vaadin/sass/ScssStylesheet.java
@@ -38,7 +38,6 @@ import com.vaadin.sass.tree.Node;
import com.vaadin.sass.tree.VariableNode;
import com.vaadin.sass.tree.controldirective.IfElseDefNode;
import com.vaadin.sass.visitor.ImportNodeHandler;
-import com.vaadin.sass.visitor.ParentSelectorHandler;
public class ScssStylesheet extends Node {
@@ -52,6 +51,8 @@ public class ScssStylesheet extends Node {
private static final HashSet<IfElseDefNode> ifElseDefNodes = new HashSet<IfElseDefNode>();
+ private static HashMap<Node, Node> lastNodeAdded = new HashMap<Node, Node>();
+
private String fileName;
/**
@@ -130,7 +131,7 @@ public class ScssStylesheet extends Node {
mixinDefs.clear();
variables.clear();
ifElseDefNodes.clear();
- ParentSelectorHandler.clear();
+ lastNodeAdded.clear();
importOtherFiles(this);
populateDefinitions(this);
traverse(this);
@@ -245,4 +246,8 @@ public class ScssStylesheet extends Node {
return fileName;
}
+ public static HashMap<Node, Node> getLastNodeAdded() {
+ return lastNodeAdded;
+ }
+
}
diff --git a/theme-compiler/src/com/vaadin/sass/tree/VariableNode.java b/theme-compiler/src/com/vaadin/sass/tree/VariableNode.java
index 3ea8379829..89cab33129 100644
--- a/theme-compiler/src/com/vaadin/sass/tree/VariableNode.java
+++ b/theme-compiler/src/com/vaadin/sass/tree/VariableNode.java
@@ -77,6 +77,8 @@ public class VariableNode extends Node implements IVariableNode {
&& expr.getParameters().toString()
.contains("$" + node.getName())) {
replaceValues(expr.getParameters(), node);
+ } else if (expr.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE) {
+ replaceValues(expr, node);
}
}
}
diff --git a/theme-compiler/src/com/vaadin/sass/visitor/BlockNodeHandler.java b/theme-compiler/src/com/vaadin/sass/visitor/BlockNodeHandler.java
index d338cb0843..0d00fd2d0c 100644
--- a/theme-compiler/src/com/vaadin/sass/visitor/BlockNodeHandler.java
+++ b/theme-compiler/src/com/vaadin/sass/visitor/BlockNodeHandler.java
@@ -19,13 +19,12 @@ package com.vaadin.sass.visitor;
import java.util.ArrayList;
import java.util.HashMap;
+import com.vaadin.sass.ScssStylesheet;
import com.vaadin.sass.tree.BlockNode;
import com.vaadin.sass.tree.Node;
public class BlockNodeHandler {
- private static HashMap<Node, Node> lastNodeAdded = new HashMap<Node, Node>();
-
public static void traverse(BlockNode node) {
Node parent = node.getParentNode();
@@ -61,6 +60,7 @@ public class BlockNodeHandler {
}
node.setSelectorList(newList);
Node oldParent = node.getParentNode();
+ HashMap<Node, Node> lastNodeAdded = ScssStylesheet.getLastNodeAdded();
if (lastNodeAdded.get(oldParent) != null) {
node.getParentNode().getParentNode()
.appendChild(node, lastNodeAdded.get(oldParent));
diff --git a/theme-compiler/src/com/vaadin/sass/visitor/MixinNodeHandler.java b/theme-compiler/src/com/vaadin/sass/visitor/MixinNodeHandler.java
index 3c31ee1073..4875a39b1d 100644
--- a/theme-compiler/src/com/vaadin/sass/visitor/MixinNodeHandler.java
+++ b/theme-compiler/src/com/vaadin/sass/visitor/MixinNodeHandler.java
@@ -48,6 +48,7 @@ public class MixinNodeHandler {
Node pre = mixinNode;
MixinDefNode defClone = (MixinDefNode) DeepCopy.copy(mixinDef);
+ defClone.traverse();
if (mixinDef.getArglist().isEmpty()) {
for (Node child : new ArrayList<Node>(defClone.getChildren())) {
diff --git a/theme-compiler/src/com/vaadin/sass/visitor/ParentSelectorHandler.java b/theme-compiler/src/com/vaadin/sass/visitor/ParentSelectorHandler.java
index 4098cc7cad..cb7b0ac8a8 100644
--- a/theme-compiler/src/com/vaadin/sass/visitor/ParentSelectorHandler.java
+++ b/theme-compiler/src/com/vaadin/sass/visitor/ParentSelectorHandler.java
@@ -19,13 +19,12 @@ package com.vaadin.sass.visitor;
import java.util.ArrayList;
import java.util.HashMap;
+import com.vaadin.sass.ScssStylesheet;
import com.vaadin.sass.tree.BlockNode;
import com.vaadin.sass.tree.Node;
public class ParentSelectorHandler {
- private static HashMap<Node, Node> parentSelectors = new HashMap<Node, Node>();
-
public static void traverse(BlockNode block) throws Exception {
Node parentNode = block.getParentNode();
if (parentNode instanceof BlockNode) {
@@ -48,22 +47,20 @@ public class ParentSelectorHandler {
if (isParentSelector) {
block.setSelectorList(newList);
Node oldparent = block.getParentNode();
- if (parentSelectors.containsKey(block.getParentNode())) {
+ HashMap<Node, Node> lastNodeAdded = ScssStylesheet
+ .getLastNodeAdded();
+ if (lastNodeAdded.containsKey(block.getParentNode())) {
block.getParentNode()
.getParentNode()
.appendChild(block,
- parentSelectors.get(block.getParentNode()));
+ lastNodeAdded.get(block.getParentNode()));
} else {
block.getParentNode().getParentNode()
.appendChild(block, block.getParentNode());
}
- parentSelectors.put(oldparent, block);
+ lastNodeAdded.put(oldparent, block);
}
}
}
-
- public static void clear() {
- parentSelectors.clear();
- }
}
diff --git a/theme-compiler/tests/resources/css/parent-selector.css b/theme-compiler/tests/resources/css/parent-selector.css
index 0330782fbf..e7e37e92ab 100644
--- a/theme-compiler/tests/resources/css/parent-selector.css
+++ b/theme-compiler/tests/resources/css/parent-selector.css
@@ -3,6 +3,10 @@ a {
text-decoration: none;
}
+a .sub {
+ color: blue;
+}
+
a:hover {
text-decoration: underline;
}
diff --git a/theme-compiler/tests/resources/css/variables.css b/theme-compiler/tests/resources/css/variables.css
index d54ae6cd30..ae5ac5e01c 100644
--- a/theme-compiler/tests/resources/css/variables.css
+++ b/theme-compiler/tests/resources/css/variables.css
@@ -3,6 +3,7 @@
color: #0000ff;
color1: #0000d1;
font-family: Arial, Helvetica, "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+ font-size: 12px;
}
.border {
diff --git a/theme-compiler/tests/resources/scss/parent-selector.scss b/theme-compiler/tests/resources/scss/parent-selector.scss
index ee02f8bf76..68f66a4a27 100644
--- a/theme-compiler/tests/resources/scss/parent-selector.scss
+++ b/theme-compiler/tests/resources/scss/parent-selector.scss
@@ -1,6 +1,9 @@
a {
font-weight: bold;
text-decoration: none;
+ .sub {
+ color: blue;
+ }
&:hover { text-decoration: underline; }
body.firefox & { font-weight: normal; }
}
diff --git a/theme-compiler/tests/resources/scss/variables.scss b/theme-compiler/tests/resources/scss/variables.scss
index 60acc5dd10..2448aaddb9 100644
--- a/theme-compiler/tests/resources/scss/variables.scss
+++ b/theme-compiler/tests/resources/scss/variables.scss
@@ -1,6 +1,7 @@
$blue: #3bbfce;
$margin: 8px;
$chameleon-font-family: Arial, Helvetica, "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+$font: 12px;
.content-navigation {
border-color: $blue;
@@ -8,6 +9,8 @@ $chameleon-font-family: Arial, Helvetica, "Lucida Grande", "Lucida Sans Unicode"
color: $blue;
color1: darken($blue, 9%);
font-family: $chameleon-font-family;
+ $font-size: $font;
+ font-size: $font-size;
}
.border {
diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentSelector.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentSelector.java
index e1e1fee3b4..ebe62fd678 100644
--- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentSelector.java
+++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/ParentSelector.java
@@ -41,10 +41,10 @@ public class ParentSelector extends AbstractTestBase {
parser.parseStyleSheet(getClass().getResource(scss).getPath());
ScssStylesheet root = handler.getStyleSheet();
BlockNode blockNode = (BlockNode) root.getChildren().get(0);
- Assert.assertEquals(4, blockNode.getChildren().size());
- BlockNode nestedBlock1 = (BlockNode) blockNode.getChildren().get(2);
+ Assert.assertEquals(5, blockNode.getChildren().size());
+ BlockNode nestedBlock1 = (BlockNode) blockNode.getChildren().get(3);
Assert.assertEquals("&:hover", nestedBlock1.getSelectorList().get(0));
- BlockNode nestedBlock2 = (BlockNode) blockNode.getChildren().get(3);
+ BlockNode nestedBlock2 = (BlockNode) blockNode.getChildren().get(4);
Assert.assertEquals("body.firefox &", nestedBlock2.getSelectorList()
.get(0));
}
diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Variables.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Variables.java
index d56a9dee9d..32984c53ec 100644
--- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Variables.java
+++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/Variables.java
@@ -45,7 +45,7 @@ public class Variables extends AbstractTestBase {
parser.setDocumentHandler(handler);
parser.parseStyleSheet(getClass().getResource(scss).getPath());
ScssStylesheet root = handler.getStyleSheet();
- Assert.assertEquals(5, root.getChildren().size());
+ Assert.assertEquals(6, root.getChildren().size());
VariableNode varNode1 = (VariableNode) root.getChildren().get(0);
Assert.assertEquals("blue", varNode1.getName());
@@ -58,7 +58,7 @@ public class Variables extends AbstractTestBase {
Assert.assertEquals(8f, varNode2.getExpr().getFloatValue());
Assert.assertEquals("px", varNode2.getExpr().getDimensionUnitText());
- BlockNode blockNode1 = (BlockNode) root.getChildren().get(4);
+ BlockNode blockNode1 = (BlockNode) root.getChildren().get(5);
Assert.assertEquals(3, blockNode1.getChildren().size());
RuleNode ruleNode1Block1 = (RuleNode) blockNode1.getChildren().get(2);
Assert.assertEquals("border-color", ruleNode1Block1.getVariable());
@@ -72,7 +72,7 @@ public class Variables extends AbstractTestBase {
.getValue().getLexicalUnitType());
Assert.assertEquals("blue", ruleNode2Block1.getValue().getStringValue());
- BlockNode blockNode2 = (BlockNode) root.getChildren().get(4);
+ BlockNode blockNode2 = (BlockNode) root.getChildren().get(5);
RuleNode ruleNode1Block2 = (RuleNode) blockNode2.getChildren().get(0);
Assert.assertEquals("padding", ruleNode1Block2.getVariable());
Assert.assertEquals(SCSSLexicalUnit.SCSS_VARIABLE, ruleNode1Block2
diff --git a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
index 0634943d09..c356465fcc 100644
--- a/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
+++ b/uitest/src/com/vaadin/launcher/ApplicationRunnerServlet.java
@@ -37,7 +37,7 @@ import com.vaadin.server.SessionInitListener;
import com.vaadin.server.UIClassSelectionEvent;
import com.vaadin.server.UIProvider;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.server.VaadinServletRequest;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.UI;
@@ -135,7 +135,7 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet {
}
protected void onVaadinSessionStarted(VaadinRequest request,
- VaadinServiceSession session) throws ServiceException {
+ VaadinSession session) throws ServiceException {
try {
final Class<?> classToRun = getClassToRun();
if (UI.class.isAssignableFrom(classToRun)) {
diff --git a/uitest/src/com/vaadin/tests/ModalWindow.java b/uitest/src/com/vaadin/tests/ModalWindow.java
index 4793797941..156f42adf3 100644
--- a/uitest/src/com/vaadin/tests/ModalWindow.java
+++ b/uitest/src/com/vaadin/tests/ModalWindow.java
@@ -31,7 +31,7 @@ import com.vaadin.ui.Window;
*
* @author Vaadin Ltd.
* @since 4.0.1
- * @see com.vaadin.server.VaadinServiceSession
+ * @see com.vaadin.server.VaadinSession
* @see com.vaadin.ui.Window
* @see com.vaadin.ui.Label
*/
diff --git a/uitest/src/com/vaadin/tests/Parameters.java b/uitest/src/com/vaadin/tests/Parameters.java
index 1ea02699ce..934a98e910 100644
--- a/uitest/src/com/vaadin/tests/Parameters.java
+++ b/uitest/src/com/vaadin/tests/Parameters.java
@@ -25,7 +25,7 @@ import com.vaadin.server.ExternalResource;
import com.vaadin.server.RequestHandler;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinResponse;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.ui.Label;
import com.vaadin.ui.LegacyWindow;
import com.vaadin.ui.Link;
@@ -55,7 +55,7 @@ public class Parameters extends com.vaadin.server.LegacyApplication implements
setMainWindow(main);
// This class acts both as URI handler and parameter handler
- VaadinServiceSession.getCurrent().addRequestHandler(this);
+ VaadinSession.getCurrent().addRequestHandler(this);
final VerticalLayout layout = new VerticalLayout();
final Label info = new Label("To test URI and Parameter Handlers, "
@@ -107,10 +107,10 @@ public class Parameters extends com.vaadin.server.LegacyApplication implements
}
@Override
- public boolean handleRequest(VaadinServiceSession session,
+ public boolean handleRequest(VaadinSession session,
VaadinRequest request, VaadinResponse response) throws IOException {
context.setValue("Context not available");
- relative.setValue(request.getRequestPathInfo());
+ relative.setValue(request.getPathInfo());
params.removeAllItems();
Map<String, String[]> parameters = request.getParameterMap();
diff --git a/uitest/src/com/vaadin/tests/TestBench.java b/uitest/src/com/vaadin/tests/TestBench.java
index d18ce04f64..6d5e162301 100644
--- a/uitest/src/com/vaadin/tests/TestBench.java
+++ b/uitest/src/com/vaadin/tests/TestBench.java
@@ -311,7 +311,7 @@ public class TestBench extends com.vaadin.server.LegacyApplication implements
final Class<?> c = Class.forName(p);
if (c.getSuperclass() != null) {
if ((c.getSuperclass()
- .equals(com.vaadin.server.VaadinServiceSession.class))) {
+ .equals(com.vaadin.server.VaadinSession.class))) {
classes.add(c);
} else if ((c.getSuperclass()
.equals(com.vaadin.ui.CustomComponent.class))) {
diff --git a/uitest/src/com/vaadin/tests/TreeFilesystem.java b/uitest/src/com/vaadin/tests/TreeFilesystem.java
index d127095c6f..67da6c273a 100644
--- a/uitest/src/com/vaadin/tests/TreeFilesystem.java
+++ b/uitest/src/com/vaadin/tests/TreeFilesystem.java
@@ -19,7 +19,7 @@ package com.vaadin.tests;
import java.io.File;
import com.vaadin.data.Item;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.tests.util.SampleDirectory;
import com.vaadin.ui.Label;
@@ -67,7 +67,7 @@ public class TreeFilesystem extends com.vaadin.server.LegacyApplication
// Get sample directory
final File sampleDir = SampleDirectory.getDirectory(
- VaadinServiceSession.getCurrent(), main);
+ VaadinSession.getCurrent(), main);
// populate tree's root node with example directory
if (sampleDir != null) {
populateNode(sampleDir.getAbsolutePath(), null);
diff --git a/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java b/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java
index 00f3b15fd0..92c53524e2 100644
--- a/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java
+++ b/uitest/src/com/vaadin/tests/TreeFilesystemContainer.java
@@ -20,7 +20,7 @@ import java.io.File;
import com.vaadin.data.util.FilesystemContainer;
import com.vaadin.data.util.FilesystemContainer.FileItem;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.tests.util.SampleDirectory;
import com.vaadin.ui.Component.Event;
import com.vaadin.ui.Component.Listener;
@@ -85,7 +85,7 @@ public class TreeFilesystemContainer extends
// Get sample directory
final File sampleDir = SampleDirectory.getDirectory(
- VaadinServiceSession.getCurrent(), w);
+ VaadinSession.getCurrent(), w);
// Populate tree with FilesystemContainer
final FilesystemContainer fsc = new FilesystemContainer(sampleDir, true);
filesystem.setContainerDataSource(fsc);
diff --git a/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java b/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java
index 5feb904873..ea462dbaae 100644
--- a/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java
+++ b/uitest/src/com/vaadin/tests/appengine/GAESyncTest.java
@@ -5,6 +5,7 @@ import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.server.ClassResource;
import com.vaadin.server.DownloadStream;
+import com.vaadin.server.ErrorEvent;
import com.vaadin.server.LegacyApplication;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
@@ -29,7 +30,7 @@ public class GAESyncTest extends LegacyApplication {
}
@Override
- public void terminalError(com.vaadin.server.Terminal.ErrorEvent event) {
+ public void terminalError(com.vaadin.server.ErrorEvent event) {
Throwable t = event.getThrowable();
// Was this caused by a GAE timeout?
while (t != null) {
diff --git a/uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.html b/uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.html
index f5ad0987aa..2bdb7c79a5 100644
--- a/uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.html
+++ b/uitest/src/com/vaadin/tests/application/DeploymentConfigurationTest.html
@@ -18,7 +18,7 @@
</tr>
<tr>
<td>assertTextPresent</td>
- <td>exact:closeIdleUIs: true</td>
+ <td>exact:closeIdleSessions: true</td>
<td></td>
</tr>
<tr>
diff --git a/uitest/src/com/vaadin/tests/application/NavigateWithOngoingXHR.java b/uitest/src/com/vaadin/tests/application/NavigateWithOngoingXHR.java
new file mode 100644
index 0000000000..d32ecb583d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/application/NavigateWithOngoingXHR.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2012 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.tests.application;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import com.vaadin.server.ExternalResource;
+import com.vaadin.server.RequestHandler;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.server.VaadinResponse;
+import com.vaadin.server.VaadinSession;
+import com.vaadin.shared.ui.progressindicator.ProgressIndicatorServerRpc;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Link;
+import com.vaadin.ui.ProgressIndicator;
+
+public class NavigateWithOngoingXHR extends AbstractTestUI {
+ private final RequestHandler slowRequestHandler = new RequestHandler() {
+ @Override
+ public boolean handleRequest(VaadinSession session,
+ VaadinRequest request, VaadinResponse response)
+ throws IOException {
+ if ("/slowRequestHandler".equals(request.getPathInfo())) {
+ // Make the navigation request last longer to keep the
+ // communication error visible
+ // System.out.println("Got slow content request");
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ if (request.getParameter("download") != null) {
+ response.setHeader("Content-Disposition", "attachment");
+ }
+
+ response.setContentType("text/plain");
+ PrintWriter writer = response.getWriter();
+ writer.println("Loaded slowly");
+ writer.close();
+
+ // System.out.println("Finished slow content request");
+
+ return true;
+ }
+ return false;
+ }
+ };
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ addComponent(new ProgressIndicator() {
+ {
+ registerRpc(new ProgressIndicatorServerRpc() {
+ @Override
+ public void poll() {
+ // System.out.println("Pausing poll request");
+ try {
+ // Make the XHR request last longer to make it
+ // easier to click the link at the right moment.
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ // System.out.println("Continuing poll request");
+ }
+ });
+ setPollingInterval(3000);
+ }
+ });
+
+ // Hacky URLs that are might not work in all deployment scenarios
+ addComponent(new Link("Navigate away", new ExternalResource(
+ "slowRequestHandler")));
+ addComponent(new Link("Start download", new ExternalResource(
+ "slowRequestHandler?download")));
+ }
+
+ @Override
+ public void attach() {
+ super.attach();
+ getSession().addRequestHandler(slowRequestHandler);
+ }
+
+ @Override
+ public void detach() {
+ getSession().removeRequestHandler(slowRequestHandler);
+ super.detach();
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Navigating away from a Vaadin page while there's an ongoing XHR request should not cause a communication error to be displayed";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(8891);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/application/TerminalErrorNotification.java b/uitest/src/com/vaadin/tests/application/TerminalErrorNotification.java
index 0dcf0a6fa8..7ab552a96b 100644
--- a/uitest/src/com/vaadin/tests/application/TerminalErrorNotification.java
+++ b/uitest/src/com/vaadin/tests/application/TerminalErrorNotification.java
@@ -15,6 +15,7 @@
*/
package com.vaadin.tests.application;
+import com.vaadin.server.ErrorEvent;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
@@ -38,7 +39,7 @@ public class TerminalErrorNotification extends TestBase {
}
@Override
- public void terminalError(com.vaadin.server.Terminal.ErrorEvent event) {
+ public void terminalError(com.vaadin.server.ErrorEvent event) {
event.getThrowable().printStackTrace();
UI mainWindow = getMainWindow();
diff --git a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java
index ac4e421fdc..57c4e3c7b9 100644
--- a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java
+++ b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java
@@ -3,7 +3,7 @@ package com.vaadin.tests.application;
import com.vaadin.server.DownloadStream;
import com.vaadin.server.PaintException;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.tests.components.AbstractTestCase;
import com.vaadin.tests.integration.FlagSeResource;
import com.vaadin.tests.util.Log;
@@ -14,7 +14,7 @@ import com.vaadin.ui.LegacyWindow;
import com.vaadin.ui.UI;
public class ThreadLocalInstances extends AbstractTestCase {
- private static final VaadinServiceSession staticInitApplication = VaadinServiceSession
+ private static final VaadinSession staticInitApplication = VaadinSession
.getCurrent();
private static final UI staticInitRoot = UI.getCurrent();
@@ -90,10 +90,10 @@ public class ThreadLocalInstances extends AbstractTestCase {
}
private void reportCurrentStatus(String phase) {
- reportStatus(phase, VaadinServiceSession.getCurrent(), UI.getCurrent());
+ reportStatus(phase, VaadinSession.getCurrent(), UI.getCurrent());
}
- private void reportStatus(String phase, VaadinServiceSession application,
+ private void reportStatus(String phase, VaadinSession application,
UI uI) {
log.log(getState(application, this) + " app in " + phase);
log.log(getState(uI, mainWindow) + " root in " + phase);
diff --git a/uitest/src/com/vaadin/tests/applicationservlet/InitParamUIProvider.java b/uitest/src/com/vaadin/tests/applicationservlet/InitParamUIProvider.java
index b4f29dda06..e62cd9a4f9 100644
--- a/uitest/src/com/vaadin/tests/applicationservlet/InitParamUIProvider.java
+++ b/uitest/src/com/vaadin/tests/applicationservlet/InitParamUIProvider.java
@@ -27,7 +27,7 @@ public class InitParamUIProvider extends UIProvider {
@Override
public Class<? extends UI> getUIClass(UIClassSelectionEvent event) {
VaadinRequest request = event.getRequest();
- String pathInfo = request.getRequestPathInfo();
+ String pathInfo = request.getPathInfo();
if ("/test".equals(pathInfo)) {
return BasicJavaScriptComponent.class;
} else {
diff --git a/uitest/src/com/vaadin/tests/applicationservlet/SystemMessagesTest.html b/uitest/src/com/vaadin/tests/applicationservlet/SystemMessagesTest.html
new file mode 100644
index 0000000000..a764255b5b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/applicationservlet/SystemMessagesTest.html
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.applicationservlet.SystemMessagesTest?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestsapplicationservletSystemMessagesTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestsapplicationservletSystemMessagesTest::Root/VNotification[0]/domChild[0]</td>
+ <td>Internal error*MessagesInfo locale: fi_FI</td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.applicationservlet.SystemMessagesTest?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>vaadin=runcomvaadintestsapplicationservletSystemMessagesTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VNativeSelect[0]/domChild[0]</td>
+ <td>label=de_DE</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestsapplicationservletSystemMessagesTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestsapplicationservletSystemMessagesTest::Root/VNotification[0]/domChild[0]</td>
+ <td>Internal error*MessagesInfo locale: de_DE</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/applicationservlet/SystemMessagesTest.java b/uitest/src/com/vaadin/tests/applicationservlet/SystemMessagesTest.java
new file mode 100644
index 0000000000..516c0ca8e0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/applicationservlet/SystemMessagesTest.java
@@ -0,0 +1,90 @@
+package com.vaadin.tests.applicationservlet;
+
+import java.util.Locale;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.CustomizedSystemMessages;
+import com.vaadin.server.SystemMessages;
+import com.vaadin.server.SystemMessagesInfo;
+import com.vaadin.server.SystemMessagesProvider;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.NativeSelect;
+
+public class SystemMessagesTest extends AbstractTestUI {
+
+ public class MyButton extends Button {
+ private boolean fail = false;
+
+ @Override
+ public void beforeClientResponse(boolean initial) {
+ super.beforeClientResponse(initial);
+ if (fail) {
+ throw new RuntimeException("Failed on purpose");
+ }
+ }
+
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final NativeSelect localeSelect = new NativeSelect("UI locale");
+ localeSelect.setImmediate(true);
+ localeSelect.addItem(new Locale("en", "US"));
+ localeSelect.addItem(new Locale("fi", "FI"));
+ localeSelect.addItem(Locale.GERMANY);
+ localeSelect.addValueChangeListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ setLocale((Locale) localeSelect.getValue());
+ getSession().getService().setSystemMessagesProvider(
+ new SystemMessagesProvider() {
+
+ @Override
+ public SystemMessages getSystemMessages(
+ SystemMessagesInfo systemMessagesInfo) {
+ CustomizedSystemMessages csm = new CustomizedSystemMessages();
+ // csm.setInternalErrorCaption("Request query string: "
+ // + ((VaadinServletRequest) systemMessagesInfo
+ // .getRequest()).getQueryString());
+ csm.setInternalErrorMessage("MessagesInfo locale: "
+ + systemMessagesInfo.getLocale());
+ return csm;
+
+ }
+ });
+ }
+ });
+ localeSelect.setValue(new Locale("fi", "FI"));
+ addComponent(localeSelect);
+ final MyButton failButton = new MyButton();
+ failButton.setCaption("Generate server side error");
+ failButton.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ failButton.fail = true;
+ }
+ });
+ addComponent(failButton);
+
+ }
+
+ @Override
+ protected String getTestDescription() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java b/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java
index ece40f5b00..0cde43119a 100644
--- a/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java
+++ b/uitest/src/com/vaadin/tests/components/AbstractComponentTest.java
@@ -14,6 +14,7 @@ import com.vaadin.event.FieldEvents.BlurNotifier;
import com.vaadin.event.FieldEvents.FocusEvent;
import com.vaadin.event.FieldEvents.FocusListener;
import com.vaadin.event.FieldEvents.FocusNotifier;
+import com.vaadin.server.ErrorEvent;
import com.vaadin.server.Resource;
import com.vaadin.server.ThemeResource;
import com.vaadin.tests.util.Log;
@@ -715,7 +716,7 @@ public abstract class AbstractComponentTest<T extends AbstractComponent>
}
@Override
- public void terminalError(com.vaadin.server.Terminal.ErrorEvent event) {
+ public void terminalError(com.vaadin.server.ErrorEvent event) {
String logMsg = "Exception occured, "
+ event.getThrowable().getClass().getName();
diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestCase.java b/uitest/src/com/vaadin/tests/components/AbstractTestCase.java
index e7423173c7..1f117a8ea8 100644
--- a/uitest/src/com/vaadin/tests/components/AbstractTestCase.java
+++ b/uitest/src/com/vaadin/tests/components/AbstractTestCase.java
@@ -1,7 +1,7 @@
package com.vaadin.tests.components;
import com.vaadin.server.LegacyApplication;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.server.WebBrowser;
public abstract class AbstractTestCase extends LegacyApplication {
@@ -11,7 +11,7 @@ public abstract class AbstractTestCase extends LegacyApplication {
protected abstract Integer getTicketNumber();
protected WebBrowser getBrowser() {
- WebBrowser webBrowser = VaadinServiceSession.getCurrent().getBrowser();
+ WebBrowser webBrowser = VaadinSession.getCurrent().getBrowser();
return webBrowser;
}
diff --git a/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java b/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java
index 2bb460e8b5..9ad6bbf56f 100644
--- a/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java
+++ b/uitest/src/com/vaadin/tests/components/AbstractTestUIProvider.java
@@ -1,7 +1,7 @@
package com.vaadin.tests.components;
import com.vaadin.server.UIProvider;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.server.WebBrowser;
public abstract class AbstractTestUIProvider extends UIProvider {
@@ -10,7 +10,7 @@ public abstract class AbstractTestUIProvider extends UIProvider {
protected abstract Integer getTicketNumber();
protected WebBrowser getBrowser() {
- WebBrowser webBrowser = VaadinServiceSession.getCurrent().getBrowser();
+ WebBrowser webBrowser = VaadinSession.getCurrent().getBrowser();
return webBrowser;
}
}
diff --git a/uitest/src/com/vaadin/tests/components/FileDownloaderTest.html b/uitest/src/com/vaadin/tests/components/FileDownloaderTest.html
new file mode 100644
index 0000000000..bfe87091cc
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/FileDownloaderTest.html
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://arturwin.office.itmill.com:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.FileDownloaderTest?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentsFileDownloaderTest::PID_Scom.vaadin.ui.ButtonDynamicimage/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsFileDownloaderTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentsFileDownloaderTest::PID_Scom.vaadin.ui.ButtonDynamicimage/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/FileDownloaderTest.java b/uitest/src/com/vaadin/tests/components/FileDownloaderTest.java
index e773c8c75b..55d2afd32d 100644
--- a/uitest/src/com/vaadin/tests/components/FileDownloaderTest.java
+++ b/uitest/src/com/vaadin/tests/components/FileDownloaderTest.java
@@ -37,6 +37,7 @@ import com.vaadin.server.StreamResource;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinResponse;
import com.vaadin.tests.components.embedded.EmbeddedPdf;
+import com.vaadin.tests.util.Log;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
@@ -45,12 +46,18 @@ import com.vaadin.ui.Component;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
import com.vaadin.ui.NativeButton;
public class FileDownloaderTest extends AbstractTestUI {
+ private AbstractComponent firstDownloadComponent;
+ private Log log = new Log(5);
+
@Override
protected void setup(VaadinRequest request) {
+ addComponent(log);
+
List<Class<? extends Component>> components = new ArrayList<Class<? extends Component>>();
components.add(Button.class);
components.add(NativeButton.class);
@@ -104,6 +111,29 @@ public class FileDownloaderTest extends AbstractTestUI {
// addComponents(resource, components);
resource = new ClassResource(new EmbeddedPdf().getClass(), "test.pdf");
addComponents("Class resource pdf", resource, components);
+
+ addComponent(new Button("Remove first download button",
+ new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Layout parent = (Layout) firstDownloadComponent
+ .getParent();
+ parent.removeComponent(firstDownloadComponent);
+ }
+ }));
+ addComponent(new Button(
+ "Detach FileDownloader from first download button",
+ new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ FileDownloader e = (FileDownloader) firstDownloadComponent
+ .getExtensions().iterator().next();
+ e.removeFromTarget();
+ log.log("FileDownload detached");
+ }
+ }));
}
public void addComponents(String caption, ConnectorResource resource,
@@ -113,7 +143,11 @@ public class FileDownloaderTest extends AbstractTestUI {
for (Class<? extends Component> cls : components) {
try {
AbstractComponent c = (AbstractComponent) cls.newInstance();
- c.setId(cls.getName());
+ if (firstDownloadComponent == null) {
+ firstDownloadComponent = c;
+ }
+
+ c.setId(cls.getName() + caption.replace(" ", ""));
c.setCaption(cls.getName());
c.setDescription(resource.getMIMEType() + " / "
+ resource.getClass());
diff --git a/uitest/src/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java b/uitest/src/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java
index 971bd1cbe3..2eef498aff 100644
--- a/uitest/src/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java
+++ b/uitest/src/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java
@@ -8,7 +8,7 @@ import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.tests.components.TestBase;
import com.vaadin.tests.util.Log;
import com.vaadin.ui.AbstractField;
@@ -55,7 +55,7 @@ public abstract class AbstractComponentDataBindingTest extends TestBase
}
protected void updateLocale(Locale locale) {
- VaadinServiceSession.getCurrent().setLocale(locale);
+ VaadinSession.getCurrent().setLocale(locale);
for (Component c : fields) {
removeComponent(c);
}
diff --git a/uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java b/uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java
index 3c7a9a40ea..646b8f67f7 100644
--- a/uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java
+++ b/uitest/src/com/vaadin/tests/components/button/ShortCutListenerModification.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.components.button;
import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.event.ShortcutAction.ModifierKey;
+import com.vaadin.server.ErrorEvent;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
@@ -57,7 +58,7 @@ public class ShortCutListenerModification extends TestBase implements
}
@Override
- public void terminalError(com.vaadin.server.Terminal.ErrorEvent event) {
+ public void terminalError(com.vaadin.server.ErrorEvent event) {
super.terminalError(event);
getMainWindow().showNotification("Failed!",
Notification.TYPE_ERROR_MESSAGE);
diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTest.html b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTest.html
new file mode 100644
index 0000000000..eb9859bf9d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTest.html
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8888/" />
+<title>PopupDateFieldTest</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">PopupDateFieldTest</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.datefield.PopupDateFieldTest?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertEditable</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]#field</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::/VVerticalLayout[0]/VVerticalLayout[0]/VMenuBar[0]#item0</td>
+ <td>29,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::Root/VOverlay[0]/VMenuBar[0]#item4</td>
+ <td>26,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::Root/VOverlay[1]/VMenuBar[0]#item6</td>
+ <td>84,9</td>
+</tr>
+<tr>
+ <td>assertNotEditable</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]#field</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::/VVerticalLayout[0]/VVerticalLayout[0]/VMenuBar[0]#item0</td>
+ <td>31,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::Root/VOverlay[0]/VMenuBar[0]#item0</td>
+ <td>29,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::Root/VOverlay[1]/VMenuBar[0]#item1</td>
+ <td>42,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::/VVerticalLayout[0]/VVerticalLayout[0]/VMenuBar[0]#item0</td>
+ <td>45,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::Root/VOverlay[0]/VMenuBar[0]#item0</td>
+ <td>43,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::Root/VOverlay[1]/VMenuBar[0]#item1</td>
+ <td>39,6</td>
+</tr>
+<tr>
+ <td>assertNotEditable</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]#field</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::/VVerticalLayout[0]/VVerticalLayout[0]/VMenuBar[0]#item0</td>
+ <td>36,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::Root/VOverlay[0]/VMenuBar[0]#item4</td>
+ <td>34,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::Root/VOverlay[1]/VMenuBar[0]#item6</td>
+ <td>71,7</td>
+</tr>
+<tr>
+ <td>assertEditable</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldPopupDateFieldTest::/VVerticalLayout[0]/VVerticalLayout[0]/VPopupCalendar[0]#field</td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTest.java b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTest.java
index 3e8b0678a7..6e3250a825 100644
--- a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTest.java
+++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTest.java
@@ -16,6 +16,7 @@ public class PopupDateFieldTest extends DateFieldTest<PopupDateField> {
super.createActions();
createInputPromptSelectAction(CATEGORY_FEATURES);
+ createTextEnabledAction(CATEGORY_FEATURES);
}
private void createInputPromptSelectAction(String category) {
@@ -36,4 +37,16 @@ public class PopupDateFieldTest extends DateFieldTest<PopupDateField> {
});
}
+ private void createTextEnabledAction(String category) {
+ this.createBooleanAction("Text field enabled", category, true,
+ new Command<PopupDateField, Boolean>() {
+
+ @Override
+ public void execute(PopupDateField c, Boolean value,
+ Object data) {
+ c.setTextFieldEnabled(value);
+ }
+
+ });
+ }
}
diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java
new file mode 100644
index 0000000000..731869f668
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java
@@ -0,0 +1,43 @@
+package com.vaadin.tests.components.datefield;
+
+import com.vaadin.data.Property;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.PopupDateField;
+
+public class PopupDateFieldTextEnabled extends TestBase {
+
+ private static final String ENABLED = "DateField text box enabled";
+ private static final String DISABLED = "DateField text box disabled";
+ @Override
+ public void setup() {
+ final PopupDateField field = new PopupDateField();
+ final CheckBox box = new CheckBox(ENABLED, true);
+ box.addListener(new Property.ValueChangeListener() {
+
+ @Override
+ public void valueChange(Property.ValueChangeEvent event) {
+ field.setTextFieldEnabled((Boolean) event.getProperty()
+ .getValue());
+ if(field.isTextFieldEnabled()){
+ box.setCaption(ENABLED);
+ }else{
+ box.setCaption(DISABLED);
+ }
+ }
+ });
+ addComponent(box);
+ addComponent(field);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "tests whether or not enabling text field in the component works";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 6790;
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java
index 57fc9f3e62..984ac69d6e 100644
--- a/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java
+++ b/uitest/src/com/vaadin/tests/components/ui/LazyInitUIs.java
@@ -87,7 +87,7 @@ public class LazyInitUIs extends AbstractTestUIProvider {
public static Label getRequestInfo(String name, VaadinRequest request) {
String info = name;
- info += "<br />pathInfo: " + request.getRequestPathInfo();
+ info += "<br />pathInfo: " + request.getPathInfo();
info += "<br />parameters: " + request.getParameterMap().keySet();
info += "<br />uri fragment: "
+ Page.getCurrent().getLocation().getFragment();
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.html b/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.html
new file mode 100644
index 0000000000..3fd7a0d560
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.html
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8070/" />
+<title>UIInitBrowserDetails</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">UIInitBrowserDetails</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/UIInitBrowserDetails?restartApplication</td>
+ <td></td>
+</tr>
+<!--location-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[4]</td>
+ <td>null</td>
+</tr>
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[2]</td>
+ <td>null</td>
+</tr>
+<!--browser window width-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[4]</td>
+ <td>null</td>
+</tr>
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[5]</td>
+ <td>-1</td>
+</tr>
+<!--browser window height-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[10]</td>
+ <td>null</td>
+</tr>
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[8]</td>
+ <td>-1</td>
+</tr>
+<!--screen width-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[10]</td>
+ <td>null</td>
+</tr>
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[11]</td>
+ <td>-1</td>
+</tr>
+<!--screen height-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[13]</td>
+ <td>null</td>
+</tr>
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[14]</td>
+ <td>-1</td>
+</tr>
+<!--timezone offset-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[16]</td>
+ <td>null</td>
+</tr>
+<!--raw timezone offset-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[19]</td>
+ <td>null</td>
+</tr>
+<!--dst saving-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[22]</td>
+ <td>null</td>
+</tr>
+<!--dst in effect-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[25]</td>
+ <td>null</td>
+</tr>
+<!--current date-->
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[28]</td>
+ <td>null</td>
+</tr>
+<tr>
+ <td>assertNotText</td>
+ <td>vaadin=runUIInitBrowserDetails::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VGridLayout[0]/VLabel[29]</td>
+ <td>null</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.java b/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.java
new file mode 100644
index 0000000000..587c9f0f9b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/UIInitBrowserDetails.java
@@ -0,0 +1,56 @@
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+
+package com.vaadin.tests.components.ui;
+
+import com.vaadin.server.Page;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.server.WebBrowser;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+
+public class UIInitBrowserDetails extends AbstractTestUI {
+
+ private GridLayout l = new GridLayout(3, 1);
+ private VaadinRequest r;
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ r = request;
+ l.setWidth("100%");
+ addComponent(l);
+
+ Page p = getPage();
+ WebBrowser wb = p.getWebBrowser();
+
+ addDetail("location", "loc", p.getLocation());
+
+ addDetail("browser window width", "cw", p.getBrowserWindowWidth());
+ addDetail("browser window height", "ch", p.getBrowserWindowHeight());
+ addDetail("screen width", "sw", wb.getScreenWidth());
+ addDetail("screen height", "sh", wb.getScreenHeight());
+
+ addDetail("timezone offset", "tzo", wb.getTimezoneOffset());
+ addDetail("raw timezone offset", "rtzo", wb.getRawTimezoneOffset());
+ addDetail("dst saving", "dstd", wb.getDSTSavings());
+ addDetail("dst in effect", "dston", wb.isDSTInEffect());
+ addDetail("current date", "curdate", wb.getCurrentDate());
+ }
+
+ @Override
+ public String getTestDescription() {
+ return "Browser details should be available in UI init";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(9037);
+ }
+
+ private void addDetail(String name, String param, Object value) {
+ l.addComponents(new Label(name), new Label(r.getParameter(param)),
+ new Label("" + value));
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java b/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java
index 53df69f028..49b8472a7a 100644
--- a/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java
+++ b/uitest/src/com/vaadin/tests/components/ui/UIsInMultipleTabs.java
@@ -5,7 +5,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import com.vaadin.server.UIClassSelectionEvent;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.tests.components.AbstractTestUIProvider;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
@@ -13,12 +13,12 @@ import com.vaadin.ui.VerticalLayout;
public class UIsInMultipleTabs extends AbstractTestUIProvider {
// No cleanup -> will leak, but shouldn't matter for tests
- private static ConcurrentHashMap<VaadinServiceSession, AtomicInteger> numberOfUIsOpened = new ConcurrentHashMap<VaadinServiceSession, AtomicInteger>();
+ private static ConcurrentHashMap<VaadinSession, AtomicInteger> numberOfUIsOpened = new ConcurrentHashMap<VaadinSession, AtomicInteger>();
public static class TabUI extends UI {
@Override
protected void init(VaadinRequest request) {
- VaadinServiceSession application = VaadinServiceSession
+ VaadinSession application = VaadinSession
.getCurrent();
AtomicInteger count = numberOfUIsOpened.get(application);
if (count == null) {
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/FindCurrentUI.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/FindCurrentUI.java
index ba7ef78ec1..858f202e6d 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/FindCurrentUI.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/FindCurrentUI.java
@@ -17,7 +17,7 @@
package com.vaadin.tests.minitutorials.v7a1;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
@@ -41,7 +41,7 @@ public class FindCurrentUI extends UI {
@Override
public void buttonClick(ClickEvent event) {
String msg = "Running in ";
- msg += VaadinServiceSession.getCurrent().getConfiguration()
+ msg += VaadinSession.getCurrent().getConfiguration()
.isProductionMode() ? "production" : "debug";
Notification.show(msg);
}
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/UsingXyzWhenInitializing.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/UsingXyzWhenInitializing.java
index c4d496641d..6cf0514df4 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/UsingXyzWhenInitializing.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/UsingXyzWhenInitializing.java
@@ -44,7 +44,7 @@ public class UsingXyzWhenInitializing extends UI {
layout.addComponent(new Label("Hello " + name));
- String pathInfo = request.getRequestPathInfo();
+ String pathInfo = request.getPathInfo();
if ("/viewSource".equals(pathInfo)) {
layout.addComponent(new Label("This is the source"));
} else {
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b1/Addition.java b/uitest/src/com/vaadin/tests/minitutorials/v7b1/Addition.java
index a91df49508..f22e56733c 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b1/Addition.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b1/Addition.java
@@ -16,7 +16,7 @@
package com.vaadin.tests.minitutorials.v7b1;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.ui.AbstractComponent;
public class Addition extends AbstractComponent {
@@ -63,6 +63,6 @@ public class Addition extends AbstractComponent {
}
}
-class AddResultState extends ComponentState {
+class AddResultState extends AbstractComponentState {
public int sum;
}
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1589.java b/uitest/src/com/vaadin/tests/tickets/Ticket1589.java
index 67b5e3e347..db6fa682fc 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket1589.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket1589.java
@@ -16,7 +16,7 @@ import com.vaadin.server.LegacyApplication;
import com.vaadin.server.RequestHandler;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinResponse;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.ui.LegacyWindow;
import com.vaadin.ui.Link;
@@ -29,7 +29,7 @@ public class Ticket1589 extends LegacyApplication {
MyDynamicResource res = new MyDynamicResource();
- VaadinServiceSession.getCurrent().addRequestHandler(res);
+ VaadinSession.getCurrent().addRequestHandler(res);
w.addComponent(new Link(
"Test (without Content-Disposition, should suggest generatedFile.png when saving, browser default for actual disposition)",
@@ -52,9 +52,9 @@ class MyDynamicResource implements RequestHandler {
* stream that contains the response from the server.
*/
@Override
- public boolean handleRequest(VaadinServiceSession session,
+ public boolean handleRequest(VaadinSession session,
VaadinRequest request, VaadinResponse response) throws IOException {
- String relativeUri = request.getRequestPathInfo();
+ String relativeUri = request.getPathInfo();
// Catch the given URI that identifies the resource, otherwise let other
// URI handlers or the Application to handle the response.
if (!relativeUri.startsWith("myresource")) {
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1921.java b/uitest/src/com/vaadin/tests/tickets/Ticket1921.java
index cde90ff3d6..79dcd3bd71 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket1921.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket1921.java
@@ -7,7 +7,7 @@ import com.vaadin.server.LegacyApplication;
import com.vaadin.server.RequestHandler;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinResponse;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
@@ -42,7 +42,7 @@ public class Ticket1921 extends LegacyApplication implements RequestHandler {
newState();
- VaadinServiceSession.getCurrent().addRequestHandler(this);
+ VaadinSession.getCurrent().addRequestHandler(this);
}
public void newState() {
@@ -94,7 +94,7 @@ public class Ticket1921 extends LegacyApplication implements RequestHandler {
}
@Override
- public boolean handleRequest(VaadinServiceSession session,
+ public boolean handleRequest(VaadinSession session,
VaadinRequest request, VaadinResponse response) throws IOException {
Map<String, String[]> parameters = request.getParameterMap();
String[] s = parameters.get("state");
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2292.java b/uitest/src/com/vaadin/tests/tickets/Ticket2292.java
index f6ec542ad2..e81ad3185a 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket2292.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket2292.java
@@ -14,7 +14,7 @@ import com.vaadin.server.ExternalResource;
import com.vaadin.server.RequestHandler;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinResponse;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Label;
@@ -44,13 +44,13 @@ public class Ticket2292 extends com.vaadin.server.LegacyApplication implements
Link l = new Link("l", icon);
main.addComponent(l);
- VaadinServiceSession.getCurrent().addRequestHandler(this);
+ VaadinSession.getCurrent().addRequestHandler(this);
}
@Override
- public boolean handleRequest(VaadinServiceSession session,
+ public boolean handleRequest(VaadinSession session,
VaadinRequest request, VaadinResponse response) throws IOException {
- String relativeUri = request.getRequestPathInfo();
+ String relativeUri = request.getPathInfo();
if (!relativeUri.contains("icon.png")) {
return false;
diff --git a/uitest/src/com/vaadin/tests/util/SampleDirectory.java b/uitest/src/com/vaadin/tests/util/SampleDirectory.java
index 74b5dfe5e8..0eeae4ca9e 100644
--- a/uitest/src/com/vaadin/tests/util/SampleDirectory.java
+++ b/uitest/src/com/vaadin/tests/util/SampleDirectory.java
@@ -20,7 +20,7 @@ import java.io.File;
import com.vaadin.server.SystemError;
import com.vaadin.server.VaadinService;
-import com.vaadin.server.VaadinServiceSession;
+import com.vaadin.server.VaadinSession;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Label;
import com.vaadin.ui.LegacyWindow;
@@ -43,7 +43,7 @@ public class SampleDirectory {
* @param application
* @return file pointing to sample directory
*/
- public static File getDirectory(VaadinServiceSession application,
+ public static File getDirectory(VaadinSession application,
LegacyWindow uI) {
String errorMessage = "Access to application "
+ "context base directory failed, "
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/DelegateState.java b/uitest/src/com/vaadin/tests/widgetset/client/DelegateState.java
index e9ac8a1e61..1af0d04bf6 100644
--- a/uitest/src/com/vaadin/tests/widgetset/client/DelegateState.java
+++ b/uitest/src/com/vaadin/tests/widgetset/client/DelegateState.java
@@ -16,10 +16,10 @@
package com.vaadin.tests.widgetset.client;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.annotations.DelegateToWidget;
-public class DelegateState extends ComponentState {
+public class DelegateState extends AbstractComponentState {
@DelegateToWidget
public String value1;
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/LabelState.java b/uitest/src/com/vaadin/tests/widgetset/client/LabelState.java
index 91a269e33f..9bc1397339 100644
--- a/uitest/src/com/vaadin/tests/widgetset/client/LabelState.java
+++ b/uitest/src/com/vaadin/tests/widgetset/client/LabelState.java
@@ -16,7 +16,7 @@
package com.vaadin.tests.widgetset.client;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
/**
* State class with the same simple name as
@@ -26,7 +26,7 @@ import com.vaadin.shared.ComponentState;
* @version @VERSION@
* @since 7.0.0
*/
-public class LabelState extends ComponentState {
+public class LabelState extends AbstractComponentState {
private String text;
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ComponentInStateState.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ComponentInStateState.java
index b64d0f0ad5..58ec6fc892 100644
--- a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ComponentInStateState.java
+++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/ComponentInStateState.java
@@ -16,9 +16,9 @@
package com.vaadin.tests.widgetset.client.minitutorials.v7a2;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.Connector;
-public class ComponentInStateState extends ComponentState {
+public class ComponentInStateState extends AbstractComponentState {
public Connector otherComponent;
}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentState.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentState.java
index 948f98e756..a7a6b987fb 100644
--- a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentState.java
+++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentState.java
@@ -1,8 +1,8 @@
package com.vaadin.tests.widgetset.client.minitutorials.v7a2;
-import com.vaadin.shared.ComponentState;
+import com.vaadin.shared.AbstractComponentState;
-public class MyComponentState extends ComponentState {
+public class MyComponentState extends AbstractComponentState {
public String text;
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7b1/CapsLockWarningRpc.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7b1/CapsLockWarningRpc.java
index 3db8d712c4..d0c2992003 100644
--- a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7b1/CapsLockWarningRpc.java
+++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7b1/CapsLockWarningRpc.java
@@ -20,6 +20,6 @@ import com.vaadin.shared.annotations.Delayed;
import com.vaadin.shared.communication.ServerRpc;
public interface CapsLockWarningRpc extends ServerRpc {
- @Delayed(lastonly = true)
+ @Delayed(lastOnly = true)
public void isCapsLockEnabled(boolean isCapsLockEnabled);
}