Default Constructor super("remaining", ALIGN_TRAIL, POSITION_LAST, 60, TableManager.TABLE_TORRENT_FILES); setRefreshInterval(INTERVAL_LIVE); setMinWidthAuto(true);
super("remaining", ALIGN_TRAIL, POSITION_LAST, 60, TableManager.TABLE_TORRENT_FILES); setRefreshInterval(INTERVAL_LIVE); setMinWidthAuto(true);
DiskManagerFileInfo fileInfo = (DiskManagerFileInfo)cell.getDataSource(); // dm may be null if this is a skeleton file view DiskManager dm = fileInfo==null?null:fileInfo.getDiskManager(); int remaining = 0; if( fileInfo != null && dm != null ) { int start = fileInfo.getFirstPieceNumber(); int end = start + fileInfo.getNbPieces(); DiskManagerPiece[] pieces = dm.getPieces(); for( int i = start; i < end; i++ ) { if( !pieces[ i ].isDone() ) remaining++; } }else{ remaining = -1; // unknown } if( !cell.setSortValue( remaining ) && cell.isValid() ) { return; } cell.setText( "" + ( remaining<0?"":(""+remaining)));