Revision: 1289
Author:   mathiasbr
Date:     2006-08-08 14:42:53 -0700 (Tue, 08 Aug 2006)
ViewCVS:  http://svn.sourceforge.net/spring-rich-c/?rev=1289&view=rev

Log Message:
-----------
a user defined maximum number of rows where evaluated to determine columns 
widths.

Modified Paths:
--------------
    
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/table/TableUtils.java
Modified: 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/table/TableUtils.java
===================================================================
--- 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/table/TableUtils.java
  2006-08-08 21:21:16 UTC (rev 1288)
+++ 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/table/TableUtils.java
  2006-08-08 21:42:53 UTC (rev 1289)
@@ -128,16 +128,18 @@
        }
 
     public static void sizeColumnsToFitRowData(JTable table) {
-        sizeColumnsToFitRowData(table, false);
+        sizeColumnsToFitRowData(table, 1);
     }
 
-    public static void sizeColumnsToFitRowData(JTable table, boolean 
onlyFirstRow) {
+    public static void sizeColumnsToFitRowData(JTable table, int 
maxNumberOfRows) {
                if (table.getRowCount() > 0) {
+            int rowSize = maxNumberOfRows <= 0 ? table.getRowCount() : Math
+                    .min(maxNumberOfRows, table.getRowCount());
                        for (int col = 0, colSize = table.getColumnCount(); col 
< colSize; col++) {
                 int width = 0;
                 TableColumn column = table.getColumnModel().getColumn(col);
                 TableCellRenderer r = 
table.getColumnModel().getColumn(col).getCellRenderer();
-                for (int row = 0, rowSize = onlyFirstRow ? 1 : 
table.getRowCount(); row < rowSize; row++) {
+                for (int row = 0; row < rowSize; row++) {
                     Object val = table.getValueAt(row, col);
                                if (r == null) {
                                        if (val != null) {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
spring-rich-c-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs

Reply via email to