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 protectedAbstractSongTableModel()Constructor.protectedAbstractSongTableModel(BeaTunes application)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(String propertyName, PropertyChangeListener propertyChangeListener)protected voidfirePropertyChange(String propertyName, Object oldValue, Object newValue)Report a bound property update to any registered listeners.voidfireTableRowsRepaint(int first, int last)Fire specialTableModelEventthat's only supposed to trigger a repaint.BeaTunesgetApplication()intgetColumnCount()intgetUnfilteredRow(int row)Returns unfiltered row index for a given row index.ObjectgetValueAt(int rowIndex, int columnIndex)protected ObjectgetValueAt(AudioSong song, int rowIndex, int columnIndex)Returns the Song property for a specific column.booleanisCellEditable(int rowIndex, int columnIndex)booleanisItemsEditable()Indicates whether the items are editable at all.voidsetApplication(BeaTunes beaTunes)Needs to be set, if you want this model to be editable.voidsetItemsEditable(boolean itemsEditable)Sets whether items are editable, e.g.protected voidsetValue(Object v, AudioSong song, int row, int column)voidsetValueAt(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:
getColumnCountin interfaceTableModel
-
getUnfilteredRow
public int getUnfilteredRow(int row)
Description copied from interface:FilterTableModelReturns unfiltered row index for a given row index.- Specified by:
getUnfilteredRowin 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:
getValueAtin 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:
setValueAtin interfaceTableModel- Overrides:
setValueAtin 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:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein classAbstractTableModel
-
fireTableRowsRepaint
public void fireTableRowsRepaint(int first, int last)Fire specialTableModelEventthat's only supposed to trigger a repaint. Listeners may ignore this event by checking forTableModelRepaintEvent.- Parameters:
first- first rowlast- last row- See Also:
TableModelRepaintEvent
-
-