use of com.biglybt.ui.mdi.MdiEntryVitalityImage 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