Java Code Examples for org.pentaho.ui.xul.XulDomContainer#addEventHandler()

The following examples show how to use org.pentaho.ui.xul.XulDomContainer#addEventHandler() . 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: 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 2
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 3
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 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: 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 6
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 7
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 8
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 9
Source File: BeamSpoonPlugin.java    From kettle-beam with Apache License 2.0 5 votes vote down vote up
@Override
public void applyToContainer( String category, XulDomContainer container ) throws XulException {
  container.registerClassLoader( getClass().getClassLoader() );
  if ( category.equals( "spoon" ) ) {
    container.loadOverlay( "beam_spoon_overlays.xul", resourceBundle );
    container.addEventHandler( BeamHelper.getInstance() );
  }
  if ( category.equals( "trans-graph" ) ) {
    container.loadOverlay( "beam_transgraph_overlays.xul", resourceBundle );
    container.addEventHandler( BeamHelper.getInstance() );
  }
}
 
Example 10
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 11
Source File: AbstractRepositoryExplorerUISupport.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void apply( XulDomContainer container ) throws XulException {
  this.container = container;
  container.registerClassLoader( getClass().getClassLoader() );
  for ( XulEventHandler handler : handlers ) {
    container.addEventHandler( handler );
  }
  for ( XulOverlay overlay : overlays ) {
    if ( overlay instanceof RepositoryExplorerDefaultXulOverlay ) {
      container.loadOverlay( overlay.getOverlayUri(), new XulSpoonResourceBundle(
        ( (RepositoryExplorerDefaultXulOverlay) overlay ).getPackageClass() ) );
    } else {
      container.loadOverlay( overlay.getOverlayUri(), overlay.getResourceBundleUri() );
    }
  }
}
 
Example 12
Source File: FormatStep.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void createPresentationComponent( final XulDomContainer mainWizardContainer ) throws XulException {
  super.createPresentationComponent( mainWizardContainer );

  mainWizardContainer.loadOverlay( FORMAT_STEP_OVERLAY );

  // Add event handlers
  mainWizardContainer.addEventHandler( formatStepHandler );
}
 
Example 13
Source File: DataSourceAndQueryStep.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void createPresentationComponent( final XulDomContainer mainWizardContainer ) throws XulException {
  super.createPresentationComponent( mainWizardContainer );

  mainWizardContainer.loadOverlay( DATASOURCE_AND_QUERY_STEP_OVERLAY );
  mainWizardContainer.addEventHandler( new DatasourceAndQueryStepHandler() );
  final XulListbox box = (XulListbox) getDocument().getElementById( DATASOURCE_SELECTIONS_BOX_ID );
  box.removeItems();
  for ( final XulEditorDataFactoryMetaData dfMeta : dataFactoryMetas ) {
    box.addItem( dfMeta );
  }
  box.addPropertyChangeListener( new SelectedIndexUpdateHandler() );
}
 
Example 14
Source File: LookAndFeelStep.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void createPresentationComponent( final XulDomContainer mainWizardContainer ) throws XulException {
  super.createPresentationComponent( mainWizardContainer );

  // Add the overlay
  mainWizardContainer.loadOverlay( LOOK_AND_FEEL_STEP_OVERLAY );

  // Add event handlers
  mainWizardContainer.addEventHandler( new SelectTemplateStepHandler() );
}
 
Example 15
Source File: UIMain.java    From pentaho-aggdesigner with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public void start(ApplicationContext context) throws XulException {
  XulDomContainer container;

  //check to see if they've specified an alternate resource bundle
  String bundleStr = configuration.getResourceBundle();
  ResourceBundle bundle = null;
  if(bundleStr != null){
    try{
      bundle = ResourceBundle.getBundle(bundleStr);
    } catch (MissingResourceException e){
      logger.error("Could not load Resource Bundle: "+bundleStr); //$NON-NLS-1$
    }
  }

  //Set the look and feel based on configuration
  setLAF();

  if(bundle != null){
    container = xulLoader.loadXul("org/pentaho/aggdes/ui/resources/mainFrame.xul", bundle); //$NON-NLS-1$
  } else {
    container = xulLoader.loadXul("org/pentaho/aggdes/ui/resources/mainFrame.xul"); //$NON-NLS-1$
  }

  //generically register all Spring-initialized XulEventHandlers
  Map handlerMap = context.getBeansOfType(XulEventHandler.class);
  for(Object handler : handlerMap.values()) {
    container.addEventHandler((XulEventHandler)handler);
  }

  xulRunner.addContainer(container);
  xulRunner.initialize();
  xulRunner.start();
}
 
Example 16
Source File: StarModelerSpoonPlugin.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void applyToContainer(String category, XulDomContainer container) throws XulException {
  container.registerClassLoader(getClass().getClassLoader());
  if(category.equals("spoon")){
    container.loadOverlay("org/pentaho/di/starmodeler/xul/spoon_overlays.xul");
    container.addEventHandler(ModelerHelper.getInstance());
  }
}
 
Example 17
Source File: DataSetSpoonPlugin.java    From pentaho-pdi-dataset with Apache License 2.0 5 votes vote down vote up
public void applyToContainer( String category, XulDomContainer container ) throws XulException {
  container.registerClassLoader( getClass().getClassLoader() );
  if ( category.equals( "spoon" ) ) {
    container.loadOverlay( "org/pentaho/di/dataset/spoon/xul/spoon_overlays.xul" );
    container.addEventHandler( DataSetHelper.getInstance() );
  }
  if ( category.equals( "trans-graph" ) ) {
    container.loadOverlay( "org/pentaho/di/dataset/spoon/xul/trans_graph_overlays.xul" );
    container.addEventHandler( DataSetHelper.getInstance() );
  }
}
 
Example 18
Source File: SparkTuningPopupMenu.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override public void applyToContainer( String category, XulDomContainer container ) throws XulException {
  if ( category.equals( "trans-graph" ) ) {
    container.registerClassLoader( getClass().getClassLoader() );
    container.loadOverlay( "org/pentaho/di/engine/configuration/impl/spark/spark-tuning-menu.xul", resourceBundle );
    container.addEventHandler( this.handler );
  }
}
 
Example 19
Source File: WizardControllerPanel.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * @param mainWizardContainer
 */
public void addContent( final XulDomContainer mainWizardContainer ) throws XulException {
  mainWizardContainer.loadOverlay( WIZARD_CONTROLLER_OVERLAY );
  mainWizardContainer.addEventHandler( (XulEventHandler) controller );
}
 
Example 20
Source File: LayoutStep.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void createPresentationComponent( final XulDomContainer mainWizardContainer ) throws XulException {
  super.createPresentationComponent( mainWizardContainer );

  mainWizardContainer.loadOverlay( LAYOUT_STEP_OVERLAY );
  mainWizardContainer.addEventHandler( new SelectFieldsAndGroupsEventHandler() );
}