Search in sources :

Example 1 with TableColumnSetupWindow

use of com.biglybt.ui.swt.views.columnsetup.TableColumnSetupWindow in project BiglyBT by BiglySoftware.

the class TableViewSWT_Common method showColumnEditor.

public void showColumnEditor() {
    TableRowCore focusedRow = tv.getFocusedRow();
    if (focusedRow == null || focusedRow.isRowDisposed()) {
        focusedRow = tv.getRow(0);
    }
    String tableID = tv.getTableID();
    new TableColumnSetupWindow(tv.getDataSourceType(), tableID, focusedRow, TableStructureEventDispatcher.getInstance(tableID)).open();
}
Also used : TableColumnSetupWindow(com.biglybt.ui.swt.views.columnsetup.TableColumnSetupWindow)

Example 2 with TableColumnSetupWindow

use of com.biglybt.ui.swt.views.columnsetup.TableColumnSetupWindow in project BiglyBT by BiglySoftware.

the class TorrentMenuFancy method buildTorrentCustomMenu_Organize.

public void buildTorrentCustomMenu_Organize(final Composite detailArea, final DownloadManager[] dms) {
    if (!hasSelection) {
        return;
    }
    // assign cats - generally cats come before tags in the UI
    createMenuRow(detailArea, "MyTorrentsView.menu.setCategory", "image.sidebar.library", new FancyMenuRowInfoListener() {

        @Override
        public void buildMenu(Menu menu) {
            TorrentUtil.addCategorySubMenu(dms, menu);
        }
    });
    // assign tags
    createMenuRow(detailArea, "label.tags", "image.sidebar.tag-overview", new FancyMenuRowInfoListener() {

        @Override
        public void buildMenu(Menu menu) {
            TagUIUtils.addLibraryViewTagsSubMenu(dms, menu);
        }
    });
    // Archive
    final List<Download> ar_dms = new ArrayList<>();
    for (DownloadManager dm : dms) {
        Download stub = PluginCoreUtils.wrap(dm);
        if (!stub.canStubbify()) {
            continue;
        }
        ar_dms.add(stub);
    }
    if (ar_dms.size() > 0) {
        createRow(detailArea, "MyTorrentsView.menu.archive", "image.sidebar.archive", new Listener() {

            @Override
            public void handleEvent(Event event) {
                ManagerUtils.moveToArchive(ar_dms, null);
            }
        });
    }
    // Advanced - > Rename
    createRow(detailArea, "MyTorrentsView.menu.rename", null, event -> ManagerUtils.advancedRename(dms));
    // Reposition
    createRow(detailArea, "MyTorrentsView.menu.reposition.manual", null, new Listener() {

        @Override
        public void handleEvent(Event event) {
            TorrentUtil.repositionManual(tv, dms, parentShell, isSeedingView);
        }
    });
    createRow(detailArea, "Button.selectAll", null, new Listener() {

        @Override
        public void handleEvent(Event event) {
            tv.selectAll();
        }
    });
    if (tv.getSWTFilter() != null) {
        createRow(detailArea, "MyTorrentsView.menu.filter", null, new Listener() {

            @Override
            public void handleEvent(Event event) {
                tv.openFilterDialog();
            }
        });
    }
    createRow(detailArea, "MyTorrentsView.menu.editTableColumns", "columns", new Listener() {

        @Override
        public void handleEvent(Event event) {
            TableRowCore focusedRow = tv.getFocusedRow();
            if (focusedRow == null || focusedRow.isRowDisposed()) {
                focusedRow = tv.getRow(0);
            }
            String tableID = tv.getTableID();
            new TableColumnSetupWindow(tv.getDataSourceType(), tableID, column, focusedRow, TableStructureEventDispatcher.getInstance(tableID)).open();
        }
    });
}
Also used : TableRowCore(com.biglybt.ui.common.table.TableRowCore) TableSelectedRowsListener(com.biglybt.ui.swt.views.table.TableSelectedRowsListener) TableColumnSetupWindow(com.biglybt.ui.swt.views.columnsetup.TableColumnSetupWindow) Download(com.biglybt.pif.download.Download) DownloadManager(com.biglybt.core.download.DownloadManager)

Example 3 with TableColumnSetupWindow

use of com.biglybt.ui.swt.views.columnsetup.TableColumnSetupWindow in project BiglyBT by BiglySoftware.

the class MainMenuV3 method buildSimpleViewMenu.

/**
 * @param viewMenu
 *
 * @since 4.5.0.3
 */
private void buildSimpleViewMenu(final Menu viewMenu, int accelerator) {
    try {
        SWTSkin skin = SWTSkinFactory.getInstance();
        MenuFactory.addMenuItem(viewMenu, SWT.CHECK, PREFIX_V3 + ".view.sidebar", new Listener() {

            @Override
            public void handleEvent(Event event) {
                SideBar sidebar = (SideBar) SkinViewManager.getByClass(SideBar.class);
                if (sidebar != null) {
                    sidebar.flipSideBarVisibility();
                }
            }
        });
        if (COConfigurationManager.getIntParameter("User Mode") > 1) {
            SWTSkinObject plugin_bar = skin.getSkinObject(SkinConstants.VIEWID_PLUGINBAR);
            if (plugin_bar != null) {
                MenuItem mi = MainMenuV3.createPluginBarMenuItem(skin, viewMenu, "v3.MainWindow.menu.view." + SkinConstants.VIEWID_PLUGINBAR, SkinConstants.VIEWID_PLUGINBAR + ".visible", SkinConstants.VIEWID_PLUGINBAR);
                if (accelerator != -1 && mi.getAccelerator() == accelerator) {
                    Listener[] listeners = mi.getListeners(SWT.Selection);
                    for (Listener l : listeners) {
                        try {
                            l.handleEvent(null);
                        } catch (Throwable e) {
                        }
                    }
                }
            }
        }
        MenuFactory.addViewToolbarMenuItem(viewMenu);
        MenuItem mi = MainMenuV3.createQuickLinksMenuItem(skin, viewMenu, "v3.MainWindow.menu.view." + SkinConstants.VIEWID_QUICK_LINKS, SkinConstants.VIEWID_QUICK_LINKS + ".visible", SkinConstants.VIEWID_QUICK_LINKS);
        // ///////
        MenuItem itemStatusBar = MenuFactory.createTopLevelMenuItem(viewMenu, "v3.MainWindow.menu.view.statusbar");
        itemStatusBar.setText(itemStatusBar.getText());
        Menu menuStatusBar = itemStatusBar.getMenu();
        final String[] statusAreaLangs = { "ConfigView.section.style.status.show_sr", "ConfigView.section.style.status.show_nat", "ConfigView.section.style.status.show_ddb", "ConfigView.section.style.status.show_ipf" };
        final String[] statusAreaConfig = { "Status Area Show SR", "Status Area Show NAT", "Status Area Show DDB", "Status Area Show IPF" };
        for (int i = 0; i < statusAreaConfig.length; i++) {
            final String configID = statusAreaConfig[i];
            String langID = statusAreaLangs[i];
            final MenuItem item = new MenuItem(menuStatusBar, SWT.CHECK);
            Messages.setLanguageText(item, langID);
            item.addListener(SWT.Selection, new Listener() {

                @Override
                public void handleEvent(Event event) {
                    COConfigurationManager.setParameter(configID, !COConfigurationManager.getBooleanParameter(configID));
                }
            });
            menuStatusBar.addListener(SWT.Show, new Listener() {

                @Override
                public void handleEvent(Event event) {
                    item.setSelection(COConfigurationManager.getBooleanParameter(configID));
                }
            });
        }
        if (Constants.isWindows) {
            MenuFactory.addSeparatorMenuItem(viewMenu);
        }
        boolean needsSep = false;
        boolean enabled = COConfigurationManager.getBooleanParameter("Beta Programme Enabled");
        if (enabled) {
            MenuFactory.addMenuItem(viewMenu, PREFIX_V2 + ".view.beta", new Listener() {

                @Override
                public void handleEvent(Event event) {
                    MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
                    if (mdi != null) {
                        mdi.showEntryByID(MultipleDocumentInterface.SIDEBAR_SECTION_BETAPROGRAM);
                    }
                }
            });
            needsSep = true;
        }
        if (needsSep) {
            MenuFactory.addSeparatorMenuItem(viewMenu);
        }
        needsSep = PluginsMenuHelper.buildViewMenu(viewMenu);
        if (COConfigurationManager.getBooleanParameter("Library.EnableSimpleView")) {
            if (needsSep) {
                MenuFactory.addSeparatorMenuItem(viewMenu);
            }
            // Ubuntu Unity (14.04) with SWT 4508 crashes when global View menu triggered as it appears
            // that radio menu items aren't supported
            // https://bugs.eclipse.org/bugs/show_bug.cgi?id=419729#c9
            int simple_advanced_menu_type = Constants.isLinux ? SWT.CHECK : SWT.RADIO;
            MenuFactory.addMenuItem(viewMenu, simple_advanced_menu_type, PREFIX_V3 + ".view.asSimpleList", new Listener() {

                @Override
                public void handleEvent(Event event) {
                    UIToolBarManager tb = UIToolBarManagerImpl.getInstance();
                    if (tb != null) {
                        UIToolBarItem item = tb.getToolBarItem("modeBig");
                        if (item != null) {
                            item.triggerToolBarItem(UIToolBarActivationListener.ACTIVATIONTYPE_NORMAL, SelectedContentManager.convertSelectedContentToObject(null));
                        }
                    }
                }
            });
            MenuFactory.addMenuItem(viewMenu, simple_advanced_menu_type, PREFIX_V3 + ".view.asAdvancedList", new Listener() {

                @Override
                public void handleEvent(Event event) {
                    UIToolBarManager tb = UIToolBarManagerImpl.getInstance();
                    if (tb != null) {
                        UIToolBarItem item = tb.getToolBarItem("modeSmall");
                        if (item != null) {
                            item.triggerToolBarItem(UIToolBarActivationListener.ACTIVATIONTYPE_NORMAL, SelectedContentManager.convertSelectedContentToObject(null));
                        }
                    }
                }
            });
            needsSep = true;
        }
        if (needsSep) {
            MenuFactory.addSeparatorMenuItem(viewMenu);
        }
        MenuFactory.addMenuItem(viewMenu, PREFIX_V2 + ".view.columnsetup", new Listener() {

            @Override
            public void handleEvent(Event event) {
                TableView<?> tv = SelectedContentManager.getCurrentlySelectedTableView();
                if (tv == null) {
                    return;
                }
                TableRowCore focusedRow = tv.getFocusedRow();
                if (focusedRow == null || focusedRow.isRowDisposed()) {
                    focusedRow = tv.getRow(0);
                }
                String tableID = tv.getTableID();
                new TableColumnSetupWindow(tv.getDataSourceType(), tableID, null, focusedRow, TableStructureEventDispatcher.getInstance(tableID)).open();
            }
        });
        viewMenu.addMenuListener(new MenuListener() {

            @Override
            public void menuShown(MenuEvent e) {
                MenuItem sidebarMenuItem = MenuFactory.findMenuItem(viewMenu, PREFIX_V3 + ".view.sidebar");
                if (sidebarMenuItem != null) {
                    MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
                    if (mdi != null) {
                        sidebarMenuItem.setSelection(mdi.isVisible());
                    }
                }
                if (COConfigurationManager.getBooleanParameter("Library.EnableSimpleView")) {
                    MenuItem itemShowAsSimple = MenuFactory.findMenuItem(viewMenu, PREFIX_V3 + ".view.asSimpleList");
                    if (itemShowAsSimple != null) {
                        UIToolBarManager tb = UIToolBarManagerImpl.getInstance();
                        if (tb != null) {
                            UIToolBarItem item = tb.getToolBarItem("modeBig");
                            long state = item == null ? 0 : item.getState();
                            itemShowAsSimple.setEnabled((state & UIToolBarItem.STATE_ENABLED) > 0);
                            itemShowAsSimple.setSelection((state & UIToolBarItem.STATE_DOWN) > 0);
                        }
                    }
                    MenuItem itemShowAsAdv = MenuFactory.findMenuItem(viewMenu, PREFIX_V3 + ".view.asAdvancedList");
                    if (itemShowAsAdv != null) {
                        UIToolBarManager tb = UIToolBarManagerImpl.getInstance();
                        if (tb != null) {
                            UIToolBarItem item = tb.getToolBarItem("modeSmall");
                            long state = item == null ? 0 : item.getState();
                            itemShowAsAdv.setEnabled((state & UIToolBarItem.STATE_ENABLED) > 0);
                            itemShowAsAdv.setSelection((state & UIToolBarItem.STATE_DOWN) > 0);
                        }
                    }
                }
                TableView<?> tv = SelectedContentManager.getCurrentlySelectedTableView();
                MenuItem itemColumnSetup = MenuFactory.findMenuItem(viewMenu, PREFIX_V2 + ".view.columnsetup");
                itemColumnSetup.setEnabled(tv != null);
            }

            @Override
            public void menuHidden(MenuEvent e) {
            }
        });
    } catch (Exception e) {
        Debug.out("Error creating View Menu", e);
    }
}
Also used : ParameterListener(com.biglybt.core.config.ParameterListener) UIToolBarActivationListener(com.biglybt.pif.ui.toolbar.UIToolBarActivationListener) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface) SWTSkin(com.biglybt.ui.swt.skin.SWTSkin) UIException(com.biglybt.pif.ui.UIException) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) TableRowCore(com.biglybt.ui.common.table.TableRowCore) TableColumnSetupWindow(com.biglybt.ui.swt.views.columnsetup.TableColumnSetupWindow) UIToolBarManager(com.biglybt.pif.ui.toolbar.UIToolBarManager) IMainMenu(com.biglybt.ui.swt.mainwindow.IMainMenu) UIToolBarItem(com.biglybt.pif.ui.toolbar.UIToolBarItem) SideBar(com.biglybt.ui.swt.views.skin.sidebar.SideBar) TableView(com.biglybt.ui.common.table.TableView)

Example 4 with TableColumnSetupWindow

use of com.biglybt.ui.swt.views.columnsetup.TableColumnSetupWindow in project BiglyBT by BiglySoftware.

the class TableViewSWT_Common method showColumnEditor.

public void showColumnEditor(TableColumnCore column) {
    TableRowCore focusedRow = tv.getFocusedRow();
    if (focusedRow == null || focusedRow.isRowDisposed()) {
        focusedRow = tv.getRow(0);
    }
    String tableID = tv.getTableID();
    new TableColumnSetupWindow(tv.getDataSourceType(), tableID, column, focusedRow, TableStructureEventDispatcher.getInstance(tableID)).open();
}
Also used : TableColumnSetupWindow(com.biglybt.ui.swt.views.columnsetup.TableColumnSetupWindow)

Aggregations

TableColumnSetupWindow (com.biglybt.ui.swt.views.columnsetup.TableColumnSetupWindow)4 TableRowCore (com.biglybt.ui.common.table.TableRowCore)2 ParameterListener (com.biglybt.core.config.ParameterListener)1 DownloadManager (com.biglybt.core.download.DownloadManager)1 Download (com.biglybt.pif.download.Download)1 UIException (com.biglybt.pif.ui.UIException)1 UIToolBarActivationListener (com.biglybt.pif.ui.toolbar.UIToolBarActivationListener)1 UIToolBarItem (com.biglybt.pif.ui.toolbar.UIToolBarItem)1 UIToolBarManager (com.biglybt.pif.ui.toolbar.UIToolBarManager)1 TableView (com.biglybt.ui.common.table.TableView)1 MultipleDocumentInterface (com.biglybt.ui.mdi.MultipleDocumentInterface)1 IMainMenu (com.biglybt.ui.swt.mainwindow.IMainMenu)1 SWTSkin (com.biglybt.ui.swt.skin.SWTSkin)1 SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)1 SideBar (com.biglybt.ui.swt.views.skin.sidebar.SideBar)1 TableSelectedRowsListener (com.biglybt.ui.swt.views.table.TableSelectedRowsListener)1