use of org.pentaho.ui.xul.XulRunner in project pentaho-kettle by pentaho.
the class FileOverwriteDialogController method getInstance.
public static FileOverwriteDialogController getInstance(Shell shell, List<UIRepositoryObject> objects) {
try {
KettleXulLoader swtLoader = new KettleXulLoader();
swtLoader.setOuterContext(shell);
swtLoader.setSettingsManager(XulSpoonSettingsManager.getInstance());
XulDomContainer container = swtLoader.loadXul("org/pentaho/di/ui/repository/repositoryexplorer/xul/file-overwrite-dialog.xul", resourceBundle);
final XulRunner runner = new SwtXulRunner();
runner.addContainer(container);
FileOverwriteDialogController dialogController = new FileOverwriteDialogController(container, objects);
container.addEventHandler(dialogController);
runner.initialize();
return dialogController;
} catch (Exception e) {
return null;
}
}
use of org.pentaho.ui.xul.XulRunner in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceRemapNoStepsDialogTest 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);
DataServiceRemapNoStepsDialog dialog = mock(DataServiceRemapNoStepsDialog.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();
}
use of org.pentaho.ui.xul.XulRunner in project pdi-dataservice-server-plugin by pentaho.
the class DriverDetailsDialogTest method testInitXul.
@Test
public void testInitXul() throws Exception {
DriverDetailsDialog dialog = mock(DriverDetailsDialog.class);
Shell parentShell = mock(Shell.class);
AbstractXulLoader xulLoader = mock(AbstractXulLoader.class);
XulRunner xulRunner = mock(XulRunner.class);
Document document = mock(Document.class);
XulDomContainer container = mock(XulDomContainer.class);
doReturn(container).when(xulLoader).loadXul(anyString(), any(ResourceBundle.class));
doReturn(document).when(container).getDocumentRoot();
doCallRealMethod().when(dialog).initXul(parentShell, xulLoader, xulRunner);
assertThat(document, is(sameInstance(dialog.initXul(parentShell, xulLoader, xulRunner))));
verify(xulLoader).setOuterContext(parentShell);
verify(xulLoader).registerClassLoader(dialog.getClass().getClassLoader());
verify(xulLoader).loadXul(anyString(), any(ResourceBundle.class));
verify(container).addEventHandler(any(DriverDetailsDialogController.class));
verify(container).getDocumentRoot();
verify(xulRunner).addContainer(container);
verify(xulRunner).initialize();
}
use of org.pentaho.ui.xul.XulRunner in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceTestDialog method initXul.
private Document initXul(Composite parent) throws KettleException {
try {
SwtXulLoader swtLoader = new KettleXulLoader();
swtLoader.setOuterContext(parent);
swtLoader.registerClassLoader(getClass().getClassLoader());
XulDomContainer container = swtLoader.loadXul(XUL_PATH, resourceBundle);
container.addEventHandler(dataServiceTestController);
final XulRunner runner = new SwtXulRunner();
runner.addContainer(container);
runner.initialize();
return container.getDocumentRoot();
} catch (XulException xulException) {
throw new KettleException("Failed to initialize DataServicesTestDialog.", xulException);
}
}
use of org.pentaho.ui.xul.XulRunner 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();
}
Aggregations