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

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


    if (unit.getLexicalUnitType() != LexicalUnit.SAC_IDENT)
    {
      return null;
    }

    CSSValue direction;
    CSSValue blockProgression;
    final String strValue = unit.getStringValue();
    // lr-tb | rl-tb | tb-rl | tb-lr
    if (strValue.equalsIgnoreCase("lr-tb"))
    {
      direction = Direction.LTR;
View Full Code Here


      for (int i = 0; i < entries.length; i++)
      {
        Map.Entry entry = entries[i];
        CSSValueReadHandler valueReadHandler = (CSSValueReadHandler) entry.getValue();
        StyleKey key = (StyleKey) entry.getKey();
        CSSValue value = valueReadHandler.createValue(key, unit);
        if (value != null)
        {
          map.put(key, value);
          break;
        }
View Full Code Here

  {
    final ArrayList list = new ArrayList();
    int count = 0;
    while (value != null && count < maxCount)
    {
      final CSSValue pvalue = parseValue(value);
      if (pvalue == null)
      {
        return null;
      }
      if (distinctValues == false ||
View Full Code Here

  {
    ArrayList values = new ArrayList();

    while (value != null)
    {
      final CSSValue firstPosition = parseFirstPosition(value);
      if (firstPosition == null)
      {
        return null;
      }

      value = value.getNextLexicalUnit();
      final CSSValue secondPosition = parseSecondPosition(value, firstPosition);
      if (secondPosition == null)
      {
        return null;
      }
View Full Code Here

    addValue(Position.STATIC);
  }

  public CSSValue createValue(StyleKey name, LexicalUnit value)
  {
    final CSSValue result = super.createValue(name, value);
    if (result != null)
    {
      return result;
    }
View Full Code Here

    // We have a holder and we were given the right type of style info ... copy the new over the old
    // NOTE: don't copy empty (null) information over
    final int length = rawstyle.values.length;
    for (int i = 0; i < length; i++)
    {
      final CSSValue o = rawstyle.values[i];
      if (o != null)
      {
        values[i] = o;
      }
    }
View Full Code Here

    if (family == null)
    {
      AbstractOutputMetaData.logger.warn("Unable to lookup the font family: " + fontFamily);

      // Get the default font name
      final CSSValue fallBack = getDefaultFontFamily();
      if (fallBack == null)
      {
        // If this case happens, the output-processor meta-data does not provide a sensible
        // fall-back value. As we cannot continue without a font, we fail here instead of
        // waiting for a NullPointer or other weird error later.
        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());
      }
      if (family == null)
      {
        // If this case happens, the output-processor meta-data does not provide a sensible
        // fall-back value. As we cannot continue without a font, we fail here instead of
View Full Code Here

   * @throws IllegalArgumentException indicated the font metrics could not be determined (this is thrown since methods
   *                                  depending upon this method can not handle a <code>null</code> return).
   */
  public FontMetrics getFontMetrics(final LayoutStyle styleSheet) throws IllegalArgumentException
  {
    final CSSValue fontFamily = getNormalizedFontFamilyName(styleSheet.getValue(FontStyleKeys.FONT_FAMILY));
    if (fontFamily == null)
    {
      // If this case happens, the stylesheet is not implemented correctly. At that point,
      // we have to assume that the whole engine is no longer behaving valid and therefore we
      // abort early.
      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();
    }

    final CSSValue value = styleSheet.getValue(FontStyleKeys.FONT_SIZE);
    final int resolution = (int) getNumericFeatureValue(OutputProcessorFeature.DEVICE_RESOLUTION);
    final double fontSize = StyleSheetUtility.convertLengthToDouble(value, resolution);
    final boolean antiAliasing = FontSmooth.ALWAYS.equals(styleSheet.getValue(FontStyleKeys.FONT_SMOOTH));

    final CSSValue boldVal = styleSheet.getValue(FontStyleKeys.FONT_WEIGHT);
    final CSSValue italicsVal = styleSheet.getValue(FontStyleKeys.FONT_STYLE);
    return getFontMetrics(fontName, fontSize, computeBold(boldVal), computeItalics(italicsVal), "UTF-8", false, antiAliasing);
  }
View Full Code Here

   * @param name
   * @return
   */
  public CSSValue getNormalizedFontFamilyName(final CSSValue name)
  {
    final CSSValue retval = (CSSValue) fontFamilyMapping.get(name);
    if (retval != null)
    {
      return retval;
    }
    if (name != null)
View Full Code Here

    return getDefaultFontFamily();
  }

  public CSSValue getDefaultFontFamily()
  {
    final CSSValue retval = (CSSValue) fontFamilyMapping.get(null);
    if (retval == null)
    {
      throw new IllegalStateException();
    }
    return retval;
View Full Code Here

TOP

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

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.