Java Code Examples for org.pentaho.ui.xul.dom.Document#getElementById()

The following examples show how to use org.pentaho.ui.xul.dom.Document#getElementById() . 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: SpoonPerspectiveManager.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void removePerspective( SpoonPerspective per ) {
  perspectives.remove( per );
  orderedPerspectives.remove( per );
  Document document = domContainer.getDocumentRoot();

  XulComponent comp = document.getElementById( "perspective-" + per.getId() );
  comp.getParent().removeChild( comp );

  comp = document.getElementById( "perspective-btn-" + per.getId() );
  comp.getParent().removeChild( comp );
  XulToolbar mainToolbar = (XulToolbar) domContainer.getDocumentRoot().getElementById( "main-toolbar" );
  ( (Composite) mainToolbar.getManagedObject() ).layout( true, true );

  deck.setSelectedIndex( 0 );

}
 
Example 2
Source File: PentahoDrillDownController.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void configureDisableTableOnEmptyFile() {
  final Document doc = getXulDomContainer().getDocumentRoot();
  final XulComponent paramTableElement = doc.getElementById( "parameter-table" ); // NON-NLS
  if ( paramTableElement instanceof XulDrillDownParameterTable == false ) {
    return;
  }

  pentahoPathWrapper.addPropertyChangeListener( PentahoPathModel.LOCAL_PATH_PROPERTY, new CheckEmptyPathHandler(
      paramTableElement ) );
}
 
Example 3
Source File: GenericUrlDrillDownController.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void configureDisableTableOnEmptyFile() {
  final Document doc = getXulDomContainer().getDocumentRoot();
  final XulComponent paramTableElement = doc.getElementById( "parameter-table" );//NON-NLS
  if ( paramTableElement instanceof XulDrillDownParameterTable == false ) {
    return;
  }

  getWrapper().getModel().addPropertyChangeListener
    ( DrillDownModel.DRILL_DOWN_PATH_PROPERTY, new CheckEmptyPathHandler( paramTableElement ) );

}
 
Example 4
Source File: DefaultXulDrillDownController.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void init( final ReportDesignerContext reportDesignerContext,
                  final DrillDownModel model,
                  final String[] fields ) {
  if ( model == null ) {
    throw new NullPointerException();
  }
  if ( reportDesignerContext == null ) {
    throw new NullPointerException();
  }
  if ( fields == null ) {
    throw new NullPointerException();
  }

  this.reportDesignerContext = reportDesignerContext;

  final Document doc = this.xulDomContainer.getDocumentRoot();
  final DefaultBindingFactory bindingFactory = new DefaultBindingFactory();
  bindingFactory.setDocument( doc );
  bindingFactory.setBindingType( Binding.Type.BI_DIRECTIONAL );
  wrapper = new DrillDownModelWrapper( model );
  final XulComponent pathElement = doc.getElementById( "path" ); //NON-NLS
  if ( pathElement != null ) {
    bindingFactory.createBinding( wrapper, DrillDownModel.DRILL_DOWN_PATH_PROPERTY, "path", "value" ); //NON-NLS
  }
  final XulComponent configElement = doc.getElementById( "config" ); //NON-NLS
  if ( configElement != null ) {
    bindingFactory.createBinding( wrapper, DrillDownModel.DRILL_DOWN_CONFIG_PROPERTY, "config", "value" ); //NON-NLS
  }
  final XulComponent linkTargetElement = doc.getElementById( "link-target" ); //NON-NLS
  if ( linkTargetElement != null ) {
    bindingFactory.createBinding( wrapper, DrillDownModel.TARGET_FORMULA_PROPERTY, "link-target", "value" ); //NON-NLS
  }
  final XulComponent linkTooltipElement = doc.getElementById( "link-tooltip" ); //NON-NLS
  if ( linkTooltipElement != null ) {
    bindingFactory
      .createBinding( wrapper, DrillDownModel.TOOLTIP_FORMULA_PROPERTY, "link-tooltip", "value" ); //NON-NLS
  }
  final XulComponent previewElement = doc.getElementById( "preview" ); //NON-NLS
  if ( previewElement != null ) {
    final BindingFactory singleSourceBinding = new DefaultBindingFactory();
    singleSourceBinding.setBindingType( Binding.Type.ONE_WAY );
    singleSourceBinding.setDocument( doc );
    singleSourceBinding.createBinding( wrapper, "preview", "preview", "value" ); //NON-NLS
  }

  // we manage the binding between the table and the outside world manually
  wrapper.refresh();
  final XulComponent paramTableElement = doc.getElementById( "parameter-table" ); //NON-NLS
  if ( paramTableElement instanceof XulDrillDownParameterTable ) {
    final XulDrillDownParameterTable parameterTable = (XulDrillDownParameterTable) paramTableElement;
    table = parameterTable.getTable();
    table.setExtraFields( fields );
    table.setReportDesignerContext( reportDesignerContext );
    table.setDrillDownParameter( model.getDrillDownParameter() );
    table.setHideParameterUi( model.getDrillDownConfig().endsWith( "-no-parameter" ) );
    table.addPropertyChangeListener( DrillDownParameterTable.DRILL_DOWN_PARAMETER_PROPERTY, new TableModelBinding() );
  }

  if ( model.isLimitedEditor() ) {
    final XulComponent tooltipAndTargetElement = doc.getElementById( "tooltip-and-target-panel" ); //NON-NLS
    if ( tooltipAndTargetElement != null ) {
      tooltipAndTargetElement.setVisible( false );
    }
  }

  SwingUtilities.invokeLater( new RefreshParameterTask() );
}
 
Example 5
Source File: EESpoonPlugin.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
/**
 * Change the menu-item states based on Execute and Create permissions.
 * @param createPermitted
 *          - if true, we enable menu-items requiring creation permissions
 * @param executePermitted
 *          - if true, we enable menu-items requiring execute permissions
 */
void updateMenuState( boolean createPermitted, boolean executePermitted ) {
  Document doc = getDocumentRoot();
  if ( doc != null ) {
    // Main spoon menu
    ( (XulMenuitem) doc.getElementById( "process-run" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$

    XulToolbarbutton transRunButton = ( (XulToolbarbutton) doc.getElementById( "trans-run" ) ); //$NON-NLS-1$
    if ( transRunButton != null ) {
      transRunButton.setDisabled( !executePermitted );
    }

    ( (XulMenuitem) doc.getElementById( "trans-preview" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$
    ( (XulMenuitem) doc.getElementById( "trans-debug" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$
    ( (XulMenuitem) doc.getElementById( "trans-replay" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$
    ( (XulMenuitem) doc.getElementById( "trans-verify" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$
    ( (XulMenuitem) doc.getElementById( "trans-impact" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$
    ( (XulMenuitem) doc.getElementById( "trans-get-sql" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$

    // Disable Show Last menu under the Action menu.
    ( (XulMenu) doc.getElementById( "trans-last" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$

    // Schedule is a plugin
    if ( doc.getElementById( "trans-schedule" ) != null ) {
      ( (XulMenuitem) doc.getElementById( "trans-schedule" ) ).setDisabled( !executePermitted ); //$NON-NLS-1$
    }

    // Main spoon toolbar
    ( (XulToolbarbutton) doc.getElementById( "toolbar-file-new" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$
    ( (XulToolbarbutton) doc.getElementById( "toolbar-file-save" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$
    ( (XulToolbarbutton) doc.getElementById( "toolbar-file-save-as" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$

    // Popup menus
    ( (XulMenuitem) doc.getElementById( "trans-class-new" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$
    ( (XulMenuitem) doc.getElementById( "job-class-new" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$

    // Main spoon menu
    ( (XulMenu) doc.getElementById( "file-new" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$
    ( (XulMenuitem) doc.getElementById( "file-save" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$
    ( (XulMenuitem) doc.getElementById( "file-save-as" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$
    ( (XulMenuitem) doc.getElementById( "file-close" ) ).setDisabled( !createPermitted ); //$NON-NLS-1$

    boolean exportAllowed = createPermitted && executePermitted;
    ( (XulMenu) doc.getElementById( "file-export" ) ).setDisabled( !exportAllowed ); //$NON-NLS-1$
    ( (XulMenuitem) doc.getElementById( "repository-export-all" ) ).setDisabled( !exportAllowed ); //$NON-NLS-1$
    ( (XulMenuitem) doc.getElementById( "file-save-as-vfs" ) ).setDisabled( !exportAllowed ); //$NON-NLS-1$
    ( (XulMenuitem) doc.getElementById( "edit-cut-steps" ) ).setDisabled( !exportAllowed ); //$NON-NLS-1$
    ( (XulMenuitem) doc.getElementById( "edit-copy-steps" ) ).setDisabled( !exportAllowed ); //$NON-NLS-1$
    ( (XulMenuitem) doc.getElementById( "edit.copy-file" ) ).setDisabled( !exportAllowed ); //$NON-NLS-1$
    ( (XulMenuitem) doc.getElementById( "edit-paste-steps" ) ).setDisabled( !exportAllowed ); //$NON-NLS-1$

    XulMenuitem transCopyContextMenu = ( (XulMenuitem) doc.getElementById( "trans-graph-entry-copy" ) ); //$NON-NLS-1$
    if ( transCopyContextMenu != null ) {
      transCopyContextMenu.setDisabled( !exportAllowed );
    }
  }
}