Search in sources :

Example 1 with SWTSkinObjectTextbox

use of com.biglybt.ui.swt.skin.SWTSkinObjectTextbox in project BiglyBT by BiglySoftware.

the class SBC_TagsOverview method skinObjectShown.

@Override
public Object skinObjectShown(SWTSkinObject skinObject, Object params) {
    super.skinObjectShown(skinObject, params);
    SWTSkinObjectTextbox soFilter = (SWTSkinObjectTextbox) getSkinObject("filterbox");
    if (soFilter != null) {
        txtFilter = soFilter.getTextControl();
    }
    SWTSkinObject so_list = getSkinObject("tags-list");
    if (so_list != null) {
        initTable((Composite) so_list.getControl());
    } else {
        return null;
    }
    if (tv == null) {
        return null;
    }
    TagManager tagManager = TagManagerFactory.getTagManager();
    if (tagManager != null) {
        if (!tm_listener_added) {
            tm_listener_added = true;
            tagManager.addTagManagerListener(this, true);
        }
    }
    return null;
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) SWTSkinObjectTextbox(com.biglybt.ui.swt.skin.SWTSkinObjectTextbox)

Example 2 with SWTSkinObjectTextbox

use of com.biglybt.ui.swt.skin.SWTSkinObjectTextbox in project BiglyBT by BiglySoftware.

the class SBC_SearchResultsView method skinObjectInitialShow.

public Object skinObjectInitialShow(SWTSkinObject skinObject, Object params) {
    image_loader = new ImageLoader(null, null);
    CoreFactory.addCoreRunningListener(new CoreRunningListener() {

        @Override
        public void coreRunning(Core core) {
            initColumns(core);
        }
    });
    SWTSkinObjectTextbox soFilterBox = (SWTSkinObjectTextbox) getSkinObject("filterbox");
    if (soFilterBox != null) {
        txtFilter = soFilterBox.getTextControl();
    }
    if (vitality_images == null) {
        ImageLoader loader = ImageLoader.getInstance();
        vitality_images = loader.getImages("image.sidebar.vitality.dots");
        ok_image = loader.getImage("tick_mark");
        fail_image = loader.getImage("progress_cancel");
        auth_image = loader.getImage("image.sidebar.vitality.auth");
    }
    final SWTSkinObject soFilterArea = getSkinObject("filterarea");
    if (soFilterArea != null) {
        SWTSkinObjectToggle soFilterButton = (SWTSkinObjectToggle) getSkinObject("filter-button");
        if (soFilterButton != null) {
            boolean toggled = COConfigurationManager.getBooleanParameter("Search View Filter Options Expanded", false);
            if (toggled) {
                soFilterButton.setToggled(true);
                soFilterArea.setVisible(true);
            }
            soFilterButton.addSelectionListener(new SWTSkinToggleListener() {

                @Override
                public void toggleChanged(SWTSkinObjectToggle so, boolean toggled) {
                    COConfigurationManager.setParameter("Search View Filter Options Expanded", toggled);
                    soFilterArea.setVisible(toggled);
                    Utils.relayout(soFilterArea.getControl().getParent());
                }
            });
        }
        Composite parent = (Composite) soFilterArea.getControl();
        Composite filter_area = new Composite(parent, SWT.NONE);
        FormData fd = Utils.getFilledFormData();
        filter_area.setLayoutData(fd);
        GridLayout layout = new GridLayout();
        layout.marginBottom = layout.marginTop = layout.marginLeft = layout.marginRight = 0;
        filter_area.setLayout(layout);
        Label label;
        int sepHeight = 20;
        Composite cRow = new Composite(filter_area, SWT.NONE);
        cRow.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
        rowLayout.spacing = 5;
        rowLayout.marginBottom = rowLayout.marginTop = rowLayout.marginLeft = rowLayout.marginRight = 0;
        rowLayout.center = true;
        cRow.setLayout(rowLayout);
        // with/without keywords
        ImageLoader imageLoader = ImageLoader.getInstance();
        for (int i = 0; i < 2; i++) {
            final boolean with = i == 0;
            if (!with) {
                label = new Label(cRow, SWT.VERTICAL | SWT.SEPARATOR);
                label.setLayoutData(new RowData(-1, sepHeight));
            }
            Composite cWithKW = new Composite(cRow, SWT.NONE);
            layout = new GridLayout(2, false);
            layout.marginWidth = 0;
            layout.marginBottom = layout.marginTop = layout.marginLeft = layout.marginRight = 0;
            cWithKW.setLayout(layout);
            // Label lblWithKW = new Label(cWithKW, SWT.NONE);
            // lblWithKW.setText(MessageText.getString(with?"SubscriptionResults.filter.with.words":"SubscriptionResults.filter.without.words"));
            Label lblWithKWImg = new Label(cWithKW, SWT.NONE);
            lblWithKWImg.setImage(imageLoader.getImage(with ? "icon_filter_plus" : "icon_filter_minus"));
            final Text textWidget = new Text(cWithKW, SWT.BORDER);
            if (with) {
                textWithKW = textWidget;
            } else {
                textWithoutKW = textWidget;
            }
            textWidget.setMessage(MessageText.getString(with ? "SubscriptionResults.filter.with.words" : "SubscriptionResults.filter.without.words"));
            GridData gd = new GridData();
            gd.widthHint = Utils.adjustPXForDPI(100);
            textWidget.setLayoutData(gd);
            textWidget.addModifyListener(new ModifyListener() {

                @Override
                public void modifyText(ModifyEvent e) {
                    String text = textWidget.getText().toLowerCase(Locale.US);
                    String[] bits = text.split("\\s+");
                    Set<String> temp = new HashSet<>();
                    for (String bit : bits) {
                        bit = bit.trim();
                        if (bit.length() > 0) {
                            temp.add(bit);
                        }
                    }
                    String[] words = temp.toArray(new String[temp.size()]);
                    synchronized (filter_lock) {
                        if (with) {
                            with_keywords = words;
                        } else {
                            without_keywords = words;
                        }
                    }
                    refilter_dispatcher.dispatch();
                }
            });
        }
        // min size
        label = new Label(cRow, SWT.VERTICAL | SWT.SEPARATOR);
        label.setLayoutData(new RowData(-1, sepHeight));
        Composite cMinSize = new Composite(cRow, SWT.NONE);
        layout = new GridLayout(2, false);
        layout.marginWidth = 0;
        layout.marginBottom = layout.marginTop = layout.marginLeft = layout.marginRight = 0;
        cMinSize.setLayout(layout);
        Label lblMinSize = new Label(cMinSize, SWT.NONE);
        lblMinSize.setText(MessageText.getString("SubscriptionResults.filter.min_size"));
        spinMinSize = new Spinner(cMinSize, SWT.BORDER);
        spinMinSize.setMinimum(0);
        // 100 TB should do...
        spinMinSize.setMaximum(100 * 1024 * 1024);
        spinMinSize.setSelection(minSize);
        spinMinSize.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event event) {
                minSize = ((Spinner) event.widget).getSelection();
                refilter();
            }
        });
        // max size
        label = new Label(cRow, SWT.VERTICAL | SWT.SEPARATOR);
        label.setLayoutData(new RowData(-1, sepHeight));
        Composite cMaxSize = new Composite(cRow, SWT.NONE);
        layout = new GridLayout(2, false);
        layout.marginWidth = 0;
        layout.marginBottom = layout.marginTop = layout.marginLeft = layout.marginRight = 0;
        cMaxSize.setLayout(layout);
        Label lblMaxSize = new Label(cMaxSize, SWT.NONE);
        lblMaxSize.setText(MessageText.getString("SubscriptionResults.filter.max_size"));
        spinMaxSize = new Spinner(cMaxSize, SWT.BORDER);
        spinMaxSize.setMinimum(0);
        // 100 TB should do...
        spinMaxSize.setMaximum(100 * 1024 * 1024);
        spinMaxSize.setSelection(maxSize);
        spinMaxSize.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event event) {
                maxSize = ((Spinner) event.widget).getSelection();
                refilter();
            }
        });
        engine_area = new Composite(filter_area, SWT.NONE);
        engine_area.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        buildEngineArea(null);
        parent.layout(true);
    }
    return null;
}
Also used : VuzeMessageBoxListener(com.biglybt.ui.swt.views.skin.VuzeMessageBoxListener) UserPrompterResultListener(com.biglybt.ui.UserPrompterResultListener) SWTSkinCheckboxListener(com.biglybt.ui.swt.skin.SWTSkinCheckboxListener) ImageDownloaderListener(com.biglybt.ui.swt.imageloader.ImageLoader.ImageDownloaderListener) TableViewSWTMenuFillListener(com.biglybt.ui.swt.views.table.TableViewSWTMenuFillListener) ResultListener(com.biglybt.core.metasearch.ResultListener) TableColumnCreationListener(com.biglybt.pif.ui.tables.TableColumnCreationListener) Listener(org.eclipse.swt.widgets.Listener) SWTSkinToggleListener(com.biglybt.ui.swt.skin.SWTSkinToggleListener) CoreRunningListener(com.biglybt.core.CoreRunningListener) MetaSearchListener(com.biglybt.core.metasearch.MetaSearchListener) SWTSkinObjectToggle(com.biglybt.ui.swt.skin.SWTSkinObjectToggle) Spinner(org.eclipse.swt.widgets.Spinner) Label(org.eclipse.swt.widgets.Label) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) GridLayout(org.eclipse.swt.layout.GridLayout) RowData(org.eclipse.swt.layout.RowData) SWTSkinObjectTextbox(com.biglybt.ui.swt.skin.SWTSkinObjectTextbox) RowLayout(org.eclipse.swt.layout.RowLayout) CoreRunningListener(com.biglybt.core.CoreRunningListener) SWTSkinToggleListener(com.biglybt.ui.swt.skin.SWTSkinToggleListener) Core(com.biglybt.core.Core) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) Text(org.eclipse.swt.widgets.Text) MessageText(com.biglybt.core.internat.MessageText) SWTSkinObjectText(com.biglybt.ui.swt.skin.SWTSkinObjectText) GridData(org.eclipse.swt.layout.GridData) Event(org.eclipse.swt.widgets.Event) ImageLoader(com.biglybt.ui.swt.imageloader.ImageLoader)

Example 3 with SWTSkinObjectTextbox

use of com.biglybt.ui.swt.skin.SWTSkinObjectTextbox in project BiglyBT by BiglySoftware.

the class SBC_ArchivedDownloadsView method skinObjectShown.

@Override
public Object skinObjectShown(SWTSkinObject skinObject, Object params) {
    super.skinObjectShown(skinObject, params);
    SWTSkinObjectTextbox soFilter = (SWTSkinObjectTextbox) getSkinObject("filterbox");
    if (soFilter != null) {
        txtFilter = soFilter.getTextControl();
    }
    SWTSkinObject so_list = getSkinObject("archived-dls-list");
    if (so_list != null) {
        initTable((Composite) so_list.getControl());
    } else {
        System.out.println("NO archived-dls-list");
        return (null);
    }
    if (tv == null) {
        return (null);
    }
    PluginInitializer.getDefaultInterface().getDownloadManager().addDownloadStubListener(this, true);
    dm_listener_added = true;
    return (null);
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) SWTSkinObjectTextbox(com.biglybt.ui.swt.skin.SWTSkinObjectTextbox)

Example 4 with SWTSkinObjectTextbox

use of com.biglybt.ui.swt.skin.SWTSkinObjectTextbox in project BiglyBT by BiglySoftware.

the class SBC_DownloadHistoryView method skinObjectShown.

@Override
public Object skinObjectShown(SWTSkinObject skinObject, Object params) {
    super.skinObjectShown(skinObject, params);
    SWTSkinObjectTextbox soFilter = (SWTSkinObjectTextbox) getSkinObject("filterbox");
    if (soFilter != null) {
        txtFilter = soFilter.getTextControl();
    }
    SWTSkinObject so_list = getSkinObject("dl-history-list");
    if (so_list != null) {
        initTable((Composite) so_list.getControl());
    } else {
        System.out.println("NO dl-history-list");
        return (null);
    }
    if (tv == null) {
        return (null);
    }
    if (dh_manager != null) {
        dh_manager.addListener(this, true);
        dh_listener_added = true;
    }
    return (null);
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) SWTSkinObjectTextbox(com.biglybt.ui.swt.skin.SWTSkinObjectTextbox)

Example 5 with SWTSkinObjectTextbox

use of com.biglybt.ui.swt.skin.SWTSkinObjectTextbox 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)

Aggregations

SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)5 SWTSkinObjectTextbox (com.biglybt.ui.swt.skin.SWTSkinObjectTextbox)5 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 Text (org.eclipse.swt.widgets.Text)2 Core (com.biglybt.core.Core)1 CoreRunningListener (com.biglybt.core.CoreRunningListener)1 DownloadManager (com.biglybt.core.download.DownloadManager)1 MessageText (com.biglybt.core.internat.MessageText)1 MetaSearchListener (com.biglybt.core.metasearch.MetaSearchListener)1 ResultListener (com.biglybt.core.metasearch.ResultListener)1 TableColumnCreationListener (com.biglybt.pif.ui.tables.TableColumnCreationListener)1 TableRow (com.biglybt.pif.ui.tables.TableRow)1 TableRowRefreshListener (com.biglybt.pif.ui.tables.TableRowRefreshListener)1 UserPrompterResultListener (com.biglybt.ui.UserPrompterResultListener)1 TableColumnCore (com.biglybt.ui.common.table.TableColumnCore)1 TableRowCore (com.biglybt.ui.common.table.TableRowCore)1 TableSelectionAdapter (com.biglybt.ui.common.table.TableSelectionAdapter)1 TableColumnManager (com.biglybt.ui.common.table.impl.TableColumnManager)1 ImageLoader (com.biglybt.ui.swt.imageloader.ImageLoader)1