FileDocCategorySizeDatePackage
TrackerNameItem.javaAPI DocAzureus 3.0.3.42573Thu Jan 11 11:53:50 GMT 2007org.gudy.azureus2.ui.swt.views.tableitems.mytorrents

TrackerNameItem

public class TrackerNameItem extends org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn implements TableCellRefreshListener, TableCellToolTipListener
author
Olivier

Fields Summary
Constructors Summary
public TrackerNameItem(String sTableID)

    super("trackername", POSITION_INVISIBLE, 120, sTableID);
    setRefreshInterval(5);
  
Methods Summary
public voidcellHover(TableCell cell)

		DownloadManager dm = (DownloadManager) cell.getDataSource();
		cell.setToolTip(TrackerCellUtils.getTooltipText(cell, dm));
	
public voidcellHoverComplete(TableCell cell)

		cell.setToolTip(null);
	
public voidrefresh(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);
    }