Classes that allow adding a column to "My Torrents" view.
import org.gudy.azureus2.plugins.Plugin;
import org.gudy.azureus2.plugins.ui.tables.mytorrents.*;
public class ExampleClass
implements Plugin
{
public void initialize(PluginInterface plugin_interface) {
plugin_interface.addColumnToMyTorrentsTable("MyColumn", new MyColumn());
}
public class MyColumn
implements PluginMyTorrentsItemFactory
{
public String getName() {
return "MyColumn";
}
public String getType() {
return PluginMyTorrentsItemFactory.TYPE_STRING;
}
public int getDefaultSize() {
return 80;
}
public int getDefaultPosition() {
return PluginMyTorrentsItemFactory.POSITION_LAST;
}
public String getOrientation() {
return PluginMyTorrentsItemFactory.ORIENT_LEFT;
}
public PluginMyTorrentsItem getInstance(MyTorrentsTableItem item) {
return new MyColumnItem(item);
}
public int getTablesVisibleIn() {
return PluginMyTorrentsItemFactory.TABLE_COMPLETE |
PluginMyTorrentsItemFactory.TABLE_INCOMPLETE;
}
}
public class MyColumnItem
implements PluginMyTorrentsItem
{
MyTorrentsTableItem tableItem;
MyColumnItem(MyTorrentsTableItem item) {
tableItem = item;
}
public void refresh() {
Download dl = tableItem.getDownload();
if (dl == null)
return;
// for this example, return the first few characters of the download name
tableItem.setText(dl.getName().subString(0, 3));
}
public String getStringValue() {
Download dl = tableItem.getDownload();
if (dl == null)
return "";
return dl.getName().subString(0, 3);
}
public int getIntValue() {
return 0;
}
}
}
@see org.gudy.azureus2.plugins.PluginInterface#addColumnToMyTorrentsTable