diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-04-19 14:27:13 +0300 |
---|---|---|
committer | Aleksi Hietanen <aleksi@vaadin.com> | 2017-04-19 14:27:13 +0300 |
commit | 8b95318c6c700c946478567193cb0e3040c1dad2 (patch) | |
tree | 64730e6bc737cd1259c78d22cc3a71d62b1fdc16 /compatibility-client | |
parent | 7d1b06cbc4dd07b8b40fbc63d148027fd4c9cf4b (diff) | |
download | vaadin-framework-8b95318c6c700c946478567193cb0e3040c1dad2.tar.gz vaadin-framework-8b95318c6c700c946478567193cb0e3040c1dad2.zip |
Fix issues in Grid with undefined height (#9104)
Diffstat (limited to 'compatibility-client')
-rw-r--r-- | compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java index f022d691b7..4eea41c0ff 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java @@ -703,13 +703,13 @@ public class Escalator extends Widget /*-{ var vScroll = esc.@com.vaadin.v7.client.widgets.Escalator::verticalScrollbar; var vScrollElem = vScroll.@com.vaadin.v7.client.widget.escalator.ScrollbarBundle::getElement()(); - + var hScroll = esc.@com.vaadin.v7.client.widgets.Escalator::horizontalScrollbar; var hScrollElem = hScroll.@com.vaadin.v7.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. @@ -730,29 +730,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.v7.client.widgets.Escalator::body; deltaY *= brc.@com.vaadin.v7.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.v7.client.widgets.Escalator::logWarning(*)(msg); } - + // IE8 has only delta y if (isNaN(deltaY)) { deltaY = -0.5*e.wheelDelta; } - + @com.vaadin.v7.client.widgets.Escalator.JsniUtil::moveScrollFromEvent(*)(esc, deltaX, deltaY, e); }); }-*/; @@ -1208,9 +1208,6 @@ public class Escalator extends Widget assertArgumentsAreValidAndWithinRange(index, numberOfRows); rows -= numberOfRows; - if (heightMode == HeightMode.UNDEFINED) { - heightByRows = rows; - } if (!isAttached()) { return; @@ -1334,9 +1331,6 @@ public class Escalator extends Widget } rows += numberOfRows; - if (heightMode == HeightMode.UNDEFINED) { - heightByRows = rows; - } /* * only add items in the DOM if the widget itself is attached to the @@ -2514,6 +2508,24 @@ public class Escalator extends Widget } @Override + public void insertRows(int index, int numberOfRows) { + super.insertRows(index, numberOfRows); + + if (heightMode == HeightMode.UNDEFINED) { + heightByRows = getRowCount(); + } + } + + @Override + public void removeRows(int index, int numberOfRows) { + super.removeRows(index, numberOfRows); + + if (heightMode == HeightMode.UNDEFINED) { + heightByRows = getRowCount(); + } + } + + @Override public void setStylePrimaryName(String primaryStyleName) { super.setStylePrimaryName(primaryStyleName); UIObject.setStylePrimaryName(root, primaryStyleName + "-body"); |