return true;
}
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
String text = "";
Track track = ((DownloadTableModel)table.getModel()).getSongDownloads().get(row);
if(track != null) {
Double downloadRate = track.getDownloadRate();
if(track.getStatus() != null) {
switch (track.getStatus()) {
case INITIALIZING:
text = "initializing...";
break;
case QUEUED:
text = "waiting...";
break;
case DOWNLOADING:
if (downloadRate != null) {
text = String.format("%1.0f%%, %d of %d kB, %1.0f kB/s",
track.getProgress() * 1.0,
track.getDownloadedBytes() / 1024,
track.getTotalBytes() / 1024,
downloadRate / 1024);
} else {
text = String.format("%1.0f%%, %d kB",
track.getProgress() * 1.0,
track.getTotalBytes() / 1024);
}
break;
case FINISHED:
downloadRate = track.getDownloadRate();
if (downloadRate != null) {
text = String.format("%d kB, %1.0f kB/s",
track.getDownloadedBytes() / 1024,
downloadRate / 1024);
} else {
text = String.format("%d kB",
track.getDownloadedBytes() / 1024);
}
break;
case CANCELLED:
text = "cancelled";
break;