use of com.biglybt.pif.ui.tables.TableColumnCreationListener in project BiglyBT by BiglySoftware.
the class SBC_TagDiscovery method initColumns.
protected void initColumns() {
synchronized (SBC_TagDiscovery.class) {
if (columnsAdded) {
return;
}
columnsAdded = true;
}
TableColumnManager tableManager = TableColumnManager.getInstance();
tableManager.registerColumn(TagDiscovery.class, ColumnTagDiscoveryName.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnTagDiscoveryName(column);
}
});
tableManager.registerColumn(TagDiscovery.class, ColumnTagDiscoveryTorrent.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnTagDiscoveryTorrent(column);
}
});
tableManager.registerColumn(TagDiscovery.class, ColumnTagDiscoveryAddedOn.COLUMN_ID, new TableColumnCoreCreationListener() {
@Override
public TableColumnCore createTableColumnCore(Class<?> forDataSourceType, String tableID, String columnID) {
return new ColumnDateSizer(TagDiscovery.class, columnID, TableColumnCreator.DATE_COLUMN_WIDTH, tableID) {
};
}
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnTagDiscoveryAddedOn(column);
}
});
tableManager.registerColumn(TagDiscovery.class, ColumnTagDiscoveryNetwork.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnTagDiscoveryNetwork(column);
}
});
tableManager.setDefaultColumnNames(TABLE_TAGDISCOVERY, new String[] { ColumnTagDiscoveryName.COLUMN_ID, ColumnTagDiscoveryTorrent.COLUMN_ID, ColumnTagDiscoveryAddedOn.COLUMN_ID });
tableManager.setDefaultSortColumnName(TABLE_TAGDISCOVERY, ColumnTagDiscoveryAddedOn.COLUMN_ID);
}
use of com.biglybt.pif.ui.tables.TableColumnCreationListener in project BiglyBT by BiglySoftware.
the class SBC_ChatOverview method initColumns.
protected void initColumns() {
synchronized (SBC_ChatOverview.class) {
if (columnsAdded) {
return;
}
columnsAdded = true;
}
TableColumnManager tableManager = TableColumnManager.getInstance();
tableManager.registerColumn(ChatInstance.class, ColumnChatName.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnChatName(column);
}
});
tableManager.registerColumn(ChatInstance.class, ColumnChatMessageCount.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnChatMessageCount(column);
}
});
tableManager.registerColumn(ChatInstance.class, ColumnChatUserCount.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnChatUserCount(column);
}
});
tableManager.registerColumn(ChatInstance.class, ColumnChatFavorite.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnChatFavorite(column);
}
});
tableManager.registerColumn(ChatInstance.class, ColumnChatMsgOutstanding.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnChatMsgOutstanding(column);
}
});
// last
tableManager.registerColumn(ChatInstance.class, ColumnChatStatus.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnChatStatus(column);
}
});
tableManager.setDefaultColumnNames(TABLE_CHAT, new String[] { ColumnChatName.COLUMN_ID, ColumnChatMessageCount.COLUMN_ID, ColumnChatUserCount.COLUMN_ID, ColumnChatFavorite.COLUMN_ID, ColumnChatMsgOutstanding.COLUMN_ID, ColumnChatStatus.COLUMN_ID });
tableManager.setDefaultSortColumnName(TABLE_CHAT, ColumnChatName.COLUMN_ID);
}
use of com.biglybt.pif.ui.tables.TableColumnCreationListener in project BiglyBT by BiglySoftware.
the class SBC_DevicesView method initColumns.
/**
* @since 4.1.0.5
*/
private void initColumns(Core core) {
if (columnsAdded) {
return;
}
columnsAdded = true;
UIManager uiManager = PluginInitializer.getDefaultInterface().getUIManager();
TableManager tableManager = uiManager.getTableManager();
tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Rank.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnTJ_Rank(column);
if (!column.getTableID().equals(TABLE_TRANSCODE_QUEUE)) {
column.setVisible(false);
}
}
});
tableManager.registerColumn(TranscodeFile.class, ColumnThumbnail.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnThumbnail(column);
column.setWidth(70);
column.setVisible(false);
}
});
tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Name.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnTJ_Name(column);
if (column.getTableID().equals(TABLE_TRANSCODE_QUEUE)) {
column.setWidth(200);
} else if (!column.getTableID().endsWith(":type=1")) {
column.setWidth(140);
}
}
});
tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Duration.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnTJ_Duration(column);
}
});
tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Device.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnTJ_Device(column);
column.setVisible(false);
}
});
tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Profile.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnTJ_Profile(column);
if (column.getTableID().equals(TABLE_TRANSCODE_QUEUE)) {
column.setWidth(70);
}
}
});
tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Resolution.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnTJ_Resolution(column);
column.setVisible(false);
if (column.getTableID().equals(TABLE_TRANSCODE_QUEUE)) {
column.setWidth(95);
}
}
});
tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Status.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnTJ_Status(column);
}
});
tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Completion.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnTJ_Completion(column);
column.setWidth(145);
}
});
tableManager.registerColumn(TranscodeFile.class, ColumnTJ_CopiedToDevice.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnTJ_CopiedToDevice(column);
if (column.getTableID().endsWith(":type=1") || column.getTableID().equals(TABLE_TRANSCODE_QUEUE)) {
column.setVisible(false);
}
}
});
tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Category.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnTJ_Category(column);
}
});
tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Tags.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnTJ_Tags(column);
}
});
TableColumnManager tcm = TableColumnManager.getInstance();
String[] defaultLibraryColumns = { ColumnTJ_Rank.COLUMN_ID, ColumnTJ_Name.COLUMN_ID, ColumnTJ_Duration.COLUMN_ID, ColumnTJ_Device.COLUMN_ID, ColumnTJ_Status.COLUMN_ID, ColumnTJ_Completion.COLUMN_ID };
tcm.setDefaultColumnNames(TABLE_TRANSCODE_QUEUE, defaultLibraryColumns);
String[] defaultQColumns = { ColumnTJ_Name.COLUMN_ID, ColumnTJ_Duration.COLUMN_ID, ColumnTJ_Profile.COLUMN_ID, ColumnTJ_Status.COLUMN_ID, ColumnTJ_Completion.COLUMN_ID };
tcm.setDefaultColumnNames(TABLE_DEVICE_LIBRARY, defaultQColumns);
}
use of com.biglybt.pif.ui.tables.TableColumnCreationListener in project BiglyBT by BiglySoftware.
the class OpenTorrentOptionsWindow method setupTVTorrents.
private void setupTVTorrents(Composite parent) {
GridLayout layout = new GridLayout();
layout.marginWidth = layout.marginHeight = 0;
layout.horizontalSpacing = layout.verticalSpacing = 0;
parent.setLayout(layout);
GridData gd;
// table
Composite table_area = new Composite(parent, SWT.NULL);
layout = new GridLayout();
layout.marginWidth = layout.marginHeight = 0;
layout.horizontalSpacing = layout.verticalSpacing = 0;
table_area.setLayout(layout);
gd = new GridData(GridData.FILL_BOTH);
Utils.setLayoutData(table_area, gd);
// toolbar area
Composite button_area = new Composite(parent, SWT.NULL);
layout = new GridLayout(5, false);
layout.marginWidth = layout.marginHeight = 0;
layout.horizontalSpacing = layout.verticalSpacing = 0;
layout.marginTop = 5;
button_area.setLayout(layout);
gd = new GridData(GridData.FILL_HORIZONTAL);
Utils.setLayoutData(button_area, gd);
Label label = new Label(button_area, SWT.NULL);
gd = new GridData(GridData.FILL_HORIZONTAL);
Utils.setLayoutData(label, gd);
buttonTorrentUp = new Button(button_area, SWT.PUSH);
buttonTorrentUp.setImage(loadImage("image.toolbar.up"));
buttonTorrentUp.setToolTipText(MessageText.getString("Button.moveUp"));
buttonTorrentUp.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
List<OpenTorrentInstance> selected = (List<OpenTorrentInstance>) (Object) tvTorrents.getSelectedDataSources();
if (selected.size() > 1) {
Collections.sort(selected, new Comparator<OpenTorrentInstance>() {
@Override
public int compare(OpenTorrentInstance o1, OpenTorrentInstance o2) {
return (o1.getIndex() - o2.getIndex());
}
});
}
boolean modified = false;
for (OpenTorrentInstance instance : selected) {
int index = instance.getIndex();
if (index > 0) {
open_instances.remove(instance);
open_instances.add(index - 1, instance);
modified = true;
}
}
if (modified) {
swt_updateTVTorrentButtons();
refreshTVTorrentIndexes();
}
}
});
buttonTorrentDown = new Button(button_area, SWT.PUSH);
buttonTorrentDown.setImage(loadImage("image.toolbar.down"));
buttonTorrentDown.setToolTipText(MessageText.getString("Button.moveDown"));
buttonTorrentDown.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
List<OpenTorrentInstance> selected = (List<OpenTorrentInstance>) (Object) tvTorrents.getSelectedDataSources();
if (selected.size() > 1) {
Collections.sort(selected, new Comparator<OpenTorrentInstance>() {
@Override
public int compare(OpenTorrentInstance o1, OpenTorrentInstance o2) {
return (o2.getIndex() - o1.getIndex());
}
});
}
boolean modified = false;
for (Object obj : selected) {
OpenTorrentInstance instance = (OpenTorrentInstance) obj;
int index = instance.getIndex();
if (index < open_instances.size() - 1) {
open_instances.remove(instance);
open_instances.add(index + 1, instance);
modified = true;
}
}
if (modified) {
swt_updateTVTorrentButtons();
refreshTVTorrentIndexes();
}
}
});
buttonTorrentRemove = new Button(button_area, SWT.PUSH);
buttonTorrentRemove.setToolTipText(MessageText.getString("OpenTorrentWindow.torrent.remove"));
buttonTorrentRemove.setImage(loadImage("image.toolbar.remove"));
buttonTorrentRemove.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
List<Object> selected = tvTorrents.getSelectedDataSources();
for (Object obj : selected) {
OpenTorrentInstance instance = (OpenTorrentInstance) obj;
removeInstance(instance, true);
}
}
});
buttonTorrentUp.setEnabled(false);
buttonTorrentDown.setEnabled(false);
buttonTorrentRemove.setEnabled(false);
label = new Label(button_area, SWT.NULL);
gd = new GridData(GridData.FILL_HORIZONTAL);
Utils.setLayoutData(label, gd);
TableColumnManager tcm = TableColumnManager.getInstance();
if (tcm.getDefaultColumnNames(TABLEID_TORRENTS) == null) {
tcm.registerColumn(OpenTorrentInstance.class, TableColumnOTOT_Position.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new TableColumnOTOT_Position(column);
}
});
tcm.registerColumn(OpenTorrentInstance.class, TableColumnOTOT_Name.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new TableColumnOTOT_Name(column);
}
});
tcm.registerColumn(OpenTorrentInstance.class, TableColumnOTOT_Size.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new TableColumnOTOT_Size(column);
}
});
tcm.setDefaultColumnNames(TABLEID_TORRENTS, new String[] { TableColumnOTOT_Position.COLUMN_ID, TableColumnOTOT_Name.COLUMN_ID, TableColumnOTOT_Size.COLUMN_ID });
tcm.setDefaultSortColumnName(TABLEID_TORRENTS, TableColumnOTOT_Position.COLUMN_ID);
}
tvTorrents = TableViewFactory.createTableViewSWT(OpenTorrentInstance.class, TABLEID_TORRENTS, TABLEID_TORRENTS, null, "#", SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
tvTorrents.initialize(table_area);
tvTorrents.setRowDefaultHeightEM(1.4f);
tvTorrents.addMenuFillListener(new TableViewSWTMenuFillListener() {
@Override
public void fillMenu(String sColumnName, Menu menu) {
final List<Object> selected = tvTorrents.getSelectedDataSources();
if (selected.size() > 0) {
final List<OpenTorrentInstance> instances = new ArrayList<>(selected.size());
final List<OpenTorrentInstance> non_simple_instances = new ArrayList<>();
boolean can_rtlf = false;
for (Object o : selected) {
OpenTorrentInstance oti = (OpenTorrentInstance) o;
instances.add(oti);
if (!oti.getOptions().isSimpleTorrent()) {
non_simple_instances.add(oti);
if (oti.canRemoveTopLevelFolder()) {
can_rtlf = true;
}
}
}
{
MenuItem item = new MenuItem(menu, SWT.PUSH);
Messages.setLanguageText(item, "OpenTorrentWindow.fileList.changeDestination");
item.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
for (Object obj : selected) {
OpenTorrentInstance instance = (OpenTorrentInstance) obj;
instance.setSavePath();
}
}
});
}
{
MenuItem item = new MenuItem(menu, SWT.PUSH);
Messages.setLanguageText(item, "OpenTorrentWindow.tlf.remove");
item.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
for (Object obj : selected) {
OpenTorrentInstance instance = (OpenTorrentInstance) obj;
if (instance.canRemoveTopLevelFolder()) {
instance.removeTopLevelFolder();
}
}
}
});
item.setEnabled(can_rtlf);
}
{
MenuItem item = new MenuItem(menu, SWT.CHECK);
item.setData(COConfigurationManager.getBooleanParameter("open.torrent.window.rename.on.tlf.change"));
Messages.setLanguageText(item, "OpenTorrentWindow.tlf.rename");
item.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
COConfigurationManager.setParameter("open.torrent.window.rename.on.tlf.change", ((MenuItem) e.widget).getSelection());
}
});
item.setEnabled(non_simple_instances.size() > 0);
}
new MenuItem(menu, SWT.SEPARATOR);
MenuItem item = new MenuItem(menu, SWT.PUSH);
Messages.setLanguageText(item, "Button.remove");
item.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
for (Object obj : selected) {
OpenTorrentInstance instance = (OpenTorrentInstance) obj;
removeInstance(instance, true);
}
}
});
new MenuItem(menu, SWT.SEPARATOR);
}
}
@Override
public void addThisColumnSubMenu(String sColumnName, Menu menuThisColumn) {
}
});
tvTorrents.addSelectionListener(new TableSelectionListener() {
@Override
public void selected(TableRowCore[] rows_not_used) {
TableRowCore[] rows = tvTorrents.getSelectedRows();
List<OpenTorrentInstance> instances = new ArrayList<>();
for (TableRowCore row : rows) {
instances.add((OpenTorrentInstance) row.getDataSource());
}
selectInstances(instances);
updateButtons();
}
@Override
public void mouseExit(TableRowCore row) {
}
@Override
public void mouseEnter(TableRowCore row) {
}
@Override
public void focusChanged(TableRowCore focus) {
}
@Override
public void deselected(TableRowCore[] rows) {
selected(rows);
}
private void updateButtons() {
Utils.execSWTThread(new Runnable() {
@Override
public void run() {
swt_updateTVTorrentButtons();
}
});
}
@Override
public void defaultSelected(TableRowCore[] rows, int stateMask) {
}
}, false);
}
use of com.biglybt.pif.ui.tables.TableColumnCreationListener in project BiglyBT by BiglySoftware.
the class ClientStatsView method initColumns.
private void initColumns(Core core) {
synchronized (ClientStatsView.class) {
if (columnsAdded) {
return;
}
columnsAdded = true;
}
UIManager uiManager = PluginInitializer.getDefaultInterface().getUIManager();
TableManager tableManager = uiManager.getTableManager();
tableManager.registerColumn(ClientStatsDataSource.class, ColumnCS_Name.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnCS_Name(column);
}
});
tableManager.registerColumn(ClientStatsDataSource.class, ColumnCS_Count.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnCS_Count(column);
}
});
tableManager.registerColumn(ClientStatsDataSource.class, ColumnCS_Discarded.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnCS_Discarded(column);
}
});
tableManager.registerColumn(ClientStatsDataSource.class, ColumnCS_Received.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnCS_Received(column);
}
});
tableManager.registerColumn(ClientStatsDataSource.class, ColumnCS_ReceivedPer.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnCS_ReceivedPer(column);
}
});
tableManager.registerColumn(ClientStatsDataSource.class, ColumnCS_Sent.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnCS_Sent(column);
}
});
tableManager.registerColumn(ClientStatsDataSource.class, ColumnCS_Pct.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
new ColumnCS_Pct(column);
}
});
for (final String network : AENetworkClassifier.AT_NETWORKS) {
tableManager.registerColumn(ClientStatsDataSource.class, network + "." + ColumnCS_Sent.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
column.setUserData("network", network);
new ColumnCS_Sent(column);
}
});
tableManager.registerColumn(ClientStatsDataSource.class, network + "." + ColumnCS_Discarded.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
column.setUserData("network", network);
new ColumnCS_Discarded(column);
}
});
tableManager.registerColumn(ClientStatsDataSource.class, network + "." + ColumnCS_Received.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
column.setUserData("network", network);
new ColumnCS_Received(column);
}
});
tableManager.registerColumn(ClientStatsDataSource.class, network + "." + ColumnCS_Count.COLUMN_ID, new TableColumnCreationListener() {
@Override
public void tableColumnCreated(TableColumn column) {
column.setUserData("network", network);
new ColumnCS_Count(column);
}
});
}
TableColumnManager tcManager = TableColumnManager.getInstance();
tcManager.setDefaultColumnNames(TABLEID, new String[] { ColumnCS_Name.COLUMN_ID, ColumnCS_Pct.COLUMN_ID, ColumnCS_Count.COLUMN_ID, ColumnCS_Received.COLUMN_ID, ColumnCS_Sent.COLUMN_ID, ColumnCS_Discarded.COLUMN_ID });
}
Aggregations