FileDocCategorySizeDatePackage
FilesDoneItem.javaAPI DocAzureus 3.0.3.42453Mon Feb 19 14:24:06 GMT 2007org.gudy.azureus2.ui.swt.views.tableitems.mytorrents

FilesDoneItem

public class FilesDoneItem extends org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn implements TableCellRefreshListener

Fields Summary
Constructors Summary
public FilesDoneItem(String sTableID)

	  super("filesdone", ALIGN_CENTER, POSITION_INVISIBLE, 50, sTableID);
	  setRefreshInterval(5);
    setMinWidthAuto(true);
  
Methods Summary
public voidrefresh(TableCell cell)

    DownloadManager dm = (DownloadManager)cell.getDataSource();
    
    String	text = "";
    
    if ( dm != null ){
    	int	complete 			= 0;
    	int	skipped				= 0;
    	int	skipped_complete	= 0;
    	
    	DiskManagerFileInfo[]	files = dm.getDiskManagerFileInfo();
    	
    	int	total	= files.length;
    	
    	for (int i=0;i<files.length;i++){
    		DiskManagerFileInfo	file = files[i];
    		
    		if ( file.getLength() == file.getDownloaded()){
    			complete++;
    			if ( file.isSkipped()){
    				skipped++;
    				skipped_complete++;
    			}
    		}else if ( file.isSkipped()){
    			skipped++;
    		}
    	}
    	
    	if ( skipped == 0 ){
    		text = complete + "/" + total;
    	}else{
    		text = (complete-skipped_complete) + "(" + complete + ")/" + (total-skipped) + "(" + total + ")"; 
    	}
    }
    
    cell.setText( text );