TrackerNameItempublic class TrackerNameItem extends org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn implements TableCellRefreshListener, TableCellToolTipListener
Constructors Summary |
---|
public TrackerNameItem(String sTableID)
super("trackername", POSITION_INVISIBLE, 120, sTableID);
setRefreshInterval(5);
|
Methods Summary |
---|
public void | cellHover(TableCell cell)
DownloadManager dm = (DownloadManager) cell.getDataSource();
cell.setToolTip(TrackerCellUtils.getTooltipText(cell, dm));
| public void | cellHoverComplete(TableCell cell)
cell.setToolTip(null);
| public void | refresh(TableCell cell)
DownloadManager dm = (DownloadManager)cell.getDataSource();
String name = "";
if( dm != null && dm.getTorrent() != null ) {
String[] parts = dm.getTorrent().getAnnounceURL().getHost().split( "\\." );
int used = 0;
for( int i = parts.length-1; i >= 0; i-- ) {
if( used > 4 ) break; //don't use more than 4 segments
String chunk = parts[ i ];
if( used < 2 || chunk.length() < 11 ) { //use first end two always, but trim out >10 chars (passkeys)
if( used == 0 ) name = chunk;
else name = chunk + "." + name;
used++;
}
else break;
}
}
if (cell.setText(name) || !cell.isValid()) {
TrackerCellUtils.updateColor(cell, dm);
}
|
|