summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Alhroos <john.ahlroos@itmill.com>2011-08-05 08:23:28 +0000
committerJohn Alhroos <john.ahlroos@itmill.com>2011-08-05 08:23:28 +0000
commit5843910f5c8d108a5d33b66f0daebf1e94bd0e6a (patch)
tree04992ac2b050ef7e221c6a0d72ee01b60dd2042c /src
parente5a64cc6be20be60c18990520ce746915bceafce (diff)
downloadvaadin-framework-5843910f5c8d108a5d33b66f0daebf1e94bd0e6a.tar.gz
vaadin-framework-5843910f5c8d108a5d33b66f0daebf1e94bd0e6a.zip
Regression fixes after fixes for #6677 #6934
svn changeset:20128/svn branch:6.6
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java127
1 files changed, 67 insertions, 60 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
index 7608e2f028..fc5994aee2 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
@@ -1616,6 +1616,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
// natural size is smaller than available space
final int extraSpace = availW - total;
final int totalWidthR = total - totalExplicitColumnsWidths;
+ int checksum = 0;
needsReLayout = true;
if (extraSpace == 1) {
@@ -1623,6 +1624,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
// undefined column
headCells = tHead.iterator();
i = 0;
+ checksum = availW;
while (headCells.hasNext()) {
HeaderCell hc = (HeaderCell) headCells.next();
if (!hc.isDefinedWidth()) {
@@ -1632,64 +1634,65 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
i++;
}
- } else if (expandRatioDivider > 0 || totalWidthR > 0) {
- int checksum = 0;
- if(expandRatioDivider > 0){
- // visible columns have some active expand ratios, excess
- // space is divided according to them
- headCells = tHead.iterator();
- i = 0;
- checksum = 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;
- checksum += w;
- }
- i++;
+ } else 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 = Math.round((extraSpace * (hCell
+ .getExpandRatio() / expandRatioDivider)));
+ w += newSpace;
+ widths[i] = w;
+ checksum += w;
+ } else {
+ checksum += widths[i];
}
- } else {
- // no expand ratios defined, we will share extra space
- // relatively to "natural widths" among those without
- // explicit width
- headCells = tHead.iterator();
- i = 0;
- checksum = 0;
- while (headCells.hasNext()) {
- HeaderCell hCell = (HeaderCell) headCells.next();
- if (!hCell.isDefinedWidth()) {
- int w = widths[i];
- final int newSpace = Math.round((float) extraSpace
- * (float) w / totalWidthR);
- w += newSpace;
- widths[i] = w;
- checksum += 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 = Math.round((float) extraSpace
+ * (float) w / totalWidthR);
+ w += newSpace;
+ widths[i] = w;
+ checksum += w;
+ } else {
+ checksum += hCell.getWidth();
}
+ i++;
}
-
- if (checksum != availW) {
- /*
- * There might be in some cases a rounding error of 1px
- * so if there is one then we give the first undefined column 1 more pixel
- */
- headCells = tHead.iterator();
- i = 0;
- while (headCells.hasNext()) {
- HeaderCell hc = (HeaderCell) headCells.next();
- if (!hc.isDefinedWidth()) {
- widths[i] += availW - checksum;
- break;
- }
- i++;
+ }
+
+ if (checksum != availW) {
+ /*
+ * There might be in some cases a rounding error of 1px so if
+ * there is one then we give the first undefined column 1 more
+ * pixel
+ */
+ headCells = tHead.iterator();
+ i = 0;
+ while (headCells.hasNext()) {
+ HeaderCell hc = (HeaderCell) headCells.next();
+ if (!hc.isDefinedWidth()) {
+ widths[i] += availW - checksum;
+ break;
}
+ i++;
}
}
+
} else {
// bodys size will be more than available and scrollbar will appear
}
@@ -2748,7 +2751,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
}
public HeaderCell getHeaderCell(int index) {
- if (index < visibleCells.size()) {
+ if (index >= 0 && index < visibleCells.size()) {
return (HeaderCell) visibleCells.get(index);
} else {
return null;
@@ -5072,27 +5075,31 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
int newSpace;
if (expandRatioDivider > 0) {
// divide excess space by expand ratios
- newSpace = Math.round(w + extraSpace
- * hCell.getExpandRatio() / expandRatioDivider);
+ newSpace = Math.round((w + extraSpace
+ * hCell.getExpandRatio() / expandRatioDivider));
} else {
if (totalUndefinedNaturaWidths != 0) {
// divide relatively to natural column widths
newSpace = Math.round(w + (float) extraSpace
- * (float) w / totalUndefinedNaturaWidths);
+ * (float) w
+ / totalUndefinedNaturaWidths);
} else {
newSpace = w;
}
}
checksum += newSpace;
setColWidth(colIndex, newSpace, false);
+ } else {
+ checksum += hCell.getWidth();
}
colIndex++;
}
-
+
if (checksum != availW) {
/*
- * There might be in some cases a rounding error of 1px
- * so if there is one then we give the first undefined column 1 more pixel
+ * There might be in some cases a rounding error of 1px so if
+ * there is one then we give the first undefined column 1 more
+ * pixel
*/
headCells = tHead.iterator();
colIndex = 0;
@@ -5106,7 +5113,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
colIndex++;
}
}
-
+
if ((height == null || "".equals(height))
&& totalRows == pageLength) {
// fix body height (may vary if lazy loading is offhorizontal