diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-09-01 08:11:04 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-09-01 08:11:04 +0000 |
commit | 8e6f3f883f1d4a000be56e72614988a6710696dd (patch) | |
tree | e52ba1191993d2e577a60db7acd1682a12435707 /src/com | |
parent | 2250b5a23afc3935b70cf37297c0e8aab37ebc48 (diff) | |
download | vaadin-framework-8e6f3f883f1d4a000be56e72614988a6710696dd.tar.gz vaadin-framework-8e6f3f883f1d4a000be56e72614988a6710696dd.zip |
fixes #3143, initial expand algorithm now works equally to the resize algorithm if only expanded and fixed columns
svn changeset:8603/svn branch:6.1
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index b89eb94c97..e25fc815ef 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -624,46 +624,46 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler { availW -= Util.getNativeScrollbarSize(); } + // TODO refactor this code to be the same as in resize timer boolean needsReLayout = false; if (availW > total) { // natural size is smaller than available space final int extraSpace = availW - total; final int totalWidthR = total - totalExplicitColumnsWidths; - if (totalWidthR > 0) { - needsReLayout = true; - - if (expandRatioDivider > 0) { - // visible columns have some active expand ratios, excess - // space is divided according to them - headCells = tHead.iterator(); - i = 0; - while (headCells.hasNext()) { - HeaderCell hCell = (HeaderCell) headCells.next(); - if (hCell.getExpandRatio() > 0) { - int w = widths[i]; - final int newSpace = (int) (extraSpace * (hCell - .getExpandRatio() / expandRatioDivider)); - w += newSpace; - widths[i] = w; - } - i++; + needsReLayout = true; + + if (expandRatioDivider > 0) { + // visible columns have some active expand ratios, excess + // space is divided according to them + headCells = tHead.iterator(); + i = 0; + while (headCells.hasNext()) { + HeaderCell hCell = (HeaderCell) headCells.next(); + if (hCell.getExpandRatio() > 0) { + int w = widths[i]; + final int newSpace = (int) (extraSpace * (hCell + .getExpandRatio() / expandRatioDivider)); + w += newSpace; + widths[i] = w; } - } else { - // now we will share this sum relatively to those without - // explicit width - headCells = tHead.iterator(); - i = 0; - while (headCells.hasNext()) { - HeaderCell hCell = (HeaderCell) headCells.next(); - if (!hCell.isDefinedWidth()) { - int w = widths[i]; - final int newSpace = extraSpace * w / totalWidthR; - w += newSpace; - widths[i] = w; - } - i++; + i++; + } + } else if (totalWidthR > 0) { + // no expand ratios defined, we will share extra space + // relatively to "natural widths" among those without + // explicit width + headCells = tHead.iterator(); + i = 0; + while (headCells.hasNext()) { + HeaderCell hCell = (HeaderCell) headCells.next(); + if (!hCell.isDefinedWidth()) { + int w = widths[i]; + final int newSpace = extraSpace * w / totalWidthR; + w += newSpace; + widths[i] = w; } + i++; } } |