Package org.jfree.layouting.input.style.values

Examples of org.jfree.layouting.input.style.values.CSSValue


  public void resolve(final LayoutProcess process,
                         final LayoutElement currentNode,
                         final StyleKey key)
  {
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSConstant == false)
    {
      // fine, we're done here ...
      return ;
    }
    final CSSConstant constant = (CSSConstant) value;
    final double parentFontSize =
            currentNode.getLayoutContext().getFontSpecification().getFontSize();
    if (RelativeFontSize.LARGER.equals(value))
    {
      final double scaleFactor = getScaleLargerFactor(parentFontSize);
      layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, scaleFactor));
    }
    else if (RelativeFontSize.SMALLER.equals(value))
    {
      final double scaleFactor = getScaleSmallerFactor(parentFontSize);
      layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, scaleFactor));
    }

    final CSSValue resolvedValue = lookupValue(constant);
    if (resolvedValue != null)
    {
      layoutContext.setValue(key, resolvedValue);
      return;
    }
View Full Code Here


    addValue(LineGridProgression.TEXT_HEIGHT);
  }

  protected CSSValue lookupValue(final LexicalUnit value)
  {
    final CSSValue length = CSSValueFactory.createLengthValue(value);
    if (length != null)
    {
      return length;
    }
    return super.lookupValue(value);
View Full Code Here

      map.put(TextStyleKeys.TEXT_OVERFLOW_ELLIPSIS, CSSInheritValue.getInstance());
      return map;
    }


    final CSSValue mode = modeReadHandler.createValue(null, unit);
    if (mode != null)
    {
      unit = unit.getNextLexicalUnit();
    }
    final CSSValue ellipsis;
    if (unit != null)
    {
      ellipsis = ellipsisReadHandler.createValue(null, unit);
    }
    else
View Full Code Here

  }

  public void appyStyle(final LayoutContext context, final OutputProcessorMetaData metaData)
  {
    super.appyStyle(context, metaData);
    final CSSValue alignVal = context.getValue(TextStyleKeys.TEXT_ALIGN);
    final CSSValue alignLastVal = context.getValue(TextStyleKeys.TEXT_ALIGN_LAST);
    this.textAlignment = createAlignment(alignVal);
    if (textAlignment == TextAlign.JUSTIFY)
    {
      this.lastLineAlignment = createAlignment(alignLastVal);
    }
View Full Code Here

  }

  protected CSSColorValue getCurrentColor(final LayoutElement currentNode)
  {
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    final CSSValue value = layoutContext.getValue(ColorStyleKeys.COLOR);
    if (value instanceof CSSColorValue)
    {
      return (CSSColorValue) value;
    }
    else
View Full Code Here

  public void resolve(final LayoutProcess process,
                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    final CSSValue value = layoutContext.getValue(key);
    if (FontVariant.SMALL_CAPS.equals(value))
    {
      layoutContext.setValue(key, FontVariant.SMALL_CAPS);
    }
    else
View Full Code Here

  public void resolve (final LayoutProcess process,
                       final LayoutElement element,
                       final StyleKey key)
  {
    final LayoutContext layoutContext = element.getLayoutContext();
    final CSSValue displayRole = layoutContext.getValue(BoxStyleKeys.DISPLAY_ROLE);
    if (DisplayRole.NONE.equals(displayRole))
    {
      // [GENERATED] 8.3. Counters in elements with 'display: none'
      //
      // An element that is not displayed ('display' set to 'none') cannot
      // increment or reset a counter.
      return;
    }

    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSValueList == false)
    {
      return; // do nothing.
    }

    final CSSValueList valueList = (CSSValueList) value;
    for (int i = 0; i < valueList.getLength(); i++)
    {
      final CSSValue item = valueList.getItem(i);
      if (item instanceof CSSValuePair == false)
      {
        continue;
      }
      final CSSValuePair counter = (CSSValuePair) item;
      final CSSValue counterName = counter.getFirstValue();
      if (counterName instanceof CSSConstant == false)
      {
        continue;
      }

      final CSSValue counterValue = counter.getSecondValue();
      final int counterIntValue = parseCounterValue(counterValue, element);
      element.resetCounter(counterName.getCSSText(), counterIntValue);
    }
  }
View Full Code Here

  {
    final ArrayList values = new ArrayList();

    while (value != null)
    {
      final CSSValue firstValue;
      if (value.getLexicalUnitType() == LexicalUnit.SAC_IDENT)
      {
        if ("round".equalsIgnoreCase(value.getStringValue()))
        {
          values.add(createList(CSSAutoValue.getInstance(),
                  CSSAutoValue.getInstance(),
                  BackgroundSize.ROUND));

          value = CSSValueFactory.parseComma(value);
          continue;
        }

        if ("auto".equalsIgnoreCase(value.getStringValue()))
        {
          firstValue = CSSAutoValue.getInstance();
        }
        else
        {
          return null;
        }
      }
      else if (value.getLexicalUnitType() == LexicalUnit.SAC_PERCENTAGE)
      {
        firstValue = CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, value.getFloatValue());
      }
      else
      {
        firstValue = CSSValueFactory.createLengthValue(value);
        if (firstValue == null)
        {
          return null;
        }
      }

      value = value.getNextLexicalUnit();
      if (value == null)
      {
        values.add(createList(firstValue,
                  CSSAutoValue.getInstance(),
                  BackgroundSize.ROUND));
        continue;
      }

      final CSSValue secondValue;
      if (value.getLexicalUnitType() == LexicalUnit.SAC_IDENT)
      {
        if ("round".equalsIgnoreCase(value.getStringValue()))
        {
          values.add(createList(firstValue,
View Full Code Here

  public void resolve(final LayoutProcess process,
                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    final CSSValue value = layoutContext.getValue(key);
    if (FontSmooth.ALWAYS.equals(value))
    {
      layoutContext.setValue(FontStyleKeys.X_FONT_SMOOTH_FLAG, FontSmooth.ALWAYS);
    }
    else if (FontSmooth.NEVER.equals(value))
View Full Code Here

  public Map createValues(final LexicalUnit unit)
  {
    // http://cheeaun.phoenity.com/weblog/2005/06/whitespace-and-generated-content.html
    // is a good overview about the whitespace stuff ..

    final CSSValue whitespace;
    final CSSValue textWrap;
    if (unit.getLexicalUnitType() == LexicalUnit.SAC_INHERIT)
    {
      whitespace = CSSInheritValue.getInstance();
      textWrap = CSSInheritValue.getInstance();
    }
View Full Code Here

TOP

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