Search in sources :

Example 11 with UISWTViewEventListener

use of com.biglybt.ui.swt.pif.UISWTViewEventListener in project BiglyBT by BiglySoftware.

the class BuddyPluginView method addBetaSubviews.

private void addBetaSubviews(boolean enable) {
    String[] views = { TableManager.TABLE_MYTORRENTS_ALL_BIG, TableManager.TABLE_MYTORRENTS_INCOMPLETE, TableManager.TABLE_MYTORRENTS_INCOMPLETE_BIG, TableManager.TABLE_MYTORRENTS_COMPLETE, "TagsView" };
    if (enable) {
        taggableLifecycleAdapter = new TaggableLifecycleAdapter() {

            @Override
            public void taggableTagged(TagType tag_type, Tag tag, Taggable taggable) {
                if (tag_type.getTagType() == TagType.TT_DOWNLOAD_MANUAL) {
                    DownloadManager dm = (DownloadManager) taggable;
                    for (BetaSubViewHolder h : beta_subviews.values()) {
                        h.tagsUpdated(dm);
                    }
                }
            }

            @Override
            public void taggableUntagged(TagType tag_type, Tag tag, Taggable taggable) {
                if (tag_type.getTagType() == TagType.TT_DOWNLOAD_MANUAL) {
                    DownloadManager dm = (DownloadManager) taggable;
                    for (BetaSubViewHolder h : beta_subviews.values()) {
                        h.tagsUpdated(dm);
                    }
                }
            }
        };
        TagManagerFactory.getTagManager().addTaggableLifecycleListener(Taggable.TT_DOWNLOAD, taggableLifecycleAdapter);
        UISWTViewEventListener listener = new UISWTViewEventListener() {

            @Override
            public boolean eventOccurred(UISWTViewEvent event) {
                UISWTView currentView = event.getView();
                switch(event.getType()) {
                    case UISWTViewEvent.TYPE_CREATE:
                        {
                            beta_subviews.put(currentView, new BetaSubViewHolder());
                            currentView.setDestroyOnDeactivate(false);
                            break;
                        }
                    case UISWTViewEvent.TYPE_INITIALIZE:
                        {
                            BetaSubViewHolder subview = beta_subviews.get(currentView);
                            if (subview != null) {
                                subview.initialise(event.getView(), (Composite) event.getData());
                            }
                            break;
                        }
                    case UISWTViewEvent.TYPE_DATASOURCE_CHANGED:
                        {
                            BetaSubViewHolder subview = beta_subviews.get(currentView);
                            if (subview != null) {
                                subview.setDataSource(event.getData());
                            }
                            break;
                        }
                    case UISWTViewEvent.TYPE_FOCUSGAINED:
                        {
                            BetaSubViewHolder subview = beta_subviews.get(currentView);
                            if (subview != null) {
                                subview.gotFocus();
                            }
                            break;
                        }
                    case UISWTViewEvent.TYPE_FOCUSLOST:
                        {
                            BetaSubViewHolder subview = beta_subviews.get(currentView);
                            if (subview != null) {
                                subview.lostFocus();
                            }
                            break;
                        }
                    case UISWTViewEvent.TYPE_DESTROY:
                        {
                            BetaSubViewHolder subview = beta_subviews.remove(currentView);
                            if (subview != null) {
                                subview.destroy();
                            }
                            break;
                        }
                }
                return true;
            }
        };
        for (String table_id : views) {
            ui_instance.addView(table_id, "azbuddy.ui.menu.chat", listener);
        }
        TableManager table_manager = plugin.getPluginInterface().getUIManager().getTableManager();
        TableCellRefreshListener msg_refresh_listener = new TableCellRefreshListener() {

            @Override
            public void refresh(TableCell _cell) {
                TableCellSWT cell = (TableCellSWT) _cell;
                Download dl = (Download) cell.getDataSource();
                if (dl == null) {
                    return;
                }
                List<ChatInstance> instances = BuddyPluginUtils.peekChatInstances(dl);
                boolean is_pending = false;
                for (ChatInstance instance : instances) {
                    if (instance.getMessageOutstanding()) {
                        is_pending = true;
                    }
                }
                Image graphic;
                String tooltip;
                int sort_order;
                if (is_pending) {
                    graphic = bs_chat_gray_text;
                    tooltip = MessageText.getString("TableColumn.header.chat.msg.out");
                    sort_order = 1;
                } else {
                    graphic = null;
                    tooltip = MessageText.getString("label.no.messages");
                    sort_order = 0;
                }
                cell.setMarginHeight(0);
                cell.setGraphic(graphic);
                cell.setToolTip(tooltip);
                cell.setSortValue(sort_order);
                cell.setCursorID(graphic == null ? SWT.CURSOR_ARROW : SWT.CURSOR_HAND);
            }
        };
        TableCellMouseListener msg_mouse_listener = new TableCellMouseListener() {

            @Override
            public void cellMouseTrigger(TableCellMouseEvent event) {
                if (event.eventType == TableCellMouseEvent.EVENT_MOUSEUP) {
                    TableCell cell = event.cell;
                    Download dl = (Download) cell.getDataSource();
                    if (dl != null) {
                        List<ChatInstance> instances = BuddyPluginUtils.peekChatInstances(dl);
                        for (ChatInstance instance : instances) {
                            if (instance.getMessageOutstanding()) {
                                try {
                                    BuddyPluginUtils.getBetaPlugin().showChat(instance);
                                } catch (Throwable e) {
                                    Debug.out(e);
                                }
                            }
                        }
                    }
                }
            }
        };
        columnMessagePending = new TableColumnCreationListener() {

            @Override
            public void tableColumnCreated(TableColumn result) {
                result.setAlignment(TableColumn.ALIGN_CENTER);
                result.setPosition(TableColumn.POSITION_LAST);
                result.setWidth(32);
                result.setRefreshInterval(TableColumn.INTERVAL_INVALID_ONLY);
                result.setType(TableColumn.TYPE_GRAPHIC);
                result.addCellRefreshListener(msg_refresh_listener);
                result.addCellMouseListener(msg_mouse_listener);
                result.setIconReference("dchat_gray", true);
                synchronized (columns) {
                    columns.add(result);
                }
            }
        };
        table_manager.registerColumn(Download.class, "azbuddy.ui.column.msgpending", columnMessagePending);
    } else {
        for (String table_id : views) {
            ui_instance.removeViews(table_id, "azbuddy.ui.menu.chat");
        }
        for (UISWTView entry : new ArrayList<>(beta_subviews.keySet())) {
            entry.closeView();
        }
        if (taggableLifecycleAdapter != null) {
            TagManagerFactory.getTagManager().removeTaggableLifecycleListener(Taggable.TT_DOWNLOAD, taggableLifecycleAdapter);
            taggableLifecycleAdapter = null;
        }
        beta_subviews.clear();
        if (columnMessagePending != null) {
            TableManager table_manager = plugin.getPluginInterface().getUIManager().getTableManager();
            table_manager.unregisterColumn(Download.class, "azbuddy.ui.column.msgpending", columnMessagePending);
            columnMessagePending = null;
            synchronized (columns) {
                columns.clear();
            }
        }
    }
}
Also used : ChatInstance(com.biglybt.plugin.net.buddy.BuddyPluginBeta.ChatInstance) TableCellSWT(com.biglybt.ui.swt.views.table.TableCellSWT) TaggableLifecycleAdapter(com.biglybt.core.tag.TaggableLifecycleAdapter) ArrayList(java.util.ArrayList) Image(org.eclipse.swt.graphics.Image) DownloadManager(com.biglybt.core.download.DownloadManager) TableCellMouseListener(com.biglybt.pif.ui.tables.TableCellMouseListener) TableColumnCreationListener(com.biglybt.pif.ui.tables.TableColumnCreationListener) TableCell(com.biglybt.pif.ui.tables.TableCell) UISWTViewEvent(com.biglybt.ui.swt.pif.UISWTViewEvent) TableManager(com.biglybt.pif.ui.tables.TableManager) Download(com.biglybt.pif.download.Download) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) UISWTViewEventListener(com.biglybt.ui.swt.pif.UISWTViewEventListener) TableColumn(com.biglybt.pif.ui.tables.TableColumn) Point(org.eclipse.swt.graphics.Point) TagType(com.biglybt.core.tag.TagType) UISWTView(com.biglybt.ui.swt.pif.UISWTView) TableCellRefreshListener(com.biglybt.pif.ui.tables.TableCellRefreshListener) TableCellMouseEvent(com.biglybt.pif.ui.tables.TableCellMouseEvent) Tag(com.biglybt.core.tag.Tag) Taggable(com.biglybt.core.tag.Taggable)

Example 12 with UISWTViewEventListener

use of com.biglybt.ui.swt.pif.UISWTViewEventListener in project BiglyBT by BiglySoftware.

the class PeersGraphicView method initialize.

protected void initialize(Composite composite) {
    display = composite.getDisplay();
    panel = new Canvas(composite, SWT.NO_BACKGROUND);
    panel.addListener(SWT.MouseHover, new Listener() {

        @Override
        public void handleEvent(Event event) {
            int x = event.x;
            int y = event.y;
            String tt = "";
            synchronized (dm_data_lock) {
                for (ManagerData data : dm_data) {
                    DownloadManager manager = data.manager;
                    if (x >= data.me_hit_x && x <= data.me_hit_x + OWN_SIZE && y >= data.me_hit_y && y <= data.me_hit_y + OWN_SIZE) {
                        if (dm_data.length > 1) {
                            tt = manager.getDisplayName() + "\r\n";
                        }
                        tt += DisplayFormatters.formatDownloadStatus(manager) + ", " + DisplayFormatters.formatPercentFromThousands(manager.getStats().getCompleted());
                        break;
                    } else {
                        PEPeer target = null;
                        for (Map.Entry<PEPeer, int[]> entry : data.peer_hit_map.entrySet()) {
                            int[] loc = entry.getValue();
                            int loc_x = loc[0];
                            int loc_y = loc[1];
                            if (x >= loc_x && x <= loc_x + PEER_SIZE && y >= loc_y && y <= loc_y + PEER_SIZE) {
                                target = entry.getKey();
                                break;
                            }
                        }
                        if (target != null) {
                            PEPeerStats stats = target.getStats();
                            String[] details = PeerUtils.getCountryDetails(target);
                            String dstr = (details == null || details.length < 2) ? "" : (" - " + details[0] + "/" + details[1]);
                            /*
							if ( dm_map.size() > 1 ){

								tt = manager.getDisplayName() + "\r\n";
							}
							*/
                            tt = target.getIp() + dstr + ", " + DisplayFormatters.formatPercentFromThousands(target.getPercentDoneInThousandNotation()) + "\r\n" + "Up=" + DisplayFormatters.formatByteCountToKiBEtcPerSec(stats.getDataSendRate() + stats.getProtocolSendRate()) + ", " + "Down=" + DisplayFormatters.formatByteCountToKiBEtcPerSec(stats.getDataReceiveRate() + stats.getProtocolReceiveRate());
                            break;
                        }
                    }
                }
            }
            panel.setToolTipText(tt);
        }
    });
    panel.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseUp(MouseEvent event) {
            if (event.button == 3) {
                int x = event.x;
                int y = event.y;
                PEPeer target = null;
                DownloadManager target_manager = null;
                synchronized (dm_data_lock) {
                    for (ManagerData data : dm_data) {
                        DownloadManager manager = data.manager;
                        for (Map.Entry<PEPeer, int[]> entry : data.peer_hit_map.entrySet()) {
                            int[] loc = entry.getValue();
                            int loc_x = loc[0];
                            int loc_y = loc[1];
                            if (x >= loc_x && x <= loc_x + PEER_SIZE && y >= loc_y && y <= loc_y + PEER_SIZE) {
                                target = entry.getKey();
                                target_manager = manager;
                                break;
                            }
                        }
                        if (target != null) {
                            break;
                        }
                    }
                }
                if (target == null) {
                    return;
                }
                Menu menu = panel.getMenu();
                if (menu != null && !menu.isDisposed()) {
                    menu.dispose();
                }
                menu = new Menu(panel);
                PeersViewBase.fillMenu(menu, target, target_manager);
                final Point cursorLocation = Display.getCurrent().getCursorLocation();
                menu.setLocation(cursorLocation.x, cursorLocation.y);
                menu.setVisible(true);
            }
        }

        @Override
        public void mouseDoubleClick(MouseEvent event) {
            int x = event.x;
            int y = event.y;
            synchronized (dm_data_lock) {
                for (ManagerData data : dm_data) {
                    DownloadManager manager = data.manager;
                    if (x >= data.me_hit_x && x <= data.me_hit_x + OWN_SIZE && y >= data.me_hit_y && y <= data.me_hit_y + OWN_SIZE) {
                        UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
                        if (uiFunctions != null) {
                            uiFunctions.getMDI().showEntryByID(MultipleDocumentInterface.SIDEBAR_SECTION_TORRENT_DETAILS, manager);
                        }
                    } else {
                        for (Map.Entry<PEPeer, int[]> entry : data.peer_hit_map.entrySet()) {
                            int[] loc = entry.getValue();
                            int loc_x = loc[0];
                            int loc_y = loc[1];
                            if (x >= loc_x && x <= loc_x + PEER_SIZE && y >= loc_y && y <= loc_y + PEER_SIZE) {
                                PEPeer target = entry.getKey();
                                try {
                                    String dm_id = "DMDetails_" + Base32.encode(manager.getTorrent().getHash());
                                    MdiEntry mdi_entry = UIFunctionsManager.getUIFunctions().getMDI().getEntry(dm_id);
                                    if (mdi_entry != null) {
                                        mdi_entry.setDatasource(new Object[] { manager, target });
                                    }
                                    Composite comp = panel.getParent();
                                    while (comp != null) {
                                        if (comp instanceof CTabFolder) {
                                            CTabFolder tf = (CTabFolder) comp;
                                            CTabItem[] items = tf.getItems();
                                            for (CTabItem item : items) {
                                                UISWTViewCore view = (UISWTViewCore) item.getData("TabbedEntry");
                                                UISWTViewEventListener listener = view.getEventListener();
                                                if (listener instanceof UISWTViewEventListenerHolder) {
                                                    listener = ((UISWTViewEventListenerHolder) listener).getDelegatedEventListener(view);
                                                }
                                                if (listener instanceof PeersView) {
                                                    tf.setSelection(item);
                                                    Event ev = new Event();
                                                    ev.item = item;
                                                    // manual setSelection doesn't file selection event - derp
                                                    tf.notifyListeners(SWT.Selection, ev);
                                                    ((PeersView) listener).selectPeer(target);
                                                    return;
                                                }
                                            }
                                        }
                                        comp = comp.getParent();
                                    }
                                } catch (Throwable e) {
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }
    });
    // without this we get a transient blank when mousing in and out of the tab folder on OSX :(
    panel.addPaintListener(new PaintListener() {

        @Override
        public void paintControl(PaintEvent e) {
            doRefresh();
        }
    });
}
Also used : PEPeer(com.biglybt.core.peer.PEPeer) UIPluginViewToolBarListener(com.biglybt.pif.ui.UIPluginViewToolBarListener) PaintListener(org.eclipse.swt.events.PaintListener) UISWTViewEventListener(com.biglybt.ui.swt.pif.UISWTViewEventListener) Listener(org.eclipse.swt.widgets.Listener) DownloadManagerPeerListener(com.biglybt.core.download.DownloadManagerPeerListener) CTabFolder(org.eclipse.swt.custom.CTabFolder) PEPeerStats(com.biglybt.core.peer.PEPeerStats) DownloadManager(com.biglybt.core.download.DownloadManager) CTabItem(org.eclipse.swt.custom.CTabItem) MdiEntry(com.biglybt.ui.mdi.MdiEntry) UIFunctions(com.biglybt.ui.UIFunctions) MdiEntry(com.biglybt.ui.mdi.MdiEntry) Menu(org.eclipse.swt.widgets.Menu) MouseEvent(org.eclipse.swt.events.MouseEvent) PaintEvent(org.eclipse.swt.events.PaintEvent) Composite(org.eclipse.swt.widgets.Composite) PaintListener(org.eclipse.swt.events.PaintListener) Canvas(org.eclipse.swt.widgets.Canvas) MouseAdapter(org.eclipse.swt.events.MouseAdapter) Point(org.eclipse.swt.graphics.Point) UISWTViewEventListener(com.biglybt.ui.swt.pif.UISWTViewEventListener) UISWTViewEventListenerHolder(com.biglybt.ui.swt.pifimpl.UISWTViewEventListenerHolder) UISWTViewCore(com.biglybt.ui.swt.pifimpl.UISWTViewCore) PaintEvent(org.eclipse.swt.events.PaintEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) Event(org.eclipse.swt.widgets.Event) UISWTViewEvent(com.biglybt.ui.swt.pif.UISWTViewEvent)

Example 13 with UISWTViewEventListener

use of com.biglybt.ui.swt.pif.UISWTViewEventListener in project BiglyBT by BiglySoftware.

the class SideBar method createSideBarPluginViews.

private void createSideBarPluginViews() {
    if (cPluginsArea == null) {
        return;
    }
    UISWTInstanceImpl uiSWTinstance = (UISWTInstanceImpl) UIFunctionsManagerSWT.getUIFunctionsSWT().getUISWTInstance();
    if (uiSWTinstance == null) {
        return;
    }
    UISWTViewEventListenerHolder[] pluginViews = uiSWTinstance.getViewListeners(UISWTInstance.VIEW_SIDEBAR_AREA);
    for (UISWTViewEventListenerHolder l : pluginViews) {
        if (l != null) {
            try {
                UISWTViewImpl view = new UISWTViewImpl(l.getViewID(), UISWTInstance.VIEW_SIDEBAR_AREA, false);
                view.setEventListener(l, true);
                addSideBarView(view, cPluginsArea);
                cPluginsArea.getParent().getParent().layout(true, true);
            } catch (Exception e) {
                e.printStackTrace();
            // skip, plugin probably specifically asked to not be added
            }
        }
    }
    swtViewListener = new SWTViewListener() {

        @Override
        public void setViewAdded(final String parent, final String id, final UISWTViewEventListener l) {
            if (!parent.equals(UISWTInstance.VIEW_SIDEBAR_AREA)) {
                return;
            }
            Utils.execSWTThread(new AERunnable() {

                @Override
                public void runSupport() {
                    try {
                        UISWTViewImpl view = new UISWTViewImpl(id, parent, false);
                        view.setEventListener(l, true);
                        addSideBarView(view, cPluginsArea);
                    } catch (Exception e) {
                        e.printStackTrace();
                    // skip, plugin probably specifically asked to not be added
                    }
                }
            });
        }

        @Override
        public void setViewRemoved(final String parent, final String id, final UISWTViewEventListener l) {
            if (!parent.equals(UISWTInstance.VIEW_SIDEBAR_AREA)) {
                return;
            }
            Utils.execSWTThread(new AERunnable() {

                @Override
                public void runSupport() {
                    try {
                        for (UISWTViewCore view : SideBar.this.pluginViews) {
                            if (l.equals(view.getEventListener())) {
                                view.closeView();
                            } else {
                                if (l instanceof UISWTViewEventListenerHolder) {
                                    UISWTViewEventListener l2 = ((UISWTViewEventListenerHolder) l).getDelegatedEventListener(view);
                                    if (l2 != null && l2.equals(view.getEventListener())) {
                                        view.closeView();
                                    }
                                }
                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    // skip, plugin probably specifically asked to not be added
                    }
                }
            });
        }
    };
    uiSWTinstance.addSWTViewListener(swtViewListener);
    cPluginsArea.getParent().getParent().layout(true, true);
}
Also used : UISWTViewCore(com.biglybt.ui.swt.pifimpl.UISWTViewCore) UISWTViewImpl(com.biglybt.ui.swt.pifimpl.UISWTViewImpl) SWTViewListener(com.biglybt.ui.swt.pifimpl.UISWTInstanceImpl.SWTViewListener) UISWTViewEventListener(com.biglybt.ui.swt.pif.UISWTViewEventListener) UISWTViewEventListenerHolder(com.biglybt.ui.swt.pifimpl.UISWTViewEventListenerHolder) UISWTInstanceImpl(com.biglybt.ui.swt.pifimpl.UISWTInstanceImpl)

Example 14 with UISWTViewEventListener

use of com.biglybt.ui.swt.pif.UISWTViewEventListener in project BiglyBT by BiglySoftware.

the class SideBarEntrySWT method buildStandAlone.

public static SWTSkinObjectContainer buildStandAlone(SWTSkinObjectContainer soParent, String skinRef, SWTSkin skin, String parentID, String id, Object datasource, int controlType, TreeItem swtItem, UISWTViewEventListener original_event_listener, boolean listener_is_new) {
    Control control = null;
    // SWTSkin skin = soParent.getSkin();
    Composite parent = soParent.getComposite();
    if (skinRef != null) {
        Shell shell = parent.getShell();
        Cursor cursor = shell.getCursor();
        try {
            shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
            // wrap skinRef with a container that we control visibility of
            // (invisible by default)
            SWTSkinObjectContainer soContents = (SWTSkinObjectContainer) skin.createSkinObject("MdiContents." + uniqueNumber++, SO_ID_ENTRY_WRAPPER, soParent, null);
            SWTSkinObject skinObject = skin.createSkinObject(id, skinRef, soContents, datasource);
            control = skinObject.getControl();
            control.setLayoutData(Utils.getFilledFormData());
            control.getParent().layout(true, true);
            soContents.setVisible(true);
            return (soContents);
        } finally {
            shell.setCursor(cursor);
        }
    } else {
        if ((original_event_listener instanceof UISWTViewCoreEventListenerEx && ((UISWTViewCoreEventListenerEx) original_event_listener).isCloneable()) || (original_event_listener instanceof UISWTViewEventListenerEx)) {
            final UISWTViewImpl view = new UISWTViewImpl(id, parentID, true);
            final UISWTViewEventListener event_listener = original_event_listener instanceof UISWTViewEventListenerEx ? ((UISWTViewEventListenerEx) original_event_listener).getClone() : ((UISWTViewCoreEventListenerEx) original_event_listener).getClone();
            try {
                view.setEventListener(event_listener, false);
            } catch (Throwable e) {
                // shouldn't happen as we aren't asking for 'create' to occur which means it can't fail
                Debug.out(e);
            }
            view.setDatasource(datasource);
            try {
                SWTSkinObjectContainer soContents = (SWTSkinObjectContainer) skin.createSkinObject("MdiIView." + uniqueNumber++, SO_ID_ENTRY_WRAPPER, soParent);
                parent.setBackgroundMode(SWT.INHERIT_NONE);
                final Composite viewComposite = soContents.getComposite();
                boolean doGridLayout = true;
                if (controlType == CONTROLTYPE_SKINOBJECT) {
                    doGridLayout = false;
                }
                // SWT.COLOR_WIDGET_FOREGROUND));
                if (doGridLayout) {
                    GridLayout gridLayout = new GridLayout();
                    gridLayout.horizontalSpacing = gridLayout.verticalSpacing = gridLayout.marginHeight = gridLayout.marginWidth = 0;
                    viewComposite.setLayout(gridLayout);
                    viewComposite.setLayoutData(Utils.getFilledFormData());
                }
                view.setPluginSkinObject(soContents);
                view.initialize(viewComposite);
                // without this some views get messed up layouts (chat view for example)
                viewComposite.setData(Utils.RELAYOUT_UP_STOP_HERE, true);
                soContents.addListener(new SWTSkinObjectListener() {

                    @Override
                    public Object eventOccured(SWTSkinObject skinObject, int eventType, Object params) {
                        if (eventType == SWTSkinObjectListener.EVENT_OBFUSCATE) {
                            Map data = new HashMap();
                            data.put("image", (Image) params);
                            data.put("obfuscateTitle", false);
                            view.triggerEvent(UISWTViewEvent.TYPE_OBFUSCATE, data);
                        }
                        return null;
                    }
                });
                if (PAINT_BG) {
                    if (swtItem != null) {
                        swtItem.setText(view.getFullTitle());
                    }
                }
                Composite iviewComposite = view.getComposite();
                control = iviewComposite;
                // that instead of form)
                if (doGridLayout) {
                    Object existingLayoutData = iviewComposite.getLayoutData();
                    Object existingParentLayoutData = iviewComposite.getParent().getLayoutData();
                    if (existingLayoutData == null || !(existingLayoutData instanceof GridData) && (existingParentLayoutData instanceof GridLayout)) {
                        GridData gridData = new GridData(GridData.FILL_BOTH);
                        iviewComposite.setLayoutData(gridData);
                    }
                }
                parent.layout(true, true);
                final UIUpdater updater = UIUpdaterSWT.getInstance();
                if (updater != null) {
                    updater.addUpdater(new UIUpdatable() {

                        @Override
                        public void updateUI() {
                            if (viewComposite.isDisposed()) {
                                updater.removeUpdater(this);
                            } else {
                                view.triggerEvent(UISWTViewEvent.TYPE_REFRESH, null);
                            }
                        }

                        @Override
                        public String getUpdateUIName() {
                            return ("popout");
                        }
                    });
                    if (event_listener instanceof IViewRequiresPeriodicUpdates) {
                        updater.addPeriodicUpdater(new UIUpdatable() {

                            @Override
                            public void updateUI() {
                                if (viewComposite.isDisposed()) {
                                    updater.removePeriodicUpdater(this);
                                } else {
                                    event_listener.eventOccurred(new UISWTViewEvent() {

                                        @Override
                                        public UISWTView getView() {
                                            return null;
                                        }

                                        @Override
                                        public int getType() {
                                            return (StatsView.EVENT_PERIODIC_UPDATE);
                                        }

                                        @Override
                                        public Object getData() {
                                            return null;
                                        }
                                    });
                                }
                            }

                            @Override
                            public String getUpdateUIName() {
                                return ("popout");
                            }
                        });
                    }
                }
                soContents.setVisible(true);
                view.triggerEvent(UISWTViewEvent.TYPE_FOCUSGAINED, null);
                iviewComposite.addDisposeListener(new DisposeListener() {

                    @Override
                    public void widgetDisposed(DisposeEvent arg0) {
                        view.triggerEvent(UISWTViewEvent.TYPE_DESTROY, null);
                    }
                });
                return (soContents);
            } catch (Throwable e) {
                Debug.out(e);
            }
        }
    }
    return (null);
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) SWTSkinObjectListener(com.biglybt.ui.swt.skin.SWTSkinObjectListener) MdiEntryVitalityImage(com.biglybt.ui.mdi.MdiEntryVitalityImage) ObfuscateImage(com.biglybt.ui.swt.debug.ObfuscateImage) DisposeEvent(org.eclipse.swt.events.DisposeEvent) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) GridLayout(org.eclipse.swt.layout.GridLayout) SWTSkinObjectContainer(com.biglybt.ui.swt.skin.SWTSkinObjectContainer) UISWTViewEvent(com.biglybt.ui.swt.pif.UISWTViewEvent) UISWTViewEventListenerEx(com.biglybt.ui.swt.pif.UISWTViewEventListenerEx) UIUpdatable(com.biglybt.ui.common.updater.UIUpdatable) UISWTViewEventListener(com.biglybt.ui.swt.pif.UISWTViewEventListener) UISWTViewImpl(com.biglybt.ui.swt.pifimpl.UISWTViewImpl) GridData(org.eclipse.swt.layout.GridData) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) UIUpdater(com.biglybt.ui.common.updater.UIUpdater) UISWTViewCoreEventListenerEx(com.biglybt.ui.swt.pifimpl.UISWTViewCoreEventListenerEx) IViewRequiresPeriodicUpdates(com.biglybt.ui.swt.views.IViewRequiresPeriodicUpdates)

Aggregations

UISWTViewEventListener (com.biglybt.ui.swt.pif.UISWTViewEventListener)14 UISWTViewEvent (com.biglybt.ui.swt.pif.UISWTViewEvent)4 SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)4 ObfuscateImage (com.biglybt.ui.swt.debug.ObfuscateImage)3 PluginUISWTSkinObject (com.biglybt.ui.swt.pif.PluginUISWTSkinObject)3 UISWTViewEventListenerEx (com.biglybt.ui.swt.pif.UISWTViewEventListenerEx)3 UISWTViewImpl (com.biglybt.ui.swt.pifimpl.UISWTViewImpl)3 Map (java.util.Map)3 Point (org.eclipse.swt.graphics.Point)3 DownloadManager (com.biglybt.core.download.DownloadManager)2 PluginInterface (com.biglybt.pif.PluginInterface)2 UIFunctions (com.biglybt.ui.UIFunctions)2 UIUpdatable (com.biglybt.ui.common.updater.UIUpdatable)2 UIUpdater (com.biglybt.ui.common.updater.UIUpdater)2 ViewTitleInfo (com.biglybt.ui.common.viewtitleinfo.ViewTitleInfo)2 MdiEntryVitalityImage (com.biglybt.ui.mdi.MdiEntryVitalityImage)2 UISWTView (com.biglybt.ui.swt.pif.UISWTView)2 UISWTViewCore (com.biglybt.ui.swt.pifimpl.UISWTViewCore)2 UISWTViewEventListenerHolder (com.biglybt.ui.swt.pifimpl.UISWTViewEventListenerHolder)2 HashMap (java.util.HashMap)2