Package org.pentaho.openformula.ui.model2

Examples of org.pentaho.openformula.ui.model2.FormulaDocument


    if ((editorModel == null) || (editorModel.getLength() < 1))
    {
      return true;
    }

    final FormulaElement mainFormulaElement = editorModel.getFormulaElementAt(1);
    final FunctionInformation currentFunction = editorModel.getCurrentFunction();
    if ((mainFormulaElement != null) && (currentFunction != null) && (currentFunction.getFunctionOffset() == 1) &&
        (mainFormulaElement.getText().equals(currentFunction.getCanonicalName())))
    {
      return true;
    }
    else
    {
View Full Code Here


  public void testParseFunction() throws BadLocationException
  {
    FormulaDocument doc = new FormulaDocument();
    final String str = "=IF(IF([a];[b];\"C\");[c]; [d]) ";
    doc.insertString(0, str, null);
    final FormulaRootElement element = doc.getRootElement();
    assertEquals("Length", str.length(), doc.getLength());
    assertEquals("Number of elements: ", 17, element.getElementCount());
  }
View Full Code Here

  public void testParseFunctionBad() throws BadLocationException
  {
    FormulaDocument doc = new FormulaDocument();
    final String str = "=IF(IF([a];[b];\"C\"));[c]; [d]) ";
    doc.insertString(0, str, null);
    final FormulaRootElement element = doc.getRootElement();
    assertEquals("Length", str.length(), doc.getLength());
    assertEquals("Number of elements: ", 18, element.getElementCount());
  }
View Full Code Here

  public void testParseFunctionBad2() throws BadLocationException
  {
    FormulaDocument doc = new FormulaDocument();
    final String str = "=IF(([a];[b];\"C\"));[c]; [d]) ";
    doc.insertString(0, str, null);
    final FormulaRootElement element = doc.getRootElement();
    assertEquals("Length", str.length(), doc.getLength());
    assertEquals("Number of elements: ", 17, element.getElementCount());
  }
View Full Code Here

    {
      return true;
    }

    final FormulaElement mainFormulaElement = editorModel.getFormulaElementAt(1);
    final FunctionInformation currentFunction = editorModel.getCurrentFunction();
    if ((mainFormulaElement != null) && (currentFunction != null) && (currentFunction.getFunctionOffset() == 1) &&
        (mainFormulaElement.getText().equals(currentFunction.getCanonicalName())))
    {
      return true;
    }
    else
    {
View Full Code Here

    if (formulaContext == null)
    {
      functionParameterEditor.clearSelectedFunction();
      return;
    }
    final FunctionInformation fnInfo = editorModel.getCurrentFunction();
    if (fnInfo == null)
    {
      functionParameterEditor.clearSelectedFunction();
      return;
    }
    final FunctionDescription fnDesc = formulaContext.getFunctionRegistry().getMetaData(fnInfo.getCanonicalName());
    if (fnDesc == null)
    {
      functionParameterEditor.clearSelectedFunction();
      return;
    }
View Full Code Here

    }
  }

  private void refreshInformationPanel()
  {
    final FunctionInformation currentFunction = editorModel.getCurrentFunction();

    final FunctionDescription description;
    if (currentFunction != null)
    {
      description = formulaContext.getFunctionRegistry().getMetaData(currentFunction.getCanonicalName());
    }
    else
    {
      description = functionSelectorPanel.getSelectedValue();
    }
View Full Code Here

      if (ignoreTextEvents == true)
      {
        return;
      }

      final FunctionInformation fn = editorModel.getCurrentFunction();
      if (fn == null)
      {
        return;
      }
View Full Code Here

  public void testEditExtraParameterEmptyText()
  {
    final ParameterUpdateEvent event = new ParameterUpdateEvent(this, 10, "", true);
    final FormulaDocument doc = new FormulaDocument();
    doc.setText("=SUM()");
    final FunctionInformation fn = doc.getFunctionForPosition(1);

    final FunctionParameterEditHelper.EditResult editResult =
        FunctionParameterEditHelper.buildFormulaText(event, fn, doc.getText());

    assertEquals("=SUM()", editResult.text);
View Full Code Here

  public void testEditExtraParameterText()
  {
    final ParameterUpdateEvent event = new ParameterUpdateEvent(this, 4, "1", true);
    final FormulaDocument doc = new FormulaDocument();
    doc.setText("=SUM()");
    final FunctionInformation fn = doc.getFunctionForPosition(1);

    final FunctionParameterEditHelper.EditResult editResult =
        FunctionParameterEditHelper.buildFormulaText(event, fn, doc.getText());

    assertEquals("=SUM(;;;;1)", editResult.text);
View Full Code Here

TOP

Related Classes of org.pentaho.openformula.ui.model2.FormulaDocument

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.