Search in sources :

Example 1 with TableManager

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

the class DeviceManagerUI method setupTranscodeMenus.

private void setupTranscodeMenus() {
    if (DISABLED_TRANSCODING) {
        return;
    }
    // top level menus
    final String[] tables = { TableManager.TABLE_MYTORRENTS_INCOMPLETE, TableManager.TABLE_MYTORRENTS_INCOMPLETE_BIG, TableManager.TABLE_MYTORRENTS_COMPLETE, TableManager.TABLE_MYTORRENTS_COMPLETE_BIG, TableManager.TABLE_TORRENT_FILES, TableManager.TABLE_MYTORRENTS_UNOPENED, TableManager.TABLE_MYTORRENTS_UNOPENED_BIG, TableManager.TABLE_MYTORRENTS_ALL_BIG };
    TableManager table_manager = plugin_interface.getUIManager().getTableManager();
    MenuItemFillListener menu_fill_listener = new MenuItemFillListener() {

        @Override
        public void menuWillBeShown(MenuItem menu, Object _target) {
            final TableRow[] target;
            if (_target instanceof TableRow) {
                target = new TableRow[] { (TableRow) _target };
            } else {
                target = (TableRow[]) _target;
            }
            boolean enabled = target.length > 0;
            for (TableRow row : target) {
                Object obj = row.getDataSource();
                if (obj instanceof Download) {
                    Download download = (Download) obj;
                    if (download.getState() == Download.ST_ERROR) {
                        enabled = false;
                    }
                } else {
                    DiskManagerFileInfo file = (DiskManagerFileInfo) obj;
                    try {
                        if (file.getIndex() < 0 || file.getDownload().getState() == Download.ST_ERROR) {
                            enabled = false;
                        }
                    } catch (Throwable e) {
                        enabled = false;
                    }
                }
            }
            menu.setEnabled(enabled);
            menu.removeAllChildItems();
            if (enabled) {
                Device[] devices = device_manager.getDevices();
                int devices_added = 0;
                for (Device device : devices) {
                    if (device.isHidden()) {
                        continue;
                    }
                    if (device instanceof TranscodeTarget) {
                        devices_added++;
                        final TranscodeTarget renderer = (TranscodeTarget) device;
                        TranscodeProfile[] profiles = renderer.getTranscodeProfiles();
                        TableContextMenuItem device_item = plugin_interface.getUIManager().getTableManager().addContextMenuItem((TableContextMenuItem) menu, "!" + device.getName() + (profiles.length == 0 ? " (No Profiles)" : "") + "!");
                        device_item.setStyle(MenuItem.STYLE_MENU);
                        if (profiles.length == 0) {
                            device_item.setEnabled(false);
                        } else {
                            Arrays.sort(profiles, new Comparator<TranscodeProfile>() {

                                @Override
                                public int compare(TranscodeProfile o1, TranscodeProfile o2) {
                                    int i1 = o1.getIconIndex();
                                    int i2 = o2.getIconIndex();
                                    if (i1 == i2) {
                                        return o1.getName().compareToIgnoreCase(o2.getName());
                                    } else {
                                        return (i1 - i2);
                                    }
                                }
                            });
                            for (final TranscodeProfile profile : profiles) {
                                TableContextMenuItem profile_item = plugin_interface.getUIManager().getTableManager().addContextMenuItem(device_item, "!" + profile.getName() + "!");
                                profile_item.addMultiListener(new MenuItemListener() {

                                    @Override
                                    public void selected(MenuItem menu, Object x) {
                                        for (TableRow row : target) {
                                            Object obj = row.getDataSource();
                                            try {
                                                if (obj instanceof Download) {
                                                    Download download = (Download) obj;
                                                    addDownload(renderer, profile, -1, download);
                                                } else {
                                                    DiskManagerFileInfo file = (DiskManagerFileInfo) obj;
                                                    addFile(renderer, profile, -1, file);
                                                }
                                            } catch (Throwable e) {
                                                Debug.out(e);
                                            }
                                        }
                                    }
                                });
                            }
                        }
                    }
                }
                if (devices_added == 0) {
                    TableContextMenuItem device_item = plugin_interface.getUIManager().getTableManager().addContextMenuItem((TableContextMenuItem) menu, "!(No Devices)!");
                    device_item.setEnabled(false);
                }
            }
        }
    };
    // instead of forcing a loop like this
    for (String table : tables) {
        TableContextMenuItem menu = table_manager.addContextMenuItem(table, "devices.contextmenu.xcode");
        menu.setStyle(TableContextMenuItem.STYLE_MENU);
        menu.setHeaderCategory(MenuItem.HEADER_CONTENT);
        menu.addFillListener(menu_fill_listener);
        menu.setDisposeWithUIDetach(UIInstance.UIT_SWT);
    }
}
Also used : DiskManagerFileInfo(com.biglybt.pif.disk.DiskManagerFileInfo) UPnPDevice(com.biglybt.net.upnp.UPnPDevice) UnassociatedDevice(com.biglybt.core.devices.DeviceManager.UnassociatedDevice) UPnPRootDevice(com.biglybt.net.upnp.UPnPRootDevice) TableContextMenuItem(com.biglybt.pif.ui.tables.TableContextMenuItem) MenuItem(com.biglybt.pif.ui.menus.MenuItem) Point(org.eclipse.swt.graphics.Point) TableContextMenuItem(com.biglybt.pif.ui.tables.TableContextMenuItem) MenuItemFillListener(com.biglybt.pif.ui.menus.MenuItemFillListener) TableRow(com.biglybt.pif.ui.tables.TableRow) TableManager(com.biglybt.pif.ui.tables.TableManager) MenuItemListener(com.biglybt.pif.ui.menus.MenuItemListener) Download(com.biglybt.pif.download.Download)

Example 2 with TableManager

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

the class SBC_DevicesView method initColumns.

/**
 * @since 4.1.0.5
 */
private void initColumns(Core core) {
    if (columnsAdded) {
        return;
    }
    columnsAdded = true;
    UIManager uiManager = PluginInitializer.getDefaultInterface().getUIManager();
    TableManager tableManager = uiManager.getTableManager();
    tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Rank.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTJ_Rank(column);
            if (!column.getTableID().equals(TABLE_TRANSCODE_QUEUE)) {
                column.setVisible(false);
            }
        }
    });
    tableManager.registerColumn(TranscodeFile.class, ColumnThumbnail.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnThumbnail(column);
            column.setWidth(70);
            column.setVisible(false);
        }
    });
    tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Name.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTJ_Name(column);
            if (column.getTableID().equals(TABLE_TRANSCODE_QUEUE)) {
                column.setWidth(200);
            } else if (!column.getTableID().endsWith(":type=1")) {
                column.setWidth(140);
            }
        }
    });
    tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Duration.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTJ_Duration(column);
        }
    });
    tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Device.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTJ_Device(column);
            column.setVisible(false);
        }
    });
    tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Profile.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTJ_Profile(column);
            if (column.getTableID().equals(TABLE_TRANSCODE_QUEUE)) {
                column.setWidth(70);
            }
        }
    });
    tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Resolution.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTJ_Resolution(column);
            column.setVisible(false);
            if (column.getTableID().equals(TABLE_TRANSCODE_QUEUE)) {
                column.setWidth(95);
            }
        }
    });
    tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Status.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTJ_Status(column);
        }
    });
    tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Completion.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTJ_Completion(column);
            column.setWidth(145);
        }
    });
    tableManager.registerColumn(TranscodeFile.class, ColumnTJ_CopiedToDevice.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTJ_CopiedToDevice(column);
            if (column.getTableID().endsWith(":type=1") || column.getTableID().equals(TABLE_TRANSCODE_QUEUE)) {
                column.setVisible(false);
            }
        }
    });
    tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Category.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTJ_Category(column);
        }
    });
    tableManager.registerColumn(TranscodeFile.class, ColumnTJ_Tags.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTJ_Tags(column);
        }
    });
    TableColumnManager tcm = TableColumnManager.getInstance();
    String[] defaultLibraryColumns = { ColumnTJ_Rank.COLUMN_ID, ColumnTJ_Name.COLUMN_ID, ColumnTJ_Duration.COLUMN_ID, ColumnTJ_Device.COLUMN_ID, ColumnTJ_Status.COLUMN_ID, ColumnTJ_Completion.COLUMN_ID };
    tcm.setDefaultColumnNames(TABLE_TRANSCODE_QUEUE, defaultLibraryColumns);
    String[] defaultQColumns = { ColumnTJ_Name.COLUMN_ID, ColumnTJ_Duration.COLUMN_ID, ColumnTJ_Profile.COLUMN_ID, ColumnTJ_Status.COLUMN_ID, ColumnTJ_Completion.COLUMN_ID };
    tcm.setDefaultColumnNames(TABLE_DEVICE_LIBRARY, defaultQColumns);
}
Also used : UIManager(com.biglybt.pif.ui.UIManager) ColumnThumbnail(com.biglybt.ui.swt.columns.torrent.ColumnThumbnail) TableColumn(com.biglybt.pif.ui.tables.TableColumn) TableColumnManager(com.biglybt.ui.common.table.impl.TableColumnManager) TableColumnCreationListener(com.biglybt.pif.ui.tables.TableColumnCreationListener) TableManager(com.biglybt.pif.ui.tables.TableManager)

Example 3 with TableManager

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

the class ClientStatsView method initColumns.

private void initColumns(Core core) {
    synchronized (ClientStatsView.class) {
        if (columnsAdded) {
            return;
        }
        columnsAdded = true;
    }
    UIManager uiManager = PluginInitializer.getDefaultInterface().getUIManager();
    TableManager tableManager = uiManager.getTableManager();
    tableManager.registerColumn(ClientStatsDataSource.class, ColumnCS_Name.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnCS_Name(column);
        }
    });
    tableManager.registerColumn(ClientStatsDataSource.class, ColumnCS_Count.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnCS_Count(column);
        }
    });
    tableManager.registerColumn(ClientStatsDataSource.class, ColumnCS_Discarded.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnCS_Discarded(column);
        }
    });
    tableManager.registerColumn(ClientStatsDataSource.class, ColumnCS_Received.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnCS_Received(column);
        }
    });
    tableManager.registerColumn(ClientStatsDataSource.class, ColumnCS_ReceivedPer.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnCS_ReceivedPer(column);
        }
    });
    tableManager.registerColumn(ClientStatsDataSource.class, ColumnCS_Sent.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnCS_Sent(column);
        }
    });
    tableManager.registerColumn(ClientStatsDataSource.class, ColumnCS_Pct.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnCS_Pct(column);
        }
    });
    for (final String network : AENetworkClassifier.AT_NETWORKS) {
        tableManager.registerColumn(ClientStatsDataSource.class, network + "." + ColumnCS_Sent.COLUMN_ID, new TableColumnCreationListener() {

            @Override
            public void tableColumnCreated(TableColumn column) {
                column.setUserData("network", network);
                new ColumnCS_Sent(column);
            }
        });
        tableManager.registerColumn(ClientStatsDataSource.class, network + "." + ColumnCS_Discarded.COLUMN_ID, new TableColumnCreationListener() {

            @Override
            public void tableColumnCreated(TableColumn column) {
                column.setUserData("network", network);
                new ColumnCS_Discarded(column);
            }
        });
        tableManager.registerColumn(ClientStatsDataSource.class, network + "." + ColumnCS_Received.COLUMN_ID, new TableColumnCreationListener() {

            @Override
            public void tableColumnCreated(TableColumn column) {
                column.setUserData("network", network);
                new ColumnCS_Received(column);
            }
        });
        tableManager.registerColumn(ClientStatsDataSource.class, network + "." + ColumnCS_Count.COLUMN_ID, new TableColumnCreationListener() {

            @Override
            public void tableColumnCreated(TableColumn column) {
                column.setUserData("network", network);
                new ColumnCS_Count(column);
            }
        });
    }
    TableColumnManager tcManager = TableColumnManager.getInstance();
    tcManager.setDefaultColumnNames(TABLEID, new String[] { ColumnCS_Name.COLUMN_ID, ColumnCS_Pct.COLUMN_ID, ColumnCS_Count.COLUMN_ID, ColumnCS_Received.COLUMN_ID, ColumnCS_Sent.COLUMN_ID, ColumnCS_Discarded.COLUMN_ID });
}
Also used : UIManager(com.biglybt.pif.ui.UIManager) TableColumn(com.biglybt.pif.ui.tables.TableColumn) TableColumnManager(com.biglybt.ui.common.table.impl.TableColumnManager) TableColumnCreationListener(com.biglybt.pif.ui.tables.TableColumnCreationListener) TableManager(com.biglybt.pif.ui.tables.TableManager)

Example 4 with TableManager

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

the class LocProvUtils method addColumns.

private void addColumns() {
    synchronized (this) {
        if (cl_installed || active_provider == null) {
            return;
        }
        TableManager tm = core.getPluginManager().getDefaultPluginInterface().getUIManager().getTableManager();
        String[] peer_tables = new String[] { TableManager.TABLE_TORRENT_PEERS, TableManager.TABLE_ALL_PEERS };
        for (int i = 0; i < peer_tables.length; i++) {
            TableColumn iso3166Column = tm.createColumn(peer_tables[i], "CountryCode");
            iso3166Column.initialize(TableColumn.ALIGN_LEAD, TableColumn.POSITION_LAST, 30, TableColumn.INTERVAL_INVALID_ONLY);
            iso3166Column.addCellRefreshListener(new TableCellRefreshListener() {

                @Override
                public void refresh(TableCell cell) {
                    Peer peer = (Peer) cell.getDataSource();
                    String s = getCountryCode(peer);
                    if (!cell.setSortValue(s) && cell.isValid()) {
                        return;
                    }
                    cell.setText(s);
                }
            });
            tm.addColumn(iso3166Column);
            columns.add(iso3166Column);
            // Country Name
            TableColumn countryColumn = tm.createColumn(peer_tables[i], "Country");
            countryColumn.initialize(TableColumn.ALIGN_LEAD, TableColumn.POSITION_INVISIBLE, 80, TableColumn.INTERVAL_INVALID_ONLY);
            countryColumn.addCellRefreshListener(new TableCellRefreshListener() {

                @Override
                public void refresh(TableCell cell) {
                    Peer peer = (Peer) cell.getDataSource();
                    String s = getCountryName(peer);
                    if (!cell.setSortValue(s) && cell.isValid()) {
                        return;
                    }
                    cell.setText(s);
                }
            });
            tm.addColumn(countryColumn);
            columns.add(countryColumn);
            // Small Flags
            TableColumn flagsColumn = tm.createColumn(peer_tables[i], "CountryFlagSmall");
            flagsColumn.initialize(TableColumn.ALIGN_LEAD, TableColumn.POSITION_INVISIBLE, 25, TableColumn.INTERVAL_INVALID_ONLY);
            flagsColumn.setType(TableColumn.TYPE_GRAPHIC);
            FlagListener flagListener = new FlagListener(true);
            flagsColumn.addCellRefreshListener(flagListener);
            flagsColumn.addCellToolTipListener(flagListener);
            tm.addColumn(flagsColumn);
            columns.add(flagsColumn);
            // Normal Flags
            flagsColumn = tm.createColumn(peer_tables[i], "CountryFlag");
            flagsColumn.initialize(TableColumn.ALIGN_LEAD, TableColumn.POSITION_LAST, 25, TableColumn.INTERVAL_INVALID_ONLY);
            flagsColumn.setType(TableColumn.TYPE_GRAPHIC);
            flagListener = new FlagListener(false);
            flagsColumn.addCellRefreshListener(flagListener);
            flagsColumn.addCellToolTipListener(flagListener);
            tm.addColumn(flagsColumn);
            columns.add(flagsColumn);
        }
    }
}
Also used : TableCellRefreshListener(com.biglybt.pif.ui.tables.TableCellRefreshListener) TableCell(com.biglybt.pif.ui.tables.TableCell) Peer(com.biglybt.pif.peers.Peer) TableManager(com.biglybt.pif.ui.tables.TableManager) TableColumn(com.biglybt.pif.ui.tables.TableColumn)

Example 5 with TableManager

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

the class BuddyPluginView method addBetaSubviews.

private void addBetaSubviews(boolean enable) {
    String[] views = { TableManager.TABLE_MYTORRENTS_ALL_BIG, TableManager.TABLE_MYTORRENTS_INCOMPLETE, TableManager.TABLE_MYTORRENTS_INCOMPLETE_BIG, TableManager.TABLE_MYTORRENTS_COMPLETE, "TagsView" };
    if (enable) {
        taggableLifecycleAdapter = new TaggableLifecycleAdapter() {

            @Override
            public void taggableTagged(TagType tag_type, Tag tag, Taggable taggable) {
                if (tag_type.getTagType() == TagType.TT_DOWNLOAD_MANUAL) {
                    DownloadManager dm = (DownloadManager) taggable;
                    for (BetaSubViewHolder h : beta_subviews.values()) {
                        h.tagsUpdated(dm);
                    }
                }
            }

            @Override
            public void taggableUntagged(TagType tag_type, Tag tag, Taggable taggable) {
                if (tag_type.getTagType() == TagType.TT_DOWNLOAD_MANUAL) {
                    DownloadManager dm = (DownloadManager) taggable;
                    for (BetaSubViewHolder h : beta_subviews.values()) {
                        h.tagsUpdated(dm);
                    }
                }
            }
        };
        TagManagerFactory.getTagManager().addTaggableLifecycleListener(Taggable.TT_DOWNLOAD, taggableLifecycleAdapter);
        UISWTViewEventListener listener = new UISWTViewEventListener() {

            @Override
            public boolean eventOccurred(UISWTViewEvent event) {
                UISWTView currentView = event.getView();
                switch(event.getType()) {
                    case UISWTViewEvent.TYPE_CREATE:
                        {
                            beta_subviews.put(currentView, new BetaSubViewHolder());
                            currentView.setDestroyOnDeactivate(false);
                            break;
                        }
                    case UISWTViewEvent.TYPE_INITIALIZE:
                        {
                            BetaSubViewHolder subview = beta_subviews.get(currentView);
                            if (subview != null) {
                                subview.initialise(event.getView(), (Composite) event.getData());
                            }
                            break;
                        }
                    case UISWTViewEvent.TYPE_DATASOURCE_CHANGED:
                        {
                            BetaSubViewHolder subview = beta_subviews.get(currentView);
                            if (subview != null) {
                                subview.setDataSource(event.getData());
                            }
                            break;
                        }
                    case UISWTViewEvent.TYPE_FOCUSGAINED:
                        {
                            BetaSubViewHolder subview = beta_subviews.get(currentView);
                            if (subview != null) {
                                subview.gotFocus();
                            }
                            break;
                        }
                    case UISWTViewEvent.TYPE_FOCUSLOST:
                        {
                            BetaSubViewHolder subview = beta_subviews.get(currentView);
                            if (subview != null) {
                                subview.lostFocus();
                            }
                            break;
                        }
                    case UISWTViewEvent.TYPE_DESTROY:
                        {
                            BetaSubViewHolder subview = beta_subviews.remove(currentView);
                            if (subview != null) {
                                subview.destroy();
                            }
                            break;
                        }
                }
                return true;
            }
        };
        for (String table_id : views) {
            ui_instance.addView(table_id, "azbuddy.ui.menu.chat", listener);
        }
        TableManager table_manager = plugin.getPluginInterface().getUIManager().getTableManager();
        TableCellRefreshListener msg_refresh_listener = new TableCellRefreshListener() {

            @Override
            public void refresh(TableCell _cell) {
                TableCellSWT cell = (TableCellSWT) _cell;
                Download dl = (Download) cell.getDataSource();
                if (dl == null) {
                    return;
                }
                List<ChatInstance> instances = BuddyPluginUtils.peekChatInstances(dl);
                boolean is_pending = false;
                for (ChatInstance instance : instances) {
                    if (instance.getMessageOutstanding()) {
                        is_pending = true;
                    }
                }
                Image graphic;
                String tooltip;
                int sort_order;
                if (is_pending) {
                    graphic = bs_chat_gray_text;
                    tooltip = MessageText.getString("TableColumn.header.chat.msg.out");
                    sort_order = 1;
                } else {
                    graphic = null;
                    tooltip = MessageText.getString("label.no.messages");
                    sort_order = 0;
                }
                cell.setMarginHeight(0);
                cell.setGraphic(graphic);
                cell.setToolTip(tooltip);
                cell.setSortValue(sort_order);
                cell.setCursorID(graphic == null ? SWT.CURSOR_ARROW : SWT.CURSOR_HAND);
            }
        };
        TableCellMouseListener msg_mouse_listener = new TableCellMouseListener() {

            @Override
            public void cellMouseTrigger(TableCellMouseEvent event) {
                if (event.eventType == TableCellMouseEvent.EVENT_MOUSEUP) {
                    TableCell cell = event.cell;
                    Download dl = (Download) cell.getDataSource();
                    if (dl != null) {
                        List<ChatInstance> instances = BuddyPluginUtils.peekChatInstances(dl);
                        for (ChatInstance instance : instances) {
                            if (instance.getMessageOutstanding()) {
                                try {
                                    BuddyPluginUtils.getBetaPlugin().showChat(instance);
                                } catch (Throwable e) {
                                    Debug.out(e);
                                }
                            }
                        }
                    }
                }
            }
        };
        columnMessagePending = new TableColumnCreationListener() {

            @Override
            public void tableColumnCreated(TableColumn result) {
                result.setAlignment(TableColumn.ALIGN_CENTER);
                result.setPosition(TableColumn.POSITION_LAST);
                result.setWidth(32);
                result.setRefreshInterval(TableColumn.INTERVAL_INVALID_ONLY);
                result.setType(TableColumn.TYPE_GRAPHIC);
                result.addCellRefreshListener(msg_refresh_listener);
                result.addCellMouseListener(msg_mouse_listener);
                result.setIconReference("dchat_gray", true);
                synchronized (columns) {
                    columns.add(result);
                }
            }
        };
        table_manager.registerColumn(Download.class, "azbuddy.ui.column.msgpending", columnMessagePending);
    } else {
        for (String table_id : views) {
            ui_instance.removeViews(table_id, "azbuddy.ui.menu.chat");
        }
        for (UISWTView entry : new ArrayList<>(beta_subviews.keySet())) {
            entry.closeView();
        }
        if (taggableLifecycleAdapter != null) {
            TagManagerFactory.getTagManager().removeTaggableLifecycleListener(Taggable.TT_DOWNLOAD, taggableLifecycleAdapter);
            taggableLifecycleAdapter = null;
        }
        beta_subviews.clear();
        if (columnMessagePending != null) {
            TableManager table_manager = plugin.getPluginInterface().getUIManager().getTableManager();
            table_manager.unregisterColumn(Download.class, "azbuddy.ui.column.msgpending", columnMessagePending);
            columnMessagePending = null;
            synchronized (columns) {
                columns.clear();
            }
        }
    }
}
Also used : ChatInstance(com.biglybt.plugin.net.buddy.BuddyPluginBeta.ChatInstance) TableCellSWT(com.biglybt.ui.swt.views.table.TableCellSWT) TaggableLifecycleAdapter(com.biglybt.core.tag.TaggableLifecycleAdapter) ArrayList(java.util.ArrayList) Image(org.eclipse.swt.graphics.Image) DownloadManager(com.biglybt.core.download.DownloadManager) TableCellMouseListener(com.biglybt.pif.ui.tables.TableCellMouseListener) TableColumnCreationListener(com.biglybt.pif.ui.tables.TableColumnCreationListener) TableCell(com.biglybt.pif.ui.tables.TableCell) UISWTViewEvent(com.biglybt.ui.swt.pif.UISWTViewEvent) TableManager(com.biglybt.pif.ui.tables.TableManager) Download(com.biglybt.pif.download.Download) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) UISWTViewEventListener(com.biglybt.ui.swt.pif.UISWTViewEventListener) TableColumn(com.biglybt.pif.ui.tables.TableColumn) Point(org.eclipse.swt.graphics.Point) TagType(com.biglybt.core.tag.TagType) UISWTView(com.biglybt.ui.swt.pif.UISWTView) TableCellRefreshListener(com.biglybt.pif.ui.tables.TableCellRefreshListener) TableCellMouseEvent(com.biglybt.pif.ui.tables.TableCellMouseEvent) Tag(com.biglybt.core.tag.Tag) Taggable(com.biglybt.core.tag.Taggable)

Aggregations

TableManager (com.biglybt.pif.ui.tables.TableManager)7 UIManager (com.biglybt.pif.ui.UIManager)4 TableColumn (com.biglybt.pif.ui.tables.TableColumn)4 TableColumnCreationListener (com.biglybt.pif.ui.tables.TableColumnCreationListener)4 TableColumnManager (com.biglybt.ui.common.table.impl.TableColumnManager)4 TableCell (com.biglybt.pif.ui.tables.TableCell)3 TableCellRefreshListener (com.biglybt.pif.ui.tables.TableCellRefreshListener)3 Subscription (com.biglybt.core.subs.Subscription)2 Download (com.biglybt.pif.download.Download)2 TableContextMenuItem (com.biglybt.pif.ui.tables.TableContextMenuItem)2 UISWTViewEvent (com.biglybt.ui.swt.pif.UISWTViewEvent)2 TableCellSWT (com.biglybt.ui.swt.views.table.TableCellSWT)2 ArrayList (java.util.ArrayList)2 Image (org.eclipse.swt.graphics.Image)2 UnassociatedDevice (com.biglybt.core.devices.DeviceManager.UnassociatedDevice)1 DownloadManager (com.biglybt.core.download.DownloadManager)1 Engine (com.biglybt.core.metasearch.Engine)1 SubscriptionManagerListener (com.biglybt.core.subs.SubscriptionManagerListener)1 Tag (com.biglybt.core.tag.Tag)1 TagType (com.biglybt.core.tag.TagType)1