Package org.pentaho.reporting.libraries.css.values

Examples of org.pentaho.reporting.libraries.css.values.CSSStringValue


  public CSSValue createValue(StyleKey name, LexicalUnit value)
  {
    if (value.getLexicalUnitType() == LexicalUnit.SAC_STRING_VALUE ||
        value.getLexicalUnitType() == LexicalUnit.SAC_IDENT)
    {
      return new CSSStringValue(CSSStringType.STRING, value.getStringValue());
    }
    return null;
  }
View Full Code Here


    else
    {
      setNumericFeatureValue(OutputProcessorFeature.DEVICE_RESOLUTION, 72);
    }

    setFamilyMapping(FontFamilyValues.SANS_SERIF, new CSSStringValue(CSSStringType.STRING, "SansSerif"));
    setFamilyMapping(FontFamilyValues.SERIF, new CSSStringValue(CSSStringType.STRING, "Serif"));
    setFamilyMapping(FontFamilyValues.NONE, FontFamilyValues.NONE);
    setFamilyMapping(FontFamilyValues.MONOSPACE, new CSSStringValue(CSSStringType.STRING, "Monospaced"));
    setFamilyMapping(FontFamilyValues.FANTASY, new CSSStringValue(CSSStringType.STRING, "Serif"));
    setFamilyMapping(FontFamilyValues.CURSIVE, new CSSStringValue(CSSStringType.STRING, "SansSerif"));
    setFamilyMapping(null, new CSSStringValue(CSSStringType.STRING, "SansSerif"));
  }
View Full Code Here

        throw new IllegalArgumentException("No default family defined, aborting.");
      }

      if (fallBack instanceof CSSStringValue)
      {
        final CSSStringValue svalue = (CSSStringValue) fallBack;
        family = registry.getFontFamily(svalue.getValue());
      }
      else
      {
        family = registry.getFontFamily(fallBack.getCSSText());
      }
View Full Code Here

      throw new IllegalArgumentException("No valid font family specified.");
    }
    final String fontName;
    if (fontFamily instanceof CSSStringValue)
    {
      final CSSStringValue svalue = (CSSStringValue) fontFamily;
      fontName = svalue.getValue();
    }
    else
    {
      fontName = fontFamily.getCSSText();
    }
View Full Code Here

      {
        contentList.add(new CSSConstant(parameters.getStringValue()));
      }
      else if (parameters.getLexicalUnitType() == LexicalUnit.SAC_STRING_VALUE)
      {
        contentList.add(new CSSStringValue(CSSStringType.STRING,
            parameters.getStringValue()));
      }
      else if (CSSValueFactory.isNumericValue(parameters))
      {
        final CSSNumericValue numericValue =
            CSSValueFactory.createNumericValue(parameters);
        if (numericValue == null)
        {
          return null;
        }
        contentList.add(numericValue);
      }
      else if (CSSValueFactory.isLengthValue(parameters))
      {
        final CSSNumericValue lengthValue =
            CSSValueFactory.createLengthValue(parameters);
        if (lengthValue == null)
        {
          return null;
        }
        contentList.add(lengthValue);
      }
      else if (parameters.getLexicalUnitType() == LexicalUnit.SAC_ATTR)
      {
        final CSSAttrFunction attrFn =
            CSSValueFactory.parseAttrFunction(parameters);
        if (attrFn == null)
        {
          return null;
        }
        contentList.add(attrFn);
      }
      else if (parameters.getLexicalUnitType() == LexicalUnit.SAC_URI)
      {
        final CSSStringValue uriValue = CSSValueFactory.createUriValue(
            parameters);
        if (uriValue == null)
        {
          return null;
        }
View Full Code Here

    {
      return null;
    }

    final String uri = value.getStringValue();
    return new CSSStringValue(CSSStringType.URI, uri);
  }
View Full Code Here

                                    final LayoutElement element,
                                    final CSSValue content)
  {
    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
View Full Code Here

        final CSSResourceValue refValue = (CSSResourceValue) value;
        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());
View Full Code Here

                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    final CSSValue value = layoutContext.getValue(key);
    CSSStringValue lineEllipsis = null;
    CSSStringValue blockEllipsis = null;
    if (value instanceof CSSValueList)
    {
      final CSSValueList vlist = (CSSValueList) value;
      if (vlist.getLength() == 2)
      {
        lineEllipsis = filterString(vlist.getItem(0));
        blockEllipsis = filterString(vlist.getItem(1));
      }
      else if (vlist.getLength() == 1)
      {
        lineEllipsis = filterString(vlist.getItem(0));
        blockEllipsis = filterString(vlist.getItem(0));
      }
    }
    if (lineEllipsis == null)
    {
      lineEllipsis = new CSSStringValue(CSSStringType.STRING, "..");
    }
    if (blockEllipsis == null)
    {
      blockEllipsis = new CSSStringValue(CSSStringType.STRING, "..");
    }

    layoutContext.setValue(TextStyleKeys.X_BLOCK_TEXT_OVERFLOW_ELLIPSIS, blockEllipsis);
    layoutContext.setValue(TextStyleKeys.X_LINE_TEXT_OVERFLOW_ELLIPSIS, lineEllipsis);
  }
View Full Code Here

    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());
    final Resource resource = cssResourceValue.getValue();
    return new ResourceContentToken(resource);
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.css.values.CSSStringValue

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.