You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/09/03 12:37:10 UTC
svn commit: r810876 -
/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java
Author: tvolkert
Date: Thu Sep 3 10:37:10 2009
New Revision: 810876
URL: http://svn.apache.org/viewvc?rev=810876&view=rev
Log:
Fixed bugs in TablePaneSkin when row span or column span took the component beyond the number or rows or columns, respectively.
Modified:
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java?rev=810876&r1=810875&r2=810876&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java Thu Sep 3 10:37:10 2009
@@ -477,6 +477,8 @@
columnWidths = getColumnWidths(width);
rowHeights = getRowHeights(height, columnWidths);
+ // Determine which rows and column should be visible so we know which
+ // ones should be collapsed
boolean[] visibleRows = new boolean[rowCount];
boolean[] visibleColumns = new boolean[columnCount];
@@ -503,12 +505,14 @@
child.setLocation(componentX, componentY);
int columnSpan = TablePane.getColumnSpan(child);
+ columnSpan = Math.min(columnSpan, columnCount - j);
int childWidth = (columnSpan - 1) * horizontalSpacing;
for (int k = 0; k < columnSpan && j + k < columnCount; k++) {
childWidth += columnWidths[j + k];
}
int rowSpan = TablePane.getRowSpan(child);
+ rowSpan = Math.min(rowSpan,rowCount - i);
int childHeight = (rowSpan - 1) * verticalSpacing;
for (int k = 0; k < rowSpan && i + k < rowCount; k++) {
childHeight += rowHeights[i + k];
@@ -599,11 +603,11 @@
int rowHeight = rowHeights[i];
int columnWidth = columnWidths[j];
- for (int k = i + 1; k < i + rowSpan; k++) {
+ for (int k = i + 1; k < i + rowSpan && k < rowCount; k++) {
rowHeight += rowHeights[k] + verticalSpacing;
}
- for (int k = j + 1; k < j + columnSpan; k++) {
+ for (int k = j + 1; k < j + columnSpan && k < columnCount; k++) {
columnWidth += columnWidths[k] + horizontalSpacing;
}