Package adams.gui.tools
Class AbstractManagementTableModel<T extends Comparable>
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- adams.gui.core.AbstractBaseTableModel
-
- adams.gui.selection.AbstractTableBasedSelectionPanel.AbstractSelectionTableModel<T>
-
- adams.gui.tools.AbstractManagementTableModel<T>
-
- All Implemented Interfaces:
LoggingLevelHandler
,LoggingSupporter
,SpreadSheetSupporter
,ClearableModel
,CustomSearchTableModel
,Serializable
,TableModel
- Direct Known Subclasses:
EmailAddressBookPanel.TableModel
,FileChooserBookmarksManagementPanel.TableModel
public abstract class AbstractManagementTableModel<T extends Comparable> extends AbstractTableBasedSelectionPanel.AbstractSelectionTableModel<T> implements ClearableModel, CustomSearchTableModel
A table model for displaying the details of the database object.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_Sorted
whether the model is sorted.protected List<T>
m_Values
the objects to display.-
Fields inherited from class adams.gui.core.AbstractBaseTableModel
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description AbstractManagementTableModel()
Default constructor (sorted).AbstractManagementTableModel(boolean sorted)
Default constructor.AbstractManagementTableModel(List<T> values)
The constructor (sorted).AbstractManagementTableModel(List<T> values, boolean sorted)
the constructor.AbstractManagementTableModel(T[] values)
The constructor (sorted).AbstractManagementTableModel(T[] values, boolean sorted)
The constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
add(T value)
Adds the Object to the model, if not alread present.void
addAll(List<T> values)
Adds the Objects to the model, if not alread present.void
clear()
Clears the internal model.abstract Class
getColumnClass(int columnIndex)
Returns the class type of the column.abstract int
getColumnCount()
Returns the number of columns in the table.abstract String
getColumnName(int column)
Returns the name of the column.T
getItemAt(int row)
Returns the Object at the specified position.int
getRowCount()
Returns the actual number of entries in the table.abstract Object
getValueAt(int row, int column)
Returns the Object at the given position.int
indexOf(T value)
Returns the index of the given (visible) Object, -1 if not found.abstract boolean
isSearchMatch(SearchParameters params, int row)
Tests whether the search matches the specified row.boolean
isSorted()
Returns whether the model is sorted.boolean
moveDown(int index)
Moves the specified element one position down.boolean
moveUp(int index)
Moves the specified element one position up.void
remove(T value)
Removes the Object to the model, if not alread present.List<T>
toList()
Returns the model as list.-
Methods inherited from class adams.gui.core.AbstractBaseTableModel
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, setLoggingLevel, toSpreadSheet, toString
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, isCellEditable, removeTableModelListener, setValueAt
-
-
-
-
Field Detail
-
m_Values
protected List<T extends Comparable> m_Values
the objects to display.
-
m_Sorted
protected boolean m_Sorted
whether the model is sorted.
-
-
Constructor Detail
-
AbstractManagementTableModel
public AbstractManagementTableModel()
Default constructor (sorted).
-
AbstractManagementTableModel
public AbstractManagementTableModel(boolean sorted)
Default constructor.- Parameters:
sorted
- true if to sort items
-
AbstractManagementTableModel
public AbstractManagementTableModel(T[] values)
The constructor (sorted).- Parameters:
values
- the values to display
-
AbstractManagementTableModel
public AbstractManagementTableModel(T[] values, boolean sorted)
The constructor.- Parameters:
values
- the values to displaysorted
- true if to sort items
-
AbstractManagementTableModel
public AbstractManagementTableModel(List<T> values)
The constructor (sorted).- Parameters:
values
- the values to display
-
-
Method Detail
-
isSorted
public boolean isSorted()
Returns whether the model is sorted.- Returns:
- true if sorted
-
getRowCount
public int getRowCount()
Returns the actual number of entries in the table.- Specified by:
getRowCount
in interfaceTableModel
- Returns:
- the number of entries
-
getColumnCount
public abstract int getColumnCount()
Returns the number of columns in the table.- Specified by:
getColumnCount
in interfaceTableModel
- Returns:
- the number of columns
-
getColumnName
public abstract String getColumnName(int column)
Returns the name of the column.- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
- Parameters:
column
- the column to get the name for- Returns:
- the name of the column
-
getColumnClass
public abstract Class getColumnClass(int columnIndex)
Returns the class type of the column.- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
- Parameters:
columnIndex
- the column to get the class for- Returns:
- the class for the column
-
getValueAt
public abstract Object getValueAt(int row, int column)
Returns the Object at the given position.- Specified by:
getValueAt
in interfaceTableModel
- Parameters:
row
- the rowcolumn
- the column- Returns:
- the Object
-
getItemAt
public T getItemAt(int row)
Returns the Object at the specified position.- Specified by:
getItemAt
in classAbstractTableBasedSelectionPanel.AbstractSelectionTableModel<T extends Comparable>
- Parameters:
row
- the (actual, not visible) position of the Object- Returns:
- the Object at the position, null if not valid index
-
indexOf
public int indexOf(T value)
Returns the index of the given (visible) Object, -1 if not found.- Specified by:
indexOf
in classAbstractTableBasedSelectionPanel.AbstractSelectionTableModel<T extends Comparable>
- Parameters:
value
- the Object to look for- Returns:
- the index, -1 if not found
-
isSearchMatch
public abstract boolean isSearchMatch(SearchParameters params, int row)
Tests whether the search matches the specified row.- Specified by:
isSearchMatch
in interfaceCustomSearchTableModel
- Parameters:
params
- the search parametersrow
- the row of the underlying, unsorted model- Returns:
- true if the search matches this row
-
clear
public void clear()
Clears the internal model.- Specified by:
clear
in interfaceClearableModel
-
add
public void add(T value)
Adds the Object to the model, if not alread present.- Parameters:
value
- the Object to add
-
addAll
public void addAll(List<T> values)
Adds the Objects to the model, if not alread present.- Parameters:
values
- the Objects to add
-
remove
public void remove(T value)
Removes the Object to the model, if not alread present.- Parameters:
value
- the Object to remove
-
moveUp
public boolean moveUp(int index)
Moves the specified element one position up.- Parameters:
index
- the index of the element to move up- Returns:
- true if successfully moved
-
moveDown
public boolean moveDown(int index)
Moves the specified element one position down.- Parameters:
index
- the index of the element to move down- Returns:
- true if successfully moved
-
-