org.springframework.richclient.table
Class TableUtils

java.lang.Object
  extended by org.springframework.richclient.table.TableUtils

public class TableUtils
extends Object

Author:
Keith Donald

Constructor Summary
TableUtils()
           
 
Method Summary
static JTable attachSorter(JTable table)
           
static int calculatePreferredColumnWidth(JTable table, TableColumn col)
          Calculates the preferred width of a table column based on the header.
static JTable createStandardSortableTable(TableModel tableModel)
           
static TableModel getUnfilteredTableModel(JTable table)
          Returns the innermost table model associated with this table; if layers of table model filters are wrapping it.
static TableModel getUnfilteredTableModel(TableModel tableModel)
           
static void installDefaultRenderers(JTable table)
           
static void scrollToRow(JTable table, int row)
           
static void setPreferredColumnWidths(JTable table)
           
static void sizeColumnsToFitRowData(JTable table)
          resizes the column widths to optimally fit the row data.
static void sizeColumnsToFitRowData(JTable table, int maxNumberOfRows)
          resizes the column widths to optimally fit the row data.
static void stopCellEditing(JTable table)
          Workaround for a very annoying bug in jtable where an editing cell value does not get committed on focus lost.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableUtils

public TableUtils()
Method Detail

scrollToRow

public static void scrollToRow(JTable table,
                               int row)

createStandardSortableTable

public static JTable createStandardSortableTable(TableModel tableModel)

attachSorter

public static JTable attachSorter(JTable table)

installDefaultRenderers

public static void installDefaultRenderers(JTable table)

setPreferredColumnWidths

public static void setPreferredColumnWidths(JTable table)

calculatePreferredColumnWidth

public static int calculatePreferredColumnWidth(JTable table,
                                                TableColumn col)
Calculates the preferred width of a table column based on the header.

Parameters:
table -
Returns:
the preferred table width

getUnfilteredTableModel

public static TableModel getUnfilteredTableModel(JTable table)
Returns the innermost table model associated with this table; if layers of table model filters are wrapping it.


sizeColumnsToFitRowData

public static void sizeColumnsToFitRowData(JTable table)
resizes the column widths to optimally fit the row data.

this method only tests the first row (if it exists)

Parameters:
table - the table whose columns should be resized, not null

sizeColumnsToFitRowData

public static void sizeColumnsToFitRowData(JTable table,
                                           int maxNumberOfRows)
resizes the column widths to optimally fit the row data.

Parameters:
table - the table whose columns should be resized, not null
maxNumberOfRows - specifies the maximum number of rows to evaluate the column widths. If it is lower or equals 0 all rows will be evaluated

getUnfilteredTableModel

public static TableModel getUnfilteredTableModel(TableModel tableModel)

stopCellEditing

public static void stopCellEditing(JTable table)
Workaround for a very annoying bug in jtable where an editing cell value does not get committed on focus lost.

Parameters:
table -


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.