Package org.jdesktop.swingx.table
Class TableUtilities
java.lang.Object
org.jdesktop.swingx.table.TableUtilities
Collection of utility methods for J/X/Table.
- Author:
- Jeanette Winzenburg, Berlin
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
clear
(TableColumnModel model, boolean includeHidden) Removes all columns of the given column model.static int
getPreferredRowHeight
(JTable table, int row) Returns the preferred height for the given row.static boolean
Returns a boolean indication whether the event represents a dataChanged type.static boolean
Returns a boolean indication whether the event represents a remove type.static boolean
Returns a boolean indication whether the event represents a insert type.static boolean
Returns a boolean indication whether the event represents a structureChanged type.static boolean
Returns a boolean indication whether the event represents a update type.static int[]
ordinalsOf
(Enum<?>... values) Returns an array containing the ordinals of the given values of an Enum.static void
setPreferredRowHeight
(JTable table, int row) static void
setPreferredRowHeights
(JTable table) Sets preferred row heights for all visible rows.
-
Method Details
-
isDataChanged
Returns a boolean indication whether the event represents a dataChanged type.- Parameters:
e
- the event to examine.- Returns:
- true if the event is of type dataChanged, false else.
-
isUpdate
Returns a boolean indication whether the event represents a update type.- Parameters:
e
- the event to examine.- Returns:
- true if the event is a true update, false otherwise.
-
isInsert
Returns a boolean indication whether the event represents a insert type.- Parameters:
e
- the event to examine- Returns:
- true if the event is of type insert, false otherwise.
-
isDelete
Returns a boolean indication whether the event represents a remove type.- Parameters:
e
- the event to examine- Returns:
- true if the event is of type remove, false otherwise.
-
isStructureChanged
Returns a boolean indication whether the event represents a structureChanged type.- Parameters:
e
- the event to examine.- Returns:
- true if the event is of type structureChanged or null, false else.
-
getPreferredRowHeight
Returns the preferred height for the given row. It loops across all visible columns and returns the maximal pref height of the rendering component. Falls back to the table's base rowheight, i f there are no columns or the renderers max is zeor.- Parameters:
table
- the table which provides the renderers, must not be nullrow
- the index of the row in view coordinates- Returns:
- the preferred row height of
- Throws:
NullPointerException
- if table is null.IndexOutOfBoundsException
- if the row is not a valid row index
-
setPreferredRowHeight
- Parameters:
table
- the table which provides the renderers, must not be nullrow
- the index of the row in view coordinates- Throws:
NullPointerException
- if table is null.IndexOutOfBoundsException
- if the row is not a valid row index
-
setPreferredRowHeights
Sets preferred row heights for all visible rows.- Parameters:
table
- the table to set row heights to- Throws:
NullPointerException
- if no table installed.
-
ordinalsOf
Returns an array containing the ordinals of the given values of an Enum.Convience for clients which define TableColumns as Enums (Issue #1304-swingx).
- Parameters:
values
- the enums to map to its ordinals- Returns:
- an array of ordinals, guaranteed to be not null
-
clear
Removes all columns of the given column model. Includes hidden columns as indicated by the includesHidden flag, the flag has no effect if the model is not of type TableColumnModelExt.- Parameters:
model
- the column model to remove all columns from.includeHidden
- indicates whether hidden columns should be removed as well, has no effect if model is not of type TableColumnModelExt.
-