* @return
*/
private String getColumnText(Object element, int columnIndex) {
String lDraw = "";
if (element instanceof IDownload) {
Download lDownload = (Download) element;
int row = DownloadService.getInstance().indexOf(lDownload);
switch (columnIndex) {
case 0: { // The download index.
lDraw = new Integer(row).toString();
}
break;
case 1: { // The file name.
if (lDownload.getAttachment().getFile() != null) {
lDraw = lDownload.getAttachment().getFile().getName();
} else {
lDraw = "Error, File name not set";
}
}
break; // The feed title.
case 2: {
lDraw = lDownload.getAttachment().getNews().getFeedReference()
.resolve().getTitle();
}
break;
case 3: {
lDraw = "TODO"; // this is the proress bar.
}
break;
case 4: {
lDraw = Util.formatSpeed(lDownload.getBytesPerSecond())
+ " kB/s";
}
break;
case 5: {
lDraw = Util.formatTime(lDownload.getTimeElapsed());
}
break;
case 6: {
String status = DownloadService.STATE_DESCRIPTION[lDownload
.getState()];
if (lDownload.getState() == DownloadService.RETRYING
|| lDownload.getState() == DownloadService.ERROR
|| lDownload.getState() == DownloadService.RELEASING) {
status += lDownload.getMessage();
}
lDraw = status;
}
break;
case 7: {
lDraw = Util.formatSize(lDownload.getCurrent());
}
}
}
return lDraw;