use of com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore in project BiglyBT by BiglySoftware.
the class FilesView method registerPluginViews.
private static void registerPluginViews() {
ViewManagerSWT vm = ViewManagerSWT.getInstance();
if (vm.areCoreViewsRegistered(PLUGIN_DS_TYPE)) {
return;
}
vm.registerView(PLUGIN_DS_TYPE, new UISWTViewBuilderCore("FileInfoView", null, FileInfoView.class));
vm.setCoreViewsRegistered(PLUGIN_DS_TYPE);
}
use of com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore in project BiglyBT by BiglySoftware.
the class SubscriptionManagerUI method setupSideBar.
protected void setupSideBar(final UISWTInstance swt_ui) {
MultipleDocumentInterfaceSWT mdi = UIFunctionsManagerSWT.getUIFunctionsSWT().getMDISWT();
if (mdi == null) {
return;
}
if (sidebar_setup_done && (mdiEntryOverview == null || mdiEntryOverview.isEntryDisposed())) {
sidebar_setup_done = false;
}
mdiEntryOverview = mdi.createEntry(new UISWTViewBuilderCore(MultipleDocumentInterface.SIDEBAR_SECTION_SUBSCRIPTIONS, null, SubscriptionsView.class).setParentEntryID(MultipleDocumentInterface.SIDEBAR_HEADER_DISCOVERY).setPreferredAfterID("~" + MultipleDocumentInterface.SIDEBAR_SECTION_CHAT), false);
if (mdiEntryOverview == null) {
return;
}
mdiEntryOverview.setDefaultExpanded(true);
synchronized (this) {
if (sidebar_setup_done) {
return;
}
sidebar_setup_done = true;
}
mdiEntryOverview.setImageLeftID("image.sidebar.subscriptions");
setupHeader(mdi, mdiEntryOverview);
String parentID = "sidebar." + MultipleDocumentInterface.SIDEBAR_SECTION_SUBSCRIPTIONS;
MenuManager menu_manager = ui_manager.getMenuManager();
MenuItem mi = menu_manager.addMenuItem(parentID, "menu.update.all.now");
mi.setDisposeWithUIDetach(UIInstance.UIT_SWT);
mi.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
SubscriptionManager subs_man = SubscriptionManagerFactory.getSingleton();
SubscriptionScheduler sched = subs_man.getScheduler();
Subscription[] subs = subs_man.getSubscriptions(true);
for (Subscription sub : subs) {
if (!sub.isSearchTemplate()) {
try {
sched.downloadAsync(sub, false);
} catch (Throwable e) {
Debug.out(e);
}
// }
}
}
}
});
mi = menu_manager.addMenuItem(parentID, "sep1");
mi.setDisposeWithUIDetach(UIInstance.UIT_SWT);
mi.setStyle(MenuItem.STYLE_SEPARATOR);
mi = menu_manager.addMenuItem(parentID, "MainWindow.menu.view.configuration");
mi.setDisposeWithUIDetach(UIInstance.UIT_SWT);
mi.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
UIFunctions uif = UIFunctionsManager.getUIFunctions();
if (uif != null) {
uif.getMDI().showEntryByID(MultipleDocumentInterface.SIDEBAR_SECTION_CONFIG, CONFIG_SECTION_ID);
}
}
});
}
use of com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore in project BiglyBT by BiglySoftware.
the class SubscriptionManagerUI method createSubscriptionMdiEntry.
private MdiEntry createSubscriptionMdiEntry(final Subscription subs) {
if (!subs.isSubscribed()) {
return null;
}
MultipleDocumentInterfaceSWT mdi = UIFunctionsManagerSWT.getUIFunctionsSWT().getMDISWT();
if (mdi == null) {
return (null);
}
String parent_name = subs.getParent();
if (parent_name != null && parent_name.length() == 0) {
parent_name = null;
}
final String key = getKey(subs);
String subs_name = subs.getName();
TreeMap<String, String> name_map = new TreeMap<String, String>(new FormattersImpl().getAlphanumericComparator(true));
name_map.put(subs_name, key);
MdiEntry[] existing = mdi.getEntries();
for (MdiEntry e : existing) {
String id = e.getViewID();
if (id.startsWith("Subscription_")) {
Object ds = e.getDataSource();
if (ds instanceof Subscription) {
String sp = ((Subscription) ds).getParent();
if (sp != null && sp.length() == 0) {
sp = null;
}
if (sp == parent_name || (sp != null && parent_name != null && sp.equals(parent_name))) {
name_map.put(e.getTitle(), id);
}
}
}
}
String prev_id = null;
for (String this_id : name_map.values()) {
if (this_id == key) {
break;
}
prev_id = this_id;
}
if (prev_id == null && name_map.size() > 1) {
Iterator<String> it = name_map.values().iterator();
it.next();
prev_id = "~" + it.next();
}
MdiEntry entry;
if (parent_name == null || parent_name.length() == 0) {
entry = mdi.createEntry(new UISWTViewBuilderCore(key, null, SubscriptionView.class).setParentEntryID(MultipleDocumentInterface.SIDEBAR_SECTION_SUBSCRIPTIONS).setInitialDatasource(subs).setPreferredAfterID(prev_id), true);
} else {
MdiEntry parent_entry;
synchronized (parent_views) {
parent_entry = parent_views.get(parent_name);
if (parent_entry == null) {
SubsParentView parent = new SubsParentView(parent_name);
String parent_key = getParentKey(parent_name);
String parent_prev_id = null;
parent_views.put(parent_name, parent_entry);
String parent_prev = null;
for (String pn : parent_views.keySet()) {
if (pn == parent_name) {
break;
}
parent_prev = pn;
}
boolean is_before;
if (parent_prev == null && parent_views.size() > 1) {
Iterator<String> it = parent_views.keySet().iterator();
it.next();
parent_prev = it.next();
is_before = true;
} else {
is_before = false;
}
if (parent_prev != null) {
parent_prev_id = getParentKey(parent_prev);
if (is_before) {
parent_prev_id = "~" + parent_prev_id;
}
}
parent_entry = mdi.createEntryFromSkinRef(MultipleDocumentInterface.SIDEBAR_SECTION_SUBSCRIPTIONS, parent_key, null, parent_name, parent, null, false, parent_prev_id);
}
}
entry = mdi.createEntry(new UISWTViewBuilderCore(key, null, SubscriptionView.class).setParentEntryID(parent_entry.getViewID()).setInitialDatasource(subs), true);
}
// This sets up the entry (menu, etc)
SubscriptionMDIEntry entryInfo = new SubscriptionMDIEntry(subs, entry);
subs.setUserData(SUB_ENTRYINFO_KEY, entryInfo);
entry.addListener(new MdiCloseListener() {
@Override
public void mdiEntryClosed(MdiEntry entry, boolean userClosed) {
subs.setUserData(SUB_ENTRYINFO_KEY, null);
}
});
return entry;
}
use of com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore in project BiglyBT by BiglySoftware.
the class SBC_LibraryTableView method initShow.
public void initShow(Core core) {
Object tfm = soParent.getControl().getData("TorrentFilterMode");
if (tfm instanceof Long) {
torrentFilterMode = (int) ((Long) tfm).longValue();
}
initialDataSource = soParent.getControl().getData("DataSource");
boolean useBigTable = useBigTable();
SWTSkinObjectTextbox soFilter = (SWTSkinObjectTextbox) skin.getSkinObject("library-filter", soParent.getParent());
BubbleTextBox txtFilter = soFilter == null ? null : soFilter.getBubbleTextBox();
SWTSkinObjectContainer soCats = (SWTSkinObjectContainer) skin.getSkinObject("library-categories", soParent.getParent());
Composite cCats = soCats == null ? null : soCats.getComposite();
if (useBigTable) {
if (torrentFilterMode == SBC_LibraryView.TORRENTS_COMPLETE || torrentFilterMode == SBC_LibraryView.TORRENTS_INCOMPLETE || torrentFilterMode == SBC_LibraryView.TORRENTS_UNOPENED) {
swtViewListener = torrentView = new MyTorrentsView_Big(core, torrentFilterMode, initialDataSource, getColumnsSupport(), txtFilter, cCats);
} else {
swtViewListener = torrentView = new MyTorrentsView_Big(core, torrentFilterMode, initialDataSource, getColumnsSupport(), txtFilter, cCats);
}
} else {
String tableID = SB_Transfers.getTableIdFromFilterMode(torrentFilterMode, false, initialDataSource);
if (torrentFilterMode == SBC_LibraryView.TORRENTS_COMPLETE) {
swtViewListener = torrentView = new MyTorrentsView(core, tableID, true, getColumnsSupport(), txtFilter, cCats, true);
} else if (torrentFilterMode == SBC_LibraryView.TORRENTS_INCOMPLETE) {
swtViewListener = torrentView = new MyTorrentsView(core, tableID, false, getColumnsSupport(), txtFilter, cCats, true);
} else if (torrentFilterMode == SBC_LibraryView.TORRENTS_UNOPENED) {
swtViewListener = torrentView = new MyTorrentsView(core, tableID, true, getColumnsSupport(), txtFilter, cCats, true) {
@Override
public boolean isOurDownloadManager(DownloadManager dm) {
if (PlatformTorrentUtils.getHasBeenOpened(dm)) {
return false;
}
return super.isOurDownloadManager(dm);
}
};
} else {
if (Utils.getBaseViewID(tableID).equals(TableManager.TABLE_MYTORRENTS_ALL_SMALL)) {
swtViewListener = torrentView = new MyTorrentsView_Small(core, torrentFilterMode, initialDataSource, getColumnsSupport(), txtFilter, cCats);
} else {
swtViewListener = new MyTorrentsSuperView(txtFilter, cCats, initialDataSource) {
@Override
public void initializeDone() {
MyTorrentsView seedingview = getSeedingview();
if (seedingview != null) {
seedingview.overrideDefaultSelected(new TableSelectionAdapter() {
@Override
public void defaultSelected(TableRowCore[] rows, int stateMask, int origin) {
doDefaultClick(rows, stateMask, false, origin);
}
});
MyTorrentsView torrentview = getTorrentview();
if (torrentview != null) {
torrentview.overrideDefaultSelected(new TableSelectionAdapter() {
@Override
public void defaultSelected(TableRowCore[] rows, int stateMask, int origin) {
doDefaultClick(rows, stateMask, false, origin);
}
});
}
}
}
};
}
}
if (torrentView != null) {
torrentView.overrideDefaultSelected(new TableSelectionAdapter() {
@Override
public void defaultSelected(TableRowCore[] rows, int stateMask, int origin) {
doDefaultClick(rows, stateMask, false, origin);
}
});
}
}
if (torrentView != null) {
tv = torrentView.getTableView();
if (torrentFilterMode == SBC_LibraryView.TORRENTS_UNOPENED) {
torrentView.setRebuildListOnFocusGain(true);
}
}
try {
UISWTViewBuilderCore builder = new UISWTViewBuilderCore(ID + torrentFilterMode, null, swtViewListener).setInitialDatasource(initialDataSource);
view = new UISWTViewImpl(builder, true);
view.setDestroyOnDeactivate(false);
} catch (Exception e) {
Debug.out(e);
}
SWTSkinObjectContainer soContents = new SWTSkinObjectContainer(skin, skin.getSkinProperties(), getUpdateUIName(), "", soMain);
skin.layout();
viewComposite = soContents.getComposite();
viewComposite.setLayoutData(Utils.getFilledFormData());
GridLayout gridLayout = new GridLayout();
gridLayout.horizontalSpacing = gridLayout.verticalSpacing = gridLayout.marginHeight = gridLayout.marginWidth = 0;
viewComposite.setLayout(gridLayout);
view.initialize(viewComposite);
if (torrentFilterMode == SBC_LibraryView.TORRENTS_ALL && tv != null) {
tv.addRefreshListener(new TableRowRefreshListener() {
@Override
public void rowRefresh(TableRow row) {
TableRowSWT rowCore = (TableRowSWT) row;
Object ds = rowCore.getDataSource(true);
if (!(ds instanceof DownloadManager)) {
return;
}
DownloadManager dm = (DownloadManager) ds;
boolean changed = false;
boolean assumedComplete = dm.getAssumedComplete();
if (!assumedComplete) {
changed |= rowCore.setAlpha(160);
} else if (!PlatformTorrentUtils.getHasBeenOpened(dm)) {
changed |= rowCore.setAlpha(255);
} else {
changed |= rowCore.setAlpha(255);
}
}
});
}
viewComposite.getParent().layout(true);
}
use of com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore in project BiglyBT by BiglySoftware.
the class SBC_AllTrackersView method registerPluginViews.
private static void registerPluginViews() {
ViewManagerSWT vm = ViewManagerSWT.getInstance();
if (vm.areCoreViewsRegistered(PLUGIN_DS_TYPE)) {
return;
}
vm.registerView(PLUGIN_DS_TYPE, new UISWTViewBuilderCore(MyTorrentsSubView.MSGID_PREFIX, null, MyTorrentsSubView.class));
vm.setCoreViewsRegistered(PLUGIN_DS_TYPE);
}
Aggregations