summaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-10-22 19:45:40 +0300
committerPekka Hyvönen <pekka@vaadin.com>2016-12-09 09:39:00 +0200
commit26dac6ff92b38ffec2491c7e1d12585ca20dfa10 (patch)
tree895e53cf0596d6d14dd3a1f362ad20742560940f /client/src
parent7b957a5c378532b11ebfb66156c3a46898f9231b (diff)
downloadvaadin-framework-26dac6ff92b38ffec2491c7e1d12585ca20dfa10.tar.gz
vaadin-framework-26dac6ff92b38ffec2491c7e1d12585ca20dfa10.zip
Publish Escalator.getBodyRowCount to JS (#20344)
This is needed to be able to get the information from e.g. TestBench Change-Id: I95ec6064f602e6a8b24e35cc59d467e9c8b31c1e
Diffstat (limited to 'client/src')
-rw-r--r--client/src/main/java/com/vaadin/client/widgets/Escalator.java32
1 files changed, 23 insertions, 9 deletions
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 fdd4c22645..3d2c80ddbe 100644
--- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java
+++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java
@@ -672,13 +672,13 @@ public class Escalator extends Widget
/*-{
var vScroll = esc.@com.vaadin.client.widgets.Escalator::verticalScrollbar;
var vScrollElem = vScroll.@com.vaadin.client.widget.escalator.ScrollbarBundle::getElement()();
-
+
var hScroll = esc.@com.vaadin.client.widgets.Escalator::horizontalScrollbar;
var hScrollElem = hScroll.@com.vaadin.client.widget.escalator.ScrollbarBundle::getElement()();
-
+
return $entry(function(e) {
var target = e.target;
-
+
// in case the scroll event was native (i.e. scrollbars were dragged, or
// the scrollTop/Left was manually modified), the bundles have old cache
// values. We need to make sure that the caches are kept up to date.
@@ -699,29 +699,29 @@ public class Escalator extends Widget
return $entry(function(e) {
var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX;
var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY;
-
+
// Delta mode 0 is in pixels; we don't need to do anything...
-
+
// A delta mode of 1 means we're scrolling by lines instead of pixels
// We need to scale the number of lines by the default line height
if(e.deltaMode === 1) {
var brc = esc.@com.vaadin.client.widgets.Escalator::body;
deltaY *= brc.@com.vaadin.client.widgets.Escalator.AbstractRowContainer::getDefaultRowHeight()();
}
-
+
// Other delta modes aren't supported
if((e.deltaMode !== undefined) && (e.deltaMode >= 2 || e.deltaMode < 0)) {
var msg = "Unsupported wheel delta mode \"" + e.deltaMode + "\"";
-
+
// Print warning message
esc.@com.vaadin.client.widgets.Escalator::logWarning(*)(msg);
}
-
+
// IE8 has only delta y
if (isNaN(deltaY)) {
deltaY = -0.5*e.wheelDelta;
}
-
+
@com.vaadin.client.widgets.Escalator.JsniUtil::moveScrollFromEvent(*)(esc, deltaX, deltaY, e);
});
}-*/;
@@ -5567,8 +5567,22 @@ public class Escalator extends Widget
// init default dimensions
setHeight(null);
setWidth(null);
+
+ publishJSHelpers(root);
+ }
+
+ private int getBodyRowCount() {
+ return getBody().getRowCount();
}
+ private native void publishJSHelpers(Element root)
+ /*-{
+ var self = this;
+ root.getBodyRowCount = $entry(function () {
+ return self.@Escalator::getBodyRowCount()();
+ });
+ }-*/;
+
private void setupScrollbars(final Element root) {
ScrollHandler scrollHandler = new ScrollHandler() {