Search in sources :

Example 16 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 17 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 18 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 19 with MdiEntry

use of com.biglybt.ui.mdi.MdiEntry in project BiglyBT by BiglySoftware.

the class SubscriptionMDIEntry method setupMdiEntry.

private void setupMdiEntry() {
    if (mdiEntry == null) {
        return;
    }
    mdiEntry.setViewTitleInfo(this);
    mdiEntry.setImageLeftID("image.sidebar.subscriptions");
    warningImage = mdiEntry.addVitalityImage(ALERT_IMAGE_ID);
    spinnerImage = mdiEntry.addVitalityImage("image.sidebar.vitality.dots");
    if (spinnerImage != null) {
        spinnerImage.setVisible(false);
    }
    setWarning();
    setupMenus(subs, new Runnable() {

        @Override
        public void run() {
            SubscriptionMDIEntry.this.refreshView();
        }
    });
    subs.addListener(this);
    mdiEntry.addAcceleratorListener((character, mask) -> {
        if ((character == 'c' || character == 'C') && mask == MdiAcceleratorListener.SHIFT) {
            subs.getHistory().markAllResultsRead();
            return (true);
        } else {
            return (false);
        }
    });
    mdiEntry.addListener(new MdiCloseListener() {

        @Override
        public void mdiEntryClosed(MdiEntry entry, boolean userClosed) {
            subs.removeListener(SubscriptionMDIEntry.this);
        }
    });
}
Also used : MdiEntry(com.biglybt.ui.mdi.MdiEntry) BaseMdiEntry(com.biglybt.ui.swt.mdi.BaseMdiEntry) MdiCloseListener(com.biglybt.ui.mdi.MdiCloseListener)

Example 20 with MdiEntry

use of com.biglybt.ui.mdi.MdiEntry in project BiglyBT by BiglySoftware.

the class ChatMDIEntry method setupMdiEntry.

private void setupMdiEntry() {
    mdi_entry.setViewTitleInfo(this);
    MdiEntryDropListener drop_listener = new MdiEntryDropListener() {

        @Override
        public boolean mdiEntryDrop(MdiEntry entry, Object payload) {
            if (payload instanceof String[]) {
                String[] derp = (String[]) payload;
                if (derp.length > 0) {
                    payload = derp[0];
                }
            }
            if (!(payload instanceof String)) {
                return false;
            }
            MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
            if (mdi != null) {
                String drop = (String) payload;
                if (view == null) {
                    drop_outstanding = drop;
                } else {
                    view.handleDrop(drop);
                }
                mdi.showEntry(mdi_entry);
                return (true);
            } else {
                return (false);
            }
        }
    };
    mdi_entry.addListener(drop_listener);
    mdi_entry.addListener(new MdiCloseListener() {

        @Override
        public void mdiEntryClosed(MdiEntry entry, boolean user) {
            chat.removeListener(adapter);
            chat.destroy();
        }
    });
    /*
		UIManager ui_manager = PluginInitializer.getDefaultInterface().getUIManager();
		
		MenuManager menu_manager = ui_manager.getMenuManager();

		MenuItem menu_item;

		menu_item = menu_manager.addMenuItem( "sidebar." + mdi_entry.getId(), "dasd.ad.ad." );
		menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
		menu_item.addListener(
				new MenuItemListener() 
				{
					@Override
					public void
					selected(
						MenuItem menu, Object target ) 
					{
				      	
					}
				});
		*/
    mdi_entry.setImageLeftID("image.sidebar.chat-overview");
    chat.addListener(adapter);
}
Also used : MdiEntry(com.biglybt.ui.mdi.MdiEntry) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface) MdiCloseListener(com.biglybt.ui.mdi.MdiCloseListener) MdiEntryDropListener(com.biglybt.ui.mdi.MdiEntryDropListener)

Aggregations

MdiEntry (com.biglybt.ui.mdi.MdiEntry)40 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 ParameterListener (com.biglybt.core.config.ParameterListener)3 PluginInterface (com.biglybt.pif.PluginInterface)3 UISWTViewEvent (com.biglybt.ui.swt.pif.UISWTViewEvent)3 UISWTViewEventListener (com.biglybt.ui.swt.pif.UISWTViewEventListener)3 DownloadManager (com.biglybt.core.download.DownloadManager)2 UIManager (com.biglybt.pif.ui.UIManager)2 UIPluginViewToolBarListener (com.biglybt.pif.ui.UIPluginViewToolBarListener)2 MenuItemListener (com.biglybt.pif.ui.menus.MenuItemListener)2 MenuManager (com.biglybt.pif.ui.menus.MenuManager)2 UIFunctions (com.biglybt.ui.UIFunctions)2 UIUpdater (com.biglybt.ui.common.updater.UIUpdater)2 MdiEntryDropListener (com.biglybt.ui.mdi.MdiEntryDropListener)2 MdiListener (com.biglybt.ui.mdi.MdiListener)2