Package org.pentaho.reporting.libraries.formula

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


{
  public static void main(String[] args)
  {
    LibFormulaBoot.getInstance().start();

    final DefaultFormulaContext context = new DefaultFormulaContext();
    final FunctionRegistry functionRegistry = context.getFunctionRegistry();
    final String[] names = functionRegistry.getFunctionNames();
    for (int i = 0; i < names.length; i++)
    {
      final String name = names[i];
      final FunctionDescription data = functionRegistry.getMetaData(name);
View Full Code Here


      throw new NullPointerException();
    }

    this.contentBase = contentBase;
    this.resourceManager = resourceManager;
    this.formulaContext = new DefaultFormulaContext();
    this.outputProcessorMetaData = outputProcessorMetaData;
    this.resourceBundleFactory = MasterReport.computeAndInitResourceBundleFactory(resourceBundleFactory, environment);
    this.configuration = configuration;
    this.layoutSupport = layoutSupport;
    if (metaData == null)
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

        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

    comboBox.setEditable(true);

    add(comboBox, BorderLayout.CENTER);
    add(ellipsisButton, BorderLayout.EAST);

    formulaContext = new DefaultFormulaContext();

    nullable = false;
  }
View Full Code Here

    functionTextArea.setRows(6);
    functionTextArea.addCaretListener(new CaretHandler());
    functionTextArea.setFont
        (new Font(Font.MONOSPACED, functionTextArea.getFont().getStyle(), functionTextArea.getFont().getSize()));

    formulaContext = new DefaultFormulaContext();

    functionSelectorPanel = new FunctionListPanel();
    functionSelectorPanel.addPropertyChangeListener("selectedValue", new FunctionDescriptionUpdateHandler()); // NON-NLS
    functionSelectorPanel.addActionListener(new FunctionDescriptionUpdateHandler());
    functionSelectorPanel.setFormulaContext(this.formulaContext);
View Full Code Here

        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

   * @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
        (LibFormulaBoot.getInstance().getGlobalConfig(), Locale.US, TimeZone.getDefault());
    this.model = model;
    useGuessType = guessType;
    this.typeRegistry = new DefaultTypeRegistry();
    this.typeRegistry.initialize(this);
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

    }
  }

  public static String createCellUITextFromFormula(final String formula)
  {
    return createCellUITextFromFormula(formula, new DefaultFormulaContext());
  }
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.