{
if(event instanceof DownloadSizeChanged)
{
Download d = ((DownloadSizeChanged)event).getDownload();
TreeIter row = model.getIterFirst();
if(row != null)
{
do
{
if(model.getValue(row, download) == d)
{
model.setValue(row, size, d.getSize() + "B");
double percent = (float)d.getSize() / (float)d.getTotalSize() * 100;
model.setValue(row, progress, Math.round(percent) + "%");
model.setValue(row, speed, d.getSpeed()/1024f + " KB/s");
}
}
while(row.iterNext());
}
}
else if(event instanceof DownloadStatusChanged)
{
Download d = ((DownloadStatusChanged)event).getDownload();
TreeIter row = model.getIterFirst();
if(row != null)
{
do
{
if(model.getValue(row, download) == d)
{
model.setValue(row, speed, "");
model.setValue(row, status, d.getStatus());
}
}
while(row.iterNext());
}
}
}