Search in sources :

Example 1 with UISWTInstance

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

the class SBC_TagsOverview method initTable.

/**
 * @param control
 *
 * @since 4.6.0.5
 */
private void initTable(Composite control) {
    UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
    if (uiFunctions != null) {
        UISWTInstance pluginUI = uiFunctions.getUISWTInstance();
        registerPluginViews(pluginUI);
    }
    if (tv == null) {
        tv = TableViewFactory.createTableViewSWT(Tag.class, TABLE_TAGS, TABLE_TAGS, new TableColumnCore[0], ColumnTagName.COLUMN_ID, SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
        if (txtFilter != null) {
            tv.enableFilterCheck(txtFilter, this);
        }
        tv.setRowDefaultHeightEM(1);
        tv.setEnableTabViews(true, true, null);
        table_parent = new Composite(control, SWT.BORDER);
        table_parent.setLayoutData(Utils.getFilledFormData());
        GridLayout layout = new GridLayout();
        layout.marginHeight = layout.marginWidth = layout.verticalSpacing = layout.horizontalSpacing = 0;
        table_parent.setLayout(layout);
        table_parent.addListener(SWT.Activate, new Listener() {

            @Override
            public void handleEvent(Event event) {
                // viewActive = true;
                updateSelectedContent();
            }
        });
        /*
			table_parent.addListener(SWT.Deactivate, new Listener() {
				public void handleEvent(Event event) {
					//viewActive = false;
					// don't updateSelectedContent() because we may have switched
					// to a button or a text field, and we still want out content to be
					// selected
				}
			})
			*/
        tv.addMenuFillListener(this);
        tv.addSelectionListener(this, false);
        tv.initialize(table_parent);
        tv.addCountChangeListener(new TableCountChangeListener() {

            @Override
            public void rowRemoved(TableRowCore row) {
            }

            @Override
            public void rowAdded(TableRowCore row) {
                if (datasource == row.getDataSource()) {
                    tv.setSelectedRows(new TableRowCore[] { row });
                }
            }
        });
    }
    control.layout(true);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) UIManagerListener(com.biglybt.pif.ui.UIManagerListener) UserPrompterResultListener(com.biglybt.ui.UserPrompterResultListener) UIPluginViewToolBarListener(com.biglybt.pif.ui.UIPluginViewToolBarListener) TableViewSWTMenuFillListener(com.biglybt.ui.swt.views.table.TableViewSWTMenuFillListener) TableColumnCreationListener(com.biglybt.pif.ui.tables.TableColumnCreationListener) UIFunctionsSWT(com.biglybt.ui.swt.UIFunctionsSWT) UISWTInstance(com.biglybt.ui.swt.pif.UISWTInstance)

Example 2 with UISWTInstance

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

the class SBC_TagsOverview method registerPluginViews.

private void registerPluginViews(final UISWTInstance pluginUI) {
    if (registeredCoreSubViews) {
        return;
    }
    pluginUI.addView(TABLE_TAGS, "TagSettingsView", TagSettingsView.class, null);
    pluginUI.addView(TABLE_TAGS, "MyTorrentsSubView", MyTorrentsSubView.class, null);
    registeredCoreSubViews = true;
    final UIManager uiManager = PluginInitializer.getDefaultInterface().getUIManager();
    uiManager.addUIListener(new UIManagerListener() {

        @Override
        public void UIAttached(UIInstance instance) {
        }

        @Override
        public void UIDetached(UIInstance instance) {
            if (!(instance instanceof UISWTInstance)) {
                return;
            }
            registeredCoreSubViews = false;
            pluginUI.removeViews(TABLE_TAGS, "TagSettingsView");
            pluginUI.removeViews(TABLE_TAGS, "MyTorrentsSubView");
            uiManager.removeUIListener(this);
        }
    });
}
Also used : UIManager(com.biglybt.pif.ui.UIManager) UISWTInstance(com.biglybt.ui.swt.pif.UISWTInstance) UIManagerListener(com.biglybt.pif.ui.UIManagerListener) UIInstance(com.biglybt.pif.ui.UIInstance)

Example 3 with UISWTInstance

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

the class SBC_TorrentDetailsView method initialize.

private void initialize(Composite composite) {
    Composite main_area = new Composite(composite, SWT.NULL);
    main_area.setLayout(new FormLayout());
    // Color bg_color = ColorCache.getColor(composite.getDisplay(), "#c0cbd4");
    UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
    this.parent = composite;
    if (tabbedMDI == null) {
        tabbedMDI = uiFunctions.createTabbedMDI(main_area, "detailsview");
    } else {
        System.out.println("ManagerView::initialize : folder isn't null !!!");
    }
    if (composite.getLayout() instanceof FormLayout) {
        main_area.setLayoutData(Utils.getFilledFormData());
    } else if (composite.getLayout() instanceof GridLayout) {
        main_area.setLayoutData(new GridData(GridData.FILL_BOTH));
    }
    composite.layout();
    // Call plugin listeners
    if (uiFunctions != null) {
        UISWTInstance pluginUI = uiFunctions.getUISWTInstance();
        if (pluginUI != null) {
            MyTorrentsView.registerPluginViews(pluginUI);
            for (String id : new String[] { UISWTInstance.VIEW_MYTORRENTS, UISWTInstance.VIEW_TORRENT_DETAILS }) {
                UISWTViewEventListenerWrapper[] pluginViews = pluginUI.getViewListeners(id);
                for (UISWTViewEventListenerWrapper l : pluginViews) {
                    if (id == UISWTInstance.VIEW_MYTORRENTS && l.getViewID() == PieceInfoView.MSGID_PREFIX) {
                        // Simple hack to exlude PieceInfoView tab as it's already within Pieces View
                        continue;
                    }
                    if (l != null) {
                        try {
                            tabbedMDI.createEntryFromEventListener(null, UISWTInstance.VIEW_TORRENT_DETAILS, l, l.getViewID(), false, manager, null);
                        } catch (Throwable e) {
                            Debug.out(e);
                        }
                    }
                }
            }
        }
    }
    SelectedContentManager.addCurrentlySelectedContentListener(this);
    tabbedMDI.addListener(new MdiSWTMenuHackListener() {

        @Override
        public void menuWillBeShown(MdiEntry entry, Menu menuTree) {
            menuTree.setData("downloads", new DownloadManager[] { manager });
            menuTree.setData("is_detailed_view", true);
            MenuFactory.buildTorrentMenu(menuTree);
        }
    });
    if (dataSource instanceof Object[] && ((Object[]) dataSource)[0] instanceof PEPeer) {
        tabbedMDI.showEntryByID(PeersView.MSGID_PREFIX);
    } else {
        MdiEntry[] entries = tabbedMDI.getEntries();
        if (entries.length > 0) {
            tabbedMDI.showEntry(entries[0]);
        }
    }
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) PEPeer(com.biglybt.core.peer.PEPeer) Composite(org.eclipse.swt.widgets.Composite) UIFunctionsSWT(com.biglybt.ui.swt.UIFunctionsSWT) DownloadManager(com.biglybt.core.download.DownloadManager) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) UISWTViewEventListenerWrapper(com.biglybt.ui.swt.pif.UISWTInstance.UISWTViewEventListenerWrapper) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) UISWTInstance(com.biglybt.ui.swt.pif.UISWTInstance) Menu(org.eclipse.swt.widgets.Menu)

Example 4 with UISWTInstance

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

the class StatsView method registerPluginViews.

private void registerPluginViews(final UISWTInstance pluginUI) {
    if (pluginUI == null || registeredCoreSubViews) {
        return;
    }
    pluginUI.addView(UISWTInstance.VIEW_STATISTICS, ActivityView.MSGID_PREFIX, ActivityView.class, null);
    pluginUI.addView(UISWTInstance.VIEW_STATISTICS, TransferStatsView.MSGID_PREFIX, TransferStatsView.class, null);
    pluginUI.addView(UISWTInstance.VIEW_STATISTICS, CacheView.MSGID_PREFIX, CacheView.class, null);
    pluginUI.addView(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX, DHTView.class, DHTView.DHT_TYPE_MAIN);
    pluginUI.addView(UISWTInstance.VIEW_STATISTICS, DHTOpsView.MSGID_PREFIX, DHTOpsView.class, DHTOpsView.DHT_TYPE_MAIN);
    pluginUI.addView(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX, VivaldiView.class, VivaldiView.DHT_TYPE_MAIN);
    if (NetworkAdmin.getSingleton().hasDHTIPV6()) {
        pluginUI.addView(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX + ".6", DHTView.class, DHTView.DHT_TYPE_MAIN_V6);
        pluginUI.addView(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX + ".6", VivaldiView.class, VivaldiView.DHT_TYPE_MAIN_V6);
    }
    if (Constants.isCVSVersion()) {
        pluginUI.addView(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX + ".cvs", DHTView.class, DHTView.DHT_TYPE_CVS);
        pluginUI.addView(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX + ".cvs", VivaldiView.class, VivaldiView.DHT_TYPE_CVS);
        pluginUI.addView(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX + ".biglybt", DHTView.class, DHTView.DHT_TYPE_BIGLYBT);
        pluginUI.addView(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX + ".biglybt", VivaldiView.class, VivaldiView.DHT_TYPE_BIGLYBT);
    }
    pluginUI.addView(UISWTInstance.VIEW_STATISTICS, TagStatsView.MSGID_PREFIX, TagStatsView.class, null);
    registeredCoreSubViews = true;
    final UIManager uiManager = PluginInitializer.getDefaultInterface().getUIManager();
    uiManager.addUIListener(new UIManagerListener() {

        @Override
        public void UIAttached(UIInstance instance) {
        }

        @Override
        public void UIDetached(UIInstance instance) {
            if (!(instance instanceof UISWTInstance)) {
                return;
            }
            registeredCoreSubViews = false;
            pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, ActivityView.MSGID_PREFIX);
            pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, TransferStatsView.MSGID_PREFIX);
            pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, CacheView.MSGID_PREFIX);
            pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX);
            pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, DHTOpsView.MSGID_PREFIX);
            pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX);
            if (NetworkAdmin.getSingleton().hasDHTIPV6()) {
                pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX + ".6");
                pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX + ".6");
            }
            if (Constants.isCVSVersion()) {
                pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX + ".cvs");
                pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX + ".cvs");
            }
            pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, TagStatsView.MSGID_PREFIX);
            uiManager.removeUIListener(this);
        }
    });
}
Also used : UIManager(com.biglybt.pif.ui.UIManager) UISWTInstance(com.biglybt.ui.swt.pif.UISWTInstance) UIManagerListener(com.biglybt.pif.ui.UIManagerListener) UIInstance(com.biglybt.pif.ui.UIInstance)

Example 5 with UISWTInstance

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

the class SBC_ArchivedDownloadsView method initTable.

private void initTable(Composite control) {
    UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
    if (uiFunctions != null) {
        UISWTInstance pluginUI = uiFunctions.getUISWTInstance();
        registerPluginViews(pluginUI);
    }
    if (tv == null) {
        tv = TableViewFactory.createTableViewSWT(DownloadStub.class, TABLE_NAME, TABLE_NAME, new TableColumnCore[0], ColumnArchiveDLName.COLUMN_ID, SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
        if (txtFilter != null) {
            tv.enableFilterCheck(txtFilter, this);
        }
        tv.setRowDefaultHeightEM(1);
        tv.setEnableTabViews(true, true, null);
        table_parent = new Composite(control, SWT.BORDER);
        table_parent.setLayoutData(Utils.getFilledFormData());
        GridLayout layout = new GridLayout();
        layout.marginHeight = layout.marginWidth = layout.verticalSpacing = layout.horizontalSpacing = 0;
        table_parent.setLayout(layout);
        tv.addMenuFillListener(this);
        tv.addSelectionListener(this, false);
        tv.initialize(table_parent);
        tv.addCountChangeListener(new TableCountChangeListener() {

            @Override
            public void rowRemoved(TableRowCore row) {
            }

            @Override
            public void rowAdded(TableRowCore row) {
                if (datasource == row.getDataSource()) {
                    tv.setSelectedRows(new TableRowCore[] { row });
                }
            }
        });
    }
    control.layout(true);
}
Also used : DownloadStub(com.biglybt.pif.download.DownloadStub) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) UIFunctionsSWT(com.biglybt.ui.swt.UIFunctionsSWT) UISWTInstance(com.biglybt.ui.swt.pif.UISWTInstance)

Aggregations

UISWTInstance (com.biglybt.ui.swt.pif.UISWTInstance)22 UIManagerListener (com.biglybt.pif.ui.UIManagerListener)12 UIInstance (com.biglybt.pif.ui.UIInstance)10 UIManager (com.biglybt.pif.ui.UIManager)10 UIFunctionsSWT (com.biglybt.ui.swt.UIFunctionsSWT)10 DownloadManager (com.biglybt.core.download.DownloadManager)5 PluginInterface (com.biglybt.pif.PluginInterface)4 UISWTViewEventListenerWrapper (com.biglybt.ui.swt.pif.UISWTInstance.UISWTViewEventListenerWrapper)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 DiskManagerFileInfo (com.biglybt.core.disk.DiskManagerFileInfo)2 PEPeer (com.biglybt.core.peer.PEPeer)2 MenuItem (com.biglybt.pif.ui.menus.MenuItem)2 MenuItemListener (com.biglybt.pif.ui.menus.MenuItemListener)2 UIFunctions (com.biglybt.ui.UIFunctions)2 UserPrompterResultListener (com.biglybt.ui.UserPrompterResultListener)2 SelectedContentListener (com.biglybt.ui.selectedcontent.SelectedContentListener)2 TabbedMdiMaximizeListener (com.biglybt.ui.swt.mdi.TabbedMdiMaximizeListener)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 Core (com.biglybt.core.Core)1