use of org.pentaho.ui.xul.XulLoader in project pentaho-kettle by pentaho.
the class TransLogDelegate method addToolBar.
private void addToolBar() {
try {
XulLoader loader = new KettleXulLoader();
loader.setSettingsManager(XulSpoonSettingsManager.getInstance());
ResourceBundle bundle = new XulSpoonResourceBundle(Spoon.class);
XulDomContainer xulDomContainer = loader.loadXul(XUL_FILE_TRANS_LOG_TOOLBAR, bundle);
xulDomContainer.addEventHandler(this);
toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById("nav-toolbar");
ToolBar swtToolBar = (ToolBar) toolbar.getManagedObject();
spoon.props.setLook(swtToolBar, Props.WIDGET_STYLE_TOOLBAR);
swtToolBar.layout(true, true);
} catch (Throwable t) {
log.logError(Const.getStackTracker(t));
new ErrorDialog(transLogComposite.getShell(), BaseMessages.getString(PKG, "Spoon.Exception.ErrorReadingXULFile.Title"), BaseMessages.getString(PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_LOG_TOOLBAR), new Exception(t));
}
}
use of org.pentaho.ui.xul.XulLoader in project pentaho-kettle by pentaho.
the class TransPreviewDelegate method addToolBar.
private void addToolBar() {
try {
XulLoader loader = new KettleXulLoader();
loader.setSettingsManager(XulSpoonSettingsManager.getInstance());
ResourceBundle bundle = GlobalMessages.getBundle("org/pentaho/di/ui/spoon/messages/messages");
XulDomContainer xulDomContainer = loader.loadXul(XUL_FILE_TRANS_PREVIEW_TOOLBAR, bundle);
xulDomContainer.addEventHandler(this);
toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById("nav-toolbar");
ToolBar swtToolBar = (ToolBar) toolbar.getManagedObject();
spoon.props.setLook(swtToolBar, Props.WIDGET_STYLE_TOOLBAR);
swtToolBar.layout(true, true);
swtToolBar.pack();
firstRadio = (SwtRadio) xulDomContainer.getDocumentRoot().getElementById("preview-first");
lastRadio = (SwtRadio) xulDomContainer.getDocumentRoot().getElementById("preview-last");
offRadio = (SwtRadio) xulDomContainer.getDocumentRoot().getElementById("preview-off");
PropsUI.getInstance().setLook((Control) firstRadio.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR);
PropsUI.getInstance().setLook((Control) lastRadio.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR);
PropsUI.getInstance().setLook((Control) offRadio.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR);
} catch (Throwable t) {
log.logError(toString(), Const.getStackTracker(t));
new ErrorDialog(transPreviewComposite.getShell(), BaseMessages.getString(PKG, "Spoon.Exception.ErrorReadingXULFile.Title"), BaseMessages.getString(PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_PREVIEW_TOOLBAR), new Exception(t));
}
}
use of org.pentaho.ui.xul.XulLoader in project pentaho-kettle by pentaho.
the class JobHistoryDelegate method addToolBar.
private void addToolBar() {
try {
XulLoader loader = new KettleXulLoader();
loader.setSettingsManager(XulSpoonSettingsManager.getInstance());
ResourceBundle bundle = new XulSpoonResourceBundle(Spoon.class);
XulDomContainer xulDomContainer = loader.loadXul(XUL_FILE_TRANS_GRID_TOOLBAR, bundle);
xulDomContainer.addEventHandler(this);
toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById("nav-toolbar");
refreshButton = (XulToolbarbutton) xulDomContainer.getDocumentRoot().getElementById("refresh-history");
fetchNextBatchButton = (XulToolbarbutton) xulDomContainer.getDocumentRoot().getElementById("fetch-next-batch-history");
fetchAllButton = (XulToolbarbutton) xulDomContainer.getDocumentRoot().getElementById("fetch-all-history");
ToolBar swtToolBar = (ToolBar) toolbar.getManagedObject();
spoon.props.setLook(swtToolBar, Props.WIDGET_STYLE_TOOLBAR);
swtToolBar.layout(true, true);
} catch (Throwable t) {
log.logError(Const.getStackTracker(t));
new ErrorDialog(jobHistoryComposite.getShell(), BaseMessages.getString(PKG, "Spoon.Exception.ErrorReadingXULFile.Title"), BaseMessages.getString(PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_GRID_TOOLBAR), new Exception(t));
}
}
use of org.pentaho.ui.xul.XulLoader in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceDialogTest method testLoadXul.
@Test
public void testLoadXul() throws Exception {
Shell shell = mock(Shell.class);
XulLoader xulLoader = mock(XulLoader.class);
XulRunner xulRunner = mock(XulRunner.class);
XulDomContainer xulDomContainer = mock(XulDomContainer.class);
final ResourceBundle resourceBundle = mock(ResourceBundle.class);
DataServiceDialog dialog = new DataServiceDialog(controller, model) {
@Override
protected ResourceBundle createResourceBundle(Class<?> packageClass) {
assertThat(packageClass, equalTo((Class) DataServiceDialog.class));
assertThat(super.createResourceBundle(packageClass), isA(ResourceBundle.class));
return resourceBundle;
}
};
when(xulLoader.loadXul(anyString(), same(resourceBundle))).thenReturn(xulDomContainer);
dialog.loadXul(shell, xulLoader, xulRunner);
verify(xulLoader).setOuterContext(shell);
verify(xulLoader).registerClassLoader(any(ClassLoader.class));
verify(xulDomContainer).addEventHandler(controller);
verify(xulRunner).addContainer(xulDomContainer);
verify(xulRunner).initialize();
}
use of org.pentaho.ui.xul.XulLoader in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceRemapConfirmationDialogTest method testInitXul.
@Test
public void testInitXul() throws KettleException, XulException {
Shell shell = mock(Shell.class);
XulLoader xulLoader = mock(XulLoader.class);
XulRunner xulRunner = mock(XulRunner.class);
XulDomContainer xulDomContainer = mock(XulDomContainer.class);
when(xulLoader.loadXul(anyString(), any(ResourceBundle.class))).thenReturn(xulDomContainer);
DataServiceRemapConfirmationDialog dialog = mock(DataServiceRemapConfirmationDialog.class);
when(dialog.initXul(shell, xulLoader, xulRunner)).thenCallRealMethod();
dialog.initXul(shell, xulLoader, xulRunner);
verify(xulLoader).setOuterContext(shell);
verify(xulLoader).registerClassLoader(any(ClassLoader.class));
verify(xulRunner).addContainer(xulDomContainer);
verify(xulRunner).initialize();
}
Aggregations