Package org.jfree.report.expressions

Examples of org.jfree.report.expressions.FormulaExpression


    final AttributeMap variableSection = new AttributeMap();
    variableSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.NAMESPACE_ATTRIBUTE, OfficeNamespaces.TEXT_NS);
    variableSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.TYPE_ATTRIBUTE, "variable-set");
    variableSection.setAttribute(OfficeNamespaces.TEXT_NS, "display", "none");

    final FormulaExpression valueExpression = variable.getValueExpression();
    final Object value = LayoutControllerUtil.evaluateExpression(getFlowController(), variable, valueExpression);
    String formula = FormatValueUtility.applyValueForVariable(value, variableSection);
    if ( formula == null )
        formula = "" + value;
    if (value instanceof Date)
View Full Code Here


            final FlowController flowController)
            throws DataSourceException
    {
        // here it is relatively easy. We have to evaluate the expression, convert
        // the result into a string, and print that string.
        final FormulaExpression formulaExpression = element.getValueExpression();
        final Object result = LayoutControllerUtil.evaluateExpression(flowController, element, formulaExpression);
        if (result == null)
        {
            // ignore it. Ignoring it is much better than printing 'null'.
            // LOGGER.debug("Formula '" + formulaExpression.getFormula() + "' evaluated to null.");
View Full Code Here

  protected boolean isValueChanged()
  {
    try
    {
      final FormattedTextElement element = (FormattedTextElement) getNode();
      final FormulaExpression formulaExpression = element.getValueExpression();
      final Formula formula = formulaExpression.getCompiledFormula();
      final LValue lValue = formula.getRootReference();
      return isReferenceChanged(lValue);
    }
    catch (final ParseException e)
    {
View Full Code Here

                                      final FlowController flowController)
      throws DataSourceException
  {
    // here it is relatively easy. We have to evaluate the expression, convert
    // the result into a string, and print that string.
    final FormulaExpression formulaExpression = element.getValueExpression();
    final Object result = LayoutControllerUtil.evaluateExpression
        (flowController, element, formulaExpression);
    if (result == null)
    {
      // ignore it. Ignoring it is much better than printing 'null'.
      Log.debug("Formula '" + formulaExpression.getFormula() + "' evaluated to null.");
      return null;
    }
    else if (result instanceof DataFlags)
    {
      return (DataFlags) result;
View Full Code Here

      (final ReportTarget target)
      throws ReportProcessingException, ReportDataFactoryException,
      DataSourceException
  {
    final ImageElement imageElement = (ImageElement) getNode();
    final FormulaExpression formulaExpression = imageElement.getFormula();
    if (formulaExpression == null)
    {
      // A static image is easy. At least at this level. Dont ask about the weird things we have to do in the
      // output targets ...
      final String linkTarget = imageElement.getImageData();
View Full Code Here

  }

  protected boolean isValueChanged()
  {
    final ImageElement imageElement = (ImageElement) getNode();
    final FormulaExpression formulaExpression = imageElement.getFormula();
    if (formulaExpression == null)
    {
      final FlowController controller = getFlowController();
      final GlobalMasterRow masterRow = controller.getMasterRow();
      final ReportDataRow reportDataRow = masterRow.getReportDataRow();
      if (reportDataRow.getCursor() == 0)
      {
        return true;
      }
      return false;
    }

    try
    {
      final Formula formula = formulaExpression.getCompiledFormula();
      final LValue lValue = formula.getRootReference();
      return isReferenceChanged(lValue);
    }
    catch (ParseException e)
    {
View Full Code Here

        (OfficeNamespaces.OOREPORT_NS, "preserve-IRI");
    if (formula != null && formula.length() != 0)
    {
      // now, the evaulated content ends up in the 'content' attribute of the
      // element.
      final FormulaExpression valueExpression = new FormulaExpression();
      valueExpression.setFormula(formula);
      contentElement.setFormula(valueExpression);
    }

    contentElement.setNamespace(OfficeNamespaces.FORM_NS);
    contentElement.setType("image");
View Full Code Here

      (final ReportTarget target)
      throws ReportProcessingException, ReportDataFactoryException,
      DataSourceException
  {
    final ImageElement imageElement = (ImageElement) getNode();
    final FormulaExpression formulaExpression = imageElement.getFormula();
    if (formulaExpression == null)
    {
      // A static image is easy. At least at this level. Dont ask about the weird things we have to do in the
      // output targets ...
      final String linkTarget = imageElement.getImageData();
View Full Code Here

  }

  protected boolean isValueChanged()
  {
    final ImageElement imageElement = (ImageElement) getNode();
    final FormulaExpression formulaExpression = imageElement.getFormula();
    if (formulaExpression == null)
    {
      final FlowController controller = getFlowController();
      final GlobalMasterRow masterRow = controller.getMasterRow();
      final ReportDataRow reportDataRow = masterRow.getReportDataRow();
      if (reportDataRow.getCursor() == 0)
      {
        return true;
      }
      return false;
    }

    try
    {
      final Formula formula = formulaExpression.getCompiledFormula();
      final LValue lValue = formula.getRootReference();
      return isReferenceChanged(lValue);
    }
    catch (ParseException e)
    {
View Full Code Here

        {
            final Node node = nodes[i];
            if (node instanceof OfficeGroup)
            {
                final OfficeGroup group = (OfficeGroup) node;
                final FormulaExpression exp = (FormulaExpression) group.getGroupingExpression();
                if ( exp == null )
                    continue;

                try
                {
                    final String expression = exp.getFormulaExpression();
                    if ( expression == null)
                        continue;
                    final FormulaFunction function = (FormulaFunction) parser.parse(expression);
                    final LValue[] parameters = function.getChildValues();
                    if (parameters.length > 0)
                    {
                        String name = parameters[0].toString();
                        for (int j = 0; j < reportFunctions.length; j++)
                        {
                            if (reportFunctions[j] instanceof FormulaExpression)
                            {
                                final FormulaExpression reportExp = (FormulaExpression) reportFunctions[j];

                                if (reportExp.getName().equals(name))
                                {
                                    final LValue val = (LValue) parser.parse(reportExp.getFormulaExpression());
                                    if (val instanceof FormulaFunction)
                                    {
                                        final FormulaFunction reportFunction = (FormulaFunction) val;
                                   
                                        final ContextLookup context = (ContextLookup) reportFunction.getChildValues()[0];
View Full Code Here

TOP

Related Classes of org.jfree.report.expressions.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.