diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/widget/grid/AutoScroller.java | 23 | ||||
-rw-r--r-- | client/src/com/vaadin/client/widgets/Grid.java | 29 |
2 files changed, 19 insertions, 33 deletions
diff --git a/client/src/com/vaadin/client/widget/grid/AutoScroller.java b/client/src/com/vaadin/client/widget/grid/AutoScroller.java index 90d206d98b..9cc238ac15 100644 --- a/client/src/com/vaadin/client/widget/grid/AutoScroller.java +++ b/client/src/com/vaadin/client/widget/grid/AutoScroller.java @@ -610,22 +610,25 @@ public class AutoScroller { } } - private double getFrozenColumnsWidth() { - double value = getMultiSelectColumnWidth(); - for (int i = 0; i < grid.getFrozenColumnCount(); i++) { + public double getFrozenColumnsWidth() { + double value = 0; + + for (int i = 0; i < getRealFrozenColumnCount(); i++) { value += grid.getColumn(i).getWidthActual(); } + return value; } - private double getMultiSelectColumnWidth() { - if (grid.getFrozenColumnCount() >= 0 - && grid.getSelectionModel().getSelectionColumnRenderer() != null) { - // frozen checkbox column is present - return getTheadElement().getFirstChildElement() - .getFirstChildElement().getOffsetWidth(); + private int getRealFrozenColumnCount() { + if (grid.getFrozenColumnCount() < 0) { + return 0; + } else if (grid.getSelectionModel().getSelectionColumnRenderer() != null) { + // includes the selection column + return grid.getFrozenColumnCount() + 1; + } else { + return grid.getFrozenColumnCount(); } - return 0.0; } private double getMaxScrollLeft() { diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index ccc909465f..a77499e41f 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -4113,7 +4113,8 @@ public class Grid<T> extends ResizeComposite implements dropMarkerLeft += autoScrollX; - final double frozenColumnsWidth = getFrozenColumnsWidth(); + final double frozenColumnsWidth = autoScroller + .getFrozenColumnsWidth(); final double rightBoundaryForDrag = getSidebarBoundaryComparedTo(dropMarkerLeft); final int visibleColumns = getVisibleColumns().size(); @@ -4156,7 +4157,8 @@ public class Grid<T> extends ResizeComposite implements .min(sidebarBoundary, gridBoundary); // Do not show on left of the frozen columns (even if scrolled) - final int frozenColumnsWidth = (int) getFrozenColumnsWidth(); + final int frozenColumnsWidth = (int) autoScroller + .getFrozenColumnsWidth(); left = Math.max(frozenColumnsWidth, Math.min(left, rightBoundary)); @@ -4317,25 +4319,6 @@ public class Grid<T> extends ResizeComposite implements autoScroller.stop(); } - private double getFrozenColumnsWidth() { - double value = getMultiSelectColumnWidth(); - for (int i = 0; i < getFrozenColumnCount(); i++) { - value += getColumn(i).getWidthActual(); - } - return value; - } - - private double getMultiSelectColumnWidth() { - if (getSelectionModel().getSelectionColumnRenderer() != null) { - // frozen checkbox column is present, it is always the first - // column - return escalator.getHeader().getElement() - .getFirstChildElement().getFirstChildElement() - .getOffsetWidth(); - } - return 0.0; - } - /** * Returns the amount of frozen columns. The selection column is always * considered frozen, since it can't be moved. @@ -4436,7 +4419,7 @@ public class Grid<T> extends ResizeComposite implements return; } - double position = getFrozenColumnsWidth(); + double position = autoScroller.getFrozenColumnsWidth(); // iterate column indices and add possible drop positions for (int i = frozenColumns; i < getColumnCount(); i++) { Column<?, T> column = getColumn(i); @@ -8714,4 +8697,4 @@ public class Grid<T> extends ResizeComposite implements } return null; } -} +}
\ No newline at end of file |