Author: gbrown
Date: Tue May 18 18:26:14 2010
New Revision: 945804

URL: http://svn.apache.org/viewvc?rev=945804&view=rev
Log:
Fix some issues with variable row height in TerraTableViewSkin.

Modified:
    pivot/trunk/tests/src/org/apache/pivot/tests/table_view_test2.wtkx
    
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java
    
pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewTextAreaCellRenderer.java

Modified: pivot/trunk/tests/src/org/apache/pivot/tests/table_view_test2.wtkx
URL: 
http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/table_view_test2.wtkx?rev=945804&r1=945803&r2=945804&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/table_view_test2.wtkx 
(original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/table_view_test2.wtkx Tue May 
18 18:26:14 2010
@@ -22,24 +22,28 @@ limitations under the License.
     xmlns:content="org.apache.pivot.wtk.content"
     xmlns="org.apache.pivot.wtk">
     <content>
-        <TableView wtkx:id="tableView" styles="{variableRowHeight:true}">
-            <columns>
-                <TableView.Column name="value" width="100">
-                    <cellRenderer>
-                        <content:TableViewTextAreaCellRenderer />
-                    </cellRenderer>
-                </TableView.Column>
+        <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
+            <view>
+                <TableView wtkx:id="tableView" 
styles="{variableRowHeight:true, backgroundColor:'#ffeeee'}">
+                    <columns>
+                        <TableView.Column name="value" width="100">
+                            <cellRenderer>
+                                <content:TableViewCellRenderer 
styles="{wrapText:true}"/>
+                            </cellRenderer>
+                        </TableView.Column>
 
-                <TableView.Column width="1*"/>
-            </columns>
-            <tableData>
-                <collections:ArrayList>
-                    <collections:HashMap value="Single Line"/>
-                    <collections:HashMap value="Double&#xA;Line"/>
-                    <collections:HashMap value="Single Line"/>
-                    <collections:HashMap value="Double&#xA;Line"/>
-                </collections:ArrayList>
-            </tableData>
-        </TableView>
+                        <TableView.Column width="1*"/>
+                    </columns>
+                    <tableData>
+                        <collections:ArrayList>
+                            <collections:HashMap value="Single Line"/>
+                            <collections:HashMap value="Double&#xA;Line Line 
Line Line!"/>
+                            <collections:HashMap value="Single Line"/>
+                            <collections:HashMap value="Double&#xA;Line"/>
+                        </collections:ArrayList>
+                    </tableData>
+                </TableView>
+            </view>
+        </ScrollPane>
     </content>
 </Window>

Modified: 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java?rev=945804&r1=945803&r2=945804&view=diff
==============================================================================
--- 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java
 (original)
+++ 
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java
 Tue May 18 18:26:14 2010
@@ -273,8 +273,9 @@ public class TerraTableViewSkin extends 
                     rowHeight = Math.max(rowHeight, 
cellRenderer.getPreferredHeight(columnWidth));
                 }
 
+                rowY += rowHeight;
                 rowBoundaries.add(rowY);
-                rowY += rowHeight + 1;
+                rowY++;
             }
         } else {
             fixedRowHeight = calculateFixedRowHeight(tableView);
@@ -545,7 +546,7 @@ public class TerraTableViewSkin extends 
         List<Object> tableData = (List<Object>)tableView.getTableData();
 
         TableView.ColumnSequence columns = tableView.getColumns();
-        Object rowData = tableData.get(0);
+        Object rowData = tableData.get(rowIndex);
 
         int rowHeight = 0;
         for (int i = 0, n = columns.getLength(); i < n; i++) {

Modified: 
pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewTextAreaCellRenderer.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewTextAreaCellRenderer.java?rev=945804&r1=945803&r2=945804&view=diff
==============================================================================
--- 
pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewTextAreaCellRenderer.java
 (original)
+++ 
pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewTextAreaCellRenderer.java
 Tue May 18 18:26:14 2010
@@ -26,9 +26,9 @@ import org.apache.pivot.wtk.Insets;
 import org.apache.pivot.wtk.TableView;
 import org.apache.pivot.wtk.TextArea;
 
-
 /**
- * Renders cell contents as a string using TextArea. Only really useful when 
the TableView is using the variableRowHeight style.
+ * Renders cell contents as a string using a text area (which supports line 
feeds,
+ * which the default label-based table view cell renderer does not).
  */
 public class TableViewTextAreaCellRenderer extends TextArea
     implements TableView.CellRenderer {


Reply via email to