Examples of FunctionEvaluationException


Examples of org.jfree.layouting.layouter.style.functions.FunctionEvaluationException

          throws FunctionEvaluationException
  {
    final CSSValue[] params = function.getParameters();
    if (params.length < 2)
    {
      throw new FunctionEvaluationException("Illegal parameter count");
    }
    final CSSValue rawValue = FunctionUtilities.resolveParameter(layoutProcess, element, params[0]);
    final String typeValue = FunctionUtilities.resolveString(layoutProcess, element, params[1]);
    final LocalizationContext localizationContext =
            DocumentContextUtility.getLocalizationContext
                    (layoutProcess.getDocumentContext());
    final LayoutContext layoutContext = element.getLayoutContext();
    if ("date".equals(typeValue))
    {
      if (params.length < 3)
      {
        return getDateValue(rawValue,
                localizationContext.getDateFormat(layoutContext.getLanguage()));
      }
      else
      {
        final String format = FunctionUtilities.resolveString(layoutProcess, element, params[2]);
        return getDateValue(rawValue,
                localizationContext.getDateFormat(format, layoutContext.getLanguage()));
      }
    }
    else if ("time".equals(typeValue))
    {
      if (params.length != 2)
      {
        throw new FunctionEvaluationException();
      }
      return getDateValue(rawValue,
              localizationContext.getTimeFormat(layoutContext.getLanguage()));
    }
    else if ("number".equals(typeValue))
    {
      if (params.length < 3)
      {
        return getNumberValue(rawValue,
                localizationContext.getDateFormat(layoutContext.getLanguage()));
      }
      else
      {
        final String format = FunctionUtilities.resolveString(layoutProcess, element, params[2]);
        return getNumberValue(rawValue,
                localizationContext.getNumberFormat(format, layoutContext.getLanguage()));
      }
    }
    else if ("integer".equals(typeValue))
    {
      if (params.length != 2)
      {
        throw new FunctionEvaluationException();
      }
      return getNumberValue(rawValue,
              localizationContext.getIntegerFormat(layoutContext.getLanguage()));
    }
    throw new FunctionEvaluationException("FormatType not recognized");
  }
View Full Code Here

Examples of org.jfree.layouting.layouter.style.functions.FunctionEvaluationException

      number = nval.getValue();
    }
    else
    {
      // Raw-Values should not have been created for number values
      throw new FunctionEvaluationException("Not a numeric value.");
    }

    final Double obj = new Double(number);
    return new FormattedContentToken
            (obj, format, format.format(obj));
View Full Code Here

Examples of org.jfree.layouting.layouter.style.functions.FunctionEvaluationException

    {
      final CSSRawValue cssRawValue = (CSSRawValue) rawValue;
      final Object o = cssRawValue.getValue();
      if (o instanceof Date == false)
      {
        throw new FunctionEvaluationException("Not a date value.");
      }
      date = (Date) o;
    }
    else if (rawValue instanceof CSSFormatedValue)
    {
      final CSSFormatedValue fval = (CSSFormatedValue) rawValue;
      final Object o = fval.getRaw();
      if (o instanceof Date == false)
      {
        throw new FunctionEvaluationException("Not a date value.");
      }
      date = (Date) o;
    }
    else
    {
      throw new FunctionEvaluationException("Not a date value.");
    }

    return new FormattedContentToken
            (date, format, format.format(date));
  }
View Full Code Here

Examples of org.jfree.layouting.layouter.style.functions.FunctionEvaluationException

          throws FunctionEvaluationException
  {
    final CSSValue[] params = function.getParameters();
    if (params.length != 1)
    {
      throw new FunctionEvaluationException();
    }
    final CSSValue value = FunctionUtilities.resolveParameter(layoutProcess, element, params[0]);
    if (value instanceof CSSResourceValue)
    {
      final CSSResourceValue cssResourceValue =
              (CSSResourceValue) value;
      final Resource resource = cssResourceValue.getValue();
      return new ResourceContentToken(resource);
    }
    if (value instanceof CSSStringValue == false)
    {
      throw new FunctionEvaluationException
              ("Not even remotely an URI: " + value);
    }
    final CSSStringValue strval = (CSSStringValue) value;
    final CSSResourceValue cssResourceValue =
            FunctionUtilities.loadResource(layoutProcess, strval.getValue());
View Full Code Here

Examples of org.jfree.layouting.layouter.style.functions.FunctionEvaluationException

          throws FunctionEvaluationException
  {
    final CSSValue[] params = function.getParameters();
    if (params.length < 2)
    {
      throw new FunctionEvaluationException
              ("The parsed attr() function needs at least two parameters.");
    }
    final String namespace = FunctionUtilities.resolveString
            (layoutProcess, element, params[0]);
    final String name = FunctionUtilities.resolveString
View Full Code Here

Examples of org.jfree.layouting.layouter.style.functions.FunctionEvaluationException

                                final String type)
          throws FunctionEvaluationException
  {
    if (value instanceof CSSValue)
    {
      throw new FunctionEvaluationException();
    }

    if (value instanceof String)
    {
      final String strVal = (String) value;
      if ("length".equals(type))
      {
        return FunctionUtilities.parseNumberValue(strVal);
      }
      else if ("url".equals(type))
      {
        return FunctionUtilities.loadResource(layoutProcess, strVal);
      }
      else if ("color".equals(type))
      {
        final CSSValue colorValue = ColorUtil.parseColor(strVal);
        if (colorValue == null)
        {
          throw new FunctionEvaluationException();
        }
        return colorValue;
      }
      else
      {
View Full Code Here

Examples of org.jfree.layouting.layouter.style.functions.FunctionEvaluationException

      final CSSStringValue strVal = (CSSStringValue) value;
      nval = FunctionUtilities.parseNumberValue(strVal.getValue());
    }
    else if (value instanceof CSSNumericValue == false)
    {
      throw new FunctionEvaluationException("Expected a number");
    }
    else
    {
      nval = (CSSNumericValue) value;
    }
    if (nval.getType().equals(CSSNumericType.NUMBER))
    {
      return (int) (nval.getValue() % 360);
    }
    throw new FunctionEvaluationException("Expected a number, not a length");
  }
View Full Code Here

Examples of org.jfree.layouting.layouter.style.functions.FunctionEvaluationException

      final CSSStringValue strVal = (CSSStringValue) value;
      nval = FunctionUtilities.parseNumberValue(strVal.getValue());
    }
    else if (value instanceof CSSNumericValue == false)
    {
      throw new FunctionEvaluationException("Expected a number");
    }
    else
    {
      nval = (CSSNumericValue) value;
    }
    if (nval.getType().equals(CSSNumericType.PERCENTAGE))
    {
      return (float) (nval.getValue() % 100);
    }
    throw new FunctionEvaluationException("Expected a number, not a length");
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.resolver.FunctionEvaluationException

          throws FunctionEvaluationException
  {
    final CSSValue[] params = function.getParameters();
    if (params.length != 1)
    {
      throw new FunctionEvaluationException();
    }
    final String name = FunctionUtilities.resolveString(layoutProcess, element, params[0]);
    return new VariableToken(name);
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.resolver.FunctionEvaluationException

  {
    // Accepts one or two parameters ...
    final CSSValue[] params = function.getParameters();
    if (params.length < 1)
    {
      throw new FunctionEvaluationException();
    }
    final String counterName =
            FunctionUtilities.resolveString(layoutProcess, element, params[0]);

    CounterStyle cstyle = null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.