Search in sources :

Example 1 with MdiEntryLoadedListener

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

the class SB_Vuze method setup.

private void setup(final MultipleDocumentInterface mdi) {
    ViewTitleInfoBetaP.setupSidebarEntry(mdi);
    WelcomeView.setupSidebarEntry(mdi);
    SBC_ActivityTableView.setupSidebarEntry(mdi);
    // Refresh the Vuze header when one of the children's title properties change
    viewTitleInfoListener = new ViewTitleInfoListener() {

        @Override
        public void viewTitleInfoRefresh(ViewTitleInfo titleInfo) {
            if (SB_Vuze.this.titleInfo == null) {
                return;
            }
            MdiEntry[] childrenArray = children.toArray(new MdiEntry[0]);
            for (MdiEntry entry : childrenArray) {
                if (entry.getViewTitleInfo() == titleInfo) {
                    ViewTitleInfoManager.refreshTitleInfo(SB_Vuze.this.titleInfo);
                    break;
                }
            }
        }
    };
    ViewTitleInfoManager.addListener(viewTitleInfoListener);
    // Maintain a list of children entries; Open header on load
    mdi.addListener(new MdiEntryLoadedListener() {

        @Override
        public void mdiEntryLoaded(MdiEntry entry) {
            if (MultipleDocumentInterface.SIDEBAR_HEADER_VUZE.equals(entry.getParentID())) {
                children.add(entry);
                entry.addListener(new MdiChildCloseListener() {

                    @Override
                    public void mdiChildEntryClosed(MdiEntry parent, MdiEntry child, boolean user) {
                        children.remove(child);
                    }
                });
            }
            if (!entry.getId().equals(MultipleDocumentInterface.SIDEBAR_HEADER_VUZE)) {
                return;
            }
            titleInfo = new ViewTitleInfo_Vuze(entry);
            entry.setViewTitleInfo(titleInfo);
        }
    });
}
Also used : MdiEntry(com.biglybt.ui.mdi.MdiEntry) MdiEntryLoadedListener(com.biglybt.ui.mdi.MdiEntryLoadedListener) ViewTitleInfoListener(com.biglybt.ui.common.viewtitleinfo.ViewTitleInfoListener) MdiChildCloseListener(com.biglybt.ui.mdi.MdiChildCloseListener) ViewTitleInfo(com.biglybt.ui.common.viewtitleinfo.ViewTitleInfo)

Aggregations

ViewTitleInfo (com.biglybt.ui.common.viewtitleinfo.ViewTitleInfo)1 ViewTitleInfoListener (com.biglybt.ui.common.viewtitleinfo.ViewTitleInfoListener)1 MdiChildCloseListener (com.biglybt.ui.mdi.MdiChildCloseListener)1 MdiEntry (com.biglybt.ui.mdi.MdiEntry)1 MdiEntryLoadedListener (com.biglybt.ui.mdi.MdiEntryLoadedListener)1