Search in sources :

Example 21 with XulDomContainer

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

the class DatabaseConnectionDialog method getSwtInstance.

public XulDomContainer getSwtInstance(SwtXulLoader loader, Shell shell) throws XulException {
    XulDomContainer container = null;
    Iterable<String> keyIterable = extendedClasses.keySet();
    for (Object key : keyIterable) {
        loader.register((String) key, extendedClasses.get(key));
    }
    loader.setOuterContext(shell);
    container = loader.loadXul(DIALOG_DEFINITION_FILE, Messages.getBundle());
    container.initialize();
    return container;
}
Also used : XulDomContainer(org.pentaho.ui.xul.XulDomContainer)

Example 22 with XulDomContainer

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

the class BrowseControllerTest method setUp.

@Before
public void setUp() throws Exception {
    DocumentFactory.registerElementClass(ElementDom4J.class);
    controller = new BrowseController();
    controller.setRepositoryDirectory(mock(UIRepositoryDirectory.class));
    directoryMap = new HashMap<>(8);
    controller.setDirMap(directoryMap);
    document = mock(Document.class);
    XulDomContainer xulDomContainer = mock(XulDomContainer.class);
    when(xulDomContainer.getDocumentRoot()).thenReturn(document);
    controller.setXulDomContainer(xulDomContainer);
    UIRepositoryDirectory someDirectory = mock(UIRepositoryDirectory.class);
    selectedFolder = mock(UIRepositoryDirectory.class);
    when(selectedFolder.createFolder(FOLDER_NAME)).thenReturn(someDirectory);
    XulTree folderTree = mock(XulTree.class);
    when(folderTree.getSelectedItems()).thenReturn(Collections.<Object>singleton(selectedFolder));
    controller.setFolderTree(folderTree);
    directoryBinding = mock(Binding.class);
    controller.setDirectoryBinding(directoryBinding);
    selectedItemsBinding = mock(Binding.class);
    controller.setSelectedItemsBinding(selectedItemsBinding);
}
Also used : UIRepositoryDirectory(org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryDirectory) Binding(org.pentaho.ui.xul.binding.Binding) XulTree(org.pentaho.ui.xul.containers.XulTree) Document(org.pentaho.ui.xul.dom.Document) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) Before(org.junit.Before)

Example 23 with XulDomContainer

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

the class SpoonBrowser method addToolBar.

protected 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_BROWSER_TOOLBAR, bundle);
        xulDomContainer.addEventHandler(this);
        toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById("nav-toolbar");
        @SuppressWarnings("unused") ToolBar swtToolBar = (ToolBar) toolbar.getManagedObject();
        spoon.props.setLook(swtToolBar, Props.WIDGET_STYLE_TOOLBAR);
        // Add a URL
        back = (XulToolbarbutton) toolbar.getElementById("browse-back");
        back.setDisabled(true);
        forward = (XulToolbarbutton) toolbar.getElementById("browse-forward");
        forward.setLabel(BaseMessages.getString(PKG, "SpoonBrowser.Dialog.Forward"));
        forward.setDisabled(false);
        location = (XulTextbox) toolbar.getElementById("browser-address");
        Control toolbarControl = (Control) toolbar.getManagedObject();
        toolbarControl.setLayoutData(new FormData());
        toolbarControl.setParent(composite);
    } catch (Exception e) {
        e.printStackTrace();
        new ErrorDialog(shell, BaseMessages.getString(PKG, "Spoon.Exception.ErrorReadingXULFile.Title"), BaseMessages.getString(PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_BROWSER_TOOLBAR), e);
    }
}
Also used : FormData(org.eclipse.swt.layout.FormData) Control(org.eclipse.swt.widgets.Control) 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) ResourceBundle(java.util.ResourceBundle) XulDomContainer(org.pentaho.ui.xul.XulDomContainer)

Example 24 with XulDomContainer

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

the class TransGridDelegate 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_GRID_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(toString(), Const.getStackTracker(t));
        new ErrorDialog(transGridComposite.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 : 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) ResourceBundle(java.util.ResourceBundle) XulDomContainer(org.pentaho.ui.xul.XulDomContainer)

Example 25 with XulDomContainer

use of org.pentaho.ui.xul.XulDomContainer 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)

Aggregations

XulDomContainer (org.pentaho.ui.xul.XulDomContainer)33 ResourceBundle (java.util.ResourceBundle)14 KettleXulLoader (org.pentaho.di.ui.xul.KettleXulLoader)12 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)11 XulLoader (org.pentaho.ui.xul.XulLoader)11 ToolBar (org.eclipse.swt.widgets.ToolBar)8 Test (org.junit.Test)8 KettleException (org.pentaho.di.core.exception.KettleException)8 XulException (org.pentaho.ui.xul.XulException)8 XulRunner (org.pentaho.ui.xul.XulRunner)7 Shell (org.eclipse.swt.widgets.Shell)6 XulComponent (org.pentaho.ui.xul.XulComponent)6 XulSpoonResourceBundle (org.pentaho.di.ui.spoon.XulSpoonResourceBundle)5 Document (org.pentaho.ui.xul.dom.Document)5 Before (org.junit.Before)2 KettleValueException (org.pentaho.di.core.exception.KettleValueException)2 TransMeta (org.pentaho.di.trans.TransMeta)2 Spoon (org.pentaho.di.ui.spoon.Spoon)2 DatabaseConnectionDialog (org.pentaho.ui.database.DatabaseConnectionDialog)2 XulDialog (org.pentaho.ui.xul.containers.XulDialog)2