Package com.tagtraum.beatunes
Class AbstractSongTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- com.tagtraum.beatunes.AbstractSongTableModel
-
- All Implemented Interfaces:
FilterTableModel<AudioSong>
,Serializable
,TableModel
- Direct Known Subclasses:
SimpleSongTableModel
,SongTableModel
public abstract class AbstractSongTableModel extends AbstractTableModel implements FilterTableModel<AudioSong>
Abstract Song Table Model.- Author:
- Hendrik Schreiber
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSongTableModel()
Constructor.protected
AbstractSongTableModel(BeaTunes application)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPropertyChangeListener(String propertyName, PropertyChangeListener propertyChangeListener)
protected void
firePropertyChange(String propertyName, Object oldValue, Object newValue)
Report a bound property update to any registered listeners.void
fireTableRowsRepaint(int first, int last)
Fire specialTableModelEvent
that's only supposed to trigger a repaint.BeaTunes
getApplication()
int
getColumnCount()
int
getUnfilteredRow(int row)
Returns unfiltered row index for a given row index.Object
getValueAt(int rowIndex, int columnIndex)
protected Object
getValueAt(AudioSong song, int rowIndex, int columnIndex)
Returns the Song property for a specific column.boolean
isCellEditable(int rowIndex, int columnIndex)
boolean
isItemsEditable()
Indicates whether the items are editable at all.void
setApplication(BeaTunes beaTunes)
Needs to be set, if you want this model to be editable.void
setItemsEditable(boolean itemsEditable)
Sets whether items are editable, e.g.protected void
setValue(Object v, AudioSong song, int row, int column)
void
setValueAt(Object value, int row, int column)
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, removeTableModelListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.tagtraum.beatunes.filter.FilterTableModel
getTableModelListeners, getValueAt, indexOf, indexOf
-
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, getColumnName, getRowCount, removeTableModelListener
-
-
-
-
Constructor Detail
-
AbstractSongTableModel
protected AbstractSongTableModel(BeaTunes application)
Constructor.- Parameters:
application
- application
-
AbstractSongTableModel
protected AbstractSongTableModel()
Constructor.
-
-
Method Detail
-
getApplication
public BeaTunes getApplication()
-
isItemsEditable
public boolean isItemsEditable()
Indicates whether the items are editable at all.- Returns:
- true or false
- See Also:
isCellEditable(int, int)
,setItemsEditable(boolean)
-
setItemsEditable
public void setItemsEditable(boolean itemsEditable)
Sets whether items are editable, e.g. by inline editors.- Parameters:
itemsEditable
- true or false- See Also:
isItemsEditable()
-
setApplication
public void setApplication(BeaTunes beaTunes)
Needs to be set, if you want this model to be editable.- Parameters:
beaTunes
- beaTunes
-
addPropertyChangeListener
public void addPropertyChangeListener(String propertyName, PropertyChangeListener propertyChangeListener)
- Parameters:
propertyName
- property namepropertyChangeListener
- listener
-
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount
in interfaceTableModel
-
getUnfilteredRow
public int getUnfilteredRow(int row)
Description copied from interface:FilterTableModel
Returns unfiltered row index for a given row index.- Specified by:
getUnfilteredRow
in interfaceFilterTableModel<AudioSong>
- Parameters:
row
- filtered row- Returns:
- unfiltered row or -1 if not found
-
firePropertyChange
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
Report a bound property update to any registered listeners. No event is fired if old and new are equal and non-null.- Parameters:
propertyName
- The programmatic name of the property that was changed.oldValue
- The old value of the property.newValue
- The new value of the property.
-
getValueAt
public Object getValueAt(int rowIndex, int columnIndex)
- Specified by:
getValueAt
in interfaceTableModel
-
getValueAt
protected Object getValueAt(AudioSong song, int rowIndex, int columnIndex)
Returns the Song property for a specific column.- Parameters:
song
- songrowIndex
- rowcolumnIndex
- property- Returns:
- the requested song property
-
setValueAt
public void setValueAt(Object value, int row, int column)
- Specified by:
setValueAt
in interfaceTableModel
- Overrides:
setValueAt
in classAbstractTableModel
-
setValue
protected void setValue(Object v, AudioSong song, int row, int column)
- Parameters:
v
- valuesong
- songrow
- rowcolumn
- column
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex)
- Specified by:
isCellEditable
in interfaceTableModel
- Overrides:
isCellEditable
in classAbstractTableModel
-
fireTableRowsRepaint
public void fireTableRowsRepaint(int first, int last)
Fire specialTableModelEvent
that's only supposed to trigger a repaint. Listeners may ignore this event by checking forTableModelRepaintEvent
.- Parameters:
first
- first rowlast
- last row- See Also:
TableModelRepaintEvent
-
-