use of com.biglybt.ui.mdi.MultipleDocumentInterface 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();
}
}
use of com.biglybt.ui.mdi.MultipleDocumentInterface in project BiglyBT by BiglySoftware.
the class SB_Dashboard method setupMDIEntry.
public MdiEntry setupMDIEntry() {
ViewTitleInfo title_info = new ViewTitleInfo() {
@Override
public Object getTitleInfoProperty(int propertyID) {
if (propertyID == TITLE_INDICATOR_TEXT) {
return (String.valueOf(items.size()));
}
if (propertyID == TITLE_INDICATOR_TEXT_TOOLTIP) {
return (null);
}
return null;
}
};
mdi_entry = mdi.createEntryFromSkinRef("", MultipleDocumentInterface.SIDEBAR_HEADER_DASHBOARD, "dashboard", "{sidebar.header.dashboard}", title_info, null, false, null);
mdi_entry.setImageLeftID("image.sidebar.dashboard");
MdiEntryVitalityImage cog = mdi_entry.addVitalityImage("image.sidebar.cog");
cog.setToolTip(MessageText.getString("configure.dashboard"));
final long[] cog_click_time = { 0 };
cog.addListener(new MdiEntryVitalityImageListener() {
@Override
public void mdiEntryVitalityImage_clicked(int x, int y) {
synchronized (items) {
cog_click_time[0] = SystemTime.getMonotonousTime();
new DBConfigWindow(new ArrayList<DashboardItem>(items));
}
}
});
cog.setVisible(true);
mdi.addListener(new MdiListener() {
@Override
public void mdiEntrySelected(MdiEntry newEntry, MdiEntry oldEntry) {
if (mdi_entry == newEntry && mdi_entry == oldEntry) {
SimpleTimer.addEvent("changed", SystemTime.getOffsetTime(250), new TimerEventPerformer() {
@Override
public void perform(TimerEvent event) {
synchronized (items) {
if (SystemTime.getMonotonousTime() - cog_click_time[0] < 250) {
return;
}
}
fireChanged();
}
});
}
}
public void mdiDisposed(MultipleDocumentInterface mdi) {
}
});
return (mdi_entry);
}
Aggregations