Search in sources :

Example 1 with VuzeListener

use of com.biglybt.ui.swt.browser.listener.VuzeListener in project BiglyBT by BiglySoftware.

the class SWTSkinObjectBrowser method init.

public void init() {
    if (browser != null && !browser.isDisposed()) {
        return;
    }
    try {
        browser = BrowserWrapper.createBrowser(cArea, SWT.NONE);
        browser.setLayoutData(Utils.getFilledFormData());
        browser.getParent().layout(true);
    } catch (SWTError e) {
        System.err.println("Browser: " + e.toString());
        return;
    }
    Control widgetIndicator = null;
    String sIndicatorWidgetID = properties.getStringValue(sConfigID + ".indicator");
    if (sIndicatorWidgetID != null) {
        SWTSkinObject skinObjectIndicator = skin.getSkinObjectByID(sIndicatorWidgetID);
        if (skinObjectIndicator != null) {
            widgetIndicator = skinObjectIndicator.getControl();
        }
    }
    String browserID = properties.getStringValue(sConfigID + ".view");
    if (browserID == null) {
        browserID = sID;
    }
    forceVisibleAfterLoad = properties.getBooleanValue(sConfigID + ".forceVisibleAfterLoad", true);
    context = new BrowserContext(browserID, browser, widgetIndicator, forceVisibleAfterLoad);
    if (autoReloadPending) {
        context.setAutoReloadPending(autoReloadPending, false);
    }
    boolean noListeners = properties.getBooleanValue(sConfigID + ".browser.nolisteners", false);
    if (!noListeners) {
        context.addMessageListener(new TorrentListener());
        context.addMessageListener(new VuzeListener());
        context.addMessageListener(new DisplayListener());
        context.addMessageListener(new ConfigListener(browser));
    }
    boolean popouts = properties.getBooleanValue(sConfigID + ".browser.allowPopouts", true);
    context.setAllowPopups(popouts);
    String[] whitelist_urls = properties.getStringArray(sConfigID + ".browser.popoutWhitelist", null);
    if (whitelist_urls != null) {
        context.setPopoutWhitelist(whitelist_urls);
    }
    String[] blacklist_urls = properties.getStringArray(sConfigID + ".browser.popoutBlacklist", null);
    if (blacklist_urls != null) {
        context.setPopoutBlacklist(blacklist_urls);
    }
    context.addListener(new BrowserContext.loadingListener() {

        @Override
        public void browserLoadingChanged(boolean loading, String url) {
            if (loading && browser.isVisible()) {
                // hack so search results page doesn't clear cur selected
                if (UrlFilter.getInstance().urlCanRPC(url)) {
                    SelectedContentManager.clearCurrentlySelectedContent();
                }
            }
        }
    });
    String url = urlToUse != null ? urlToUse : sStartURL != null ? sStartURL : properties.getStringValue(sConfigID + ".url", (String) null);
    if (url != null) {
        setURL(url);
    }
}
Also used : SWTError(org.eclipse.swt.SWTError) TorrentListener(com.biglybt.ui.swt.browser.listener.TorrentListener) DisplayListener(com.biglybt.ui.swt.browser.listener.DisplayListener) VuzeListener(com.biglybt.ui.swt.browser.listener.VuzeListener) BrowserContext(com.biglybt.ui.swt.browser.BrowserContext) ConfigListener(com.biglybt.ui.swt.browser.listener.ConfigListener)

Example 2 with VuzeListener

use of com.biglybt.ui.swt.browser.listener.VuzeListener in project BiglyBT by BiglySoftware.

the class Initializer method initializePlatformClientMessageContext.

/**
 * @since 3.0.5.3
 */
private void initializePlatformClientMessageContext() {
    ClientMessageContext clientMsgContext = PlatformMessenger.getClientMessageContext();
    if (clientMsgContext != null) {
        clientMsgContext.setMessageDispatcher(new MessageDispatcherSWT(clientMsgContext));
        clientMsgContext.addMessageListener(new TorrentListener());
        clientMsgContext.addMessageListener(new VuzeListener());
        clientMsgContext.addMessageListener(new DisplayListener());
        clientMsgContext.addMessageListener(new ConfigListener(null));
    }
}
Also used : ClientMessageContext(com.biglybt.core.messenger.ClientMessageContext) TorrentListener(com.biglybt.ui.swt.browser.listener.TorrentListener) VuzeListener(com.biglybt.ui.swt.browser.listener.VuzeListener) DisplayListener(com.biglybt.ui.swt.browser.listener.DisplayListener) ConfigListener(com.biglybt.ui.swt.browser.listener.ConfigListener) MessageDispatcherSWT(com.biglybt.ui.swt.browser.msg.MessageDispatcherSWT)

Aggregations

ConfigListener (com.biglybt.ui.swt.browser.listener.ConfigListener)2 DisplayListener (com.biglybt.ui.swt.browser.listener.DisplayListener)2 TorrentListener (com.biglybt.ui.swt.browser.listener.TorrentListener)2 VuzeListener (com.biglybt.ui.swt.browser.listener.VuzeListener)2 ClientMessageContext (com.biglybt.core.messenger.ClientMessageContext)1 BrowserContext (com.biglybt.ui.swt.browser.BrowserContext)1 MessageDispatcherSWT (com.biglybt.ui.swt.browser.msg.MessageDispatcherSWT)1 SWTError (org.eclipse.swt.SWTError)1