use of com.biglybt.ui.swt.skin.SWTSkinObject in project BiglyBT by BiglySoftware.
the class MainMenuV3 method createViewMenuItem.
// ====================================
/**
* @param viewMenu
*/
public static MenuItem createViewMenuItem(final SWTSkin skin, Menu viewMenu, final String textID, final String configID, final String viewID, final boolean fast, int menuIndex) {
MenuItem item;
if (!ConfigurationDefaults.getInstance().doesParameterDefaultExist(configID)) {
COConfigurationManager.setBooleanDefault(configID, true);
}
item = MenuFactory.addMenuItem(viewMenu, SWT.CHECK, menuIndex, textID, new Listener() {
@Override
public void handleEvent(Event event) {
SWTSkinObject skinObject = skin.getSkinObject(viewID);
if (skinObject != null) {
boolean newVisibility = !skinObject.isVisible();
SWTSkinUtils.setVisibility(skin, configID, viewID, newVisibility, true, fast);
}
}
});
SWTSkinUtils.setVisibility(skin, configID, viewID, COConfigurationManager.getBooleanParameter(configID), false, true);
final MenuItem itemViewPluginBar = item;
final ParameterListener listener = new ParameterListener() {
@Override
public void parameterChanged(String parameterName) {
itemViewPluginBar.setSelection(COConfigurationManager.getBooleanParameter(parameterName));
}
};
COConfigurationManager.addAndFireParameterListener(configID, listener);
item.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
COConfigurationManager.removeParameterListener(configID, listener);
}
});
return item;
}
use of com.biglybt.ui.swt.skin.SWTSkinObject in project BiglyBT by BiglySoftware.
the class BaseMdiEntry method setPluginSkinObject.
/* (non-Javadoc)
* @see com.biglybt.ui.swt.pifimpl.UISWTViewImpl2#setPluginSkinObject(com.biglybt.ui.swt.pif.PluginUISWTSkinObject, org.eclipse.swt.widgets.Composite)
*/
@Override
public void setPluginSkinObject(PluginUISWTSkinObject skinObject) {
super.setPluginSkinObject(skinObject);
Object initialDataSource = (datasource == null || ((datasource instanceof Object[]) && ((Object[]) datasource).length == 0)) ? getInitialDataSource() : datasource;
if (initialDataSource != null) {
if (skinObject instanceof SWTSkinObject) {
((SWTSkinObject) skinObject).triggerListeners(SWTSkinObjectListener.EVENT_DATASOURCE_CHANGED, initialDataSource);
}
triggerEvent(UISWTViewEvent.TYPE_DATASOURCE_CHANGED, initialDataSource);
}
}
use of com.biglybt.ui.swt.skin.SWTSkinObject in project BiglyBT by BiglySoftware.
the class BaseMdiEntry method swt_hide.
protected void swt_hide() {
SWTSkinObject skinObjectMaster = getSkinObjectMaster();
if (skinObjectMaster instanceof SWTSkinObjectContainer) {
SWTSkinObjectContainer container = (SWTSkinObjectContainer) skinObjectMaster;
Control oldComposite = container.getControl();
container.setVisible(false);
if (oldComposite != null && !oldComposite.isDisposed()) {
oldComposite.getShell().update();
}
}
Composite oldComposite = getComposite();
if (oldComposite != null && !oldComposite.isDisposed()) {
oldComposite.setVisible(false);
oldComposite.getShell().update();
}
try {
triggerEvent(UISWTViewEvent.TYPE_FOCUSLOST, null);
} catch (Exception e) {
Debug.out(e);
}
}
use of com.biglybt.ui.swt.skin.SWTSkinObject in project BiglyBT by BiglySoftware.
the class BaseMdiEntry method triggerEvent.
/* (non-Javadoc)
* @see com.biglybt.ui.swt.pifimpl.UISWTViewImpl2#triggerEvent(int, java.lang.Object)
*/
@Override
public void triggerEvent(int eventType, Object data) {
super.triggerEvent(eventType, data);
if (eventType == UISWTViewEvent.TYPE_LANGUAGEUPDATE) {
// } else {
if (viewTitleInfo != null) {
viewTitleInfoRefresh(viewTitleInfo);
}
updateUI();
// }
SWTSkinObject skinObjectMaster = getSkinObjectMaster();
if (skinObjectMaster != null) {
skinObjectMaster.triggerListeners(SWTSkinObjectListener.EVENT_LANGUAGE_CHANGE);
}
}
}
use of com.biglybt.ui.swt.skin.SWTSkinObject in project BiglyBT by BiglySoftware.
the class TabbedEntry method widgetDisposed.
@Override
public void widgetDisposed(DisposeEvent e) {
setSwtItem(null);
SWTThread instance = SWTThread.getInstance();
triggerCloseListeners(instance != null && !instance.isTerminated());
try {
setEventListener(null, false);
} catch (UISWTViewEventCancelledException e1) {
}
SWTSkinObject so = getSkinObject();
if (so != null) {
setSkinObjectMaster(null);
so.getSkin().removeSkinObject(so);
}
// delay saving of removing of auto-open flag. If after the delay, we are
// still alive, it's assumed the user invoked the close, and we should
// remove the auto-open flag
Utils.execSWTThreadLater(0, new SWTRunnable() {
@Override
public void runWithDisplay(Display display) {
// even though execThreadLater will not run on close of app because
// the display is disposed, do a double check of tree disposal just
// in case. We don't want to trigger close listeners or
// remove autoopen parameters if the user is closing the app (as
// opposed to closing the sidebar)
mdi.removeItem(TabbedEntry.this);
mdi.removeEntryAutoOpen(id);
}
});
}
Aggregations