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

Examples of org.pentaho.reporting.libraries.css.resolver.tokens.statics.StaticTextToken


    if (content instanceof CSSStringValue)
    {
      final CSSStringValue sval = (CSSStringValue) content;
      if (CSSStringType.STRING.equals(sval.getType()))
      {
        return new StaticTextToken(sval.getValue());
      }
      else
      {
        // this is an external URL, so try to load it.
        final CSSFunctionValue function = new CSSFunctionValue
                ("url", new CSSValue[]{sval});
        return evaluateFunction(function, process, element);
      }
    }

    if (content instanceof CSSFunctionValue)
    {
      return evaluateFunction((CSSFunctionValue) content, process, element);
    }

    if (content instanceof CSSConstant)
    {
      if (ContentValues.DOCUMENT_URL.equals(content))
      {
        final ResourceKey baseKey = process.getContextKey();
        final ResourceManager resourceManager = process.getResourceManager();
        final URL url = resourceManager.toURL(baseKey);
        if (url != null)
        {
          return new StaticTextToken(url.toExternalForm());
        }
        return null;
      }
    }
    return null;
View Full Code Here


        return new ResourceContentToken(refValue.getValue());
      }
      else if (value instanceof CSSStringValue)
      {
        final CSSStringValue strval = (CSSStringValue) value;
        return new StaticTextToken(strval.getValue());
      }
      else if (value instanceof CSSRawValue)
      {
        final CSSRawValue rawValue = (CSSRawValue) value;
        return new ExternalContentToken(rawValue.getValue());
      }
      return new StaticTextToken(value.getCSSText());
    }
    catch (FunctionEvaluationException e)
    {
      DebugLog.log("Evaluation failed " + e);
      return null;
View Full Code Here

    if (content instanceof CSSStringValue)
    {
      final CSSStringValue sval = (CSSStringValue) content;
      if (CSSStringType.STRING.equals(sval.getType()))
      {
        return new StaticTextToken(sval.getValue());
      }
      else
      {
        // this is an external URL, so try to load it.
        final CSSFunctionValue function = new CSSFunctionValue
                ("url", new CSSValue[]{sval});
        return evaluateFunction(function, process, element);
      }
    }

    if (content instanceof CSSFunctionValue)
    {
      return evaluateFunction((CSSFunctionValue) content, process, element);
    }

    if (content instanceof CSSConstant)
    {
      if (ContentValues.DOCUMENT_URL.equals(content))
      {
        final ResourceKey baseKey = process.getContextKey();
        final ResourceManager resourceManager = process.getResourceManager();
        final URL url = resourceManager.toURL(baseKey);
        if (url != null)
        {
          return new StaticTextToken(url.toExternalForm());
        }
        return null;
      }

      final ContentToken token = (ContentToken) tokenMapping.get(content);
View Full Code Here

        return new ResourceContentToken(refValue.getValue());
      }
      else if (value instanceof CSSStringValue)
      {
        final CSSStringValue strval = (CSSStringValue) value;
        return new StaticTextToken(strval.getValue());
      }
      else if (value instanceof CSSRawValue)
      {
        final CSSRawValue rawValue = (CSSRawValue) value;
        return new ExternalContentToken(rawValue.getValue());
      }
      return new StaticTextToken(value.getCSSText());
    }
    catch (FunctionEvaluationException e)
    {
//      Log.debug ("Evaluation failed " + e);
      return null;
View Full Code Here

        contentSpecification.setContents(new ContentToken[]{token});
      }
      else
      {
        contentSpecification.setContents
            (new ContentToken[]{counterToken, new StaticTextToken(suffix)});
      }
    }
    else
    {
      contentSpecification.setContents(new ContentToken[]{token});
View Full Code Here

      if (content instanceof CSSStringValue)
      {
        final CSSStringValue sval = (CSSStringValue) content;
        if (CSSStringType.STRING.equals(sval.getType()))
        {
          return new StaticTextToken(sval.getValue());
        }
        else
        {
          // this is an external URL, so try to load it.
          final CSSFunctionValue function = new CSSFunctionValue
              ("url", new CSSValue[]{sval});
          return evaluateFunction(function, process, element);
        }
      }

      if (content instanceof CSSConstant)
      {
        if (ContentValues.DOCUMENT_URL.equals(content))
        {
          final ResourceKey baseKey = process.getContextKey();
          final ResourceManager resourceManager = process.getResourceManager();
          final URL url = resourceManager.toURL(baseKey);
          if (url != null)
          {
            return new StaticTextToken(url.toExternalForm());
          }
          return null;
        }

        final ContentToken token = (ContentToken) tokenMapping.get(content);
View Full Code Here

    {
      final String strVal = (String) value;
      if ("length".equals(type))
      {
        final CSSNumericValue cssNumericValue = FunctionUtilities.parseNumberValue(strVal);
        return new StaticTextToken(cssNumericValue.getCSSText());
      }
      else if ("url".equals(type))
      {
        final CSSResourceValue cssResourceValue = FunctionUtilities.loadResource(layoutProcess, strVal);
        final Resource resource = cssResourceValue.getValue();
        return new ResourceContentToken(resource);
      }
      else if ("color".equals(type))
      {
        final CSSValue colorValue = ColorUtil.parseColor(strVal);
        if (colorValue == null)
        {
          throw new FunctionEvaluationException();
        }
        return new StaticTextToken(colorValue.getCSSText());
      }
      else
      {
        // auto-mode. We check for URLs, as this is required for images
        final CSSValue cssValue = FunctionUtilities.parseValue(layoutProcess, strVal);
        if (cssValue instanceof CSSResourceValue)
        {
          final CSSResourceValue cssResourceValue = (CSSResourceValue) cssValue;
          final Resource resource = cssResourceValue.getValue();
          return new ResourceContentToken(resource);
        }
        else if (cssValue instanceof CSSStringValue)
        {
          final CSSStringValue sval = (CSSStringValue) cssValue;
          return new StaticTextToken(sval.getValue());
        }
        else
        {
          return new StaticTextToken(cssValue.getCSSText());
        }
      }
    }
    else if (value instanceof URL)
    {
      final CSSResourceValue cssResourceValue = FunctionUtilities.loadResource(layoutProcess, value);
      final Resource resource = cssResourceValue.getValue();
      return new ResourceContentToken(resource);
    }
    else if (value instanceof Resource)
    {
      return new ResourceContentToken((Resource) value);
    }
    else if (value instanceof ResourceKey)
    {
      final CSSResourceValue cssResourceValue = FunctionUtilities.loadResource(layoutProcess, value);
      final Resource resource = cssResourceValue.getValue();
      return new ResourceContentToken(resource);
    }
    else if (value instanceof Date)
    {
      return new StaticTextToken(String.valueOf(value));
    }
    else if (value instanceof Number)
    {
      return new StaticTextToken(String.valueOf(value));
    }
    else
    {
      return new ExternalContentToken(value);
    }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.css.resolver.tokens.statics.StaticTextToken

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.