Author: noelgrandin
Date: Wed Oct 19 15:41:45 2011
New Revision: 1186281
URL: http://svn.apache.org/viewvc?rev=1186281&view=rev
Log:
PIVOT-803 ImageView placement is incorrect when nested inside two TablePanes
The problem was that TablePane was not dealing with the case where it had
insufficient space.
This is a bit of a blunt solution, but at least it's simple.
Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java
URL:
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java?rev=1186281&r1=1186280&r2=1186281&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java Wed Oct 19
15:41:45 2011
@@ -1423,7 +1423,7 @@ public class TablePaneSkin extends Conta
int rowSpan = TablePane.getRowSpan(component);
if (rowSpan > 1) {
- // We might need to adjust row heights to accomodate
+ // We might need to adjust row heights to accommodate
// this spanning cell. First, we find out if any of the
// spanned cells are default height and how much space
// we've allocated thus far for those cells
@@ -1490,7 +1490,7 @@ public class TablePaneSkin extends Conta
// Finally, we allocate the heights of the relative rows by divvying
// up the remaining height
- int remainingHeight = Math.max(height - reservedHeight, 0);
+ int remainingHeight = height - reservedHeight;
if (totalRelativeWeight > 0
&& remainingHeight > 0) {
for (int i = 0; i < rowCount; i++) {
@@ -1510,6 +1510,23 @@ public class TablePaneSkin extends Conta
}
}
+ // If we have don't actually have enough height available
+
+ while (remainingHeight < 0) {
+ for (int i = 0; i < rowCount; i++) {
+ if (isRowVisible(i)) {
+ TablePane.Row row = rows.get(i);
+ if (!row.isRelative()) {
+ if (rowHeights[i] > 0) {
+ rowHeights[i]--;
+ remainingHeight++;
+ if (remainingHeight >= 0) break;
+ }
+ }
+ }
+ }
+ }
+
return rowHeights;
}