aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/com/vaadin/client/widgets/Escalator.java8
-rw-r--r--client/src/com/vaadin/client/widgets/Grid.java44
2 files changed, 44 insertions, 8 deletions
diff --git a/client/src/com/vaadin/client/widgets/Escalator.java b/client/src/com/vaadin/client/widgets/Escalator.java
index 07173c487b..450655c9d3 100644
--- a/client/src/com/vaadin/client/widgets/Escalator.java
+++ b/client/src/com/vaadin/client/widgets/Escalator.java
@@ -2037,8 +2037,14 @@ public class Escalator extends Widget implements RequiresResize, DeferredWorker
cellClone.getStyle().clearWidth();
rowElement.insertBefore(cellClone, cellOriginal);
+
+ /*
+ * [[subpixelworkaround]] (6.2.2015, Henrik Paul) FIXME: not
+ * using the double-version is a workaround for a bug. It'll be
+ * converted to use the double version at a later time
+ */
double requiredWidth = WidgetUtil
- .getRequiredWidthBoundingClientRectDouble(cellClone);
+ .getRequiredWidthBoundingClientRect(cellClone);
if (BrowserInfo.get().isIE9()) {
/*
diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java
index 9a6a6d6029..cac8a1d6d3 100644
--- a/client/src/com/vaadin/client/widgets/Grid.java
+++ b/client/src/com/vaadin/client/widgets/Grid.java
@@ -2447,6 +2447,29 @@ public class Grid<T> extends ResizeComposite implements
applyColumnWidths();
} else {
applyColumnWidthsWithExpansion();
+
+ /*
+ * [[subpixelworkaround]] (6.2.2015, Henrik Paul) FIXME: just
+ * dump all the remaining pixels into the last column and
+ * whistle loudly
+ */
+ boolean dumpIntoLastColumn = false;
+ double escalatorWidth = escalator.getInnerWidth();
+ double occupiedWidth = 0;
+ for (Column column : getColumns()) {
+ occupiedWidth += column.getWidthActual();
+ if (column.getWidth() < 0 && column.getExpandRatio() != 0) {
+ dumpIntoLastColumn = true;
+ }
+ }
+
+ if (dumpIntoLastColumn) {
+ Column<?, T> lastColumn = getColumn(getColumnCount() - 1);
+ double width = Math.floor(lastColumn.getWidthActual()
+ + (escalatorWidth - occupiedWidth));
+ escalator.getColumnConfiguration().setColumnWidth(
+ getColumnCount() - 1, width);
+ }
}
}
@@ -2565,7 +2588,8 @@ public class Grid<T> extends ResizeComposite implements
* can distribute the remaining pixels to all columns according to
* their expand ratios.
*/
- double pixelsToDistribute = escalator.getInnerWidth()
+ // [[subpixelworkaround]] (6.2.2015, Henrik Paul) FIXME: ceil
+ double pixelsToDistribute = Math.ceil(escalator.getInnerWidth())
- reservedPixels;
if (pixelsToDistribute <= 0 || totalRatios <= 0) {
return;
@@ -2579,7 +2603,9 @@ public class Grid<T> extends ResizeComposite implements
boolean aColumnHasMaxedOut;
do {
aColumnHasMaxedOut = false;
- final double widthPerRatio = pixelsToDistribute / totalRatios;
+ // [[subpixelworkaround]] (6.2.2015, Henrik Paul) FIXME floor
+ final double widthPerRatio = Math.floor(pixelsToDistribute
+ / totalRatios);
final Iterator<Column<?, ?>> i = columnsToExpand.iterator();
while (i.hasNext()) {
final Column<?, ?> column = i.next();
@@ -2615,7 +2641,9 @@ public class Grid<T> extends ResizeComposite implements
* If we still have anything left, distribute the remaining pixels
* to the remaining columns.
*/
- final double widthPerRatio = pixelsToDistribute / totalRatios;
+ // [[subpixelworkaround]] (6.2.2015, Henrik Paul) FIXME: floor
+ final double widthPerRatio = Math.floor(pixelsToDistribute
+ / totalRatios);
for (Column<?, ?> column : columnsToExpand) {
final int expandRatio = getExpandRatio(column,
someColumnExpands);
@@ -2651,7 +2679,8 @@ public class Grid<T> extends ResizeComposite implements
* wouldn't show up in that set.
*/
- double minWidth = getMinWidth(column);
+ // [[subpixelworkaround]] (6.2.2015, Henrik Paul) FIXME ceil
+ double minWidth = Math.ceil(getMinWidth(column));
double currentWidth = column.getWidthActual();
boolean hasAutoWidth = column.getWidth() < 0;
if (hasAutoWidth && currentWidth < minWidth) {
@@ -2676,8 +2705,9 @@ public class Grid<T> extends ResizeComposite implements
for (Column<?, ?> column : columnsToExpand) {
totalRatios += getExpandRatio(column, someColumnExpands);
}
- final double pixelsToRemovePerRatio = pixelsToRemoveFromOtherColumns
- / totalRatios;
+ // [[subpixelworkaround]] (6.2.2015, Henrik Paul) FIXME: ceil
+ final double pixelsToRemovePerRatio = Math
+ .ceil(pixelsToRemoveFromOtherColumns / totalRatios);
for (Column<?, ?> column : columnsToExpand) {
final double pixelsToRemove = pixelsToRemovePerRatio
* getExpandRatio(column, someColumnExpands);
@@ -3100,7 +3130,7 @@ public class Grid<T> extends ResizeComposite implements
* the width in pixels or negative for auto sizing
*/
public Column<C, T> setWidth(double pixels) {
- if (widthUser != pixels) {
+ if (!WidgetUtil.pixelValuesEqual(widthUser, pixels)) {
widthUser = pixels;
scheduleColumnWidthRecalculator();
}