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

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


                       final StyleKey key)
  {
    final LayoutContext layoutContext = element.getLayoutContext();
    final ContentSpecification contentSpecification =
            layoutContext.getContentSpecification();
    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSConstant)
    {
      if (ContentValues.NONE.equals(value))
      {
        contentSpecification.setStrings(XAlternateTextResolveHandler.DEFAULT_CONTENT);
        return;
      }
    }

    contentSpecification.setStrings(XAlternateTextResolveHandler.DEFAULT_CONTENT);
    if (value instanceof CSSAttrFunction)
    {
      final ContentToken token =
              evaluateFunction((CSSFunctionValue) value, process, element);
      if (token == null)
      {
        return;
      }
      contentSpecification.setStrings(new ContentToken[]{token});
    }

    if (value instanceof CSSValueList == false)
    {
      return; // cant handle that one
    }

    final ArrayList tokens = new ArrayList();
    final CSSValueList list = (CSSValueList) value;
    final int size = list.getLength();
    for (int i = 0; i < size; i++)
    {
      final CSSValueList sequence = (CSSValueList) list.getItem(i);
      for (int j = 0; j < sequence.getLength(); j++)
      {
        final CSSValue content = sequence.getItem(j);
        final ContentToken token = createToken(process, element, content);
        if (token == null)
        {
          // ok, a failure. Skip to the next content spec ...
          tokens.clear();
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);
    final CSSConstant result;
    if (FontStretch.WIDER.equals(value))
    {
      // ask the parent ...
      final CSSConstant parentStretch = queryParent(currentNode.getParent());
View Full Code Here

   * @param unit
   * @return
   */
  public Map createValues(LexicalUnit unit)
  {
    final CSSValue width = widthReadHandler.parseWidth(unit);
    if (width != null)
    {
      unit = unit.getNextLexicalUnit();
    }

    final CSSConstant style;
    if (unit != null)
    {
      style = (CSSConstant) lookupValue(unit);
      if (style != null)
      {
        unit = unit.getNextLexicalUnit();
      }
    }
    else
    {
      style = null;
    }

    final CSSValue color;
    if (unit != null)
    {
      color = ColorReadHandler.createColorValue(unit);
    }
    else
View Full Code Here

  {
    final StyleValueFunction styleFunction =
            FunctionFactory.getInstance().getStyleFunction(function.getFunctionName());
    try
    {
      final CSSValue value = styleFunction.evaluate(process, element, function);
      if (value instanceof CSSResourceValue)
      {
        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());
      }
      return new StaticTextToken(value.getCSSText());
    }
    catch (FunctionEvaluationException e)
    {
      DebugLog.log ("Evaluation failed " + e);
      return null;
View Full Code Here

  {
    if (parent == null)
    {
      return FontStretch.NORMAL;
    }
    final CSSValue parentValue =
            parent.getLayoutContext().getValue(FontStyleKeys.FONT_STRETCH);
    if (parentValue == null)
    {
      return FontStretch.NORMAL;
    }
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 (value instanceof CSSConstant)
    {
      super.resolve(process, currentNode, key);
    }
    else if (value instanceof CSSStringValue)
View Full Code Here

   * @param unit
   * @return
   */
  public Map createValues(final LexicalUnit unit)
  {
    final CSSValue value = createValue(null, unit);
    if (value == null)
    {
      return null;
    }

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 (value instanceof CSSConstant == false)
    {
      // fine, we're done here ...
      return;
    }
    final CSSConstant constant = (CSSConstant) value;
    final LayoutElement parent = currentNode.getParent();
    if (parent != null)
    {
      final double parentFontSize =
              parent.getLayoutContext().getFontSpecification().getFontSize();
      if (RelativeFontSize.LARGER.equals(value))
      {
        final double scaleFactor = getScaleLargerFactor(parentFontSize);
        layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, scaleFactor));
        return;
      }

      if (RelativeFontSize.SMALLER.equals(value))
      {
        final double scaleFactor = getScaleSmallerFactor(parentFontSize);
        layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, scaleFactor));
        return;
      }
    }
    else
    {
      // we might not have a parent, but that won't stop us ..
      if (RelativeFontSize.LARGER.equals(value))
      {
        layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, 120));
        return ;
      }

      if (RelativeFontSize.SMALLER.equals(value))
      {
        layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, 85));
        return;
      }
    }

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

                       final LayoutElement currentNode,
                       final StyleKey key)
  {

    final LayoutContext layoutContext = currentNode.getLayoutContext();
    final CSSValue displayModel = layoutContext.getValue(BoxStyleKeys.DISPLAY_MODEL);
    if (DisplayRole.NONE.equals(displayModel))
    {
      // skip ... the element will not be displayed ...
      layoutContext.setValue(PositioningStyleKeys.POSITION, Position.STATIC);
      return;
    }

    final CSSValue rawValue = layoutContext.getValue(key);
    if (rawValue instanceof CSSFunctionValue)
    {
      // OK; check for pending ..
      final CSSFunctionValue function = (CSSFunctionValue) rawValue;
      if ("running".equals(function.getFunctionName()))
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);
    final int fontWeight;
    if (FontWeight.BOLD.equals(value))
    {
      // ask the parent ...
      fontWeight = 700;
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.