Search in sources :

Example 6 with MdiEntry

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);
        }
    }
}
Also used : BaseMdiEntry(com.biglybt.ui.swt.mdi.BaseMdiEntry) MdiEntry(com.biglybt.ui.mdi.MdiEntry) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface)

Example 7 with MdiEntry

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;
}
Also used : BaseMdiEntry(com.biglybt.ui.swt.mdi.BaseMdiEntry) MdiEntry(com.biglybt.ui.mdi.MdiEntry) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface) Point(org.eclipse.swt.graphics.Point)

Example 8 with MdiEntry

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);
                }
            }
        }
    });
}
Also used : MdiEntryOpenListener(com.biglybt.ui.mdi.MdiEntryOpenListener) BaseMdiEntry(com.biglybt.ui.swt.mdi.BaseMdiEntry) MdiEntry(com.biglybt.ui.mdi.MdiEntry) SideBarEntrySWT(com.biglybt.ui.swt.views.skin.sidebar.SideBarEntrySWT) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface)

Example 9 with MdiEntry

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);
}
Also used : MdiEntry(com.biglybt.ui.mdi.MdiEntry) ViewTitleInfo(com.biglybt.ui.common.viewtitleinfo.ViewTitleInfo)

Example 10 with MdiEntry

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;
}
Also used : MdiEntry(com.biglybt.ui.mdi.MdiEntry)

Aggregations

MdiEntry (com.biglybt.ui.mdi.MdiEntry)41 MultipleDocumentInterface (com.biglybt.ui.mdi.MultipleDocumentInterface)13 BaseMdiEntry (com.biglybt.ui.swt.mdi.BaseMdiEntry)11 MenuItem (com.biglybt.pif.ui.menus.MenuItem)4 ViewTitleInfo (com.biglybt.ui.common.viewtitleinfo.ViewTitleInfo)4 MdiCloseListener (com.biglybt.ui.mdi.MdiCloseListener)4 MultipleDocumentInterfaceSWT (com.biglybt.ui.swt.mdi.MultipleDocumentInterfaceSWT)4 UISWTViewEvent (com.biglybt.ui.swt.pif.UISWTViewEvent)4 UISWTViewEventListener (com.biglybt.ui.swt.pif.UISWTViewEventListener)4 ParameterListener (com.biglybt.core.config.ParameterListener)3 DownloadManager (com.biglybt.core.download.DownloadManager)3 PluginInterface (com.biglybt.pif.PluginInterface)3 UIPluginViewToolBarListener (com.biglybt.pif.ui.UIPluginViewToolBarListener)3 UIFunctions (com.biglybt.ui.UIFunctions)3 DownloadManagerPeerListener (com.biglybt.core.download.DownloadManagerPeerListener)2 PEPeer (com.biglybt.core.peer.PEPeer)2 PEPeerStats (com.biglybt.core.peer.PEPeerStats)2 UIManager (com.biglybt.pif.ui.UIManager)2 MenuItemListener (com.biglybt.pif.ui.menus.MenuItemListener)2 MenuManager (com.biglybt.pif.ui.menus.MenuManager)2