summaryrefslogtreecommitdiffstats
path: root/server/src/com
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2015-08-19 11:54:59 +0300
committerHenri Sara <hesara@vaadin.com>2015-08-19 11:54:59 +0300
commit123c9fbc74d52c66f59bb825414ad3260aaea975 (patch)
tree8deda9347560f9324d36a5513d4a6fc555d0f13d /server/src/com
parent7a3e03b5acd416141e1a95eae32c3808a8e5addd (diff)
parente7fda93b300b11d9507f25917306e1f3d57cb27c (diff)
downloadvaadin-framework-123c9fbc74d52c66f59bb825414ad3260aaea975.tar.gz
vaadin-framework-123c9fbc74d52c66f59bb825414ad3260aaea975.zip
Merge branch 'master-before-18503' into grid-unbuffered-editor
Conflicts: server/src/com/vaadin/data/RpcDataProviderExtension.java uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java Change-Id: I9e7907c9caf839fd043444db0505f9853f020a6a
Diffstat (limited to 'server/src/com')
-rw-r--r--server/src/com/vaadin/server/VaadinServlet.java20
-rw-r--r--server/src/com/vaadin/server/WebBrowser.java14
-rw-r--r--server/src/com/vaadin/server/communication/AtmospherePushConnection.java7
-rw-r--r--server/src/com/vaadin/server/communication/FileUploadHandler.java2
-rw-r--r--server/src/com/vaadin/ui/Grid.java30
-rw-r--r--server/src/com/vaadin/ui/HorizontalLayout.java7
-rw-r--r--server/src/com/vaadin/ui/VerticalLayout.java7
-rw-r--r--server/src/com/vaadin/ui/renderers/ImageRenderer.java2
8 files changed, 78 insertions, 11 deletions
diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java
index 7aada2402d..61df02feaa 100644
--- a/server/src/com/vaadin/server/VaadinServlet.java
+++ b/server/src/com/vaadin/server/VaadinServlet.java
@@ -28,6 +28,7 @@ import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
+import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -694,17 +695,20 @@ public class VaadinServlet extends HttpServlet implements Constants {
return false;
}
+ String decodedRequestURI = URLDecoder.decode(request.getRequestURI(),
+ "UTF-8");
if ((request.getContextPath() != null)
- && (request.getRequestURI().startsWith("/VAADIN/"))) {
- serveStaticResourcesInVAADIN(request.getRequestURI(), request,
- response);
+ && (decodedRequestURI.startsWith("/VAADIN/"))) {
+ serveStaticResourcesInVAADIN(decodedRequestURI, request, response);
return true;
- } else if (request.getRequestURI().startsWith(
- request.getContextPath() + "/VAADIN/")) {
+ }
+
+ String decodedContextPath = URLDecoder.decode(request.getContextPath(),
+ "UTF-8");
+ if (decodedRequestURI.startsWith(decodedContextPath + "/VAADIN/")) {
serveStaticResourcesInVAADIN(
- request.getRequestURI().substring(
- request.getContextPath().length()), request,
- response);
+ decodedRequestURI.substring(decodedContextPath.length()),
+ request, response);
return true;
}
diff --git a/server/src/com/vaadin/server/WebBrowser.java b/server/src/com/vaadin/server/WebBrowser.java
index 66018b02f2..9bf30cb3db 100644
--- a/server/src/com/vaadin/server/WebBrowser.java
+++ b/server/src/com/vaadin/server/WebBrowser.java
@@ -126,6 +126,20 @@ public class WebBrowser implements Serializable {
}
/**
+ * Tests whether the user is using Edge.
+ *
+ * @return true if the user is using Edge, false if the user is not using
+ * Edge or if no information on the browser is present
+ */
+ public boolean isEdge() {
+ if (browserDetails == null) {
+ return false;
+ }
+
+ return browserDetails.isEdge();
+ }
+
+ /**
* Tests whether the user is using Safari.
*
* @return true if the user is using Safari, false if the user is not using
diff --git a/server/src/com/vaadin/server/communication/AtmospherePushConnection.java b/server/src/com/vaadin/server/communication/AtmospherePushConnection.java
index 357278f411..a45d9aa059 100644
--- a/server/src/com/vaadin/server/communication/AtmospherePushConnection.java
+++ b/server/src/com/vaadin/server/communication/AtmospherePushConnection.java
@@ -274,6 +274,13 @@ public class AtmospherePushConnection implements PushConnection {
public void disconnect() {
assert isConnected();
+ if (resource == null) {
+ // Already disconnected. Should not happen but if it does, we don't
+ // want to cause NPEs
+ getLogger()
+ .fine("AtmospherePushConnection.disconnect() called twice, this should not happen");
+ return;
+ }
if (resource.isResumed()) {
// This can happen for long polling because of
// http://dev.vaadin.com/ticket/16919
diff --git a/server/src/com/vaadin/server/communication/FileUploadHandler.java b/server/src/com/vaadin/server/communication/FileUploadHandler.java
index 576cbd8411..532c7fe95b 100644
--- a/server/src/com/vaadin/server/communication/FileUploadHandler.java
+++ b/server/src/com/vaadin/server/communication/FileUploadHandler.java
@@ -269,7 +269,7 @@ public class FileUploadHandler implements RequestHandler {
streamVariable = uI.getConnectorTracker().getStreamVariable(
connectorId, variableName);
String secKey = uI.getConnectorTracker().getSeckey(streamVariable);
- if (!secKey.equals(parts[3])) {
+ if (secKey == null || !secKey.equals(parts[3])) {
// TODO Should rethink error handling
return true;
}
diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java
index bee424e98f..c7ad9632fa 100644
--- a/server/src/com/vaadin/ui/Grid.java
+++ b/server/src/com/vaadin/ui/Grid.java
@@ -1167,6 +1167,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
private int selectionLimit = DEFAULT_MAX_SELECTIONS;
+ private boolean allSelected;
+
@Override
public boolean select(final Object... itemIds)
throws IllegalArgumentException {
@@ -1212,6 +1214,9 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
}
fireSelectionEvent(oldSelection, selection);
}
+
+ updateAllSelectedState();
+
return selectionWillChange;
}
@@ -1277,6 +1282,9 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
selection.removeAll(itemIds);
fireSelectionEvent(oldSelection, selection);
}
+
+ updateAllSelectedState();
+
return hasCommonElements;
}
@@ -1357,6 +1365,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
fireSelectionEvent(oldSelection, selection);
}
+ updateAllSelectedState();
+
return changed;
}
@@ -1370,6 +1380,13 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
"Vararg array of itemIds may not be null");
}
}
+
+ private void updateAllSelectedState() {
+ if (allSelected != selection.size() >= selectionLimit) {
+ allSelected = selection.size() >= selectionLimit;
+ grid.getRpcProxy(GridClientRpc.class).setSelectAll(allSelected);
+ }
+ }
}
/**
@@ -3648,10 +3665,21 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
safeConverter.getPresentationType(), locale);
}
- JsonValue encodedValue = renderer.encode(presentationValue);
+ JsonValue encodedValue;
+ try {
+ encodedValue = renderer.encode(presentationValue);
+ } catch (Exception e) {
+ getLogger().log(Level.SEVERE, "Unable to encode data", e);
+ encodedValue = renderer.encode(null);
+ }
return encodedValue;
}
+
+ private static Logger getLogger() {
+ return Logger.getLogger(AbstractRenderer.class.getName());
+ }
+
}
/**
diff --git a/server/src/com/vaadin/ui/HorizontalLayout.java b/server/src/com/vaadin/ui/HorizontalLayout.java
index 54569570b9..616fa09225 100644
--- a/server/src/com/vaadin/ui/HorizontalLayout.java
+++ b/server/src/com/vaadin/ui/HorizontalLayout.java
@@ -15,6 +15,8 @@
*/
package com.vaadin.ui;
+import com.vaadin.shared.ui.orderedlayout.HorizontalLayoutState;
+
/**
* Horizontal layout
*
@@ -48,4 +50,9 @@ public class HorizontalLayout extends AbstractOrderedLayout {
addComponents(children);
}
+ @Override
+ protected HorizontalLayoutState getState() {
+ return (HorizontalLayoutState) super.getState();
+ }
+
}
diff --git a/server/src/com/vaadin/ui/VerticalLayout.java b/server/src/com/vaadin/ui/VerticalLayout.java
index 12819e50bc..7002fbc7e6 100644
--- a/server/src/com/vaadin/ui/VerticalLayout.java
+++ b/server/src/com/vaadin/ui/VerticalLayout.java
@@ -15,6 +15,8 @@
*/
package com.vaadin.ui;
+import com.vaadin.shared.ui.orderedlayout.VerticalLayoutState;
+
/**
* Vertical layout
*
@@ -48,4 +50,9 @@ public class VerticalLayout extends AbstractOrderedLayout {
this();
addComponents(children);
}
+
+ @Override
+ protected VerticalLayoutState getState() {
+ return (VerticalLayoutState) super.getState();
+ }
}
diff --git a/server/src/com/vaadin/ui/renderers/ImageRenderer.java b/server/src/com/vaadin/ui/renderers/ImageRenderer.java
index 2fb872583e..ad7d5cae2b 100644
--- a/server/src/com/vaadin/ui/renderers/ImageRenderer.java
+++ b/server/src/com/vaadin/ui/renderers/ImageRenderer.java
@@ -58,7 +58,7 @@ public class ImageRenderer extends ClickableRenderer<Resource> {
if (!(resource == null || resource instanceof ExternalResource || resource instanceof ThemeResource)) {
throw new IllegalArgumentException(
"ImageRenderer only supports ExternalResource and ThemeResource ("
- + resource.getClass().getSimpleName() + "given )");
+ + resource.getClass().getSimpleName() + " given)");
}
return encode(ResourceReference.create(resource, this, null),