org.pentaho.di.ui.xul.KettleXulLoader Java Examples

The following examples show how to use org.pentaho.di.ui.xul.KettleXulLoader. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImportRulesDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
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 ) );
    }
  }
 
Example #2
Source File: FileOverwriteDialogController.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
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;
  }
}
 
Example #3
Source File: JobLogDelegate.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
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 ) );
    }
  }
 
Example #4
Source File: JobHistoryDelegate.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
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 ) );
  }
}
 
Example #5
Source File: TransGridDelegate.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
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 ) );
    }
  }
 
Example #6
Source File: TransHistoryDelegate.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void addToolBar() {
  try {
    KettleXulLoader loader = new KettleXulLoader();
    loader.setIconsSize( 16, 16 );
    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( transHistoryComposite.getShell(),
      BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Title" ),
      BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_GRID_TOOLBAR ),
      new Exception( t ) );
  }
}
 
Example #7
Source File: TransLogDelegate.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
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 ) );
    }
  }
 
Example #8
Source File: XulPreviewRowsDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void open() {
  try {
    KettleXulLoader theLoader = new KettleXulLoader();
    theLoader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
    theLoader.setOuterContext( this.shell );
    this.container = theLoader.loadXul( XUL );

    this.controller =
      new XulPreviewRowsController( this.shell, this.databaseMeta, this.schema, this.table, this.limit );
    this.container.addEventHandler( this.controller );

    this.runner = new SwtXulRunner();
    this.runner.addContainer( this.container );
    this.runner.initialize();

    XulDialog thePreviewDialog =
      (XulDialog) this.container.getDocumentRoot().getElementById( "previewRowsDialog" );
    thePreviewDialog.show();

  } catch ( Exception e ) {
    logger.info( e );
  }
}
 
Example #9
Source File: XulStepFieldsDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void open( boolean isAcceptButtonHidden ) {
  try {
    KettleXulLoader theLoader = new KettleXulLoader();
    theLoader.setOuterContext( this.shell );
    theLoader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
    this.container = theLoader.loadXul( XUL );

    this.controller =
      new XulStepFieldsController( this.shell, this.databaseMeta, this.schemaTableCombo, this.rowMeta );
    this.controller.setShowAcceptButton( isAcceptButtonHidden );
    this.container.addEventHandler( this.controller );

    this.runner = new SwtXulRunner();
    this.runner.addContainer( this.container );
    this.runner.initialize();

    XulDialog thePreviewDialog =
      (XulDialog) this.container.getDocumentRoot().getElementById( "stepFieldsDialog" );
    thePreviewDialog.show();
    ( (SwtDialog) thePreviewDialog ).dispose();
  } catch ( Exception e ) {
    logger.info( e );
  }
}
 
Example #10
Source File: BeamPerspective.java    From kettle-beam with Apache License 2.0 5 votes vote down vote up
BeamPerspective() throws XulException {
  KettleXulLoader loader = new KettleXulLoader();
  loader.registerClassLoader( getClass().getClassLoader() );
  container = loader.loadXul( "beam_perspective.xul", resourceBundle );

  try {

    document = container.getDocumentRoot();
    tabs = (XulTabs) document.getElementById( "tabs" );
    panels = (XulTabpanels) document.getElementById( "tabpanels" );
    tabbox = (XulTabbox) tabs.getParent();

    container.addEventHandler( this );

    // addAdminTab();

    /*
     * To make compatible with webSpoon
     * Create a temporary parent for the UI and then call layout().
     * A different parent will be assigned to the UI in SpoonPerspectiveManager.PerspectiveManager.performInit().
    SwtDeck deck = (SwtDeck) Spoon.getInstance().getXulDomContainer().getDocumentRoot().getElementById( "canvas-deck" );
    box = deck.createVBoxCard();
    getUI().setParent( (Composite) box.getManagedObject() );
    getUI().layout();
     */

  } catch ( Exception e ) {
    logger.logError( "Error initializing perspective", e );
  }

}
 
Example #11
Source File: Neo4jPerspective.java    From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 5 votes vote down vote up
Neo4jPerspective() throws XulException {
  KettleXulLoader loader = new KettleXulLoader();
  loader.registerClassLoader( getClass().getClassLoader() );
  container = loader.loadXul( "neo4j_perspective.xul", resourceBundle );

  try {

    document = container.getDocumentRoot();
    tabs = (XulTabs) document.getElementById( "tabs" );
    panels = (XulTabpanels) document.getElementById( "tabpanels" );
    tabbox = (XulTabbox) tabs.getParent();

    container.addEventHandler( this );
    connectionFactory = new MetaStoreFactory<>( NeoConnection.class, Spoon.getInstance().getMetaStore(), Neo4jDefaults.NAMESPACE );
    modelsFactory = new MetaStoreFactory<>( GraphModel.class, Spoon.getInstance().getMetaStore(), Neo4jDefaults.NAMESPACE );

    // addAdminTab();

    /*
     * To make compatible with webSpoon
     * Create a temporary parent for the UI and then call layout().
     * A different parent will be assigned to the UI in SpoonPerspectiveManager.PerspectiveManager.performInit().
     */
    SwtDeck deck = (SwtDeck) Spoon.getInstance().getXulDomContainer().getDocumentRoot().getElementById( "canvas-deck" );
    box = deck.createVBoxCard();
    getUI().setParent( (Composite) box.getManagedObject() );
    getUI().layout();

  } catch ( Exception e ) {
    logger.logError( "Error initializing perspective", e );
  }

}
 
Example #12
Source File: SpoonBrowser.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
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 );
    }
  }
 
Example #13
Source File: TransPreviewDelegate.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
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 ) );
    }
  }
 
Example #14
Source File: XulDatabaseExplorerDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public boolean open() {
  try {

    KettleXulLoader theLoader = new KettleXulLoader();
    theLoader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
    theLoader.setSettingsManager( new DefaultSettingsManager( new File( Const.getKettleDirectory()
      + Const.FILE_SEPARATOR + "xulSettings.properties" ) ) );
    theLoader.setOuterContext( this.shell );

    this.container = theLoader.loadXul( XUL, new XulDatabaseExplorerResourceBundle() );

    XulDialog theExplorerDialog =
      (XulDialog) this.container.getDocumentRoot().getElementById( "databaseExplorerDialog" );

    SpoonPluginManager.getInstance().applyPluginsForContainer( "database_dialog", container );

    this.controller =
      new XulDatabaseExplorerController(
        this.shell, this.databaseMeta, this.databases, look );

    this.container.addEventHandler( this.controller );

    this.runner = new SwtXulRunner();
    this.runner.addContainer( this.container );

    this.runner.initialize();

    this.controller.setSelectedSchemaAndTable( schemaName, selectedTable );

    // show dialog if connection is success only.
    if ( controller.getActionStatus() == UiPostActionStatus.OK ) {
      theExplorerDialog.show();
    }

  } catch ( Exception e ) {
    LogChannel.GENERAL.logError( "Error exploring database", e );
  }
  return this.controller.getSelectedTable() != null;
}
 
Example #15
Source File: BaseStepXulDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
protected void initializeXul() throws XulException {
  initializeXul( new KettleXulLoader(), new SwtBindingFactory(), new SwtXulRunner(), parent );
  dialogShell = (Shell) xulDialog.getRootObject();
}