Search in sources :

Example 1 with XulLoader

use of org.pentaho.ui.xul.XulLoader in project pentaho-kettle by pentaho.

the class JobLogDelegate 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(jobLogComposite.getShell(), BaseMessages.getString(PKG, "Spoon.Exception.ErrorReadingXULFile.Title"), BaseMessages.getString(PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_LOG_TOOLBAR), new Exception(t));
    }
}
Also used : XulSpoonResourceBundle(org.pentaho.di.ui.spoon.XulSpoonResourceBundle) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) XulLoader(org.pentaho.ui.xul.XulLoader) ToolBar(org.eclipse.swt.widgets.ToolBar) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) XulSpoonResourceBundle(org.pentaho.di.ui.spoon.XulSpoonResourceBundle) ResourceBundle(java.util.ResourceBundle) XulDomContainer(org.pentaho.ui.xul.XulDomContainer)

Example 2 with XulLoader

use of org.pentaho.ui.xul.XulLoader in project pentaho-kettle by pentaho.

the class ImportRulesDialog 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_TOOLBAR, bundle);
        xulDomContainer.addEventHandler(this);
        toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById("import-rules-toolbar");
        ToolBar swtToolbar = (ToolBar) toolbar.getManagedObject();
        swtToolbar.layout(true, true);
    } catch (Throwable t) {
        LogChannel.GENERAL.logError(Const.getStackTracker(t));
        new ErrorDialog(shell, BaseMessages.getString(PKG, "ImportRulesDialog.Exception.ErrorReadingXULFile.Title"), BaseMessages.getString(PKG, "ImportRulesDialog.Exception.ErrorReadingXULFile.Message", XUL_FILE_TOOLBAR), new Exception(t));
    }
}
Also used : XulSpoonResourceBundle(org.pentaho.di.ui.spoon.XulSpoonResourceBundle) XulLoader(org.pentaho.ui.xul.XulLoader) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) ToolBar(org.eclipse.swt.widgets.ToolBar) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) XulSpoonResourceBundle(org.pentaho.di.ui.spoon.XulSpoonResourceBundle) ResourceBundle(java.util.ResourceBundle) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) KettleException(org.pentaho.di.core.exception.KettleException)

Example 3 with XulLoader

use of org.pentaho.ui.xul.XulLoader 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();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) XulLoader(org.pentaho.ui.xul.XulLoader) ResourceBundle(java.util.ResourceBundle) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) XulRunner(org.pentaho.ui.xul.XulRunner) Test(org.junit.Test)

Example 4 with XulLoader

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();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) XulLoader(org.pentaho.ui.xul.XulLoader) ResourceBundle(java.util.ResourceBundle) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) XulRunner(org.pentaho.ui.xul.XulRunner) SwtXulRunner(org.pentaho.ui.xul.swt.SwtXulRunner) Test(org.junit.Test)

Example 5 with XulLoader

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();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) XulLoader(org.pentaho.ui.xul.XulLoader) ResourceBundle(java.util.ResourceBundle) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) XulRunner(org.pentaho.ui.xul.XulRunner) Test(org.junit.Test)

Aggregations

ResourceBundle (java.util.ResourceBundle)11 XulDomContainer (org.pentaho.ui.xul.XulDomContainer)11 XulLoader (org.pentaho.ui.xul.XulLoader)11 KettleXulLoader (org.pentaho.di.ui.xul.KettleXulLoader)8 ToolBar (org.eclipse.swt.widgets.ToolBar)7 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)7 Shell (org.eclipse.swt.widgets.Shell)4 Test (org.junit.Test)4 XulSpoonResourceBundle (org.pentaho.di.ui.spoon.XulSpoonResourceBundle)4 XulRunner (org.pentaho.ui.xul.XulRunner)4 KettleException (org.pentaho.di.core.exception.KettleException)2 FormData (org.eclipse.swt.layout.FormData)1 Control (org.eclipse.swt.widgets.Control)1 KettleStepException (org.pentaho.di.core.exception.KettleStepException)1 KettleValueException (org.pentaho.di.core.exception.KettleValueException)1 SwtXulRunner (org.pentaho.ui.xul.swt.SwtXulRunner)1