Package com.illumon.iris.gui.table
Class HiddenColumnModel
java.lang.Object
javax.swing.table.DefaultTableColumnModel
com.illumon.iris.gui.table.HiddenColumnModel
- All Implemented Interfaces:
PropertyChangeListener
,Serializable
,EventListener
,ListSelectionListener
,TableColumnModel
public class HiddenColumnModel extends DefaultTableColumnModel
A
TableColumnModel
which allows columns to be hidden and unhidden.- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class javax.swing.table.DefaultTableColumnModel
changeEvent, columnMargin, columnSelectionAllowed, listenerList, selectionModel, tableColumns, totalColumnWidth
-
Constructor Summary
Constructors Constructor Description HiddenColumnModel()
HiddenColumnModel(boolean isEditable)
-
Method Summary
Modifier and Type Method Description void
addColumn(TableColumn column)
Add the specified column to the table.void
addColumn(TableColumn column, int index)
Add the specified column to the table at the specified index.TableColumn
getColumn(String name)
Get the specified column by name.Object[][]
getColumnNameData()
Get an array of column data in the format: name, abbreviationList<TableColumn>
getHiddenColumns()
Get a list of the hidden columns.static String
getName(TableColumn column)
Get the name of the specified TableColumn, or null if it couldn't be determined.void
hideAllColumns()
Hide all of the columns.void
hideColumn(int index)
Hide the column at the specified index.void
hideColumn(TableColumn column)
Hide the specified column.boolean
isEditable()
Check if users are allowed to set column abbreviationsboolean
isHiddenColumn(String columnName)
Check if the specified column is hidden.boolean
isHiddenColumn(TableColumn tableColumn)
Check if the specified column is hidden.boolean
isLocked(TableColumn column)
Check if the specified column is 'locked'void
lockColumn(String column)
Mark the specified column as 'locked'.void
moveColumn(int columnIndex, int newIndex)
void
setColumnRename(String columnName, String rename)
Set the column header name.void
setIsEditable(boolean isEditable)
Set if users are allowed to set column abbreviations.void
showColumn(String name)
Show the specified column.void
showColumn(TableColumn column)
Show the specified column.void
unlockAllColumns()
Unlock all locked columns.void
unlockColumn(String column)
Unlock the specified column.Methods inherited from class javax.swing.table.DefaultTableColumnModel
addColumnModelListener, createSelectionModel, fireColumnAdded, fireColumnMarginChanged, fireColumnMoved, fireColumnRemoved, fireColumnSelectionChanged, getColumn, getColumnCount, getColumnIndex, getColumnIndexAtX, getColumnMargin, getColumnModelListeners, getColumns, getColumnSelectionAllowed, getListeners, getSelectedColumnCount, getSelectedColumns, getSelectionModel, getTotalColumnWidth, propertyChange, recalcWidthCache, removeColumn, removeColumnModelListener, setColumnMargin, setColumnSelectionAllowed, setSelectionModel, valueChanged
-
Constructor Details
-
HiddenColumnModel
public HiddenColumnModel() -
HiddenColumnModel
public HiddenColumnModel(boolean isEditable)
-
-
Method Details
-
isEditable
public boolean isEditable()Check if users are allowed to set column abbreviations- Returns:
- true if users are allowed ot set column abbreviations
-
setIsEditable
public void setIsEditable(boolean isEditable)Set if users are allowed to set column abbreviations.- Parameters:
isEditable
- if users are allowed to set column abbreviations
-
hideColumn
public void hideColumn(int index)Hide the column at the specified index.- Parameters:
index
- the column to hide
-
hideColumn
Hide the specified column.- Parameters:
column
- the column to hide.
-
isHiddenColumn
Check if the specified column is hidden.- Parameters:
tableColumn
- the column- Returns:
- true if the column was hidden
-
isHiddenColumn
Check if the specified column is hidden.- Parameters:
columnName
- the column- Returns:
- true if the column was hidden
-
showColumn
Show the specified column.- Parameters:
column
- the column to show
-
showColumn
Show the specified column.- Parameters:
name
- the column name to show
-
hideAllColumns
public void hideAllColumns()Hide all of the columns. -
getHiddenColumns
Get a list of the hidden columns.- Returns:
- a list of hidden columns
- ImplNote:
- Users must not modify the returned value.
-
getColumn
Get the specified column by name.- Parameters:
name
- the column name- Returns:
- the column or null if not found.
-
addColumn
Add the specified column to the table. The identifier must be an instance of aWColumn
- Specified by:
addColumn
in interfaceTableColumnModel
- Overrides:
addColumn
in classDefaultTableColumnModel
- Parameters:
column
- the column to add- ImplNote:
- This will not add columns with a
hidden attribute
-
addColumn
Add the specified column to the table at the specified index.- Parameters:
column
- the column to insertindex
- the index to insert at- ImplNote:
- This will not add columns with a
hidden attribute
-
setColumnRename
Set the column header name. A rename value of 'null' will reset to it's original value.- Parameters:
columnName
- the column to set the header namerename
- the header name to set.
-
getColumnNameData
Get an array of column data in the format: name, abbreviation -
lockColumn
Mark the specified column as 'locked'. a 'locked' column will not be moved upon amoveColumn(int, int)
.- Parameters:
column
- the column to lock
-
unlockColumn
Unlock the specified column.- Parameters:
column
- the coluimn to unlock.
-
isLocked
Check if the specified column is 'locked'- Parameters:
column
- the column- Returns:
- true if the column was locked.
-
moveColumn
public void moveColumn(int columnIndex, int newIndex)- Specified by:
moveColumn
in interfaceTableColumnModel
- Overrides:
moveColumn
in classDefaultTableColumnModel
-
unlockAllColumns
public void unlockAllColumns()Unlock all locked columns. -
getName
Get the name of the specified TableColumn, or null if it couldn't be determined.- Parameters:
column
- The column- Returns:
- the name, or null.
-