Package org.pentaho.reporting.engine.classic.core.states

Examples of org.pentaho.reporting.engine.classic.core.states.LegacyDataRowWrapper


    if (postProcessingLanguage == null || postProcessingScript == null)
    {
      return originalChart;
    }

    final LegacyDataRowWrapper legacyDataRowWrapper = new LegacyDataRowWrapper();
    final WrapperExpressionRuntime runtimeWrapper = new WrapperExpressionRuntime();
    runtimeWrapper.update(null, getRuntime());
    legacyDataRowWrapper.setParent(getDataRow());
    try
    {
      final BSFManager interpreter = new BSFManager();
      interpreter.declareBean("chart", originalChart, JFreeChart.class); //$NON-NLS-1$
      interpreter.declareBean("runtime", runtimeWrapper, ExpressionRuntime.class); //$NON-NLS-1$
      interpreter.declareBean("dataRow", legacyDataRowWrapper, DataRow.class); //$NON-NLS-1$
      final Object o = interpreter.eval
          (postProcessingLanguage, "expression", 1, 1, postProcessingScript); //$NON-NLS-1$
      if (o instanceof JFreeChart)
      {
        return (JFreeChart) o;
      }
      return originalChart;
    }
    catch (BSFException e)
    {
      // this is not nice
      AbstractChartExpression.logger.warn("Failed to evaluate post processing script", e);
    }
    finally
    {
      legacyDataRowWrapper.setParent(null);
      runtimeWrapper.update(null, null);
    }
    return originalChart;
  }
View Full Code Here


   * @throws BSFException if an error occured.
   */
  protected void initializeInterpreter(final BSFManager interpreter)
      throws BSFException
  {
    dataRowWrapper = new LegacyDataRowWrapper();
    runtimeWrapper = new WrapperExpressionRuntime();
    runtimeWrapper.update(getDataRow(), getRuntime());
    interpreter.declareBean("runtime", runtimeWrapper, ExpressionRuntime.class); //$NON-NLS-1$
    interpreter.declareBean("dataRow", dataRowWrapper, DataRow.class); //$NON-NLS-1$
    if (script != null)
View Full Code Here

  }


  protected void initializeScope (final Scriptable scope)
  {
    final LegacyDataRowWrapper dataRowWrapper = new LegacyDataRowWrapper();
    final Object wrappedDataRow = Context.javaToJS(dataRowWrapper, scope);
    ScriptableObject.putProperty(scope, "dataRow", wrappedDataRow);
  }
View Full Code Here

   * @throws BSFException if an error occured.
   */
  protected void initializeInterpreter(final BSFManager interpreter)
      throws BSFException
  {
    dataRowWrapper = new LegacyDataRowWrapper();
    interpreter.declareBean("dataRow", dataRowWrapper, DataRow.class); //$NON-NLS-1$
    interpreter.declareBean("configuration", configuration, Configuration.class); //$NON-NLS-1$
    interpreter.declareBean("contextKey", contextKey, ResourceKey.class); //$NON-NLS-1$
    interpreter.declareBean("resourceManager", resourceManager, ResourceManager.class); //$NON-NLS-1$
    interpreter.declareBean("resourceBundleFactory", resourceBundleFactory, ResourceBundleFactory.class); //$NON-NLS-1$
View Full Code Here

   * @throws BSFException if an error occured.
   */
  protected void initializeInterpreter(final BSFManager interpreter)
      throws BSFException
  {
    dataRowWrapper = new LegacyDataRowWrapper();
    runtimeWrapper = new WrapperExpressionRuntime();
    runtimeWrapper.update(getDataRow(), getRuntime());
    interpreter.declareBean("runtime", runtimeWrapper, ExpressionRuntime.class); //$NON-NLS-1$
    interpreter.declareBean("dataRow", dataRowWrapper, DataRow.class); //$NON-NLS-1$
    if (script != null)
View Full Code Here

  }


  protected LegacyDataRowWrapper initializeScope (final Scriptable scope)
  {
    final LegacyDataRowWrapper dataRowWrapper = new LegacyDataRowWrapper();
    dataRowWrapper.setParent(getRuntime().getDataRow());
    final Object wrappedDataRow = Context.javaToJS(dataRowWrapper, scope);
    ScriptableObject.putProperty(scope, "dataRow", wrappedDataRow); // NON-NLS
    return dataRowWrapper;
  }
View Full Code Here

    if (expression == null)
    {
      return null;
    }

    LegacyDataRowWrapper wrapper = null;
    try
    {
      final ContextFactory contextFactory = new ContextFactory();
      final Context context = contextFactory.enterContext();
      final Scriptable scope = context.initStandardObjects();
      wrapper = initializeScope(scope);

      final Object o = context.evaluateString(scope, expression, getName(), 1, null);
      if (o instanceof NativeJavaObject)
      {
        final NativeJavaObject object = (NativeJavaObject) o;
        return object.unwrap();
      }
      return o;
    }
    finally
    {
      if (wrapper != null)
      {
        wrapper.setParent(null);
      }
      Context.exit();
    }
  }
View Full Code Here

   * @throws BSFException if an error occured.
   */
  protected void initializeInterpreter(final BSFManager interpreter)
      throws BSFException
  {
    dataRowWrapper = new LegacyDataRowWrapper();
    interpreter.declareBean("dataRow", dataRowWrapper, DataRow.class); //$NON-NLS-1$
    interpreter.declareBean("configuration", getConfiguration(), Configuration.class); //$NON-NLS-1$
    interpreter.declareBean("contextKey", getContextKey(), ResourceKey.class); //$NON-NLS-1$
    interpreter.declareBean("resourceManager", getResourceManager(), ResourceManager.class); //$NON-NLS-1$
    interpreter.declareBean("resourceBundleFactory", getResourceBundleFactory(), ResourceBundleFactory.class); //$NON-NLS-1$
View Full Code Here

    if (postProcessingLanguage == null || postProcessingScript == null)
    {
      return originalChart;
    }

    final LegacyDataRowWrapper legacyDataRowWrapper = new LegacyDataRowWrapper();
    final WrapperExpressionRuntime runtimeWrapper = new WrapperExpressionRuntime();
    runtimeWrapper.update(null, getRuntime());
    legacyDataRowWrapper.setParent(getDataRow());
    try
    {
      final BSFManager interpreter = new BSFManager();
      interpreter.declareBean("chartExpression", this, getClass()); //$NON-NLS-1$
      interpreter.declareBean("chart", originalChart, JFreeChart.class); //$NON-NLS-1$
      interpreter.declareBean("runtime", runtimeWrapper, ExpressionRuntime.class); //$NON-NLS-1$
      interpreter.declareBean("dataRow", legacyDataRowWrapper, DataRow.class); //$NON-NLS-1$
      final Object o = interpreter.eval
          (postProcessingLanguage, "expression", 1, 1, postProcessingScript); //$NON-NLS-1$
      if (o instanceof JFreeChart)
      {
        return (JFreeChart) o;
      }
      return originalChart;
    }
    catch (BSFException e)
    {
      // this is not nice
      AbstractChartExpression.logger.warn("Failed to evaluate post processing script", e);
    }
    finally
    {
      legacyDataRowWrapper.setParent(null);
      runtimeWrapper.update(null, null);
    }
    return originalChart;
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.states.LegacyDataRowWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.