Search in sources :

Example 6 with XulLoader

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));
    }
}
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 7 with XulLoader

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));
    }
}
Also used : 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) ResourceBundle(java.util.ResourceBundle) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) KettleStepException(org.pentaho.di.core.exception.KettleStepException) KettleException(org.pentaho.di.core.exception.KettleException)

Example 8 with XulLoader

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));
    }
}
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) KettleValueException(org.pentaho.di.core.exception.KettleValueException)

Example 9 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 10 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