JIDE 3.5.15

com.jidesoft.grid
Class TableColumnAutoResizer

java.lang.Object
  extended by com.jidesoft.grid.TableColumnAutoResizer
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class TableColumnAutoResizer
extends Object

Allows table column automatically resize to fit in all the contents in the cells when user mouse double clicks on the grid line of table header or table depending on the parameter you use to construct this class. To use it, you simply call

 new TableColumnAutoResizer(table);
 
or
 new TableColumnAutoResizer(table, false);
 
If you use any of the tables provided by JIDE Grids, you can simply call JideTable.setColumnAutoResizable(boolean) to make columns auto-resizable. *

Author:
Jan Reidemeister, JIDE Software, Inc.

Field Summary
protected  boolean _onTableHeader
           
protected  JTable _table
           
protected static String KEY
           
 
Constructor Summary
TableColumnAutoResizer(JTable table)
          Constructor.
TableColumnAutoResizer(JTable table, boolean onTableHeader)
          Constructor.
 
Method Summary
 MouseInputListener createMouseInputListener()
           
 void install()
           
 void propertyChange(PropertyChangeEvent evt)
           
protected  void resizeColumn(TableColumn resizingColumn)
          The action to resize the column.
 void uninstall()
          Removes the MouseListener registered by install() method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY

protected static final String KEY
See Also:
Constant Field Values

_table

protected JTable _table

_onTableHeader

protected final boolean _onTableHeader
Constructor Detail

TableColumnAutoResizer

public TableColumnAutoResizer(JTable table)
Constructor. The default value for onTableHeader is true, meaning that the auto resize is effective on the table header.

Parameters:
table - the table to enable column auto resize

TableColumnAutoResizer

public TableColumnAutoResizer(JTable table,
                              boolean onTableHeader)
Constructor.

Parameters:
table - the table to enable column auto resize
onTableHeader - if the auto resize feature is going to be effective on table header or table cells.
Method Detail

createMouseInputListener

public MouseInputListener createMouseInputListener()

resizeColumn

protected void resizeColumn(TableColumn resizingColumn)
The action to resize the column. In some cases like PivotTablePane, you need consider the synchronization between different tables.

Parameters:
resizingColumn - the column to be resized.

install

public void install()

uninstall

public void uninstall()
Removes the MouseListener registered by install() method.


propertyChange

public void propertyChange(PropertyChangeEvent evt)
Specified by:
propertyChange in interface PropertyChangeListener

JIDE 3.5.15