use of com.biglybt.ui.swt.pif.UISWTInstance in project BiglyBT by BiglySoftware.
the class SBC_TagsOverview method initTable.
/**
* @param control
*
* @since 4.6.0.5
*/
private void initTable(Composite control) {
UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uiFunctions != null) {
UISWTInstance pluginUI = uiFunctions.getUISWTInstance();
registerPluginViews(pluginUI);
}
if (tv == null) {
tv = TableViewFactory.createTableViewSWT(Tag.class, TABLE_TAGS, TABLE_TAGS, new TableColumnCore[0], ColumnTagName.COLUMN_ID, SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
if (txtFilter != null) {
tv.enableFilterCheck(txtFilter, this);
}
tv.setRowDefaultHeightEM(1);
tv.setEnableTabViews(true, true, null);
table_parent = new Composite(control, SWT.BORDER);
table_parent.setLayoutData(Utils.getFilledFormData());
GridLayout layout = new GridLayout();
layout.marginHeight = layout.marginWidth = layout.verticalSpacing = layout.horizontalSpacing = 0;
table_parent.setLayout(layout);
table_parent.addListener(SWT.Activate, new Listener() {
@Override
public void handleEvent(Event event) {
// viewActive = true;
updateSelectedContent();
}
});
/*
table_parent.addListener(SWT.Deactivate, new Listener() {
public void handleEvent(Event event) {
//viewActive = false;
// don't updateSelectedContent() because we may have switched
// to a button or a text field, and we still want out content to be
// selected
}
})
*/
tv.addMenuFillListener(this);
tv.addSelectionListener(this, false);
tv.initialize(table_parent);
tv.addCountChangeListener(new TableCountChangeListener() {
@Override
public void rowRemoved(TableRowCore row) {
}
@Override
public void rowAdded(TableRowCore row) {
if (datasource == row.getDataSource()) {
tv.setSelectedRows(new TableRowCore[] { row });
}
}
});
}
control.layout(true);
}
use of com.biglybt.ui.swt.pif.UISWTInstance in project BiglyBT by BiglySoftware.
the class SBC_TagsOverview method registerPluginViews.
private void registerPluginViews(final UISWTInstance pluginUI) {
if (registeredCoreSubViews) {
return;
}
pluginUI.addView(TABLE_TAGS, "TagSettingsView", TagSettingsView.class, null);
pluginUI.addView(TABLE_TAGS, "MyTorrentsSubView", MyTorrentsSubView.class, null);
registeredCoreSubViews = true;
final UIManager uiManager = PluginInitializer.getDefaultInterface().getUIManager();
uiManager.addUIListener(new UIManagerListener() {
@Override
public void UIAttached(UIInstance instance) {
}
@Override
public void UIDetached(UIInstance instance) {
if (!(instance instanceof UISWTInstance)) {
return;
}
registeredCoreSubViews = false;
pluginUI.removeViews(TABLE_TAGS, "TagSettingsView");
pluginUI.removeViews(TABLE_TAGS, "MyTorrentsSubView");
uiManager.removeUIListener(this);
}
});
}
use of com.biglybt.ui.swt.pif.UISWTInstance in project BiglyBT by BiglySoftware.
the class SBC_TorrentDetailsView method initialize.
private void initialize(Composite composite) {
Composite main_area = new Composite(composite, SWT.NULL);
main_area.setLayout(new FormLayout());
// Color bg_color = ColorCache.getColor(composite.getDisplay(), "#c0cbd4");
UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
this.parent = composite;
if (tabbedMDI == null) {
tabbedMDI = uiFunctions.createTabbedMDI(main_area, "detailsview");
} else {
System.out.println("ManagerView::initialize : folder isn't null !!!");
}
if (composite.getLayout() instanceof FormLayout) {
main_area.setLayoutData(Utils.getFilledFormData());
} else if (composite.getLayout() instanceof GridLayout) {
main_area.setLayoutData(new GridData(GridData.FILL_BOTH));
}
composite.layout();
// Call plugin listeners
if (uiFunctions != null) {
UISWTInstance pluginUI = uiFunctions.getUISWTInstance();
if (pluginUI != null) {
MyTorrentsView.registerPluginViews(pluginUI);
for (String id : new String[] { UISWTInstance.VIEW_MYTORRENTS, UISWTInstance.VIEW_TORRENT_DETAILS }) {
UISWTViewEventListenerWrapper[] pluginViews = pluginUI.getViewListeners(id);
for (UISWTViewEventListenerWrapper l : pluginViews) {
if (id == UISWTInstance.VIEW_MYTORRENTS && l.getViewID() == PieceInfoView.MSGID_PREFIX) {
// Simple hack to exlude PieceInfoView tab as it's already within Pieces View
continue;
}
if (l != null) {
try {
tabbedMDI.createEntryFromEventListener(null, UISWTInstance.VIEW_TORRENT_DETAILS, l, l.getViewID(), false, manager, null);
} catch (Throwable e) {
Debug.out(e);
}
}
}
}
}
}
SelectedContentManager.addCurrentlySelectedContentListener(this);
tabbedMDI.addListener(new MdiSWTMenuHackListener() {
@Override
public void menuWillBeShown(MdiEntry entry, Menu menuTree) {
menuTree.setData("downloads", new DownloadManager[] { manager });
menuTree.setData("is_detailed_view", true);
MenuFactory.buildTorrentMenu(menuTree);
}
});
if (dataSource instanceof Object[] && ((Object[]) dataSource)[0] instanceof PEPeer) {
tabbedMDI.showEntryByID(PeersView.MSGID_PREFIX);
} else {
MdiEntry[] entries = tabbedMDI.getEntries();
if (entries.length > 0) {
tabbedMDI.showEntry(entries[0]);
}
}
}
use of com.biglybt.ui.swt.pif.UISWTInstance in project BiglyBT by BiglySoftware.
the class StatsView method registerPluginViews.
private void registerPluginViews(final UISWTInstance pluginUI) {
if (pluginUI == null || registeredCoreSubViews) {
return;
}
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, ActivityView.MSGID_PREFIX, ActivityView.class, null);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, TransferStatsView.MSGID_PREFIX, TransferStatsView.class, null);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, CacheView.MSGID_PREFIX, CacheView.class, null);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX, DHTView.class, DHTView.DHT_TYPE_MAIN);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, DHTOpsView.MSGID_PREFIX, DHTOpsView.class, DHTOpsView.DHT_TYPE_MAIN);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX, VivaldiView.class, VivaldiView.DHT_TYPE_MAIN);
if (NetworkAdmin.getSingleton().hasDHTIPV6()) {
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX + ".6", DHTView.class, DHTView.DHT_TYPE_MAIN_V6);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX + ".6", VivaldiView.class, VivaldiView.DHT_TYPE_MAIN_V6);
}
if (Constants.isCVSVersion()) {
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX + ".cvs", DHTView.class, DHTView.DHT_TYPE_CVS);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX + ".cvs", VivaldiView.class, VivaldiView.DHT_TYPE_CVS);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX + ".biglybt", DHTView.class, DHTView.DHT_TYPE_BIGLYBT);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX + ".biglybt", VivaldiView.class, VivaldiView.DHT_TYPE_BIGLYBT);
}
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, TagStatsView.MSGID_PREFIX, TagStatsView.class, null);
registeredCoreSubViews = true;
final UIManager uiManager = PluginInitializer.getDefaultInterface().getUIManager();
uiManager.addUIListener(new UIManagerListener() {
@Override
public void UIAttached(UIInstance instance) {
}
@Override
public void UIDetached(UIInstance instance) {
if (!(instance instanceof UISWTInstance)) {
return;
}
registeredCoreSubViews = false;
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, ActivityView.MSGID_PREFIX);
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, TransferStatsView.MSGID_PREFIX);
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, CacheView.MSGID_PREFIX);
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX);
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, DHTOpsView.MSGID_PREFIX);
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX);
if (NetworkAdmin.getSingleton().hasDHTIPV6()) {
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX + ".6");
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX + ".6");
}
if (Constants.isCVSVersion()) {
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX + ".cvs");
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX + ".cvs");
}
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, TagStatsView.MSGID_PREFIX);
uiManager.removeUIListener(this);
}
});
}
use of com.biglybt.ui.swt.pif.UISWTInstance in project BiglyBT by BiglySoftware.
the class SBC_ArchivedDownloadsView method initTable.
private void initTable(Composite control) {
UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uiFunctions != null) {
UISWTInstance pluginUI = uiFunctions.getUISWTInstance();
registerPluginViews(pluginUI);
}
if (tv == null) {
tv = TableViewFactory.createTableViewSWT(DownloadStub.class, TABLE_NAME, TABLE_NAME, new TableColumnCore[0], ColumnArchiveDLName.COLUMN_ID, SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
if (txtFilter != null) {
tv.enableFilterCheck(txtFilter, this);
}
tv.setRowDefaultHeightEM(1);
tv.setEnableTabViews(true, true, null);
table_parent = new Composite(control, SWT.BORDER);
table_parent.setLayoutData(Utils.getFilledFormData());
GridLayout layout = new GridLayout();
layout.marginHeight = layout.marginWidth = layout.verticalSpacing = layout.horizontalSpacing = 0;
table_parent.setLayout(layout);
tv.addMenuFillListener(this);
tv.addSelectionListener(this, false);
tv.initialize(table_parent);
tv.addCountChangeListener(new TableCountChangeListener() {
@Override
public void rowRemoved(TableRowCore row) {
}
@Override
public void rowAdded(TableRowCore row) {
if (datasource == row.getDataSource()) {
tv.setSelectedRows(new TableRowCore[] { row });
}
}
});
}
control.layout(true);
}
Aggregations