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

Examples of org.pentaho.reporting.engine.classic.core.function.FormulaExpression


    {
      element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, getFieldname());
    }
    if (getFormula() != null)
    {
      final FormulaExpression formulaExpression = new FormulaExpression();
      formulaExpression.setFormula(getFormula());
      element.setAttributeExpression(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, formulaExpression);
    }
    if (spacing != null)
    {
      element.setAttribute(SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.SPACING, spacing);
View Full Code Here


                                   final StyleKey styleKey)
      throws IOException
  {
    if (expression instanceof FormulaExpression)
    {
      final FormulaExpression fe = (FormulaExpression) expression;
      final AttributeList properties = new AttributeList();
      properties.setAttribute(ExtParserModule.NAMESPACE, "style-key", styleKey.getName());
      properties.setAttribute(ExtParserModule.NAMESPACE, "formula", fe.getFormula());
      if (expression.getDependencyLevel() > 0)
      {
        properties.setAttribute(ExtParserModule.NAMESPACE, "deplevel", String.valueOf(
            expression.getDependencyLevel()));
      }
      getXmlWriter().writeTag(ExtParserModule.NAMESPACE, FunctionsWriter.STYLE_EXPRESSION_TAG, properties,
          XmlWriterSupport.CLOSE);
      return;
    }

    if (expression instanceof FormulaFunction)
    {
      final FormulaFunction fe = (FormulaFunction) expression;
      final AttributeList properties = new AttributeList();
      properties.setAttribute(ExtParserModule.NAMESPACE, "style-key", styleKey.getName());
      properties.setAttribute(ExtParserModule.NAMESPACE, "formula", fe.getFormula());
      properties.setAttribute(ExtParserModule.NAMESPACE, "initial", fe.getInitial());
      if (expression.getDependencyLevel() > 0)
      {
        properties.setAttribute(ExtParserModule.NAMESPACE, "deplevel", String.valueOf(
            expression.getDependencyLevel()));
      }
View Full Code Here

    final String formula = attrs.getValue(getUri(), "formula");
    if (expressionClassName == null)
    {
      if (formula != null)
      {
        final FormulaExpression expression = new FormulaExpression();
        expression.setFormula(formula);
        this.expression = expression;
        this.expression.setName(name); // doesnt matter anyway, but it feels good :)
      }
      else
      {
View Full Code Here

    {
      element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, getFieldname());
    }
    if (getFormula() != null)
    {
      final FormulaExpression formulaExpression = new FormulaExpression();
      formulaExpression.setFormula(getFormula());
      element.setAttributeExpression(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, formulaExpression);
    }

    if (getType() != null)
    {
View Full Code Here

        this.originalClassName = FormulaFunction.class.getName();
        this.expressionClassName = FormulaFunction.class.getName();
      }
      else
      {
        final FormulaExpression expression = new FormulaExpression();
        expression.setFormula(formula);
        this.expression = expression;
        this.expression.setName(expressionName);
        this.expression.setDependencyLevel(depLevel);

        this.originalClassName = FormulaExpression.class.getName();
        this.expressionClassName = FormulaExpression.class.getName();
      }
    }

    if (expression == null && className != null)
    {
      final String mappedName = CompatibilityMapperUtil.mapClassName(className);
      expression = (Expression) ObjectUtilities.loadAndInstantiate
          (mappedName, getClass(), Expression.class);
      if (expression == null)
      {
        throw new ParseException("Expression '" + className + "' is not valid.", getLocator());
      }
      expression.setName(expressionName);
      expression.setDependencyLevel(depLevel);

      this.originalClassName = className;
      this.expressionClassName = mappedName;
    }
View Full Code Here

    final String formula = attrs.getValue(getUri(), "formula");
    if (className == null)
    {
      if (formula != null)
      {
        final FormulaExpression expression = new FormulaExpression();
        expression.setFormula(formula);
        this.expression = expression;
        this.expression.setName(expressionName);

        this.originalClassName = FormulaExpression.class.getName();
        this.expressionClassName = FormulaExpression.class.getName();
View Full Code Here

    return label;
  }

  public static Element createFieldItem(final String text, final float width, final float height)
  {
    final FormulaExpression fe = new FormulaExpression();
    fe.setFormula("=[value]");

    final Element label = new Element();
    label.setElementType(LabelType.INSTANCE);
    label.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, text);
    label.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, width);
View Full Code Here

      throw new NullPointerException();
    }

    if (expression instanceof FormulaExpression)
    {
      final FormulaExpression fe = (FormulaExpression) expression;
      if (StringUtils.isEmpty(fe.getFormula()))
      {
        return;
      }
      expressionAttrList.setAttribute(namespaceUri, "formula", fe.getFormula());// NON-NLS
      writer.writeTag(namespaceUri, expressionTag, expressionAttrList, XmlWriterSupport.CLOSE);
      return;
    }

    if (expression instanceof FormulaFunction)
    {
      final FormulaFunction fe = (FormulaFunction) expression;
      if (StringUtils.isEmpty(fe.getFormula()))
      {
        return;
      }
      expressionAttrList.setAttribute(namespaceUri, "formula", fe.getFormula());// NON-NLS
      expressionAttrList.setAttribute(namespaceUri, "initial", fe.getInitial());// NON-NLS
      writer.writeTag(namespaceUri, expressionTag, expressionAttrList, XmlWriterSupport.CLOSE);
      return;
    }

    try
View Full Code Here

      ex.setField(fieldName);
      element.setStyleExpression(ElementStyleKeys.ANCHOR_NAME, ex);
    }
    else if (formula != null)
    {
      final FormulaExpression fe = new FormulaExpression();
      fe.setFormula(formula);
      element.setStyleExpression(ElementStyleKeys.ANCHOR_NAME, fe);
    }
  }
View Full Code Here

    return label;
  }

  public static Element createFieldItem(final String text, final float width, final float height)
  {
    final FormulaExpression fe = new FormulaExpression();
    fe.setFormula("=[value]");

    final Element label = new Element();
    label.setElementType(LabelType.INSTANCE);
    label.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, text);
    label.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, width);
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.function.FormulaExpression

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.