FileDocCategorySizeDatePackage
CommentIconItem.javaAPI DocAzureus 3.0.3.42829Thu Jul 19 13:46:06 BST 2007org.gudy.azureus2.ui.swt.views.tableitems.mytorrents

CommentIconItem

public class CommentIconItem extends org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn implements TableCellRefreshListener, TableCellMouseListener
author
amc1

Fields Summary
Constructors Summary
public CommentIconItem(String sTableID)
Default Constructor

	super("commenticon", CommentIconItem.POSITION_LAST, 20, sTableID);
	setRefreshInterval(INTERVAL_LIVE);
    initializeAsGraphic(POSITION_LAST, 20);
    setWidthLimits(20, 20);
  
Methods Summary
public voidcellMouseTrigger(TableCellMouseEvent event)

		DownloadManager dm = (DownloadManager) event.cell.getDataSource();
		if (dm == null) {return;}
		
		if (event.eventType != TableCellMouseEvent.EVENT_MOUSEUP) {return;}

		// Only activate on LMB.
		if (event.button != 1) {return;}
		event.skipCoreFunctionality = true;
		
		TorrentUtil.promptUserForComment(new DownloadManager[]{dm});
		refresh(event.cell);
  
public voidrefresh(TableCell cell)

	  if (cell.isDisposed()) {return;}
	  
	  DownloadManager dm = (DownloadManager)cell.getDataSource();
	  String comment = null;
	  if (dm != null) {
		  comment = dm.getDownloadState().getUserComment();
		  if (comment!=null && comment.length()==0) {comment = null;}
	  }
	  
	  if (comment == null) {
		  ((TableCellSWT)cell).setGraphic(ImageRepository.getImage(null));
		  cell.setToolTip(null);
		  cell.setSortValue(0);
	  }
	  else {
		  ((TableCellSWT)cell).setGraphic(ImageRepository.getImage("comment"));
		  cell.setToolTip(comment);
		  cell.setSortValue(1);
	  }