Class ColumnResizeHandler
- java.lang.Object
-
- io.github.jonestimd.swing.table.ColumnResizeHandler
-
- All Implemented Interfaces:
SettingsPersister
public class ColumnResizeHandler extends java.lang.Object implements SettingsPersister
Provides improved column resizing and handles save/restore of column sizes and ordering.Column Sizing
if
ColumnConfiguration.getWidth(TableColumn)
returns anon-null
value then the column is initialized to that width. Otherwise, the width is initialized to the value returned byColumnWidthCalculator.preferredWidth(TableColumn)
.If
ColumnWidthCalculator.isFixedWidth(TableColumn)
returnstrue
then the column's min, max and preferred widths are all initialized to the same value so that the column's size will not change when other columns are resized by the user. This class provides special handling for resizing a column with only fixed width columns to the right. In that case, the right most column will adjust to compensate for the changing column's new size. This class does not prevent the user from explicitly changing the size of a column, including fixed width columns.If
ColumnWidthCalculator.isFixedWidth(TableColumn)
returnsfalse
for a column then only the preferred width is initialized using the saved width or the calculated preferred width.Saved Settings
This class delegates to
ColumnConfiguration
for saving/loading the column widths and ordering.- See Also:
ColumnConfiguration
,ColumnWidthCalculator
-
-
Constructor Summary
Constructors Constructor Description ColumnResizeHandler(javax.swing.JTable table, ColumnConfiguration configuration, ColumnWidthCalculator widthCalculator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
saveSettings()
-
-
-
Constructor Detail
-
ColumnResizeHandler
public ColumnResizeHandler(javax.swing.JTable table, ColumnConfiguration configuration, ColumnWidthCalculator widthCalculator)
-
-
Method Detail
-
saveSettings
public void saveSettings()
- Specified by:
saveSettings
in interfaceSettingsPersister
-
-