Search in sources :

Example 1 with SWTSkinObject

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

the class SBC_TagsOverview method skinObjectInitialShow.

// @see SkinView#skinObjectInitialShow(SWTSkinObject, java.lang.Object)
@Override
public Object skinObjectInitialShow(SWTSkinObject skinObject, Object params) {
    initColumns();
    SWTSkinObjectButton soAddTagButton = (SWTSkinObjectButton) getSkinObject("add-tag");
    if (soAddTagButton != null) {
        soAddTagButton.addSelectionListener(new ButtonListenerAdapter() {

            // @see SWTSkinButtonUtility.ButtonListenerAdapter#pressed(SWTSkinButtonUtility, SWTSkinObject, int)
            @Override
            public void pressed(SWTSkinButtonUtility buttonUtility, SWTSkinObject skinObject, int stateMask) {
                TagUIUtilsV3.showCreateTagDialog(null);
            }
        });
    }
    new InfoBarUtil(skinObject, "tagsview.infobar", false, "tags.infobar", "tags.view.infobar") {

        @Override
        public boolean allowShow() {
            return true;
        }
    };
    return null;
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) SWTSkinButtonUtility(com.biglybt.ui.swt.skin.SWTSkinButtonUtility) SWTSkinObjectButton(com.biglybt.ui.swt.skin.SWTSkinObjectButton) ButtonListenerAdapter(com.biglybt.ui.swt.skin.SWTSkinButtonUtility.ButtonListenerAdapter)

Example 2 with SWTSkinObject

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

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

the class SBC_TorrentDetailsView method skinObjectInitialShow.

// @see SkinView#skinObjectInitialShow(SWTSkinObject, java.lang.Object)
@Override
public Object skinObjectInitialShow(SWTSkinObject skinObject, Object params) {
    SWTSkinObject soListArea = getSkinObject("torrentdetails-list-area");
    if (soListArea == null) {
        return null;
    }
    /*
		MultipleDocumentInterfaceSWT mdi = UIFunctionsManagerSWT.getUIFunctionsSWT().getMDISWT();

		if (mdi != null) {

			mdi_entry = mdi.getEntryFromSkinObject(skinObject);

			if ( mdi_entry == null ){

					// We *really* need to not use 'current' here as it is inaccurate (try opening multiple torrent details view
					// at once to see this)

				Debug.out( "Failed to get MDI entry from skin object, reverting to using 'current'" );

				mdi_entry = mdi.getCurrentEntrySWT();
			}

		}
		*/
    initialize((Composite) soListArea.getControl());
    return null;
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject)

Example 4 with SWTSkinObject

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

the class SideBarEntrySWT method widgetDisposed.

@Override
public void widgetDisposed(DisposeEvent e) {
    ImageLoader imageLoader = ImageLoader.getInstance();
    if (imageLoader != null) {
        imageLoader.releaseImage("image.sidebar.closeitem");
        imageLoader.releaseImage("image.sidebar.closeitem-selected");
    }
    setDisposed(true);
    final TreeItem treeItem = (TreeItem) e.widget;
    if (treeItem != swtItem) {
        Debug.out("Warning: TreeItem changed for sidebar " + id);
        return;
    }
    if (swtItem == null) {
        return;
    }
    if (swtItem != null && !Constants.isOSX) {
        // In theory, the disposal of swtItem will trigger the disposal of the
        // children.  Let's force it just in case
        // On OSX this will cause disposal confusion in SWT, and possibly result
        // in a SIGSEGV crash.
        TreeItem[] children = swtItem.getItems();
        for (TreeItem child : children) {
            if (child.isDisposed()) {
                continue;
            }
            MdiEntry entry = (MdiEntry) child.getData("MdiEntry");
            if (entry != null) {
                entry.close(true);
            }
        }
    }
    final Tree tree = sidebar.getTree();
    if (tree.isDisposed() || (swtItem != null && swtItem.isDisposed()) || tree.getShell().isDisposed()) {
        return;
    }
    setTreeItem(null);
    mdi.removeItem(SideBarEntrySWT.this);
    SWTThread instance = SWTThread.getInstance();
    boolean user = instance != null && !instance.isTerminated();
    if (user) {
        // It's not a user close if the parent is making the children (this entry)
        // close.  parent will be marked disposed, so use that as a check.
        String parentID = getParentID();
        if (parentID != null) {
            MdiEntry entry = mdi.getEntry(parentID);
            if (entry != null && entry.isDisposed()) {
                user = false;
            }
        }
    }
    triggerCloseListeners(user);
    SWTSkinObject so = getSkinObject();
    if (so != null) {
        setSkinObjectMaster(null);
        so.getSkin().removeSkinObject(so);
    }
    for (SideBarVitalityImageSWT vitalityImage : listVitalityImages) {
        vitalityImage.dispose();
    }
    listVitalityImages.clear();
    // delay saving of removing of auto-open flag.  If after the delay, we are
    // still alive, it's assumed the user invoked the close, and we should
    // remove the auto-open flag
    Utils.execSWTThreadLater(0, new SWTRunnable() {

        @Override
        public void runWithDisplay(Display display) {
            // opposed to closing  the sidebar)
            if (tree.isDisposed()) {
                return;
            }
            try {
                COConfigurationManager.removeParameter("SideBar.AutoOpen." + id);
                // Force selection
                if (Constants.isOSX && !tree.isDisposed() && tree.getSelectionCount() == 0) {
                    String parentid = getParentID();
                    if (parentid != null && mdi.getEntry(parentid) != null) {
                        mdi.showEntryByID(parentid);
                    } else {
                        mdi.showEntryByID(SideBar.SIDEBAR_SECTION_LIBRARY);
                    }
                }
            } catch (Exception e2) {
                Debug.out(e2);
            }
            // See if this entry has been replaced by another in the meantime. This happens when we are
            // moving an entry in the sidebar by removing it and then re-adding it. We assume that the
            // auto-open properties of the replacement are the same as those of the initial entry
            boolean replaced = false;
            String my_id = SideBarEntrySWT.this.getId();
            if (my_id != null) {
                MdiEntry entry = mdi.getEntry(my_id);
                if (entry != null && entry != SideBarEntrySWT.this) {
                    replaced = true;
                }
            }
            if (!replaced) {
                mdi.removeEntryAutoOpen(id);
            }
        }
    });
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) BaseMdiEntry(com.biglybt.ui.swt.mdi.BaseMdiEntry) MdiEntry(com.biglybt.ui.mdi.MdiEntry) SWTRunnable(com.biglybt.ui.swt.utils.SWTRunnable) ImageLoader(com.biglybt.ui.swt.imageloader.ImageLoader) SWTThread(com.biglybt.ui.swt.mainwindow.SWTThread)

Example 5 with SWTSkinObject

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

the class SkinViewManager method add.

/**
 * @param key
 * @param skinView
 */
public static void add(final SkinView skinView) {
    mon_skinViews.enter();
    try {
        List<SkinView> list = mapSkinViews.get(skinView.getClass());
        if (list == null) {
            list = new ArrayList<>(1);
            mapSkinViews.put(skinView.getClass(), list);
        }
        list.add(skinView);
    } finally {
        mon_skinViews.exit();
    }
    SWTSkinObject mainSkinObject = skinView.getMainSkinObject();
    if (mainSkinObject != null) {
        skinIDs.put(mainSkinObject.getSkinObjectID(), skinView);
        String viewID = mainSkinObject.getViewID();
        if (viewID != null && viewID.length() > 0) {
            skinViewIDs.put(viewID, skinView);
        }
    }
    triggerViewAddedListeners(skinView);
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject)

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