diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2018-12-05 08:53:13 +0200 |
---|---|---|
committer | Sun Zhe <31067185+ZheSun88@users.noreply.github.com> | 2018-12-05 08:53:13 +0200 |
commit | eba78039628c3f6b092338d0ff8da3b6821741e4 (patch) | |
tree | 960cddcd1269377ec78d7c8ad24df47f9b9a5fb2 /client | |
parent | e23c3dd83c372c86c1c2aa3b911bdcb0720c0095 (diff) | |
download | vaadin-framework-eba78039628c3f6b092338d0ff8da3b6821741e4.tar.gz vaadin-framework-eba78039628c3f6b092338d0ff8da3b6821741e4.zip |
Improvements to updating spacer indexes. (#11353)
* Improvements to updating spacer indexes.
- When details rows are moved down, indexes need to be updated from
bottom up.
Fixes #11352
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/widgets/Escalator.java | 17 |
1 files changed, 13 insertions, 4 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 cc207c10c0..c559c36c18 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java +++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java @@ -5606,10 +5606,19 @@ public class Escalator extends Widget */ public void shiftSpacersByRows(int index, int numberOfRows) { final double pxDiff = numberOfRows * body.getDefaultRowHeight(); - for (SpacerContainer.SpacerImpl spacer : getSpacersForRowAndAfter( - index)) { - spacer.setPositionDiff(0, pxDiff); - spacer.setRowIndex(spacer.getRow() + numberOfRows); + List<SpacerContainer.SpacerImpl> spacers = new ArrayList<>( + getSpacersForRowAndAfter(index)); + if (numberOfRows < 0) { + for (SpacerContainer.SpacerImpl spacer : spacers) { + spacer.setPositionDiff(0, pxDiff); + spacer.setRowIndex(spacer.getRow() + numberOfRows); + } + } else { + for (int i = spacers.size() - 1; i >= 0; --i) { + SpacerContainer.SpacerImpl spacer = spacers.get(i); + spacer.setPositionDiff(0, pxDiff); + spacer.setRowIndex(spacer.getRow() + numberOfRows); + } } } |