net.sourceforge.atunes.gui.model
Class PlayListTableModel

java.lang.Object
  extended by net.sourceforge.atunes.gui.model.PlayListTableModel
All Implemented Interfaces:
javax.swing.table.TableModel

public class PlayListTableModel
extends java.lang.Object
implements javax.swing.table.TableModel

The Class PlayListTableModel.

Author:
fleax

Constructor Summary
PlayListTableModel(javax.swing.JTable table)
          Constructor.
 
Method Summary
 void addSong(AudioObject song)
          Adds a song to Play list.
 void addTableModelListener(javax.swing.event.TableModelListener l)
          Adds a listener.
 void arrangeColumns(boolean reapplyFilter)
          Arrange columns.
 Column getColumn(int column)
          Return Column object for a given column number.
 java.lang.Class<?> getColumnClass(int colIndex)
          Returns column data class.
 int getColumnCount()
          Return column count.
 PlayListColumns.PlayListColumn getColumnId(int colIndex)
          Returns Column ID given a column number.
 java.lang.String getColumnName(int colIndex)
          Return column name.
 AudioObject getFileAt(int pos)
          Return a file of a row.
 int getRowCount()
          Return row count.
 java.lang.Object getValueAt(int rowIndex, int colIndex)
          Returns value of a row and column.
 int getWidthForColumn(int column)
          Returns width for a given column number.
 int getWidthForColumn(PlayListColumns.PlayListColumn c)
          Returns width for a given column.
 boolean isAlbumVisible()
          Checks if is album visible.
 boolean isArtistVisible()
          Checks if is artist visible.
 boolean isCellEditable(int rowIndex, int columnIndex)
          Returns if a cell is editable.
 boolean isEmpty()
          Checks if is empty.
 void moveDown(int[] rows)
          Move down.
 void moveToBottom(int[] rows)
          Move bottom.
 void moveToTop(int[] rows)
          Move to top.
 void moveUp(int[] rows)
          Move up.
 void refresh()
          Refresh table.
 void refresh(int pos)
          Refresh a row.
 void refreshTable()
          Refresh visually table.
 void removeSongs()
          Removes all songs.
 void removeSongs(int[] rows)
          Removes songs from Play List.
 void removeTableModelListener(javax.swing.event.TableModelListener l)
          Removes a listener.
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
          Sets value for a cell.
 void updateColumnWidth()
          Updates columns width.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlayListTableModel

public PlayListTableModel(javax.swing.JTable table)
Constructor.

Parameters:
table - the table
Method Detail

addSong

public void addSong(AudioObject song)
Adds a song to Play list.

Parameters:
song - the song

addTableModelListener

public void addTableModelListener(javax.swing.event.TableModelListener l)
Adds a listener.

Specified by:
addTableModelListener in interface javax.swing.table.TableModel
Parameters:
l - the l

arrangeColumns

public void arrangeColumns(boolean reapplyFilter)
Arrange columns.

Parameters:
reapplyFilter - the reapply filter

getColumn

public Column getColumn(int column)
Return Column object for a given column number.

Parameters:
column - the column
Returns:
the column

getColumnClass

public java.lang.Class<?> getColumnClass(int colIndex)
Returns column data class.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Parameters:
colIndex - the col index
Returns:
the column class

getColumnCount

public int getColumnCount()
Return column count.

Specified by:
getColumnCount in interface javax.swing.table.TableModel
Returns:
the column count

getColumnId

public PlayListColumns.PlayListColumn getColumnId(int colIndex)
Returns Column ID given a column number.

Parameters:
colIndex - the col index
Returns:
the column id

getColumnName

public java.lang.String getColumnName(int colIndex)
Return column name.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Parameters:
colIndex - the col index
Returns:
the column name

getFileAt

public AudioObject getFileAt(int pos)
Return a file of a row.

Parameters:
pos - the pos
Returns:
the file at

getRowCount

public int getRowCount()
Return row count.

Specified by:
getRowCount in interface javax.swing.table.TableModel
Returns:
the row count

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int colIndex)
Returns value of a row and column.

Specified by:
getValueAt in interface javax.swing.table.TableModel
Parameters:
rowIndex - the row index
colIndex - the col index
Returns:
the value at

getWidthForColumn

public int getWidthForColumn(int column)
Returns width for a given column number.

Parameters:
column - the column
Returns:
the width for column

getWidthForColumn

public int getWidthForColumn(PlayListColumns.PlayListColumn c)
Returns width for a given column.

Parameters:
c - the c
Returns:
the width for column

isAlbumVisible

public boolean isAlbumVisible()
Checks if is album visible.

Returns:
true, if is album visible

isArtistVisible

public boolean isArtistVisible()
Checks if is artist visible.

Returns:
true, if is artist visible

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Returns if a cell is editable.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Parameters:
rowIndex - the row index
columnIndex - the column index
Returns:
true, if checks if is cell editable

isEmpty

public boolean isEmpty()
Checks if is empty.

Returns:
true, if is empty

moveDown

public void moveDown(int[] rows)
Move down.

Parameters:
rows - the rows

moveToBottom

public void moveToBottom(int[] rows)
Move bottom.

Parameters:
rows - the rows

moveToTop

public void moveToTop(int[] rows)
Move to top.

Parameters:
rows - the rows

moveUp

public void moveUp(int[] rows)
Move up.

Parameters:
rows - the rows

refresh

public void refresh()
Refresh table.


refresh

public void refresh(int pos)
Refresh a row.

Parameters:
pos - the pos

refreshTable

public void refreshTable()
Refresh visually table.


removeSongs

public void removeSongs()
Removes all songs.


removeSongs

public void removeSongs(int[] rows)
Removes songs from Play List.

Parameters:
rows - the rows

removeTableModelListener

public void removeTableModelListener(javax.swing.event.TableModelListener l)
Removes a listener.

Specified by:
removeTableModelListener in interface javax.swing.table.TableModel
Parameters:
l - the l

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
Sets value for a cell. Does nothing as cells are not editable

Specified by:
setValueAt in interface javax.swing.table.TableModel
Parameters:
aValue - the a value
rowIndex - the row index
columnIndex - the column index

updateColumnWidth

public void updateColumnWidth()
Updates columns width.



Copyright © 2006-2008 The aTunes Team. All Rights Reserved.