aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2016-04-21 10:24:12 +0300
committerTeemu Suo-Anttila <teemusa@vaadin.com>2016-04-21 10:24:12 +0300
commitfa6f39bc84fa94f876248f6e967a3c9cefcd097b (patch)
tree29644e1376a93fec862f185da221845346265fad
parent1bb67a02544e0fbf2999e5a814c79475d1b05c9b (diff)
parentb2f283b414129407f4e839470380e5e5d0383fb4 (diff)
downloadvaadin-framework-fa6f39bc84fa94f876248f6e967a3c9cefcd097b.tar.gz
vaadin-framework-fa6f39bc84fa94f876248f6e967a3c9cefcd097b.zip
Merge remote-tracking branch 'origin/master' into feature/mavenize
Change-Id: I1c55d6158caf32b796a9ad0d9e8df5392812e9a6
-rw-r--r--all/src/main/templates/release-notes.html1
-rw-r--r--client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java3
-rw-r--r--client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java12
-rw-r--r--client/src/test/java/com/vaadin/client/communication/ServerMessageHandlerTest.java2
-rw-r--r--documentation/tutorial.adoc2
-rw-r--r--server/src/main/java/com/vaadin/data/util/IndexedContainer.java4
-rw-r--r--server/src/main/java/com/vaadin/server/DefaultDeploymentConfiguration.java14
-rw-r--r--server/src/main/java/com/vaadin/server/UIProvider.java12
-rw-r--r--server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java6
-rw-r--r--server/src/main/java/com/vaadin/server/communication/UidlRequestHandler.java2
-rw-r--r--server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java2
-rw-r--r--server/src/test/java/com/vaadin/data/util/AbstractContainerTestBase.java4
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/MarginInfo.java10
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/WindowAndUIShortcuts.java76
-rw-r--r--uitest/src/com/vaadin/tests/components/ui/WindowAndUIShortcutsTest.java43
-rw-r--r--uitest/src/test/java/com/vaadin/tests/VerifyBrowserVersionTest.java5
16 files changed, 182 insertions, 16 deletions
diff --git a/all/src/main/templates/release-notes.html b/all/src/main/templates/release-notes.html
index fc1d69fd24..828aa193b9 100644
--- a/all/src/main/templates/release-notes.html
+++ b/all/src/main/templates/release-notes.html
@@ -144,6 +144,7 @@
@Inherited. The annotation is also looked up in extended interfaces for backwards compatibility.</li>
<li>Server-side timings of request processing are only sent to the client when not in production mode. Using the
timings in TestBench tests requires the server not to be in production mode.</li>
+ <li>System properties now override application parameters for settings such as production mode.</li>
</ul>
<h3 id="knownissues">Known Issues and Limitations</h3>
<ul>
diff --git a/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java b/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java
index 2a9a8d4204..e5d5ea8a25 100644
--- a/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java
+++ b/client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java
@@ -188,9 +188,10 @@ public class ServerRpcQueue {
* Triggers a send of server RPC and legacy variable changes to the server.
*/
public void flush() {
- if (flushScheduled) {
+ if (flushScheduled || isEmpty()) {
return;
}
+
flushPending = true;
flushScheduled = true;
Scheduler.get().scheduleFinally(scheduledFlushCommand);
diff --git a/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java b/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java
index 9ffb9cfba9..6f4872729d 100644
--- a/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java
@@ -507,8 +507,16 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
@Override
public void onKeyDown(KeyDownEvent event) {
if (getWidget().actionHandler != null) {
- getWidget().actionHandler.handleKeyboardEvent((Event) event
- .getNativeEvent().cast());
+ Element target = Element.as(event.getNativeEvent()
+ .getEventTarget());
+ if (target == Document.get().getBody()
+ || getWidget().getElement().isOrHasChild(target)) {
+ // Only react to body and elements inside the UI
+ getWidget().actionHandler
+ .handleKeyboardEvent((Event) event
+ .getNativeEvent().cast());
+ }
+
}
}
}, KeyDownEvent.getType());
diff --git a/client/src/test/java/com/vaadin/client/communication/ServerMessageHandlerTest.java b/client/src/test/java/com/vaadin/client/communication/ServerMessageHandlerTest.java
index c2752f1953..7b0d886c39 100644
--- a/client/src/test/java/com/vaadin/client/communication/ServerMessageHandlerTest.java
+++ b/client/src/test/java/com/vaadin/client/communication/ServerMessageHandlerTest.java
@@ -20,7 +20,7 @@ import org.junit.Test;
/**
*
- * @since
+ * @since 7.7
* @author Vaadin Ltd
*/
public class ServerMessageHandlerTest {
diff --git a/documentation/tutorial.adoc b/documentation/tutorial.adoc
index fa8ceecfed..cc70a762bc 100644
--- a/documentation/tutorial.adoc
+++ b/documentation/tutorial.adoc
@@ -712,7 +712,7 @@ private Button save = new Button("Save");
private Button delete = new Button("Delete");
----
-Also, we will laterneed a reference to the currently edited Customer object,
+Also, we will later need a reference to the currently edited Customer object,
CustomerService and the MyUI that uses this class. Add these fields and a
basic constructor that accepts MyUI as a parameter to the CustomerForm class:
diff --git a/server/src/main/java/com/vaadin/data/util/IndexedContainer.java b/server/src/main/java/com/vaadin/data/util/IndexedContainer.java
index b851baf674..8783c061ac 100644
--- a/server/src/main/java/com/vaadin/data/util/IndexedContainer.java
+++ b/server/src/main/java/com/vaadin/data/util/IndexedContainer.java
@@ -741,6 +741,10 @@ public class IndexedContainer extends
*/
@Override
public Property getItemProperty(Object id) {
+ if (!propertyIds.contains(id)) {
+ return null;
+ }
+
return new IndexedContainerProperty(itemId, id);
}
diff --git a/server/src/main/java/com/vaadin/server/DefaultDeploymentConfiguration.java b/server/src/main/java/com/vaadin/server/DefaultDeploymentConfiguration.java
index b26e048431..1f22a9e33d 100644
--- a/server/src/main/java/com/vaadin/server/DefaultDeploymentConfiguration.java
+++ b/server/src/main/java/com/vaadin/server/DefaultDeploymentConfiguration.java
@@ -125,14 +125,14 @@ public class DefaultDeploymentConfiguration extends
String defaultValue) {
String val = null;
- // Try application properties
- val = getApplicationProperty(propertyName);
+ // Try system properties
+ val = getSystemProperty(propertyName);
if (val != null) {
return val;
}
- // Try system properties
- val = getSystemProperty(propertyName);
+ // Try application properties
+ val = getApplicationProperty(propertyName);
if (val != null) {
return val;
}
@@ -175,6 +175,12 @@ public class DefaultDeploymentConfiguration extends
// Try lowercased system properties
val = System.getProperty(pkgName + parameterName.toLowerCase());
+ if (val != null) {
+ return val;
+ }
+
+ // version prefixed with just "vaadin."
+ val = System.getProperty("vaadin." + parameterName);
return val;
}
diff --git a/server/src/main/java/com/vaadin/server/UIProvider.java b/server/src/main/java/com/vaadin/server/UIProvider.java
index 4ed86b9c31..7fd880919e 100644
--- a/server/src/main/java/com/vaadin/server/UIProvider.java
+++ b/server/src/main/java/com/vaadin/server/UIProvider.java
@@ -16,6 +16,7 @@
package com.vaadin.server;
+import java.io.InputStream;
import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.annotation.Inherited;
@@ -30,6 +31,10 @@ import com.vaadin.shared.ui.ui.Transport;
import com.vaadin.ui.UI;
public abstract class UIProvider implements Serializable {
+
+ /* Default widgetset name to look for */
+ private static final String APP_WIDGETSET_NAME = "AppWidgetset";
+
public abstract Class<? extends UI> getUIClass(UIClassSelectionEvent event);
public UI createInstance(UICreateEvent event) {
@@ -136,8 +141,13 @@ public abstract class UIProvider implements Serializable {
if (uiWidgetset != null) {
return uiWidgetset.value();
} else {
- return null;
+ InputStream resource = event.getUIClass().getResourceAsStream(
+ "/" + APP_WIDGETSET_NAME + ".gwt.xml");
+ if (resource != null) {
+ return APP_WIDGETSET_NAME;
+ }
}
+ return null;
}
/**
diff --git a/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java b/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java
index 3503a2d8b1..be261ede92 100644
--- a/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java
+++ b/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java
@@ -324,7 +324,7 @@ public class ServerRpcHandler implements Serializable {
* @param invocationsData
* JSON containing all information needed to execute all
* requested RPC calls.
- * @since
+ * @since 7.7
*/
protected void handleInvocations(UI ui, int lastSyncIdSeenByClient,
JsonArray invocationsData) {
@@ -423,7 +423,7 @@ public class ServerRpcHandler implements Serializable {
/**
* Handles the given RPC method invocation for the given connector
*
- * @since
+ * @since 7.7
* @param ui
* the UI containing the connector
* @param connector
@@ -446,7 +446,7 @@ public class ServerRpcHandler implements Serializable {
* Handles the given Legacy variable change RPC method invocation for the
* given connector
*
- * @since
+ * @since 7.7
* @param ui
* the UI containing the connector
* @param connector
diff --git a/server/src/main/java/com/vaadin/server/communication/UidlRequestHandler.java b/server/src/main/java/com/vaadin/server/communication/UidlRequestHandler.java
index db18bb9e1e..20b906c3e6 100644
--- a/server/src/main/java/com/vaadin/server/communication/UidlRequestHandler.java
+++ b/server/src/main/java/com/vaadin/server/communication/UidlRequestHandler.java
@@ -60,7 +60,7 @@ public class UidlRequestHandler extends SynchronizedRequestHandler implements
/**
* Creates the ServerRpcHandler to use
*
- * @since
+ * @since 7.7
* @return the ServerRpcHandler to use
*/
protected ServerRpcHandler createRpcHandler() {
diff --git a/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java b/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java
index 255f34d936..45bd3751d3 100644
--- a/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java
+++ b/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java
@@ -506,6 +506,8 @@ public class ClassPathExplorer {
* directory (not a JAR file etc.) on the classpath.
*
* TODO this could be done better...
+ *
+ * @since 7.6.5
*
* @param widgetsetFileName
* relative path for the widgetset
diff --git a/server/src/test/java/com/vaadin/data/util/AbstractContainerTestBase.java b/server/src/test/java/com/vaadin/data/util/AbstractContainerTestBase.java
index c70cf98449..64f1a31399 100644
--- a/server/src/test/java/com/vaadin/data/util/AbstractContainerTestBase.java
+++ b/server/src/test/java/com/vaadin/data/util/AbstractContainerTestBase.java
@@ -153,6 +153,10 @@ public abstract class AbstractContainerTestBase {
}
+ // getItemProperty
+ Assert.assertNull(container.getItem(itemIdInSet).getItemProperty(
+ "notinset"));
+
}
protected static final Object FULLY_QUALIFIED_NAME = "fullyQualifiedName";
diff --git a/shared/src/main/java/com/vaadin/shared/ui/MarginInfo.java b/shared/src/main/java/com/vaadin/shared/ui/MarginInfo.java
index 92f7956015..c66d1f0a11 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/MarginInfo.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/MarginInfo.java
@@ -71,6 +71,16 @@ public class MarginInfo implements Serializable {
doSetMargins(top, right, bottom, left);
}
+ /**
+ * Creates a MarginInfo object by having horizontal and vertical margins specified (analogous to CSS).
+ *
+ * @since 7.6.5
+ *
+ * @param vertical
+ * enable or disable top and bottom margins
+ * @param horizontal
+ * enable or disable left and right margins
+ */
public MarginInfo(boolean vertical, boolean horizontal) {
this(vertical, horizontal, vertical, horizontal);
}
diff --git a/uitest/src/com/vaadin/tests/components/ui/WindowAndUIShortcuts.java b/uitest/src/com/vaadin/tests/components/ui/WindowAndUIShortcuts.java
new file mode 100644
index 0000000000..c5c9c16e2d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/WindowAndUIShortcuts.java
@@ -0,0 +1,76 @@
+package com.vaadin.tests.components.ui;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.event.ShortcutAction;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+import com.vaadin.ui.themes.ValoTheme;
+
+@Theme(ValoTheme.THEME_NAME)
+public class WindowAndUIShortcuts extends UI {
+
+ @Override
+ protected void init(VaadinRequest request) {
+ VerticalLayout layout = new VerticalLayout();
+ layout.setSizeFull();
+ layout.setMargin(true);
+
+ final VerticalLayout mainLayout = new VerticalLayout();
+
+ mainLayout.addComponent(new Button("Show page",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent clickEvent) {
+ final VerticalLayout pageLayout = new VerticalLayout();
+ pageLayout.setSpacing(true);
+
+ pageLayout.addComponent(new Label("Page"));
+ pageLayout.addComponent(new Button(
+ "Open dialog window",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(
+ Button.ClickEvent clickEvent) {
+ Window dialog = new Window();
+ dialog.setModal(true);
+ dialog.setCaption("Press ESC shortcut");
+ dialog.setWidth("300px");
+ dialog.setHeight("100px");
+
+ dialog.setContent(new TextField(
+ "TextField in window"));
+ addWindow(dialog);
+ }
+ }));
+ Button closeButton = new Button("Close page",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(
+ Button.ClickEvent clickEvent) {
+ mainLayout.removeComponent(pageLayout);
+
+ Notification
+ .show("OMG! Page is also closed!");
+ }
+ });
+ closeButton
+ .setClickShortcut(ShortcutAction.KeyCode.ESCAPE);
+ pageLayout.addComponent(closeButton);
+
+ mainLayout.addComponent(pageLayout);
+ mainLayout.setExpandRatio(pageLayout, 1);
+ }
+ }));
+
+ layout.addComponent(mainLayout);
+ layout.setExpandRatio(mainLayout, 1);
+
+ setContent(layout);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/ui/WindowAndUIShortcutsTest.java b/uitest/src/com/vaadin/tests/components/ui/WindowAndUIShortcutsTest.java
new file mode 100644
index 0000000000..93324f0792
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/WindowAndUIShortcutsTest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2014 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.components.ui;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.testbench.elements.WindowElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class WindowAndUIShortcutsTest extends SingleBrowserTest {
+
+ @Test
+ public void windowShortcutShouldNotReachUI() {
+ openTestURL();
+ $(ButtonElement.class).caption("Show page").first().click();
+ $(ButtonElement.class).caption("Open dialog window").first().click();
+
+ WindowElement window = $(WindowElement.class).first();
+ window.$(TextFieldElement.class).first().sendKeys(Keys.ESCAPE);
+
+ // Window should have been closed
+ Assert.assertTrue($(WindowElement.class).all().isEmpty());
+ // "Close page" should not have been clicked
+ Assert.assertTrue($(ButtonElement.class).caption("Close page").exists());
+ }
+}
diff --git a/uitest/src/test/java/com/vaadin/tests/VerifyBrowserVersionTest.java b/uitest/src/test/java/com/vaadin/tests/VerifyBrowserVersionTest.java
index a64df1e724..2a66b6f1f4 100644
--- a/uitest/src/test/java/com/vaadin/tests/VerifyBrowserVersionTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/VerifyBrowserVersionTest.java
@@ -39,8 +39,9 @@ public class VerifyBrowserVersionTest extends MultiBrowserTest {
if (BrowserUtil.isChrome(getDesiredCapabilities())) {
// Chrome version does not necessarily match the desired version
// because of auto updates...
- browserIdentifier = getExpectedUserAgentString(getDesiredCapabilities())
- + "48";
+ // TODO - replace fixed number with a range?
+ browserIdentifier = getExpectedUserAgentString(
+ getDesiredCapabilities()) + "49";
} else {
browserIdentifier = getExpectedUserAgentString(desiredCapabilities)
+ desiredCapabilities.getVersion();