summaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorelmot <elmot@vaadin.com>2016-04-13 15:01:50 +0300
committerelmot <elmot@vaadin.com>2016-04-13 15:32:47 +0300
commit980f879176696906c25e985e4f7c8e3bdc04258d (patch)
treed781a70e24eef0994ba5d371280e1cf837f94825 /client/src
parentf7f5ba596dbba0c2374a6d8ac10e89362cbbaeb5 (diff)
parent9b46608f6c645c4289b854e2949bae3b1a2f5147 (diff)
downloadvaadin-framework-980f879176696906c25e985e4f7c8e3bdc04258d.tar.gz
vaadin-framework-980f879176696906c25e985e4f7c8e3bdc04258d.zip
Merge branch 'master' into feature/mavenize
Change-Id: Id7db526d07a14ac259cbb50415bbafd2a7c2ab94
Diffstat (limited to 'client/src')
-rw-r--r--client/src/main/java/com/vaadin/client/ApplicationConnection.java9
-rw-r--r--client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java20
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java42
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VFilterSelect.java20
-rw-r--r--client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java16
-rw-r--r--client/src/main/java/com/vaadin/client/ui/table/TableConnector.java33
-rw-r--r--client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java4
-rw-r--r--client/src/main/java/com/vaadin/client/widgets/Escalator.java9
-rw-r--r--client/src/main/java/com/vaadin/client/widgets/Grid.java6
9 files changed, 111 insertions, 48 deletions
diff --git a/client/src/main/java/com/vaadin/client/ApplicationConnection.java b/client/src/main/java/com/vaadin/client/ApplicationConnection.java
index ce55c13ce5..97ddd14764 100644
--- a/client/src/main/java/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/main/java/com/vaadin/client/ApplicationConnection.java
@@ -42,7 +42,6 @@ import com.google.gwt.user.client.Timer;
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.ConnectionStateHandler;
@@ -486,12 +485,16 @@ public class ApplicationConnection implements HasHandlers {
}
client.getProfilingData = $entry(function() {
- var smh = ap.@com.vaadin.client.ApplicationConnection::getMessageHandler();
+ var smh = ap.@com.vaadin.client.ApplicationConnection::getMessageHandler()();
var pd = [
smh.@com.vaadin.client.communication.MessageHandler::lastProcessingTime,
smh.@com.vaadin.client.communication.MessageHandler::totalProcessingTime
];
- pd = pd.concat(smh.@com.vaadin.client.communication.MessageHandler::serverTimingInfo);
+ if (null != smh.@com.vaadin.client.communication.MessageHandler::serverTimingInfo) {
+ pd = pd.concat(smh.@com.vaadin.client.communication.MessageHandler::serverTimingInfo);
+ } else {
+ pd = pd.concat(-1, -1);
+ }
pd[pd.length] = smh.@com.vaadin.client.communication.MessageHandler::bootstrapTime;
return pd;
});
diff --git a/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java b/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java
index 112623d1fe..1229922a9c 100644
--- a/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java
+++ b/client/src/main/java/com/vaadin/client/connectors/JavaScriptRendererConnector.java
@@ -42,9 +42,11 @@ import elemental.json.JsonValue;
* @since 7.4
* @author Vaadin Ltd
*/
+// This is really typed to <JsonValue>, but because of the way native strings
+// are not always instanceof JsonValue, we need to accept Object
@Connect(AbstractJavaScriptRenderer.class)
public class JavaScriptRendererConnector extends
- AbstractRendererConnector<JsonValue> implements
+ AbstractRendererConnector<Object> implements
HasJavaScriptConnectorHelper {
private final JavaScriptConnectorHelper helper = new JavaScriptConnectorHelper(
this);
@@ -131,7 +133,7 @@ public class JavaScriptRendererConnector extends
}-*/;
@Override
- protected Renderer<JsonValue> createRenderer() {
+ protected Renderer<Object> createRenderer() {
helper.ensureJavascriptInited();
if (!hasFunction("render")) {
@@ -146,11 +148,13 @@ public class JavaScriptRendererConnector extends
final boolean hasGetConsumedEvents = hasFunction("getConsumedEvents");
final boolean hasOnBrowserEvent = hasFunction("onBrowserEvent");
- return new ComplexRenderer<JsonValue>() {
+ return new ComplexRenderer<Object>() {
@Override
- public void render(RendererCellReference cell, JsonValue data) {
- render(helper.getConnectorWrapper(), getJsCell(cell),
- Util.json2jso(data));
+ public void render(RendererCellReference cell, Object data) {
+ if (data instanceof JsonValue) {
+ data = Util.json2jso((JsonValue) data);
+ }
+ render(helper.getConnectorWrapper(), getJsCell(cell), data);
}
private JavaScriptObject getJsCell(CellReference<?> cell) {
@@ -159,7 +163,7 @@ public class JavaScriptRendererConnector extends
}
public native void render(JavaScriptObject wrapper,
- JavaScriptObject cell, JavaScriptObject data)
+ JavaScriptObject cell, Object data)
/*-{
wrapper.render(cell, data);
}-*/;
@@ -262,7 +266,7 @@ public class JavaScriptRendererConnector extends
}
@Override
- public JsonValue decode(JsonValue value) {
+ public Object decode(JsonValue value) {
// Let the js logic decode the raw json that the server sent
return value;
}
diff --git a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java
index f3905f9e46..15ab9a6ce0 100644
--- a/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java
+++ b/client/src/main/java/com/vaadin/client/ui/VDragAndDropWrapper.java
@@ -45,6 +45,7 @@ import com.vaadin.client.MouseEventDetailsBuilder;
import com.vaadin.client.Util;
import com.vaadin.client.VConsole;
import com.vaadin.client.ValueMap;
+import com.vaadin.client.WidgetUtil;
import com.vaadin.client.ui.dd.DDUtil;
import com.vaadin.client.ui.dd.VAbstractDropHandler;
import com.vaadin.client.ui.dd.VAcceptCallback;
@@ -106,25 +107,12 @@ public class VDragAndDropWrapper extends VCustomComponent implements
final int deltaX = Math.abs(event.getClientX() - startX);
final int deltaY = Math.abs(event.getClientY() - startY);
if ((deltaX + deltaY) < MIN_PX_DELTA) {
- setFocusOnLastElement(event);
+ Element clickedElement = WidgetUtil.getElementFromPoint(
+ event.getClientX(), event.getClientY());
+ clickedElement.focus();
}
}
- private void setFocusOnLastElement(final MouseUpEvent event) {
- Element el = event.getRelativeElement();
- getLastChildElement(el).focus();
- }
-
- private Element getLastChildElement(Element el) {
- do {
- if (el == null) {
- break;
- }
- el = el.getFirstChildElement();
- } while (el.getFirstChildElement() != null);
- return el;
- }
-
}, MouseUpEvent.getType());
addDomHandler(new TouchStartHandler() {
@@ -196,6 +184,9 @@ public class VDragAndDropWrapper extends VCustomComponent implements
/** For internal use only. May be removed or replaced in the future. */
public VAbstractDropHandler dropHandler;
+ /** For internal use only. May be removed or replaced in the future. */
+ public UploadHandler uploadHandler;
+
private VDragEvent vaadinDragEvent;
int filecounter = 0;
@@ -239,9 +230,9 @@ public class VDragAndDropWrapper extends VCustomComponent implements
@Override
public void onReadyStateChange(XMLHttpRequest xhr) {
if (xhr.getReadyState() == XMLHttpRequest.DONE) {
- // visit server for possible
- // variable changes
- client.sendPendingVariableChanges();
+ // #19616 Notify the upload handler that the request is complete
+ // and let it poll the server for changes.
+ uploadHandler.uploadDone();
uploading = false;
startNextUpload();
xhr.clearOnReadyStateChange();
@@ -727,4 +718,17 @@ public class VDragAndDropWrapper extends VCustomComponent implements
return dragImageWidget;
}
+ /**
+ * Internal client side interface used by the connector and the widget for
+ * the drag and drop wrapper to signal the completion of an HTML5 file
+ * upload.
+ *
+ * @since 7.6.4
+ */
+ public interface UploadHandler {
+
+ public void uploadDone();
+
+ }
+
}
diff --git a/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java b/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java
index 9459cc14a6..8a6b442fb8 100644
--- a/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java
+++ b/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java
@@ -1132,6 +1132,26 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
public class FilterSelectTextBox extends TextBox {
/**
+ * Creates a new filter select text box.
+ *
+ * @since 7.6.4
+ */
+ public FilterSelectTextBox() {
+ /*-
+ * Stop the browser from showing its own suggestion popup.
+ *
+ * Using an invalid value instead of "off" as suggested by
+ * https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
+ *
+ * Leaving the non-standard Safari options autocapitalize and
+ * autocorrect untouched since those do not interfere in the same
+ * way, and they might be useful in a combo box where new items are
+ * allowed.
+ */
+ getElement().setAttribute("autocomplete", "nope");
+ }
+
+ /**
* Overridden to avoid selecting text when text input is disabled
*/
@Override
diff --git a/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java b/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java
index f222721e24..7ea9596809 100644
--- a/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java
@@ -30,11 +30,18 @@ import com.vaadin.client.ui.VDragAndDropWrapper;
import com.vaadin.client.ui.customcomponent.CustomComponentConnector;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.draganddropwrapper.DragAndDropWrapperConstants;
+import com.vaadin.shared.ui.draganddropwrapper.DragAndDropWrapperServerRpc;
import com.vaadin.ui.DragAndDropWrapper;
@Connect(DragAndDropWrapper.class)
public class DragAndDropWrapperConnector extends CustomComponentConnector
- implements Paintable {
+ implements Paintable, VDragAndDropWrapper.UploadHandler {
+
+ @Override
+ protected void init() {
+ super.init();
+ getWidget().uploadHandler = this;
+ }
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
@@ -121,4 +128,11 @@ public class DragAndDropWrapperConnector extends CustomComponentConnector
private static Logger getLogger() {
return Logger.getLogger(DragAndDropWrapperConnector.class.getName());
}
+
+ @Override
+ public void uploadDone() {
+ // #19616 RPC to poll the server for changes
+ getRpcProxy(DragAndDropWrapperServerRpc.class).poll();
+ }
+
}
diff --git a/client/src/main/java/com/vaadin/client/ui/table/TableConnector.java b/client/src/main/java/com/vaadin/client/ui/table/TableConnector.java
index a554b9335c..cfe93b6641 100644
--- a/client/src/main/java/com/vaadin/client/ui/table/TableConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/table/TableConnector.java
@@ -180,20 +180,6 @@ public class TableConnector extends AbstractFieldConnector implements
return;
}
- getWidget().enabled = isEnabled();
-
- if (BrowserInfo.get().isIE8() && !getWidget().enabled) {
- /*
- * The disabled shim will not cover the table body if it is relative
- * in IE8. See #7324
- */
- getWidget().scrollBodyPanel.getElement().getStyle()
- .setPosition(Position.STATIC);
- } else if (BrowserInfo.get().isIE8()) {
- getWidget().scrollBodyPanel.getElement().getStyle()
- .setPosition(Position.RELATIVE);
- }
-
getWidget().paintableId = uidl.getStringAttribute("id");
getWidget().immediate = getState().immediate;
@@ -399,6 +385,25 @@ public class TableConnector extends AbstractFieldConnector implements
}
@Override
+ public void updateEnabledState(boolean enabledState) {
+ super.updateEnabledState(enabledState);
+ getWidget().enabled = isEnabled();
+
+ if (BrowserInfo.get().isIE8() && !getWidget().enabled) {
+ /*
+ * The disabled shim will not cover the table body if it is relative
+ * in IE8. See #7324
+ */
+ getWidget().scrollBodyPanel.getElement().getStyle()
+ .setPosition(Position.STATIC);
+ } else if (BrowserInfo.get().isIE8()) {
+ getWidget().scrollBodyPanel.getElement().getStyle()
+ .setPosition(Position.RELATIVE);
+ }
+
+ }
+
+ @Override
public VScrollTable getWidget() {
return (VScrollTable) super.getWidget();
}
diff --git a/client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java b/client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java
index 958029889d..151deb87d1 100644
--- a/client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java
+++ b/client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java
@@ -558,7 +558,7 @@ public abstract class ScrollbarBundle implements DeferredWorker {
*/
public final double getScrollPos() {
assert internalGetScrollPos() == toInt32(scrollPos) : "calculated scroll position ("
- + toInt32(scrollPos)
+ + scrollPos
+ ") did not match the DOM element scroll position ("
+ internalGetScrollPos() + ")";
return scrollPos;
@@ -793,7 +793,7 @@ public abstract class ScrollbarBundle implements DeferredWorker {
*/
private static native int toInt32(double val)
/*-{
- return val | 0;
+ return Math.round(val) | 0;
}-*/;
/**
diff --git a/client/src/main/java/com/vaadin/client/widgets/Escalator.java b/client/src/main/java/com/vaadin/client/widgets/Escalator.java
index 3585be1d60..29b7eb6d53 100644
--- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java
+++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java
@@ -3105,6 +3105,15 @@ public class Escalator extends Widget implements RequiresResize,
logicalTargetIndex);
/*
+ * moveAndUpdateEscalatorRows recalculates the rows, but
+ * logical top row index bookkeeping is handled in this
+ * method.
+ *
+ * TODO: Redesign how to keep it easy to track this.
+ */
+ updateTopRowLogicalIndex(-removedLogicalInside.length());
+
+ /*
* Scrolling the body to the correct location will be
* fixed automatically. Because the amount of rows is
* decreased, the viewport is pushed up as the scrollbar
diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java
index c4e3491992..cf9456d8a8 100644
--- a/client/src/main/java/com/vaadin/client/widgets/Grid.java
+++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java
@@ -2527,7 +2527,6 @@ public class Grid<T> extends ResizeComposite implements
if (rowIndex == rowWithFocus
&& cellFocusRange.contains(columnIndexDOM)
&& container == this.containerWithFocus) {
- refreshRow(rowWithFocus);
return;
}
@@ -8491,6 +8490,11 @@ public class Grid<T> extends ResizeComposite implements
if (isEditorActive()) {
editor.updateVerticalScrollPosition();
}
+
+ // if there is a resize, we need to refresh the body to avoid an
+ // off-by-one error which occurs when the user scrolls all the
+ // way to the bottom.
+ refreshBody();
}
});
}