use of com.biglybt.ui.mdi.MdiEntry in project BiglyBT by BiglySoftware.
the class UIFunctionsImpl method closeAllDetails.
// @see UIFunctionsSWT#closeAllDetails()
@Override
public void closeAllDetails() {
MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
if (mdi == null) {
return;
}
MdiEntry[] sideBarEntries = mdi.getEntries();
for (MdiEntry entry : sideBarEntries) {
String id = entry.getViewID();
if (id.startsWith("DMDetails_")) {
mdi.closeEntryByID(id);
}
}
}
use of com.biglybt.ui.mdi.MdiEntry in project BiglyBT by BiglySoftware.
the class UIFunctionsImpl method hasDetailViews.
// @see UIFunctionsSWT#hasDetailViews()
@Override
public boolean hasDetailViews() {
MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
if (mdi == null) {
return false;
}
MdiEntry[] sideBarEntries = mdi.getEntries();
for (int i = 0; i < sideBarEntries.length; i++) {
MdiEntry entry = sideBarEntries[i];
String id = entry.getViewID();
if (id != null && id.startsWith("DMDetails_")) {
return true;
}
}
return false;
}
use of com.biglybt.ui.mdi.MdiEntry in project BiglyBT by BiglySoftware.
the class UIFunctionsImpl method showURL.
/**
* @param url
* @param target
*/
private void showURL(final String url, String target) {
if ("_blank".equalsIgnoreCase(target)) {
Utils.launch(url);
return;
}
if (target.startsWith("tab-")) {
target = target.substring(4);
}
MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
// by the caller
if (mdi == null || !mdi.showEntryByID(target)) {
Utils.launch(url);
return;
}
MdiEntry entry = mdi.getEntry(target);
entry.addListener(new MdiEntryOpenListener() {
@Override
public void mdiEntryOpen(MdiEntry entry) {
entry.removeListener(this);
mainWindow.setVisible(true, true);
if (!(entry instanceof SideBarEntrySWT)) {
return;
}
SideBarEntrySWT entrySWT = (SideBarEntrySWT) entry;
SWTSkinObjectBrowser soBrowser = SWTSkinUtils.findBrowserSO(entrySWT.getSkinObject());
if (soBrowser != null) {
// ((SWTSkinObjectBrowser) skinObject).getBrowser().setVisible(false);
if (url == null || url.length() == 0) {
soBrowser.restart();
} else {
soBrowser.setURL(url);
}
}
}
});
}
use of com.biglybt.ui.mdi.MdiEntry in project BiglyBT by BiglySoftware.
the class SB_Discovery method setupHeader.
private void setupHeader(final MdiEntry entry) {
ViewTitleInfo titleInfo = new ViewTitleInfo() {
@Override
public Object getTitleInfoProperty(int propertyID) {
if (propertyID == TITLE_INDICATOR_TEXT) {
if (entry.isExpanded()) {
return null;
}
StringBuilder sb = new StringBuilder();
MdiEntry[] entries = entry.getMDI().getEntries();
for (MdiEntry subEntry : entries) {
if (subEntry.getViewID().startsWith("Subscription_")) {
continue;
}
if (entry.getViewID().equals(subEntry.getParentID())) {
ViewTitleInfo titleInfo = subEntry.getViewTitleInfo();
if (titleInfo != null) {
Object text = titleInfo.getTitleInfoProperty(TITLE_INDICATOR_TEXT);
if (text instanceof String) {
if (sb.length() > 0) {
sb.append(" | ");
}
sb.append(text);
}
}
}
}
if (sb.length() > 0) {
return sb.toString();
}
} else if (propertyID == TITLE_INDICATOR_TEXT_TOOLTIP) {
if (entry.isExpanded()) {
return null;
}
StringBuilder sb = new StringBuilder();
MdiEntry[] entries = entry.getMDI().getEntries();
for (MdiEntry subEntry : entries) {
if (entry.getViewID().equals(subEntry.getParentID())) {
ViewTitleInfo titleInfo = subEntry.getViewTitleInfo();
if (titleInfo != null) {
Object text = titleInfo.getTitleInfoProperty(TITLE_INDICATOR_TEXT);
if (text instanceof String) {
if (sb.length() > 0) {
sb.append("\n");
}
sb.append(subEntry.getTitle()).append(": ").append(text);
}
}
}
}
if (sb.length() > 0) {
return sb.toString();
}
}
return null;
}
};
entry.setViewTitleInfo(titleInfo);
}
use of com.biglybt.ui.mdi.MdiEntry in project BiglyBT by BiglySoftware.
the class SideBar method closeEntryByID.
@Override
public BaseMdiEntry closeEntryByID(String id, boolean user_initiated) {
MdiEntry currentBeforeClose = getCurrentEntry();
BaseMdiEntry entry = super.closeEntryByID(id, user_initiated);
if (entry == null || Utils.isDisplayDisposed()) {
return entry;
}
String next = null;
synchronized (entryViewHistory) {
entryViewHistory.remove(id);
if (currentBeforeClose == null) {
return entry;
}
if (currentBeforeClose != null && currentBeforeClose != entry) {
// Skip finding next in list
return entry;
}
while (!entryViewHistory.isEmpty()) {
next = entryViewHistory.pop();
if (entryExists(next)) {
break;
} else {
next = null;
}
}
}
if (next == null) {
// OSX doesn't select a treeitem after closing an existing one
// Force selection
next = SideBar.SIDEBAR_SECTION_LIBRARY;
}
showEntryByID(next);
return entry;
}
Aggregations