Search in sources :

Example 36 with SWTSkinObject

use of com.biglybt.ui.swt.skin.SWTSkinObject 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 37 with SWTSkinObject

use of com.biglybt.ui.swt.skin.SWTSkinObject 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 38 with SWTSkinObject

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

the class SBC_GenericBrowsePage method skinObjectInitialShow.

@Override
public Object skinObjectInitialShow(SWTSkinObject skinObject, Object params) {
    Object creationParams = skinObject.getData("CreationParams");
    browserSkinObject = SWTSkinUtils.findBrowserSO(soMain);
    final MultipleDocumentInterfaceSWT mdi = UIFunctionsManagerSWT.getUIFunctionsSWT().getMDISWT();
    if (mdi != null) {
        entry = mdi.getEntryBySkinView(this);
        if (entry != null) {
            vitalityImage = entry.addVitalityImage("image.sidebar.vitality.dots");
            vitalityImage.setVisible(false);
            mdi.addListener(new MdiListener() {

                long lastSelect = 0;

                @Override
                public void mdiEntrySelected(MdiEntry newEntry, MdiEntry oldEntry) {
                    if (entry == newEntry) {
                        if (entry == oldEntry) {
                            if (lastSelect < SystemTime.getOffsetTime(-1000)) {
                                if (browserSkinObject != null) {
                                    browserSkinObject.restart();
                                }
                            }
                        } else {
                            lastSelect = SystemTime.getCurrentTime();
                        }
                    }
                }

                @Override
                public void mdiDisposed(MultipleDocumentInterface mdi) {
                }
            });
        }
    }
    browserSkinObject.addListener(new SWTSkinObjectListener() {

        @Override
        public Object eventOccured(SWTSkinObject skinObject, int eventType, Object params) {
            if (eventType == EVENT_SHOW) {
                browserSkinObject.removeListener(this);
                browserSkinObject.addListener(new BrowserContext.loadingListener() {

                    @Override
                    public void browserLoadingChanged(boolean loading, String url) {
                        if (vitalityImage != null) {
                            vitalityImage.setVisible(loading);
                        }
                    }
                });
            } else if (eventType == EVENT_DATASOURCE_CHANGED) {
                if (params instanceof String) {
                    browserSkinObject.setURL((String) params);
                }
            }
            return null;
        }
    });
    openURL();
    return null;
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) MdiListener(com.biglybt.ui.mdi.MdiListener) MdiEntry(com.biglybt.ui.mdi.MdiEntry) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) MultipleDocumentInterfaceSWT(com.biglybt.ui.swt.mdi.MultipleDocumentInterfaceSWT) SWTSkinObjectListener(com.biglybt.ui.swt.skin.SWTSkinObjectListener) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface)

Example 39 with SWTSkinObject

use of com.biglybt.ui.swt.skin.SWTSkinObject 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 40 with SWTSkinObject

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

the class SBC_LibraryView method setViewMode.

public void setViewMode(int viewMode, boolean save) {
    if (viewMode >= modeViewIDs.length || viewMode < 0 || viewMode == this.viewMode) {
        return;
    }
    if (!COConfigurationManager.getBooleanParameter("Library.EnableSimpleView")) {
        viewMode = MODE_SMALLTABLE;
    }
    int oldViewMode = this.viewMode;
    this.viewMode = viewMode;
    if (oldViewMode >= 0 && oldViewMode < modeViewIDs.length) {
        SWTSkinObject soOldViewArea = getSkinObject(modeViewIDs[oldViewMode]);
        // SWTSkinObject soOldViewArea = skin.getSkinObjectByID(modeIDs[oldViewMode]);
        if (soOldViewArea != null) {
            soOldViewArea.setVisible(false);
        }
    }
    SelectedContentManager.clearCurrentlySelectedContent();
    SWTSkinObject soViewArea = getSkinObject(modeViewIDs[viewMode]);
    if (soViewArea == null) {
        soViewArea = skin.createSkinObject(modeIDs[viewMode] + torrentFilterMode, modeIDs[viewMode], soListArea);
        soViewArea.getControl().setData("SBC_LibraryView:ViewMode", viewMode);
        skin.layout();
        soViewArea.setVisible(true);
        soViewArea.getControl().setLayoutData(Utils.getFilledFormData());
    } else {
        soViewArea.setVisible(true);
    }
    if (save) {
        COConfigurationManager.setParameter(torrentFilter + ".viewmode", viewMode);
    }
    String entryID = null;
    if (torrentFilterMode == TORRENTS_ALL) {
        entryID = SideBar.SIDEBAR_SECTION_LIBRARY;
    } else if (torrentFilterMode == TORRENTS_COMPLETE) {
        entryID = SideBar.SIDEBAR_SECTION_LIBRARY_CD;
    } else if (torrentFilterMode == TORRENTS_INCOMPLETE) {
        entryID = SideBar.SIDEBAR_SECTION_LIBRARY_DL;
    } else if (torrentFilterMode == TORRENTS_UNOPENED) {
        entryID = SideBar.SIDEBAR_SECTION_LIBRARY_UNOPENED;
    }
    if (entryID != null) {
        MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
        currentEntry = mdi.getEntry(entryID);
        if (currentEntry != null) {
            currentEntry.setLogID(entryID + "-" + viewMode);
        }
    }
    SB_Transfers sb_t = MainMDISetup.getSb_transfers();
    if (sb_t != null) {
        sb_t.triggerCountRefreshListeners();
    }
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface) Point(org.eclipse.swt.graphics.Point)

Aggregations

SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)53 SWTSkinObjectContainer (com.biglybt.ui.swt.skin.SWTSkinObjectContainer)15 GridLayout (org.eclipse.swt.layout.GridLayout)8 SWTSkinObjectListener (com.biglybt.ui.swt.skin.SWTSkinObjectListener)7 SWTSkinButtonUtility (com.biglybt.ui.swt.skin.SWTSkinButtonUtility)5 SWTSkinObjectText (com.biglybt.ui.swt.skin.SWTSkinObjectText)5 SWTSkinObjectTextbox (com.biglybt.ui.swt.skin.SWTSkinObjectTextbox)5 GridData (org.eclipse.swt.layout.GridData)5 CoreRunningListener (com.biglybt.core.CoreRunningListener)4 MultipleDocumentInterface (com.biglybt.ui.mdi.MultipleDocumentInterface)4 FormAttachment (org.eclipse.swt.layout.FormAttachment)4 FormData (org.eclipse.swt.layout.FormData)4 Core (com.biglybt.core.Core)3 ToolBarItem (com.biglybt.ui.common.ToolBarItem)3 UIUpdatable (com.biglybt.ui.common.updater.UIUpdatable)3 UIUpdater (com.biglybt.ui.common.updater.UIUpdater)3 MdiEntry (com.biglybt.ui.mdi.MdiEntry)3 PluginUISWTSkinObject (com.biglybt.ui.swt.pif.PluginUISWTSkinObject)3 Control (org.eclipse.swt.widgets.Control)3 ActivitiesEntry (com.biglybt.activities.ActivitiesEntry)2