Package org.jfree.layouting.layouter.style.functions

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


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


      throws FunctionEvaluationException
  {
    final CSSValue[] parameters = function.getParameters();
    if (parameters.length == 0)
    {
      throw new FunctionEvaluationException
          ("One parameter must be given to the 'pending' function.");
    }

    final String name = FunctionUtilities.resolveString
        (layoutProcess, element, parameters[0]);
View Full Code Here

          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

  {
    // 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

      throws FunctionEvaluationException
  {
    final CSSValue[] parameters = function.getParameters();
    if (parameters.length == 0)
    {
      throw new FunctionEvaluationException
          ("One parameter must be given to the 'elements' function.");
    }

    final String name = FunctionUtilities.resolveString
        (layoutProcess, element, parameters[0]);
View Full Code Here

          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

      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

    {
      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

          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

          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

TOP

Related Classes of org.jfree.layouting.layouter.style.functions.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.