Package org.pentaho.reporting.libraries.formula

Examples of org.pentaho.reporting.libraries.formula.DefaultFormulaContext


        if (FORMULA_VALUE_ROLE.equals(valueRole) && isFormulaFragment())
        {
          final GenericExpressionRuntime expressionRuntime = new GenericExpressionRuntime
              (new StaticDataRow(), new DefaultTableModel(), -1, new DefaultProcessingContext());
          final String formulaText = FormulaUtil.createEditorTextFromFormula
              (String.valueOf(value), new ReportFormulaContext(new DefaultFormulaContext(), expressionRuntime));
          textField.setText(formulaText);
          comboBox.setSelectedItem(formulaText);
        }
        else
        {
View Full Code Here


        parser = new FormulaParser();
        try
        {
            final XFormulaOpCodeMapper mapper = (XFormulaOpCodeMapper) UnoRuntime.queryInterface(XFormulaOpCodeMapper.class, m_xContext.getServiceManager().createInstanceWithContext("simple.formula.FormulaOpCodeMapperObj", m_xContext));
            FormulaOpCodeMapEntry[] opCodes = mapper.getAvailableMappings(FormulaLanguage.ODFF, FormulaMapGroup.FUNCTIONS);
            final DefaultFormulaContext defaultContext = new DefaultFormulaContext();
            final FunctionRegistry functionRegistry = defaultContext.getFunctionRegistry();

            String[] names = functionRegistry.getFunctionNames();
            addOpCodes(names, opCodes, FUNCTIONS);
            names = getOperators(defaultContext, OPERATORS);
            opCodes = mapper.getAvailableMappings(FormulaLanguage.ODFF, FormulaMapGroup.UNARY_OPERATORS);
View Full Code Here

    public SOFunctionManager(XComponentContext context)
    {
        m_xContext = context;
        final ClassLoader cl = java.lang.Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
        defaultContext = new DefaultFormulaContext();
        functionRegistry = defaultContext.getFunctionRegistry();
        categories = functionRegistry.getCategories();
        Thread.currentThread().setContextClassLoader(cl);

    }
View Full Code Here

    context.setExportDescriptor(target.getExportDescriptor());
    final DefaultLayoutControllerFactory lcf = new DefaultLayoutControllerFactory();
    lcf.initialize(job);
    context.setLayoutControllerFactory(lcf);

    final DefaultFormulaContext formulaContext = new DefaultFormulaContext();
    context.setFormulaContext(formulaContext);
    context.setResourceBundleFactory(job.getResourceBundleFactory());
    context.setReportStructureRoot(job.getReportStructureRoot());
    return context;
  }
View Full Code Here

   * @param guessType if <code>resolveReferenceType</code> should guess the type of the reference or return a type
   *                  <code>Any</code>.
   */
  public TestFormulaContext(final TableModel model, final boolean guessType)
  {
    formulaContext = new DefaultFormulaContext();
    this.model = model;
    useGuessType = guessType;
  }
View Full Code Here

  }


  public void testFrenchDateParsing() throws Exception
  {
    final DefaultFormulaContext context = new DefaultFormulaContext(LibFormulaBoot.getInstance().getGlobalConfig(),
        Locale.FRENCH, TimeZone.getDefault());

    performTest("DATEVALUE(\"25/12/2004\")=DATE(2004;12;25)", Boolean.TRUE, context);
  }
View Full Code Here

  {
    final Formula f = new Formula("IF(NOT(TRUE()));\"Testing\"; \"Other\"");

    // connects the parsed formula to the context. The context provides the
    // operator and function implementations and resolves the references.
    f.initialize(new DefaultFormulaContext());

    final LValue rootReference = f.getRootReference();
    print(rootReference, 0);
  }
View Full Code Here

        parser = new FormulaParser();
        try
        {
            final XFormulaOpCodeMapper mapper = (XFormulaOpCodeMapper) UnoRuntime.queryInterface(XFormulaOpCodeMapper.class, m_xContext.getServiceManager().createInstanceWithContext("simple.formula.FormulaOpCodeMapperObj", m_xContext));
            FormulaOpCodeMapEntry[] opCodes = mapper.getAvailableMappings(FormulaLanguage.ODFF, FormulaMapGroup.FUNCTIONS);
            final DefaultFormulaContext defaultContext = new DefaultFormulaContext();
            final FunctionRegistry functionRegistry = defaultContext.getFunctionRegistry();

            String[] names = functionRegistry.getFunctionNames();
            addOpCodes(names, opCodes, FUNCTIONS);
            names = getOperators(defaultContext, OPERATORS);
            opCodes = mapper.getAvailableMappings(FormulaLanguage.ODFF, FormulaMapGroup.UNARY_OPERATORS);
View Full Code Here

    public SOFunctionManager(XComponentContext context)
    {
        m_xContext = context;
        final ClassLoader cl = java.lang.Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
        defaultContext = new DefaultFormulaContext();
        functionRegistry = defaultContext.getFunctionRegistry();
        categories = functionRegistry.getCategories();
        Thread.currentThread().setContextClassLoader(cl);

    }
View Full Code Here

    public SOFunctionManager(XComponentContext context)
    {
        m_xContext = context;
        final ClassLoader cl = java.lang.Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
        defaultContext = new DefaultFormulaContext();
        functionRegistry = defaultContext.getFunctionRegistry();
        categories = functionRegistry.getCategories();
        Thread.currentThread().setContextClassLoader(cl);

    }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.formula.DefaultFormulaContext

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.