-
-
--
cgit v1.2.3
From eee3c6be22e583752748acea31255b27fde27fdf Mon Sep 17 00:00:00 2001
From: Artur Signell
Date: Mon, 9 Mar 2015 13:03:02 +0200
Subject: Disable auto-testing of TB2 tests on Chrome
Chrome has started auto-updating even though auto updates are
disabled on the test machines. TestBench 2 works with Chrome 41 (latest)
but opens the test in a new tab instead of in a new window and therefore
is unable to resize the browser to the correct size for screenshots.
Change-Id: Ib7f05a9115a9c82f5b3b384d73c47d6becbfbe79
---
uitest/test.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/uitest/test.xml b/uitest/test.xml
index 496e115c18..c07c4d96af 100644
--- a/uitest/test.xml
+++ b/uitest/test.xml
@@ -7,7 +7,7 @@
-
+
--
cgit v1.2.3
From 9086245a6d2052fe813b3ef4296c686aad82b244 Mon Sep 17 00:00:00 2001
From: Alexey Fansky
Date: Wed, 4 Mar 2015 13:23:42 -0800
Subject: Using ComponentFactory in DesignContext.getDefaultInstance() (#16990)
Change-Id: I0bb3e7975f2b48cdc589de740cb07ac893b13461
---
.../com/vaadin/ui/declarative/DesignContext.java | 21 +++++++++---------
.../vaadin/tests/design/ComponentFactoryTest.java | 25 ++++++++++++++++++++++
2 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/server/src/com/vaadin/ui/declarative/DesignContext.java b/server/src/com/vaadin/ui/declarative/DesignContext.java
index 09fefd0a6b..218774c72d 100644
--- a/server/src/com/vaadin/ui/declarative/DesignContext.java
+++ b/server/src/com/vaadin/ui/declarative/DesignContext.java
@@ -278,16 +278,8 @@ public class DesignContext implements Serializable {
Class extends Component> componentClass) {
Component instance = instanceCache.get(componentClass);
if (instance == null) {
- try {
- instance = componentClass.newInstance();
- instanceCache.put(componentClass, instance);
- } catch (InstantiationException e) {
- throw new RuntimeException("Could not instantiate "
- + componentClass.getName());
- } catch (IllegalAccessException e) {
- throw new RuntimeException("Could not instantiate "
- + componentClass.getName());
- }
+ instance = instantiateClass(componentClass.getName());
+ instanceCache.put(componentClass, instance);
}
return instance;
}
@@ -484,6 +476,15 @@ public class DesignContext implements Serializable {
// Extract the package and class names.
String qualifiedClassName = tagNameToClassName(node);
+ return instantiateClass(qualifiedClassName);
+ }
+
+ /**
+ * Instantiates given class via ComponentFactory.
+ * @param qualifiedClassName class name to instantiate
+ * @return instance of a given class
+ */
+ private Component instantiateClass(String qualifiedClassName) {
ComponentFactory factory = Design.getComponentFactory();
Component component = factory.createComponent(qualifiedClassName, this);
diff --git a/server/tests/src/com/vaadin/tests/design/ComponentFactoryTest.java b/server/tests/src/com/vaadin/tests/design/ComponentFactoryTest.java
index a5f1d288a2..4115872fb7 100644
--- a/server/tests/src/com/vaadin/tests/design/ComponentFactoryTest.java
+++ b/server/tests/src/com/vaadin/tests/design/ComponentFactoryTest.java
@@ -19,6 +19,8 @@ import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.List;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.TextField;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
@@ -109,9 +111,32 @@ public class ComponentFactoryTest {
Design.read(new ByteArrayInputStream("".getBytes()));
}
+ @Test
+ public void testGetDefaultInstanceUsesComponentFactory() {
+ final List classes = new ArrayList();
+ currentComponentFactory.set(new ComponentFactory() {
+ @Override
+ public Component createComponent(String fullyQualifiedClassName,
+ DesignContext context) {
+ classes.add(fullyQualifiedClassName);
+ return defaultFactory.createComponent(fullyQualifiedClassName,
+ context);
+ }
+ });
+
+ DesignContext designContext = new DesignContext();
+ designContext.getDefaultInstance(new DefaultInstanceTestComponent());
+
+ Assert.assertEquals("There should be one class requests", 1, classes.size());
+ Assert.assertEquals("First class should be DefaultInstanceTestComponent",
+ DefaultInstanceTestComponent.class.getName(), classes.get(0));
+ }
+
@After
public void cleanup() {
currentComponentFactory.remove();
}
+ public static class DefaultInstanceTestComponent extends AbstractComponent {
+ }
}
--
cgit v1.2.3
From 3373024142a2adc22654afca1c5ac6ca195d3660 Mon Sep 17 00:00:00 2001
From: Artur Signell
Date: Fri, 2 Jan 2015 16:20:26 +0200
Subject: Script for updating push version
Supports both Vaadin atmosphere versions and upstream versions
Change-Id: I4d4965354a19c071dbd0bfb295e311e7cd55a63f
---
scripts/updatePushVersion.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
create mode 100755 scripts/updatePushVersion.sh
diff --git a/scripts/updatePushVersion.sh b/scripts/updatePushVersion.sh
new file mode 100755
index 0000000000..d2e83e0454
--- /dev/null
+++ b/scripts/updatePushVersion.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+if [ "$#" != "2" ]
+then
+ echo "Usage: $0 "
+ echo "If the runtime version contains the string 'vaadin', then a vaadin atmosphere version will be assumed, otherwise an upstream atmosphere version".
+ echo "If a version is set to -, the version will not be updated"
+ exit 1
+fi
+
+pushd `dirname $0`/.. > /dev/null
+basedir=`pwd`
+popd > /dev/null
+
+currentRuntime=`grep ENTITY "$basedir"/push/ivy.xml|grep runtime.version|cut -d\" -f 2`
+currentJs=`grep ENTITY "$basedir"/push/ivy.xml|grep js.version|cut -d\" -f 2`
+
+sed=`which sed`
+
+uname|grep Darwin > /dev/null
+if [ "$?" = "0" ]
+then
+ # Mac if uname output contains Darwin
+ sed=`which gsed`
+ if [ "$sed" = "" ]
+ then
+ echo "Install gnu sed (gsed) using e.g. brew install gnu-sed"
+ exit 2
+ fi
+fi
+
+echo "Currently using runtime $currentRuntime and JS $currentJs"
+
+newRuntime=$1
+newJs=$2
+
+if [ "$newRuntime" != "-" ]
+then
+ echo "Updating runtime to $newRuntime..."
+ $sed -i "s#$currentRuntime#$newRuntime#" "$basedir"/push/ivy.xml
+ $sed -i "s/$currentRuntime/$newRuntime/g" "$basedir"/push/build.xml
+ $sed -i "s/$currentRuntime/$newRuntime/g" "$basedir"/server/src/com/vaadin/server/Constants.java
+ if [[ $newRuntime == *"vaadin"* ]]
+ then
+ $sed -i "s/org.atmosphere/com.vaadin.external.atmosphere/g" "$basedir"/push/ivy.xml
+ else
+ $sed -i "s/com.vaadin.external.atmosphere/org.atmosphere/g" "$basedir"/push/ivy.xml
+ fi
+fi
+
+if [ "$newJs" != "-" ]
+then
+ echo "Updating JS to $newJs..."
+ $sed -i "s/$currentJs/$newJs/g" "$basedir"/push/ivy.xml
+fi
--
cgit v1.2.3
From 21c73437439539276c6f4152fa149c201db94d95 Mon Sep 17 00:00:00 2001
From: Artur Signell
Date: Tue, 10 Mar 2015 15:19:27 +0200
Subject: Update Atmosphere to 2.2.4.vaadin5 (#17074)
Change-Id: I85618f66effbf647856d9c152b3e66a6454001d9
---
push/build.xml | 2 +-
push/ivy.xml | 2 +-
server/src/com/vaadin/server/Constants.java | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/push/build.xml b/push/build.xml
index 519dc81ed2..336c3629aa 100644
--- a/push/build.xml
+++ b/push/build.xml
@@ -18,7 +18,7 @@
location="${result.dir}/js/VAADIN/vaadinPush.debug.js" />
-
+
diff --git a/push/ivy.xml b/push/ivy.xml
index c285bfd4aa..605f5d1a05 100644
--- a/push/ivy.xml
+++ b/push/ivy.xml
@@ -1,7 +1,7 @@
-
+
]>
diff --git a/server/src/com/vaadin/server/Constants.java b/server/src/com/vaadin/server/Constants.java
index b9a43a98de..b7c2a1ff3e 100644
--- a/server/src/com/vaadin/server/Constants.java
+++ b/server/src/com/vaadin/server/Constants.java
@@ -67,7 +67,7 @@ public interface Constants {
// Keep the version number in sync with push/build.xml and other locations
// listed in that file
- static final String REQUIRED_ATMOSPHERE_RUNTIME_VERSION = "2.2.4.vaadin4";
+ static final String REQUIRED_ATMOSPHERE_RUNTIME_VERSION = "2.2.4.vaadin5";
static final String INVALID_ATMOSPHERE_VERSION_WARNING = "\n"
+ "=================================================================\n"
--
cgit v1.2.3
From 155ffa7560e6445557ad2d04d2f83411c391debb Mon Sep 17 00:00:00 2001
From: Sauli Tähkäpää
Date: Wed, 25 Feb 2015 23:19:30 +0200
Subject: Use Math.floor instead of casting to int when trimming decimals.
(#16926)
Change-Id: I02802b910d0dc90221483fedbf05be48958d8dcc
---
server/src/com/vaadin/ui/Slider.java | 2 +-
.../src/com/vaadin/tests/server/component/slider/SliderTest.java | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/server/src/com/vaadin/ui/Slider.java b/server/src/com/vaadin/ui/Slider.java
index dad4d295bf..fab6e33cae 100644
--- a/server/src/com/vaadin/ui/Slider.java
+++ b/server/src/com/vaadin/ui/Slider.java
@@ -267,7 +267,7 @@ public class Slider extends AbstractField {
if (resolution > 0) {
// Round up to resolution
- newValue = (int) (v * Math.pow(10, resolution));
+ newValue = Math.floor(v * Math.pow(10, resolution));
newValue = newValue / Math.pow(10, resolution);
if (getMin() > newValue || getMax() < newValue) {
throw new ValueOutOfBoundsException(newValue);
diff --git a/server/tests/src/com/vaadin/tests/server/component/slider/SliderTest.java b/server/tests/src/com/vaadin/tests/server/component/slider/SliderTest.java
index 48bba8a853..d2e2654cbc 100644
--- a/server/tests/src/com/vaadin/tests/server/component/slider/SliderTest.java
+++ b/server/tests/src/com/vaadin/tests/server/component/slider/SliderTest.java
@@ -65,6 +65,15 @@ public class SliderTest {
} catch (Slider.ValueOutOfBoundsException e) {
// TODO: handle exception
}
+ }
+
+ @Test
+ public void valueCanHaveLargePrecision() {
+ Slider slider = new Slider();
+ slider.setResolution(20);
+
+ slider.setValue(99.01234567891234567890123456789);
+ assertThat(slider.getValue(), is(99.01234567891234567890123456789));
}
}
--
cgit v1.2.3
From b2db17740aa8e7b33b208c73559c1d5d3461c192 Mon Sep 17 00:00:00 2001
From: Fabian Lange
Date: Mon, 2 Mar 2015 13:28:15 +0100
Subject: Improve performance of getMeasureTargetsJsArray (#16973).
This change optimizes the method
LayoutDependenyTree.getMeasureTargetsJsArray.
The previous code dumps both MeasureQueues and then iterates over the
vertical one and then checks if it is present in the horizontal one.
If it is not present it pushes the element to the array (which usually
invokes an arraycopy in js).
The new code adds both Queues to a new FastStringSet which does deal
with duplicates nicely.
While this is not much faster than the dumps, it avoids the array
allocations and the separate iteration for duplicate checking.
Change-Id: I2f643a2d0b32e4c2517efff16c196387f38f0d8a
---
.../vaadin/client/ui/layout/LayoutDependencyTree.java | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
index da3aed4bbc..af261c0208 100644
--- a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
+++ b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
@@ -690,19 +690,10 @@ public class LayoutDependencyTree {
}
public JsArrayString getMeasureTargetsJsArray() {
- FastStringSet horizontalQueue = getMeasureQueue(HORIZONTAL);
- JsArrayString measureTargets = horizontalQueue.dump();
-
- JsArrayString verticalDump = getMeasureQueue(VERTICAL).dump();
- int length = verticalDump.length();
- for (int i = 0; i < length; i++) {
- String connectorId = verticalDump.get(i);
- if (!horizontalQueue.contains(connectorId)) {
- measureTargets.push(connectorId);
- }
- }
-
- return measureTargets;
+ FastStringSet allMeasuredTargets = FastStringSet.create();
+ allMeasuredTargets.addAll(getMeasureQueue(HORIZONTAL));
+ allMeasuredTargets.addAll(getMeasureQueue(VERTICAL));
+ return allMeasuredTargets.dump();
}
public void logDependencyStatus(ComponentConnector connector) {
--
cgit v1.2.3
From c2a85b37901a70fa3134c0dc2adfcff97e7b06e8 Mon Sep 17 00:00:00 2001
From: Fabian Lange
Date: Mon, 2 Mar 2015 10:45:28 +0100
Subject: LayoutManager uses shortcut when delaying overflow fixes (#16963).
This change introduces an extracted method which will quick return if
a component needs a delayedOverflowFix.
Change-Id: I0d6ab100964a59e2f445a81271863a8212538d4d
---
client/src/com/vaadin/client/LayoutManager.java | 27 ++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java
index f77b61a5a3..dfcf2cb5bb 100644
--- a/client/src/com/vaadin/client/LayoutManager.java
+++ b/client/src/com/vaadin/client/LayoutManager.java
@@ -605,15 +605,7 @@ public class LayoutManager {
ComponentConnector componentConnector = (ComponentConnector) connectorMap
.getConnector(connectorId);
- // Delay the overflow fix if the involved connectors might still
- // change
- boolean connectorChangesExpected = !currentDependencyTree
- .noMoreChangesExpected(componentConnector);
- boolean parentChangesExcpected = componentConnector.getParent() instanceof ComponentConnector
- && !currentDependencyTree
- .noMoreChangesExpected((ComponentConnector) componentConnector
- .getParent());
- if (connectorChangesExpected || parentChangesExcpected) {
+ if (delayOverflowFix(componentConnector)) {
delayedOverflowFixes.add(connectorId);
continue;
}
@@ -732,6 +724,23 @@ public class LayoutManager {
return measureCount;
}
+ /*
+ * Delay the overflow fix if the involved connectors might still change
+ */
+ private boolean delayOverflowFix(ComponentConnector componentConnector) {
+ if (!currentDependencyTree.noMoreChangesExpected(componentConnector)) {
+ return true;
+ }
+ ServerConnector parent = componentConnector.getParent();
+ if (parent instanceof ComponentConnector
+ && !currentDependencyTree
+ .noMoreChangesExpected((ComponentConnector) parent)) {
+ return true;
+ }
+
+ return false;
+ }
+
private void measureConnector(ComponentConnector connector) {
Profiler.enter("LayoutManager.measureConnector");
Element element = connector.getWidget().getElement();
--
cgit v1.2.3
From ed8ac01fbd34d4ef8654bc458b83773898aa55b4 Mon Sep 17 00:00:00 2001
From: Fabian Lange
Date: Mon, 2 Mar 2015 13:08:02 +0100
Subject: Improve performance of setNeedsMeasure (#16972).
This change removes the method LayoutDependenyTree.setNeedsMeasure which
takes a connectorId as first param.
In all places where it is used, the ComponentConnector is actually known,
so this change avoids looking it up over and over again.
Also The lookup would need to lookup the ConnectorMap every time.
Change-Id: I2593b0bede05cd69889ba68aac854cfba43f70b1
---
client/src/com/vaadin/client/LayoutManager.java | 17 ++++++++++-------
.../vaadin/client/ui/layout/LayoutDependencyTree.java | 9 +++++++++
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java
index dfcf2cb5bb..828f0942b7 100644
--- a/client/src/com/vaadin/client/LayoutManager.java
+++ b/client/src/com/vaadin/client/LayoutManager.java
@@ -310,8 +310,11 @@ public class LayoutManager {
dump = needsMeasure.dump();
dumpLength = dump.length();
for (int i = 0; i < dumpLength; i++) {
- String layoutId = dump.get(i);
- currentDependencyTree.setNeedsMeasure(layoutId, true);
+ ServerConnector connector = connectorMap.getConnector(dump.get(i));
+ if (connector != null) {
+ currentDependencyTree.setNeedsMeasure(
+ (ComponentConnector) connector, true);
+ }
}
needsMeasure = FastStringSet.create();
@@ -661,7 +664,7 @@ public class LayoutManager {
parentElement.getStyle().setProperty("overflow",
originalOverflows.get(parentElement));
- layoutDependencyTree.setNeedsMeasure(connectorId, true);
+ layoutDependencyTree.setNeedsMeasure(componentConnector, true);
}
Profiler.leave("Overflow fix restore");
@@ -695,8 +698,7 @@ public class LayoutManager {
measureConnector(connectors.get(i));
}
for (int i = 0; i < connectorCount; i++) {
- layoutDependencyTree.setNeedsMeasure(connectors.get(i)
- .getConnectorId(), false);
+ layoutDependencyTree.setNeedsMeasure(connectors.get(i), false);
}
measureCount += connectorCount;
@@ -715,8 +717,9 @@ public class LayoutManager {
measureCount++;
}
for (int i = 0; i < length; i++) {
- String connectorId = measureTargets.get(i);
- layoutDependencyTree.setNeedsMeasure(connectorId, false);
+ ComponentConnector connector = (ComponentConnector) connectorMap
+ .getConnector(measureTargets.get(i));
+ layoutDependencyTree.setNeedsMeasure(connector, false);
}
}
Profiler.leave("Layout measure from tree");
diff --git a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
index af261c0208..07bb6688e3 100644
--- a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
+++ b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java
@@ -429,6 +429,15 @@ public class LayoutDependencyTree {
setNeedsVerticalMeasure(connector, needsMeasure);
}
+ /**
+ * @param connectorId
+ * @param needsMeasure
+ *
+ * @deprecated As of 7.4.2, use
+ * {@link #setNeedsMeasure(ComponentConnector, boolean)} for
+ * improved performance.
+ */
+ @Deprecated
public void setNeedsMeasure(String connectorId, boolean needsMeasure) {
ComponentConnector connector = (ComponentConnector) ConnectorMap.get(
connection).getConnector(connectorId);
--
cgit v1.2.3
From 5692572146f7029c51b129ff30c89dd30d9c788d Mon Sep 17 00:00:00 2001
From: Henrik Paul
Date: Thu, 12 Mar 2015 14:22:29 +0200
Subject: Makes Connectors into DeferredWorker candidates (#17127)
Change-Id: Ie24a85a2c4abc5e68af0bec2af4dcbcabee77c91
---
.../com/vaadin/client/ApplicationConnection.java | 215 +++++++++++----------
client/src/com/vaadin/client/DeferredWorker.java | 12 +-
2 files changed, 114 insertions(+), 113 deletions(-)
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index f88a3b6f63..1b3196e1c2 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -62,7 +62,6 @@ 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;
-import com.vaadin.client.ApplicationConnection.ApplicationStoppedEvent;
import com.vaadin.client.ResourceLoader.ResourceLoadEvent;
import com.vaadin.client.ResourceLoader.ResourceLoadListener;
import com.vaadin.client.communication.HasJavaScriptConnectorHelper;
@@ -94,7 +93,6 @@ import com.vaadin.client.ui.VOverlay;
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.AbstractComponentState;
import com.vaadin.shared.ApplicationConstants;
import com.vaadin.shared.JsonConstants;
import com.vaadin.shared.VaadinUriResolver;
@@ -115,14 +113,14 @@ import elemental.json.JsonValue;
* This is the client side communication "engine", managing client-server
* communication with its server side counterpart
* com.vaadin.server.VaadinService.
- *
+ *
* Client-side connectors receive updates from the corresponding server-side
* connector (typically component) as state updates or RPC calls. The connector
* has the possibility to communicate back with its server side counter part
* through RPC calls.
- *
+ *
* TODO document better
- *
+ *
* Entry point classes (widgetsets) define onModuleLoad().
*/
public class ApplicationConnection implements HasHandlers {
@@ -166,12 +164,12 @@ public class ApplicationConnection implements HasHandlers {
* A string that, if found in a non-JSON response to a UIDL request, will
* cause the browser to refresh the page. If followed by a colon, optional
* whitespace, and a URI, causes the browser to synchronously load the URI.
- *
+ *
*
* This allows, for instance, a servlet filter to redirect the application
* to a custom login page when the session expires. For example:
*
- *
+ *
*
* if (sessionExpired) {
* response.setHeader("Content-Type", "text/html");
@@ -354,7 +352,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Event triggered when a XHR request has finished with the status code of
* the response.
- *
+ *
* Useful for handlers observing network failures like online/off-line
* monitors.
*/
@@ -410,12 +408,12 @@ public class ApplicationConnection implements HasHandlers {
/**
* Event triggered when a application is stopped by calling
* {@link ApplicationConnection#setApplicationRunning(false)}.
- *
+ *
* To listen for the event add a {@link ApplicationStoppedHandler} by
* invoking
* {@link ApplicationConnection#addHandler(ApplicationConnection.ApplicationStoppedEvent.Type, ApplicationStoppedHandler)}
* to the {@link ApplicationConnection}
- *
+ *
* @since 7.1.8
* @author Vaadin Ltd
*/
@@ -442,7 +440,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Called when a communication error has occurred. Returning
* true from this method suppresses error handling.
- *
+ *
* @param details
* A string describing the error.
* @param statusCode
@@ -457,7 +455,7 @@ public class ApplicationConnection implements HasHandlers {
* A listener for listening to application stopped events. The listener can
* be added to a {@link ApplicationConnection} by invoking
* {@link ApplicationConnection#addHandler(ApplicationStoppedEvent.Type, ApplicationStoppedHandler)}
- *
+ *
* @since 7.1.8
* @author Vaadin Ltd
*/
@@ -467,7 +465,7 @@ public class ApplicationConnection implements HasHandlers {
* Triggered when the {@link ApplicationConnection} marks a previously
* running application as stopped by invoking
* {@link ApplicationConnection#setApplicationRunning(false)}
- *
+ *
* @param event
* the event triggered by the {@link ApplicationConnection}
*/
@@ -599,7 +597,7 @@ public class ApplicationConnection implements HasHandlers {
* called once this application has started (first response received) or
* failed to start. This ensures that the applications are started in order,
* to avoid session-id problems.
- *
+ *
*/
public void start() {
String jsonText = configuration.getUIDL();
@@ -709,7 +707,7 @@ public class ApplicationConnection implements HasHandlers {
*
vaadin.postRequestHooks is a map of functions which gets
* called after each XHR made by vaadin application. Note, that it is
* attaching js functions responsibility to create the variable like this:
- *
+ *
*
* if(!vaadin.postRequestHooks) {vaadin.postRequestHooks = new Object();}
* postRequestHooks.myHook = function(appId) {
@@ -720,7 +718,7 @@ public class ApplicationConnection implements HasHandlers {
*
First parameter passed to these functions is the identifier
* of Vaadin application that made the request.
*
- *
+ *
* TODO make this multi-app aware
*/
private native void initializeClientHooks()
@@ -751,7 +749,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Runs possibly registered client side post request hooks. This is expected
* to be run after each uidl request made by Vaadin application.
- *
+ *
* @param appId
*/
private static native void runPostRequestHooks(String appId)
@@ -771,7 +769,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* If on Liferay and logged in, ask the client side session management
* JavaScript to extend the session duration.
- *
+ *
* Otherwise, Liferay client side JavaScript will explicitly expire the
* session even though the server side considers the session to be active.
* See ticket #8305 for more information.
@@ -790,7 +788,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Indicates whether or not there are currently active UIDL requests. Used
* internally to sequence requests properly, seldom needed in Widgets.
- *
+ *
* @return true if there are active requests
*/
public boolean hasActiveRequest() {
@@ -810,7 +808,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Requests an analyze of layouts, to find inconsistencies. Exclusively used
* for debugging during development.
- *
+ *
* @deprecated as of 7.1. Replaced by {@link UIConnector#analyzeLayouts()}
*/
@Deprecated
@@ -822,7 +820,7 @@ public class ApplicationConnection implements HasHandlers {
* Sends a request to the server to print details to console that will help
* the developer to locate the corresponding server-side connector in the
* source code.
- *
+ *
* @param serverConnector
* @deprecated as of 7.1. Replaced by
* {@link UIConnector#showServerDebugInfo(ServerConnector)}
@@ -834,7 +832,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Makes an UIDL request to the server.
- *
+ *
* @param reqInvocations
* Data containing RPC invocations and all related information.
* @param extraParams
@@ -872,7 +870,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Sends an asynchronous or synchronous UIDL request to the server using the
* given URI.
- *
+ *
* @param uri
* The URI to use for the request. May includes GET parameters
* @param payload
@@ -947,8 +945,7 @@ public class ApplicationConnection implements HasHandlers {
}
}).schedule(100);
} else {
- handleError(
- "Invalid status code 0 (server down?)",
+ handleError("Invalid status code 0 (server down?)",
statusCode);
}
return;
@@ -993,8 +990,8 @@ public class ApplicationConnection implements HasHandlers {
} else if ((statusCode / 100) == 5) {
// Something's wrong on the server, there's nothing the
// client can do except maybe try again.
- handleError("Server error. Error code: "
- + statusCode, statusCode);
+ handleError("Server error. Error code: " + statusCode,
+ statusCode);
return;
}
@@ -1039,7 +1036,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Handles received UIDL JSON text, parsing it, and passing it on to the
* appropriate handlers, while logging timing information.
- *
+ *
* @param jsonText
* @param statusCode
*/
@@ -1076,7 +1073,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Sends an asynchronous UIDL request to the server using the given URI.
- *
+ *
* @param uri
* The URI to use for the request. May includes GET parameters
* @param payload
@@ -1211,7 +1208,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Checks whether or not the CSS is loaded. By default checks the size of
* the loading indicator element.
- *
+ *
* @return
*/
protected boolean isCSSLoaded() {
@@ -1221,12 +1218,12 @@ public class ApplicationConnection implements HasHandlers {
/**
* Shows the communication error notification.
- *
+ *
* @param details
* Optional details for debugging.
* @param statusCode
* The status code returned for the request
- *
+ *
*/
protected void showCommunicationError(String details, int statusCode) {
VConsole.error("Communication error: " + details);
@@ -1235,7 +1232,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Shows the authentication error notification.
- *
+ *
* @param details
* Optional details for debugging.
*/
@@ -1246,7 +1243,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Shows the session expiration notification.
- *
+ *
* @param details
* Optional details for debugging.
*/
@@ -1257,7 +1254,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Shows an error notification.
- *
+ *
* @param details
* Optional details for debugging.
* @param message
@@ -1270,7 +1267,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Shows the error notification.
- *
+ *
* @param details
* Optional details for debugging.
*/
@@ -1357,7 +1354,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* This method is called after applying uidl change set to application.
- *
+ *
* It will clean current and queued variable change sets. And send next
* change set if it exists.
*/
@@ -1376,7 +1373,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Cleans given queue of variable changes of such changes that came from
* components that do not exist anymore.
- *
+ *
* @param variableBurst
*/
private void cleanVariableBurst(
@@ -1403,20 +1400,25 @@ public class ApplicationConnection implements HasHandlers {
int size = connectors.size();
for (int i = 0; i < size; i++) {
ServerConnector conn = connectors.get(i);
- ComponentConnector compConn = null;
+ if (isWorkPending(conn)) {
+ return true;
+ }
+
if (conn instanceof ComponentConnector) {
- compConn = (ComponentConnector) conn;
- Widget wgt = compConn.getWidget();
- if (wgt instanceof DeferredWorker) {
- if (((DeferredWorker) wgt).isWorkPending()) {
- return true;
- }
+ ComponentConnector compConn = (ComponentConnector) conn;
+ if (isWorkPending(compConn.getWidget())) {
+ return true;
}
}
}
return false;
}
+ private static boolean isWorkPending(Object object) {
+ return object instanceof DeferredWorker
+ && ((DeferredWorker) object).isWorkPending();
+ }
+
/**
* Checks if deferred commands are (potentially) still being executed as a
* result of an update from the server. Returns true if a deferred command
@@ -1425,7 +1427,7 @@ public class ApplicationConnection implements HasHandlers {
*
* Used by the native "client.isActive" function.
*
- *
+ *
* @return true if deferred commands are (potentially) being executed, false
* otherwise
*/
@@ -1440,7 +1442,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Returns the loading indicator used by this ApplicationConnection
- *
+ *
* @return The loading indicator for this ApplicationConnection
*/
public VLoadingIndicator getLoadingIndicator() {
@@ -1449,7 +1451,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Determines whether or not the loading indicator is showing.
- *
+ *
* @return true if the loading indicator is visible
* @deprecated As of 7.1. Use {@link #getLoadingIndicator()} and
* {@link VLoadingIndicator#isVisible()}.isVisible() instead.
@@ -1483,7 +1485,7 @@ public class ApplicationConnection implements HasHandlers {
* server is received.
*
* The initial id when no request has yet been processed is -1.
- *
+ *
* @return and id identifying the response
*/
public int getLastResponseId() {
@@ -1923,13 +1925,13 @@ public class ApplicationConnection implements HasHandlers {
/**
* Sends the state change events created while updating the state
* information.
- *
+ *
* This must be called after hierarchy change listeners have been
* called. At least caption updates for the parent are strange if
* fired from state change listeners and thus calls the parent
* BEFORE the parent is aware of the child (through a
* ConnectorHierarchyChangedEvent)
- *
+ *
* @param pendingStateChangeEvents
* The events to send
*/
@@ -2285,7 +2287,7 @@ public class ApplicationConnection implements HasHandlers {
* Updates the connector hierarchy and returns a list of events that
* should be fired after update of the hierarchy and the state is
* done.
- *
+ *
* @param json
* The JSON containing the hierarchy information
* @return A collection of events that should be fired when update
@@ -2697,9 +2699,9 @@ public class ApplicationConnection implements HasHandlers {
/**
* Adds an explicit RPC method invocation to the send queue.
- *
+ *
* @since 7.0
- *
+ *
* @param invocation
* RPC method invocation
* @param delayed
@@ -2739,7 +2741,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Removes any pending invocation of the given method from the queue
- *
+ *
* @param invocation
* The invocation to remove
*/
@@ -2757,12 +2759,12 @@ public class ApplicationConnection implements HasHandlers {
/**
* This method sends currently queued variable changes to server. It is
* called when immediate variable update must happen.
- *
+ *
* To ensure correct order for variable changes (due servers multithreading
* or network), we always wait for active request to be handler before
* sending a new one. If there is an active request, we will put varible
* "burst" to queue that will be purged after current request is handled.
- *
+ *
*/
public void sendPendingVariableChanges() {
if (!deferredSendPending) {
@@ -2803,11 +2805,11 @@ public class ApplicationConnection implements HasHandlers {
/**
* Build the variable burst and send it to server.
- *
+ *
* When sync is forced, we also force sending of all pending variable-bursts
* at the same time. This is ok as we can assume that DOM will never be
* updated after this.
- *
+ *
* @param pendingInvocations
* List of RPC method invocations to send
*/
@@ -2901,7 +2903,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
*
- *
+ *
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -2923,7 +2925,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
*
- *
+ *
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -2946,7 +2948,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
*
- *
+ *
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -2969,7 +2971,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
*
- *
+ *
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -2992,7 +2994,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
*
- *
+ *
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -3015,7 +3017,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
*
- *
+ *
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -3038,7 +3040,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
*
- *
+ *
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -3061,7 +3063,7 @@ public class ApplicationConnection implements HasHandlers {
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
*
- *
+ *
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -3078,13 +3080,13 @@ public class ApplicationConnection implements HasHandlers {
/**
* Sends a new value for the given paintables given variable to the server.
- *
+ *
* The update is actually queued to be sent at a suitable time. If immediate
* is true, the update is sent as soon as possible. If immediate is false,
* the update will be sent along with the next immediate update.
- *
+ *
* A null array is sent as an empty array.
- *
+ *
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -3101,14 +3103,13 @@ public class ApplicationConnection implements HasHandlers {
/**
* Sends a new value for the given paintables given variable to the server.
- *
+ *
* The update is actually queued to be sent at a suitable time. If immediate
* is true, the update is sent as soon as possible. If immediate is false,
- * the update will be sent along with the next immediate update.
- *
+ * the update will be sent along with the next immediate update.
+ *
* A null array is sent as an empty array.
- *
- *
+ *
* @param paintableId
* the id of the paintable that owns the variable
* @param variableName
@@ -3125,7 +3126,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Does absolutely nothing. Replaced by {@link LayoutManager}.
- *
+ *
* @param container
* @deprecated As of 7.0, serves no purpose
*/
@@ -3147,7 +3148,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Returns false
- *
+ *
* @param paintable
* @return false, always
* @deprecated As of 7.0, serves no purpose
@@ -3159,7 +3160,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Returns false
- *
+ *
* @param paintable
* @return false, always
* @deprecated As of 7.0, serves no purpose
@@ -3180,16 +3181,16 @@ public class ApplicationConnection implements HasHandlers {
/**
* Get either an existing ComponentConnector or create a new
* ComponentConnector with the given type and id.
- *
+ *
* If a ComponentConnector with the given id already exists, returns it.
* Otherwise creates and registers a new ComponentConnector of the given
* type.
- *
+ *
* @param connectorId
* Id of the paintable
* @param connectorType
* Type of the connector, as passed from the server side
- *
+ *
* @return Either an existing ComponentConnector or a new ComponentConnector
* of the given type
*/
@@ -3202,15 +3203,15 @@ public class ApplicationConnection implements HasHandlers {
/**
* Creates a new ServerConnector with the given type and id.
- *
+ *
* Creates and registers a new ServerConnector of the given type. Should
* never be called with the connector id of an existing connector.
- *
+ *
* @param connectorId
* Id of the new connector
* @param connectorType
* Type of the connector, as passed from the server side
- *
+ *
* @return A new ServerConnector of the given type
*/
private ServerConnector createAndRegisterConnector(String connectorId,
@@ -3230,7 +3231,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Gets a recource that has been pre-loaded via UIDL, such as custom
* layouts.
- *
+ *
* @param name
* identifier of the resource to get
* @return the resource
@@ -3241,7 +3242,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Singleton method to get instance of app's context menu.
- *
+ *
* @return VContextMenu object
*/
public VContextMenu getContextMenu() {
@@ -3256,7 +3257,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Gets an {@link Icon} instance corresponding to a URI.
- *
+ *
* @since 7.2
* @param uri
* @return Icon object
@@ -3278,7 +3279,7 @@ public class ApplicationConnection implements HasHandlers {
* Translates custom protocols in UIDL URI's to be recognizable by browser.
* All uri's from UIDL should be routed via this method before giving them
* to browser due URI's in UIDL may contain custom protocols like theme://.
- *
+ *
* @param uidlUri
* Vaadin URI from uidl
* @return translated URI ready for browser
@@ -3290,7 +3291,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Gets the URI for the current theme. Can be used to reference theme
* resources.
- *
+ *
* @return URI to the current theme
*/
public String getThemeUri() {
@@ -3301,7 +3302,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Listens for Notification hide event, and redirects. Used for system
* messages, such as session expired.
- *
+ *
*/
private class NotificationRedirect implements VNotification.EventListener {
String url;
@@ -3330,7 +3331,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Gets the token (aka double submit cookie) that the server uses to protect
* against Cross Site Request Forgery attacks.
- *
+ *
* @return the CSRF token string
*/
public String getCsrfToken() {
@@ -3340,7 +3341,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Use to notify that the given component's caption has changed; layouts may
* have to be recalculated.
- *
+ *
* @param component
* the Paintable whose caption has changed
* @deprecated As of 7.0.2, has not had any effect for a long time
@@ -3352,7 +3353,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Gets the main view
- *
+ *
* @return the main view
*/
public UIConnector getUIConnector() {
@@ -3361,7 +3362,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Gets the {@link ApplicationConfiguration} for the current application.
- *
+ *
* @see ApplicationConfiguration
* @return the configuration for this application
*/
@@ -3374,7 +3375,7 @@ public class ApplicationConnection implements HasHandlers {
* list of events which has server side listeners is updated automatically
* before the component is updated so the value is correct if called from
* updatedFromUIDL.
- *
+ *
* @param paintable
* The connector to register event listeners for
* @param eventIdentifier
@@ -3394,7 +3395,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Adds the get parameters to the uri and returns the new uri that contains
* the parameters.
- *
+ *
* @param uri
* The uri to which the parameters should be added.
* @param extraParams
@@ -3424,7 +3425,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Get VTooltip instance related to application connection
- *
+ *
* @return VTooltip instance
*/
public VTooltip getVTooltip() {
@@ -3436,7 +3437,7 @@ public class ApplicationConnection implements HasHandlers {
* this method is now handled by the state change event handler in
* AbstractComponentConnector. The only function this method has is to
* return true if the UIDL is a "cached" update.
- *
+ *
* @param component
* @param uidl
* @param manageCaption
@@ -3487,7 +3488,7 @@ public class ApplicationConnection implements HasHandlers {
* Schedules a heartbeat request to occur after the configured heartbeat
* interval elapses if the interval is a positive number. Otherwise, does
* nothing.
- *
+ *
* @deprecated as of 7.2, use {@link Heartbeat#schedule()} instead
*/
@Deprecated
@@ -3501,7 +3502,7 @@ public class ApplicationConnection implements HasHandlers {
* 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 UI.
- *
+ *
* @deprecated as of 7.2, use {@link Heartbeat#send()} instead
*/
@Deprecated
@@ -3525,7 +3526,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* This method can be used to postpone rendering of a response for a short
* period of time (e.g. to avoid the rendering process during animation).
- *
+ *
* @param lock
*/
public void suspendReponseHandling(Object lock) {
@@ -3534,7 +3535,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Resumes the rendering process once all locks have been removed.
- *
+ *
* @param lock
*/
public void resumeResponseHandling(Object lock) {
@@ -3585,7 +3586,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Sets the delegate that is called whenever a communication error occurrs.
- *
+ *
* @param delegate
* the delegate.
*/
@@ -3628,7 +3629,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Gets the active connector for focused element in browser.
- *
+ *
* @return Connector for focused element or null.
*/
private ComponentConnector getActiveConnector() {
@@ -3642,7 +3643,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Sets the status for the push connection.
- *
+ *
* @param enabled
* true to enable the push connection;
* false to disable the push connection.
@@ -3655,7 +3656,7 @@ public class ApplicationConnection implements HasHandlers {
push.init(this, pushState, new CommunicationErrorHandler() {
@Override
public boolean onError(String details, int statusCode) {
- handleCommunicationError(details,statusCode);
+ handleCommunicationError(details, statusCode);
return true;
}
});
@@ -3692,7 +3693,7 @@ public class ApplicationConnection implements HasHandlers {
/**
* Returns a human readable string representation of the method used to
* communicate with the server.
- *
+ *
* @since 7.1
* @return A string representation of the current transport type
*/
diff --git a/client/src/com/vaadin/client/DeferredWorker.java b/client/src/com/vaadin/client/DeferredWorker.java
index 8e78bd9bff..cc22cda2a2 100644
--- a/client/src/com/vaadin/client/DeferredWorker.java
+++ b/client/src/com/vaadin/client/DeferredWorker.java
@@ -16,18 +16,18 @@
package com.vaadin.client;
/**
- * Give widgets the possibility to indicate to the framework that there is work
- * scheduled to be executed in the near future and that the framework should
- * wait for this work to complete before assuming the UI has reached a steady
- * state.
+ * Give widgets and connectors the possibility to indicate to the framework that
+ * there is work scheduled to be executed in the near future and that the
+ * framework should wait for this work to complete before assuming the UI has
+ * reached a steady state.
*
* @since 7.3
* @author Vaadin Ltd
*/
public interface DeferredWorker {
/**
- * Checks whether there are operations pending for this widget that must be
- * executed before reaching a steady state.
+ * Checks whether there are operations pending for this widget or connector
+ * that must be executed before reaching a steady state.
*
* @returns true iff there are operations pending which must be
* executed before reaching a steady state
--
cgit v1.2.3