Package org.pentaho.reporting.libraries.css.resolver

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


    final StyleValueFunction function =
        FunctionFactory.getInstance().getStyleFunction
            (functionValue.getFunctionName());
    if (function == null)
    {
      throw new FunctionEvaluationException
          ("Unsupported Function: " + functionValue);
    }
    return function.evaluate
        (layoutProcess, layoutElement, functionValue);
  }
View Full Code Here


          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

                                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

      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

      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

              ColorUtil.hslToRGB(hueValue, saturationValue, lightValue);
      return new CSSColorValue(rgb[0], rgb[1], rgb[2], alphaValue);
    }
    else
    {
      throw new FunctionEvaluationException("Expected either three or four parameters.");
    }
  }
View Full Code Here

          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)
    {
      return value;
    }
    if (value instanceof CSSStringValue == false)
    {
      throw new FunctionEvaluationException
              ("Not even remotely an URI: " + value);
    }
    final CSSStringValue strval = (CSSStringValue) value;
    return FunctionUtilities.loadResource(layoutProcess, strval.getValue());
  }
View Full Code Here

      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() % 256);
    }
    if (nval.getType().equals(CSSNumericType.PERCENTAGE))
    {
      return (int) (nval.getValue() * 256.0 / 100.0);
    }
    throw new FunctionEvaluationException("Expected a number, not a length");
  }
View Full Code Here

          (FunctionUtilities.resolveParameter(layoutProcess, element, values[3]));
      return new CSSColorValue(redValue, greenValue, blueValue, alphaValue);
    }
    else
    {
      throw new FunctionEvaluationException("Expected either three or four parameters.");
    }
  }
View Full Code Here

      final CSSFunctionValue functionValue = (CSSFunctionValue) value;
      final String name = functionValue.getFunctionName().toLowerCase();
      final StyleValueFunction o = (StyleValueFunction) functions.get(name);
      if (o == null)
      {
        throw new FunctionEvaluationException("No such function registered: " + name);
      }
      return o.evaluate(documentContext, element, (CSSFunctionValue) value);
    }
    else if (value instanceof CSSValueList)
    {
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.css.resolver.FunctionEvaluationException

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.