|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.wordpress.tipsforjava.swing.TableColumnAdjuster
public class TableColumnAdjuster extends Object
Class to manage the widths of colunmns in a table. Various properties control how the width of the column is calculated. Another property controls whether column width calculation should be dynamic. Finally, various Actions will be added to the table to allow the user to customize the functionality. This class was designed to be used with tables that use an auto resize mode of AUTO_RESIZE_OFF. With all other modes you are constrained as the width of the columns must fit inside the table. So if you increase one column, one or more of the other columns must decrease. Because of this the resize mode of RESIZE_ALL_COLUMNS will work the best.
| Nested Class Summary | |
|---|---|
class |
TableColumnAdjuster.ColumnAction
|
class |
TableColumnAdjuster.ToggleAction
|
| Field Summary | |
|---|---|
private Map |
columnSizes
|
private boolean |
isColumnDataIncluded
|
private boolean |
isColumnHeaderIncluded
|
private boolean |
isDynamicAdjustment
|
private boolean |
isOnlyAdjustLarger
|
private int |
spacing
|
private JTable |
table
|
| Constructor Summary | |
TableColumnAdjuster(JTable table)
|
|
TableColumnAdjuster(JTable table, int spacing)
|
|
| Method Summary | |
|---|---|
void
|
adjustColumn(int column)
|
void
|
adjustColumns()
|
private int
|
getCellDataWidth(int row, int column)
|
private int
|
getColumnDataWidth(int column)
|
private int
|
getColumnHeaderWidth(int column)
|
private void
|
installActions()
|
private void
|
installColumnAction(boolean isSelectedColumn, boolean isAdjust, String key, String keyStroke)
|
private void
|
installToggleAction(boolean isToggleDynamic, boolean isToggleLarger, String key, String keyStroke)
|
void
|
propertyChange(PropertyChangeEvent e)
|
private void
|
restoreColumn(int column)
|
void
|
restoreColumns()
|
void
|
setColumnDataIncluded(boolean isColumnDataIncluded)
|
void
|
setColumnHeaderIncluded(boolean isColumnHeaderIncluded)
|
void
|
setDynamicAdjustment(boolean isDynamicAdjustment)
|
void
|
setOnlyAdjustLarger(boolean isOnlyAdjustLarger)
|
void
|
tableChanged(TableModelEvent e)
|
private void
|
updateTableColumn(int column, int width)
|
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Field Detail |
|---|
private Map columnSizes
private boolean isColumnDataIncluded
private boolean isColumnHeaderIncluded
private boolean isDynamicAdjustment
private boolean isOnlyAdjustLarger
private int spacing
private JTable table
| Constructor Detail |
|---|
public TableColumnAdjuster(JTable table)
public TableColumnAdjuster(JTable table, int spacing)
| Method Detail |
|---|
public void adjustColumn(int column)
public void adjustColumns()
private int getCellDataWidth(int row, int column)
private int getColumnDataWidth(int column)
private int getColumnHeaderWidth(int column)
private void installActions()
private void installColumnAction(boolean isSelectedColumn, boolean isAdjust, String key, String keyStroke)
private void installToggleAction(boolean isToggleDynamic, boolean isToggleLarger, String key, String keyStroke)
public void propertyChange(PropertyChangeEvent e)
private void restoreColumn(int column)
public void restoreColumns()
public void setColumnDataIncluded(boolean isColumnDataIncluded)
public void setColumnHeaderIncluded(boolean isColumnHeaderIncluded)
public void setDynamicAdjustment(boolean isDynamicAdjustment)
public void setOnlyAdjustLarger(boolean isOnlyAdjustLarger)
public void tableChanged(TableModelEvent e)
private void updateTableColumn(int column, int width)
Groovy Documentation