Search in sources :

Example 1 with MdiEntryDropListener

use of com.biglybt.ui.mdi.MdiEntryDropListener in project BiglyBT by BiglySoftware.

the class ChatMDIEntry method setupMdiEntry.

private void setupMdiEntry() {
    mdi_entry.setViewTitleInfo(this);
    MdiEntryDropListener drop_listener = new MdiEntryDropListener() {

        @Override
        public boolean mdiEntryDrop(MdiEntry entry, Object payload) {
            if (payload instanceof String[]) {
                String[] derp = (String[]) payload;
                if (derp.length > 0) {
                    payload = derp[0];
                }
            }
            if (!(payload instanceof String)) {
                return false;
            }
            MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
            if (mdi != null) {
                String drop = (String) payload;
                if (view == null) {
                    drop_outstanding = drop;
                } else {
                    view.handleDrop(drop);
                }
                mdi.showEntry(mdi_entry);
                return (true);
            } else {
                return (false);
            }
        }
    };
    mdi_entry.addListener(drop_listener);
    mdi_entry.addListener(new MdiCloseListener() {

        @Override
        public void mdiEntryClosed(MdiEntry entry, boolean user) {
            chat.removeListener(adapter);
            chat.destroy();
        }
    });
    /*
		UIManager ui_manager = PluginInitializer.getDefaultInterface().getUIManager();
		
		MenuManager menu_manager = ui_manager.getMenuManager();

		MenuItem menu_item;

		menu_item = menu_manager.addMenuItem( "sidebar." + mdi_entry.getId(), "dasd.ad.ad." );
		menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
		menu_item.addListener(
				new MenuItemListener() 
				{
					@Override
					public void
					selected(
						MenuItem menu, Object target ) 
					{
				      	
					}
				});
		*/
    mdi_entry.setImageLeftID("image.sidebar.chat-overview");
    chat.addListener(adapter);
}
Also used : MdiEntry(com.biglybt.ui.mdi.MdiEntry) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface) MdiCloseListener(com.biglybt.ui.mdi.MdiCloseListener) MdiEntryDropListener(com.biglybt.ui.mdi.MdiEntryDropListener)

Example 2 with MdiEntryDropListener

use of com.biglybt.ui.mdi.MdiEntryDropListener in project BiglyBT by BiglySoftware.

the class ChatMDIEntry method setupMdiEntry.

private void setupMdiEntry(UIManager ui_manager) {
    mdi_entry.setViewTitleInfo(this);
    MdiEntryDropListener drop_listener = new MdiEntryDropListener() {

        @Override
        public boolean mdiEntryDrop(MdiEntry entry, Object payload) {
            if (payload instanceof String[]) {
                String[] derp = (String[]) payload;
                if (derp.length > 0) {
                    payload = derp[0];
                }
            }
            if (!(payload instanceof String)) {
                return false;
            }
            MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
            if (mdi != null) {
                String drop = (String) payload;
                if (view == null) {
                    drop_outstanding = drop;
                } else {
                    view.handleDrop(drop);
                }
                mdi.showEntry(mdi_entry);
                return (true);
            } else {
                return (false);
            }
        }
    };
    mdi_entry.addListener(drop_listener);
    mdi_entry.addListener(new MdiCloseListener() {

        @Override
        public void mdiEntryClosed(MdiEntry entry, boolean user) {
            chat.removeListener(adapter);
            chat.destroy();
        }
    });
    String menu_key = "sidebar." + mdi_entry.getViewID();
    MenuManager menu_manager = ui_manager.getMenuManager();
    MenuItem menu_item = menu_manager.addMenuItem(menu_key, "iconBar.remove");
    Utils.setMenuItemImage(menu_item, "delete");
    menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
    menu_item.addListener(new MenuItemListener() {

        @Override
        public void selected(MenuItem menu, Object target) {
            chat.remove();
        }
    });
    menu_item = menu_manager.addMenuItem(menu_key, "sep");
    menu_item.setStyle(MenuItem.STYLE_SEPARATOR);
    mdi_entry.setImageLeftID("image.sidebar.chat-overview");
    chat.addListener(adapter);
}
Also used : MdiEntry(com.biglybt.ui.mdi.MdiEntry) MenuManager(com.biglybt.pif.ui.menus.MenuManager) MenuItem(com.biglybt.pif.ui.menus.MenuItem) MenuItemListener(com.biglybt.pif.ui.menus.MenuItemListener) MultipleDocumentInterface(com.biglybt.ui.mdi.MultipleDocumentInterface) MdiCloseListener(com.biglybt.ui.mdi.MdiCloseListener) MdiEntryDropListener(com.biglybt.ui.mdi.MdiEntryDropListener)

Aggregations

MdiCloseListener (com.biglybt.ui.mdi.MdiCloseListener)2 MdiEntry (com.biglybt.ui.mdi.MdiEntry)2 MdiEntryDropListener (com.biglybt.ui.mdi.MdiEntryDropListener)2 MultipleDocumentInterface (com.biglybt.ui.mdi.MultipleDocumentInterface)2 MenuItem (com.biglybt.pif.ui.menus.MenuItem)1 MenuItemListener (com.biglybt.pif.ui.menus.MenuItemListener)1 MenuManager (com.biglybt.pif.ui.menus.MenuManager)1