Search in sources :

Example 36 with TableColumnManager

use of com.biglybt.ui.common.table.impl.TableColumnManager in project BiglyBT by BiglySoftware.

the class SBC_DownloadHistoryView method initColumns.

protected void initColumns() {
    synchronized (SBC_DownloadHistoryView.class) {
        if (columnsAdded) {
            return;
        }
        columnsAdded = true;
    }
    TableColumnManager tableManager = TableColumnManager.getInstance();
    tableManager.registerColumn(DownloadHistory.class, ColumnDLHistoryName.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnDLHistoryName(column);
        }
    });
    tableManager.registerColumn(DownloadHistory.class, ColumnDLHistoryAddDate.COLUMN_ID, new TableColumnCoreCreationListener() {

        @Override
        public TableColumnCore createTableColumnCore(Class<?> forDataSourceType, String tableID, String columnID) {
            return new ColumnDateSizer(DownloadHistory.class, columnID, TableColumnCreator.DATE_COLUMN_WIDTH, tableID) {
            };
        }

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnDLHistoryAddDate(column);
        }
    });
    tableManager.registerColumn(DownloadHistory.class, ColumnDLHistoryCompleteDate.COLUMN_ID, new TableColumnCoreCreationListener() {

        @Override
        public TableColumnCore createTableColumnCore(Class<?> forDataSourceType, String tableID, String columnID) {
            return new ColumnDateSizer(DownloadHistory.class, columnID, TableColumnCreator.DATE_COLUMN_WIDTH, tableID) {
            };
        }

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnDLHistoryCompleteDate(column);
        }
    });
    tableManager.registerColumn(DownloadHistory.class, ColumnDLHistoryRemoveDate.COLUMN_ID, new TableColumnCoreCreationListener() {

        @Override
        public TableColumnCore createTableColumnCore(Class<?> forDataSourceType, String tableID, String columnID) {
            return new ColumnDateSizer(DownloadHistory.class, columnID, TableColumnCreator.DATE_COLUMN_WIDTH, tableID) {
            };
        }

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnDLHistoryRemoveDate(column);
        }
    });
    tableManager.registerColumn(DownloadHistory.class, ColumnDLHistoryHash.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnDLHistoryHash(column);
        }
    });
    tableManager.registerColumn(DownloadHistory.class, ColumnDLHistorySize.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnDLHistorySize(column);
        }
    });
    tableManager.registerColumn(DownloadHistory.class, ColumnDLHistorySaveLocation.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnDLHistorySaveLocation(column);
        }
    });
    tableManager.setDefaultColumnNames(TABLE_NAME, new String[] { ColumnDLHistoryName.COLUMN_ID, ColumnDLHistoryAddDate.COLUMN_ID, ColumnDLHistoryCompleteDate.COLUMN_ID, ColumnDLHistoryRemoveDate.COLUMN_ID });
    tableManager.setDefaultSortColumnName(TABLE_NAME, ColumnDLHistoryName.COLUMN_ID);
}
Also used : ColumnDateSizer(com.biglybt.ui.swt.views.tableitems.ColumnDateSizer) TableColumn(com.biglybt.pif.ui.tables.TableColumn) TableColumnManager(com.biglybt.ui.common.table.impl.TableColumnManager) TableColumnCreationListener(com.biglybt.pif.ui.tables.TableColumnCreationListener) DownloadHistory(com.biglybt.core.history.DownloadHistory)

Example 37 with TableColumnManager

use of com.biglybt.ui.common.table.impl.TableColumnManager in project BiglyBT by BiglySoftware.

the class SBC_LibraryTableView method initShow.

public void initShow(Core core) {
    Object data = soParent.getControl().getData("TorrentFilterMode");
    if (data instanceof Long) {
        torrentFilterMode = (int) ((Long) data).longValue();
    }
    data = soParent.getControl().getData("DataSource");
    boolean useBigTable = useBigTable();
    SWTSkinObjectTextbox soFilter = (SWTSkinObjectTextbox) skin.getSkinObject("library-filter", soParent.getParent());
    Text txtFilter = soFilter == null ? null : soFilter.getTextControl();
    SWTSkinObjectContainer soCats = (SWTSkinObjectContainer) skin.getSkinObject("library-categories", soParent.getParent());
    Composite cCats = soCats == null ? null : soCats.getComposite();
    // columns not needed for small mode, all torrents
    TableColumnCore[] columns = useBigTable || torrentFilterMode != SBC_LibraryView.TORRENTS_ALL ? getColumns() : null;
    if (null != columns) {
        TableColumnManager tcManager = TableColumnManager.getInstance();
        tcManager.addColumns(columns);
    }
    if (useBigTable) {
        if (torrentFilterMode == SBC_LibraryView.TORRENTS_COMPLETE || torrentFilterMode == SBC_LibraryView.TORRENTS_INCOMPLETE || torrentFilterMode == SBC_LibraryView.TORRENTS_UNOPENED) {
            swtViewListener = torrentView = new MyTorrentsView_Big(core, torrentFilterMode, columns, txtFilter, cCats);
        } else {
            swtViewListener = torrentView = new MyTorrentsView_Big(core, torrentFilterMode, columns, txtFilter, cCats);
        }
    } else {
        String tableID = SB_Transfers.getTableIdFromFilterMode(torrentFilterMode, false);
        if (torrentFilterMode == SBC_LibraryView.TORRENTS_COMPLETE) {
            swtViewListener = torrentView = new MyTorrentsView(core, tableID, true, columns, txtFilter, cCats, true);
        } else if (torrentFilterMode == SBC_LibraryView.TORRENTS_INCOMPLETE) {
            swtViewListener = torrentView = new MyTorrentsView(core, tableID, false, columns, txtFilter, cCats, true);
        } else if (torrentFilterMode == SBC_LibraryView.TORRENTS_UNOPENED) {
            swtViewListener = torrentView = new MyTorrentsView(core, tableID, true, columns, txtFilter, cCats, true) {

                @Override
                public boolean isOurDownloadManager(DownloadManager dm) {
                    if (PlatformTorrentUtils.getHasBeenOpened(dm)) {
                        return false;
                    }
                    return super.isOurDownloadManager(dm);
                }
            };
        } else {
            swtViewListener = new MyTorrentsSuperView(txtFilter, cCats) {

                @Override
                public void initializeDone() {
                    MyTorrentsView seedingview = getSeedingview();
                    if (seedingview != null) {
                        seedingview.overrideDefaultSelected(new TableSelectionAdapter() {

                            @Override
                            public void defaultSelected(TableRowCore[] rows, int stateMask, int origin) {
                                doDefaultClick(rows, stateMask, false, origin);
                            }
                        });
                        MyTorrentsView torrentview = getTorrentview();
                        if (torrentview != null) {
                            torrentview.overrideDefaultSelected(new TableSelectionAdapter() {

                                @Override
                                public void defaultSelected(TableRowCore[] rows, int stateMask, int origin) {
                                    doDefaultClick(rows, stateMask, false, origin);
                                }
                            });
                        }
                    }
                }
            };
        }
        if (torrentView != null) {
            torrentView.overrideDefaultSelected(new TableSelectionAdapter() {

                @Override
                public void defaultSelected(TableRowCore[] rows, int stateMask, int origin) {
                    doDefaultClick(rows, stateMask, false, origin);
                }
            });
        }
    }
    if (torrentView != null) {
        tv = torrentView.getTableView();
        if (torrentFilterMode == SBC_LibraryView.TORRENTS_UNOPENED) {
            torrentView.setRebuildListOnFocusGain(true);
        }
    }
    try {
        view = new UISWTViewImpl(ID + torrentFilterMode, UISWTInstance.VIEW_MAIN, false);
        view.setDatasource(data);
        view.setEventListener(swtViewListener, true);
    } catch (Exception e) {
        Debug.out(e);
    }
    SWTSkinObjectContainer soContents = new SWTSkinObjectContainer(skin, skin.getSkinProperties(), getUpdateUIName(), "", soMain);
    skin.layout();
    viewComposite = soContents.getComposite();
    viewComposite.setLayoutData(Utils.getFilledFormData());
    GridLayout gridLayout = new GridLayout();
    gridLayout.horizontalSpacing = gridLayout.verticalSpacing = gridLayout.marginHeight = gridLayout.marginWidth = 0;
    viewComposite.setLayout(gridLayout);
    view.initialize(viewComposite);
    SWTSkinObject soSizeSlider = skin.getSkinObject("table-size-slider", soParent.getParent());
    if (soSizeSlider instanceof SWTSkinObjectContainer) {
        SWTSkinObjectContainer so = (SWTSkinObjectContainer) soSizeSlider;
        if (tv != null && !tv.enableSizeSlider(so.getComposite(), 16, 100)) {
            so.setVisible(false);
        }
    }
    if (torrentFilterMode == SBC_LibraryView.TORRENTS_ALL && tv != null) {
        tv.addRefreshListener(new TableRowRefreshListener() {

            @Override
            public void rowRefresh(TableRow row) {
                TableRowSWT rowCore = (TableRowSWT) row;
                Object ds = rowCore.getDataSource(true);
                if (!(ds instanceof DownloadManager)) {
                    return;
                }
                DownloadManager dm = (DownloadManager) ds;
                boolean changed = false;
                boolean assumedComplete = dm.getAssumedComplete();
                if (!assumedComplete) {
                    changed |= rowCore.setAlpha(160);
                } else if (!PlatformTorrentUtils.getHasBeenOpened(dm)) {
                    changed |= rowCore.setAlpha(255);
                } else {
                    changed |= rowCore.setAlpha(255);
                }
            }
        });
    }
    viewComposite.getParent().layout(true);
}
Also used : TableSelectionAdapter(com.biglybt.ui.common.table.TableSelectionAdapter) TableRowSWT(com.biglybt.ui.swt.views.table.TableRowSWT) TableColumnCore(com.biglybt.ui.common.table.TableColumnCore) DownloadManager(com.biglybt.core.download.DownloadManager) TableColumnManager(com.biglybt.ui.common.table.impl.TableColumnManager) TableRowCore(com.biglybt.ui.common.table.TableRowCore) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) GridLayout(org.eclipse.swt.layout.GridLayout) SWTSkinObjectContainer(com.biglybt.ui.swt.skin.SWTSkinObjectContainer) SWTSkinObjectTextbox(com.biglybt.ui.swt.skin.SWTSkinObjectTextbox) MyTorrentsSuperView(com.biglybt.ui.swt.views.MyTorrentsSuperView) Composite(org.eclipse.swt.widgets.Composite) TableRowRefreshListener(com.biglybt.pif.ui.tables.TableRowRefreshListener) Text(org.eclipse.swt.widgets.Text) MyTorrentsView(com.biglybt.ui.swt.views.MyTorrentsView) UISWTViewImpl(com.biglybt.ui.swt.pifimpl.UISWTViewImpl) TableRow(com.biglybt.pif.ui.tables.TableRow) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject)

Example 38 with TableColumnManager

use of com.biglybt.ui.common.table.impl.TableColumnManager in project BiglyBT by BiglySoftware.

the class SBC_TagsOverview method initColumns.

protected void initColumns() {
    synchronized (SBC_TagsOverview.class) {
        if (columnsAdded) {
            return;
        }
        columnsAdded = true;
    }
    TableColumnManager tableManager = TableColumnManager.getInstance();
    tableManager.registerColumn(Tag.class, ColumnTagCount.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagCount(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagColor.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagColor(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagName.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagName(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagType.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagType(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagPublic.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagPublic(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagUpRate.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagUpRate(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagDownRate.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagDownRate(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagUpLimit.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagUpLimit(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagDownLimit.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagDownLimit(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagUpSession.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagUpSession(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagDownSession.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagDownSession(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagUpTotal.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagUpTotal(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagDownTotal.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagDownTotal(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagRSSFeed.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagRSSFeed(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagUploadPriority.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagUploadPriority(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagMinSR.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagMinSR(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagMaxSR.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagMaxSR(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagAggregateSR.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagAggregateSR(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagAggregateSRMax.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagAggregateSRMax(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagXCode.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagXCode(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagInitialSaveLocation.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagInitialSaveLocation(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagMoveOnComp.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagMoveOnComp(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagCopyOnComp.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagCopyOnComp(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagProperties.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagProperties(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagVisible.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagVisible(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagGroup.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagGroup(column);
        }
    });
    tableManager.registerColumn(Tag.class, ColumnTagLimits.COLUMN_ID, new TableColumnCreationListener() {

        @Override
        public void tableColumnCreated(TableColumn column) {
            new ColumnTagLimits(column);
        }
    });
    tableManager.setDefaultColumnNames(TABLE_TAGS, new String[] { ColumnTagColor.COLUMN_ID, ColumnTagName.COLUMN_ID, ColumnTagCount.COLUMN_ID, ColumnTagType.COLUMN_ID, ColumnTagPublic.COLUMN_ID, ColumnTagUpRate.COLUMN_ID, ColumnTagDownRate.COLUMN_ID, ColumnTagUpLimit.COLUMN_ID, ColumnTagDownLimit.COLUMN_ID });
    tableManager.setDefaultSortColumnName(TABLE_TAGS, ColumnTagName.COLUMN_ID);
}
Also used : TableColumnManager(com.biglybt.ui.common.table.impl.TableColumnManager) TableColumnCreationListener(com.biglybt.pif.ui.tables.TableColumnCreationListener) TableColumn(com.biglybt.pif.ui.tables.TableColumn)

Aggregations

TableColumnManager (com.biglybt.ui.common.table.impl.TableColumnManager)38 TableColumnCore (com.biglybt.ui.common.table.TableColumnCore)16 TableColumn (com.biglybt.pif.ui.tables.TableColumn)13 TableColumnCreationListener (com.biglybt.pif.ui.tables.TableColumnCreationListener)11 LightHashMap (com.biglybt.core.util.LightHashMap)4 UIManager (com.biglybt.pif.ui.UIManager)4 TableManager (com.biglybt.pif.ui.tables.TableManager)4 ISelectedContent (com.biglybt.ui.selectedcontent.ISelectedContent)3 Subscription (com.biglybt.core.subs.Subscription)2 UIInputReceiverListener (com.biglybt.pif.ui.UIInputReceiverListener)2 UIPluginViewToolBarListener (com.biglybt.pif.ui.UIPluginViewToolBarListener)2 UIFunctions (com.biglybt.ui.UIFunctions)2 TableColumnCoreCreationListener (com.biglybt.ui.common.table.TableColumnCoreCreationListener)2 TableRowCore (com.biglybt.ui.common.table.TableRowCore)2 DownloadUrlInfo (com.biglybt.ui.selectedcontent.DownloadUrlInfo)2 SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)2 SWTSkinObjectContainer (com.biglybt.ui.swt.skin.SWTSkinObjectContainer)2 TableViewSWTMenuFillListener (com.biglybt.ui.swt.views.table.TableViewSWTMenuFillListener)2 ColumnDateSizer (com.biglybt.ui.swt.views.tableitems.ColumnDateSizer)2 Map (java.util.Map)2