Search in sources :

Example 6 with UIPluginViewToolBarListener

use of com.biglybt.pif.ui.UIPluginViewToolBarListener in project BiglyBT by BiglySoftware.

the class SkinView method skinObjectCreated.

@Override
public Object skinObjectCreated(SWTSkinObject skinObject, Object params) {
    SkinViewManager.add(this);
    MultipleDocumentInterfaceSWT mdi = UIFunctionsManagerSWT.getUIFunctionsSWT().getMDISWT();
    if (mdi != null) {
        MdiEntry entry = mdi.getEntryFromSkinObject(skinObject);
        if (entry != null && (this instanceof UIPluginViewToolBarListener)) {
            entry.addToolbarEnabler((UIPluginViewToolBarListener) this);
        }
    }
    return super.skinObjectCreated(skinObject, params);
}
Also used : MdiEntry(com.biglybt.ui.mdi.MdiEntry) MultipleDocumentInterfaceSWT(com.biglybt.ui.swt.mdi.MultipleDocumentInterfaceSWT) UIPluginViewToolBarListener(com.biglybt.pif.ui.UIPluginViewToolBarListener)

Example 7 with UIPluginViewToolBarListener

use of com.biglybt.pif.ui.UIPluginViewToolBarListener in project BiglyBT by BiglySoftware.

the class MyTorrentsView method refreshToolBarItems.

@Override
public void refreshToolBarItems(Map<String, Long> list) {
    if (!isTableFocus()) {
        UISWTViewCore active_view = getActiveView();
        if (active_view != null) {
            UIPluginViewToolBarListener l = active_view.getToolBarListener();
            if (l != null) {
                Map<String, Long> activeViewList = new HashMap<>();
                l.refreshToolBarItems(activeViewList);
                if (activeViewList.size() > 0) {
                    list.putAll(activeViewList);
                    return;
                }
            }
        }
    }
}
Also used : UISWTViewCore(com.biglybt.ui.swt.pifimpl.UISWTViewCore) UIPluginViewToolBarListener(com.biglybt.pif.ui.UIPluginViewToolBarListener)

Example 8 with UIPluginViewToolBarListener

use of com.biglybt.pif.ui.UIPluginViewToolBarListener in project BiglyBT by BiglySoftware.

the class MyTorrentsView method toolBarItemActivated.

@Override
public boolean toolBarItemActivated(ToolBarItem item, long activationType, Object datasource) {
    boolean isTableSelected = false;
    if (tv instanceof TableViewImpl) {
        isTableSelected = ((TableViewImpl) tv).isTableSelected();
    }
    if (!isTableSelected) {
        UISWTViewCore active_view = getActiveView();
        if (active_view != null) {
            UIPluginViewToolBarListener l = active_view.getToolBarListener();
            if (l != null && l.toolBarItemActivated(item, activationType, datasource)) {
                return true;
            }
        }
        return false;
    }
    String itemKey = item.getID();
    if (activationType == UIToolBarActivationListener.ACTIVATIONTYPE_HELD) {
        if (itemKey.equals("up")) {
            moveSelectedTorrentsTop();
            return true;
        }
        if (itemKey.equals("down")) {
            moveSelectedTorrentsEnd();
            return true;
        }
        return false;
    }
    if (activationType != UIToolBarActivationListener.ACTIVATIONTYPE_NORMAL) {
        return false;
    }
    if (itemKey.equals("top")) {
        moveSelectedTorrentsTop();
        return true;
    }
    if (itemKey.equals("bottom")) {
        moveSelectedTorrentsEnd();
        return true;
    }
    if (itemKey.equals("up")) {
        moveSelectedTorrentsUp();
        return true;
    }
    if (itemKey.equals("down")) {
        moveSelectedTorrentsDown();
        return true;
    }
    if (itemKey.equals("run")) {
        TorrentUtil.runDataSources(tv.getSelectedDataSources().toArray());
        return true;
    }
    if (itemKey.equals("start")) {
        TorrentUtil.queueDataSources(tv.getSelectedDataSources().toArray(), false);
        return true;
    }
    if (itemKey.equals("stop")) {
        TorrentUtil.stopDataSources(tv.getSelectedDataSources().toArray());
        return true;
    }
    if (itemKey.equals("startstop")) {
        TorrentUtil.stopOrStartDataSources(tv.getSelectedDataSources().toArray(), false);
        return true;
    }
    if (itemKey.equals("remove")) {
        TorrentUtil.removeDataSources(tv.getSelectedDataSources().toArray());
        return true;
    }
    return false;
}
Also used : TableViewImpl(com.biglybt.ui.common.table.impl.TableViewImpl) UISWTViewCore(com.biglybt.ui.swt.pifimpl.UISWTViewCore) UIPluginViewToolBarListener(com.biglybt.pif.ui.UIPluginViewToolBarListener)

Example 9 with UIPluginViewToolBarListener

use of com.biglybt.pif.ui.UIPluginViewToolBarListener in project BiglyBT by BiglySoftware.

the class SBC_AllTrackersView method toolBarItemActivated.

@Override
public boolean toolBarItemActivated(ToolBarItem item, long activationType, Object datasource) {
    boolean isTableSelected = false;
    if (tv instanceof TableViewImpl) {
        isTableSelected = ((TableViewImpl) tv).isTableSelected();
    }
    if (!isTableSelected) {
        UISWTViewCore active_view = getActiveView();
        if (active_view != null) {
            UIPluginViewToolBarListener l = active_view.getToolBarListener();
            if (l != null && l.toolBarItemActivated(item, activationType, datasource)) {
                return true;
            }
        }
        return false;
    }
    if (tv == null || !tv.isVisible()) {
        return (false);
    }
    boolean didSomething = false;
    List<Object> datasources = tv.getSelectedDataSources();
    for (Object o : datasources) {
        AllTrackersViewEntry entry = (AllTrackersViewEntry) o;
        String id = item.getID();
        if (id.equals("remove")) {
            entry.remove();
            didSomething = true;
        }
    }
    return (didSomething);
}
Also used : TableViewImpl(com.biglybt.ui.common.table.impl.TableViewImpl) UISWTViewCore(com.biglybt.ui.swt.pifimpl.UISWTViewCore) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) UIPluginViewToolBarListener(com.biglybt.pif.ui.UIPluginViewToolBarListener)

Aggregations

UIPluginViewToolBarListener (com.biglybt.pif.ui.UIPluginViewToolBarListener)9 UISWTViewCore (com.biglybt.ui.swt.pifimpl.UISWTViewCore)4 TableViewImpl (com.biglybt.ui.common.table.impl.TableViewImpl)3 MultipleDocumentInterfaceSWT (com.biglybt.ui.swt.mdi.MultipleDocumentInterfaceSWT)3 MdiEntrySWT (com.biglybt.ui.swt.mdi.MdiEntrySWT)2 DiskManagerFileInfo (com.biglybt.core.disk.DiskManagerFileInfo)1 DownloadManager (com.biglybt.core.download.DownloadManager)1 DownloadManagerListener (com.biglybt.core.download.DownloadManagerListener)1 AERunnableBoolean (com.biglybt.core.util.AERunnableBoolean)1 UIToolBarEnablerBase (com.biglybt.pif.ui.toolbar.UIToolBarEnablerBase)1 MdiEntry (com.biglybt.ui.mdi.MdiEntry)1 ISelectedContent (com.biglybt.ui.selectedcontent.ISelectedContent)1 ISelectedVuzeFileContent (com.biglybt.ui.selectedcontent.ISelectedVuzeFileContent)1 UIFunctionsSWT (com.biglybt.ui.swt.UIFunctionsSWT)1 SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)1 ArrayList (java.util.ArrayList)1