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/10 14:43:06 UTC
svn commit: r813406 -
/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java
Author: tvolkert
Date: Thu Sep 10 12:43:05 2009
New Revision: 813406
URL: http://svn.apache.org/viewvc?rev=813406&view=rev
Log:
Reverted previous change to TerraTableViewSkin - the fix will be re-applied differently
Modified:
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java?rev=813406&r1=813405&r2=813406&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java Thu Sep 10 12:43:05 2009
@@ -133,13 +133,7 @@
TableView.Column column = columns.get(i);
if (!column.isRelative()) {
- int columnWidth = column.getWidth();
-
- if (columnWidth == -1) {
- columnWidth = getPreferredColumnWidth(column);
- }
-
- preferredWidth += columnWidth;
+ preferredWidth += column.getWidth();
// Include space for vertical gridlines; even if we are
// not painting them, the header does
@@ -196,7 +190,16 @@
int columnWidth = column.getWidth();
if (columnWidth == -1) {
- columnWidth = getPreferredColumnWidth(column);
+ // Calculate the maximum cell width
+ columnWidth = 0;
+
+ TableView.CellRenderer cellRenderer = column.getCellRenderer();
+ List<?> tableData = tableView.getTableData();
+
+ for (Object rowData : tableData) {
+ cellRenderer.render(rowData, tableView, column, false, false, false);
+ columnWidth = Math.max(cellRenderer.getPreferredWidth(-1), columnWidth);
+ }
}
columnWidths.add(columnWidth);
@@ -371,26 +374,6 @@
}
/**
- * Gets the preferred width of a column, which is the maximum preferred
- * width of the column's cells.
- */
- private int getPreferredColumnWidth(TableView.Column column) {
- int columnWidth = 0;
-
- TableView tableView = (TableView)getComponent();
-
- TableView.CellRenderer cellRenderer = column.getCellRenderer();
- List<?> tableData = tableView.getTableData();
-
- for (Object rowData : tableData) {
- cellRenderer.render(rowData, tableView, column, false, false, false);
- columnWidth = Math.max(cellRenderer.getPreferredWidth(-1), columnWidth);
- }
-
- return columnWidth;
- }
-
- /**
* Returns the table row height, which is determined as the maximum
* preferred height of all cell renderers.
*