use of org.pentaho.ui.xul.impl.XulEventHandler in project pentaho-kettle by pentaho.
the class AbstractPreviewRowsXulDialog method initializeXul.
protected void initializeXul(XulLoader loader, BindingFactory bindingFactory, XulRunner runner, Object parent) throws XulException {
bf = bindingFactory;
this.runner = runner;
loader.registerClassLoader(getClass().getClassLoader());
loader.setSettingsManager(getSettingsManager());
loader.setOuterContext(parent);
container = loader.loadXul(xulFile, getResourceBundle());
bf.setDocument(container.getDocumentRoot());
for (XulEventHandler h : getEventHandlers()) {
container.addEventHandler(h);
}
this.runner.addContainer(container);
// try and get the dialog
xulDialog = (XulDialog) container.getDocumentRoot().getRootElement();
runner.initialize();
}
use of org.pentaho.ui.xul.impl.XulEventHandler in project pentaho-kettle by pentaho.
the class SpoonPerspectiveManager method activatePerspective.
/**
* Activates the given instance of the class literal passed in. Activating a perspective first deactivates the current
* perspective removing any overlays its applied to the UI. It then switches the main deck to display the perspective
* UI and applies the optional overlays to the main Spoon XUL container.
*
* @param clazz
* SpoonPerspective class literal
* @throws KettleException
* throws a KettleException if no perspective is found for the given parameter
*/
public void activatePerspective(Class<? extends SpoonPerspective> clazz) throws KettleException {
if (this.forcePerspective) {
// we are currently prevented from switching perspectives
return;
}
SpoonPerspective sp = perspectives.get(clazz);
if (sp == null) {
throw new KettleException("Could not locate perspective by class: " + clazz);
}
PerspectiveManager perspectiveManager = getPerspectiveManagerMap().get(sp);
if (perspectiveManager != null) {
perspectiveManager.initializeIfNeeded();
}
unloadPerspective(activePerspective);
activePerspective = sp;
List<XulOverlay> overlays = sp.getOverlays();
if (overlays != null) {
for (XulOverlay overlay : overlays) {
try {
ResourceBundle res = null;
if (overlay.getResourceBundleUri() != null) {
try {
res = ResourceBundle.getBundle(overlay.getResourceBundleUri());
} catch (MissingResourceException ignored) {
// Ignore errors
}
} else {
try {
res = ResourceBundle.getBundle(overlay.getOverlayUri().replace(".xul", ".properties"));
} catch (MissingResourceException ignored) {
// Ignore errors
}
}
if (res == null) {
res = new XulSpoonResourceBundle(sp.getClass());
}
domContainer.loadOverlay(overlay.getOverlayUri(), res);
} catch (XulException e) {
log.logError("Error activate perspective", e);
}
}
}
List<XulEventHandler> theXulEventHandlers = sp.getEventHandlers();
if (theXulEventHandlers != null) {
for (XulEventHandler handler : theXulEventHandlers) {
domContainer.addEventHandler(handler);
}
}
sp.setActive(true);
if (sp.equals(activePerspective)) {
deck.setSelectedIndex(deck.getChildNodes().indexOf(deck.getElementById("perspective-" + sp.getId())));
getSpoon().enableMenus();
}
}
use of org.pentaho.ui.xul.impl.XulEventHandler in project pentaho-kettle by pentaho.
the class BaseStepGenericXulDialog method initializeXul.
protected void initializeXul(XulLoader loader, BindingFactory bindingFactory, XulRunner runner, Object parent) throws XulException {
bf = bindingFactory;
this.runner = runner;
loader.registerClassLoader(getClass().getClassLoader());
loader.setSettingsManager(getSettingsManager());
loader.setOuterContext(parent);
container = loader.loadXul(xulFile, getResourceBundle());
bf.setDocument(container.getDocumentRoot());
for (XulEventHandler h : getEventHandlers()) {
container.addEventHandler(h);
}
this.runner.addContainer(container);
// try and get the dialog
xulDialog = (XulDialog) container.getDocumentRoot().getRootElement();
runner.initialize();
}
use of org.pentaho.ui.xul.impl.XulEventHandler in project pentaho-kettle by pentaho.
the class RepositoryLockController method init.
public void init(Repository rep) throws ControllerInitializationException {
try {
if (rep != null && rep.hasService(ILockService.class)) {
repository = rep;
service = (ILockService) rep.getService(ILockService.class);
} else {
throw new ControllerInitializationException(BaseMessages.getString(PKG, "RepositoryLockController.ERROR_0001_UNABLE_TO_INITIAL_REPOSITORY_SERVICE", // $NON-NLS-1$
ILockService.class));
}
bindingFactory = new DefaultBindingFactory();
bindingFactory.setDocument(getXulDomContainer().getDocumentRoot());
// $NON-NLS-1$
XulEventHandler eventHandler = getXulDomContainer().getEventHandler("browseController");
if (eventHandler instanceof BrowseController) {
browseController = (BrowseController) eventHandler;
}
// Disable row dragging if it is locked and the user does not have permissions
// $NON-NLS-1$
fileTable = (XulTree) getXulDomContainer().getDocumentRoot().getElementById("file-table");
// $NON-NLS-1$
folderTree = (XulTree) document.getElementById("folder-tree");
// $NON-NLS-1$
lockFileMenuItem = (XulMenuitem) getXulDomContainer().getDocumentRoot().getElementById("file-context-lock");
// $NON-NLS-1$
deleteFileMenuItem = (XulMenuitem) getXulDomContainer().getDocumentRoot().getElementById("file-context-delete");
// $NON-NLS-1$
renameFileMenuItem = (XulMenuitem) getXulDomContainer().getDocumentRoot().getElementById("file-context-rename");
// $NON-NLS-1$
messageBox = (XulMessageBox) document.createElement("messagebox");
createBindings();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.pentaho.ui.xul.impl.XulEventHandler in project pentaho-kettle by pentaho.
the class AbstractRepositoryExplorerUISupport method apply.
public void apply(XulDomContainer container) throws XulException {
this.container = container;
container.registerClassLoader(getClass().getClassLoader());
for (XulEventHandler handler : handlers) {
container.addEventHandler(handler);
}
for (XulOverlay overlay : overlays) {
if (overlay instanceof RepositoryExplorerDefaultXulOverlay) {
container.loadOverlay(overlay.getOverlayUri(), new XulSpoonResourceBundle(((RepositoryExplorerDefaultXulOverlay) overlay).getPackageClass()));
} else {
container.loadOverlay(overlay.getOverlayUri(), overlay.getResourceBundleUri());
}
}
}
Aggregations