Examples of LayoutElement


Examples of org.jfree.layouting.layouter.model.LayoutElement

    final CSSNumericValue nval = (CSSNumericValue) value;
    if (CSSNumericType.NUMBER.equals(nval.getType()) == false)
    {
      return; // syntax error, do nothing
    }
    final LayoutElement parent = currentNode.getParent();
    if (parent == null)
    {
      return; // no parent to resolve against ...
    }
View Full Code Here

Examples of org.jfree.layouting.layouter.model.LayoutElement

                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    final CSSValue value = layoutContext.getValue(key);
    final LayoutElement parent = currentNode.getParent();
    final FontSpecification fontSpecification =
        currentNode.getLayoutContext().getFontSpecification();

    if (value instanceof CSSNumericValue == false)
    {
      if (parent == null)
      {
        fontSpecification.setFontSize(this.baseFontSize);
        layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, baseFontSize));
      }
      else
      {
        final LayoutContext parentContext = parent.getLayoutContext();
        final FontSpecification parentFont = parentContext.getFontSpecification();
        final double fontSize = parentFont.getFontSize();
        fontSpecification.setFontSize(fontSize);
        layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, fontSize));
      }
      return;
    }

    final CSSNumericValue nval = (CSSNumericValue) value;
    if (CSSValueResolverUtility.isAbsoluteValue(nval))
    {
      final CSSNumericValue fsize = CSSValueResolverUtility.convertLength
          (nval, currentNode.getLayoutContext(), process.getOutputMetaData());
      final double fontSize = fsize.getValue();
      fontSpecification.setFontSize(fontSize);
      layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, fontSize));
    }
    // we encountered one of the relative values.
    else if (CSSNumericType.EM.equals(nval.getType()))
    {
      final double parentSize;
      if (parent == null)
      {
        parentSize = this.baseFontSize;
      }
      else
      {
        final LayoutContext parentContext = parent.getLayoutContext();
        final FontSpecification parentFont = parentContext.getFontSpecification();
        parentSize = parentFont.getFontSize();
      }
      final double fontSize = parentSize * nval.getValue();
      fontSpecification.setFontSize(fontSize);
      layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, fontSize));
    }
    else if (CSSNumericType.EX.equals(nval.getType()))
    {
      final double parentSize;
      if (parent == null)
      {
        // if we have no parent, we create a fixed default value.
        parentSize = this.baseFontSize * LibFontsDefaults.DEFAULT_XHEIGHT_SIZE / LibFontsDefaults.DEFAULT_ASCENT_SIZE;
      }
      else
      {
        final LayoutContext parentContext = parent.getLayoutContext();
        final FontSpecification parentFont = parentContext.getFontSpecification();
        parentSize = parentFont.getFontSize();
      }
      final double fontSize = parentSize * nval.getValue();
      layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, fontSize));
      fontSpecification.setFontSize(fontSize);
    }
    else if (CSSNumericType.PERCENTAGE.equals(nval.getType()))
    {
      final double parentSize;
      if (parent == null)
      {
        // if we have no parent, we create a fixed default value.
        parentSize = this.baseFontSize;
      }
      else
      {
        final LayoutContext parentContext = parent.getLayoutContext();
        final FontSpecification parentFont = parentContext.getFontSpecification();
        parentSize = parentFont.getFontSize();
      }
      final double fontSize = parentSize * nval.getValue() / 100.0d;
      fontSpecification.setFontSize(fontSize);
View Full Code Here

Examples of org.jfree.layouting.layouter.model.LayoutElement

        (ContextId.SOURCE_NORMALIZER, NO_PARENT, nextId);
    nextId += 1;

    final LayoutContext layoutContext = new DefaultLayoutContext
        (ctxId, namespace, tag, pseudo, attributes);
    final LayoutElement element =
        new LayoutElement(currentElement, currentSilbling, layoutContext);
    currentElement = element;
    currentSilbling = null;

    styleResolver.resolveStyle(element);
    if (isStringRecordingNeeded(element))
View Full Code Here

Examples of org.jfree.layouting.layouter.model.LayoutElement

//            layoutContext.getTagName() + ":" +
//            layoutContext.getPseudoElement());

    // Stage 0: Initialize with the built-in defaults
    // Stage 1a: Add the parent styles (but only the one marked as inheritable).
    final LayoutElement parent = element.getParent();
    final LayoutStyle initialStyle = getInitialStyle();
    if (layoutContext.copyFrom(initialStyle) == false)
    {
      // ok, manual copy ..
      Log.debug ("Failed to use fast-copy");
      for (int i = 0; i < keys.length; i++)
      {
        final StyleKey key = keys[i];
        layoutContext.setValue(key, initialStyle.getValue(key));
      }
    }

    final LayoutStyle parentStyle;
    if (parent != null)
    {
      parentStyle = parent.getLayoutContext();
      final StyleKey[] inheritedKeys = getInheritedKeys();
      for (int i = 0; i < inheritedKeys.length; i++)
      {
        final StyleKey key = inheritedKeys[i];
        layoutContext.setValue(key, parentStyle.getValue(key));
View Full Code Here

Examples of org.jfree.layouting.layouter.model.LayoutElement

        final DescendantSelector ds = (DescendantSelector) selector;
        if (isMatch(node, ds.getSimpleSelector()) == false)
        {
          return false;
        }
        final LayoutElement parent = node.getParent();
        return (isMatch(parent, ds.getAncestorSelector()));
      }
      case Selector.SAC_DESCENDANT_SELECTOR:
      {
        final DescendantSelector ds = (DescendantSelector) selector;
View Full Code Here

Examples of org.jfree.layouting.layouter.model.LayoutElement

  }

  private boolean isDescendantMatch(final LayoutElement node,
                                    final Selector selector)
  {
    LayoutElement parent = node.getParent();
    while (parent != null)
    {
      if (isMatch(parent, selector))
      {
        return true;
      }
      parent = parent.getParent();
    }
    return false;
  }
View Full Code Here

Examples of org.jfree.layouting.layouter.model.LayoutElement

  }

  private boolean isSilblingMatch(final LayoutElement node,
                                  final SiblingSelector select)
  {
    LayoutElement pred = node.getPrevious();
    while (pred != null)
    {
      if (isMatch(pred, select))
      {
        return true;
      }
      pred = pred.getPrevious();
    }
    return false;
  }
View Full Code Here

Examples of org.jfree.layouting.layouter.model.LayoutElement

  }

  public LayoutContext createAnonymousContext(final ContextId id,
                                              final LayoutContext parent)
  {
    final LayoutElement parentElement = new LayoutElement(null, null, parent);
    final DefaultLayoutContext anonymousContext = new DefaultLayoutContext
            (id, Namespaces.LIBLAYOUT_NAMESPACE,
                    "anonymous-context", null, new AttributeMap());
    final LayoutElement anonymousElement = new LayoutElement
            (parentElement, null, anonymousContext);
    resolveOutOfContext(anonymousElement);
    return anonymousContext;
  }
View Full Code Here

Examples of org.jfree.layouting.layouter.model.LayoutElement

  }

  private void handleNone (final LayoutElement currentNode)
  {
    final double fontSize;
    final LayoutElement parent = currentNode.getParent();
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    if (parent == null)
    {
      // fall back to normal;
      fontSize = layoutContext.getFontSpecification().getFontSize();
    }
    else
    {
      fontSize = parent.getLayoutContext().getFontSpecification().getFontSize();
    }
    layoutContext.setValue(LineStyleKeys.LINE_HEIGHT, CSSNumericValue.createValue(CSSNumericType.PT, fontSize));
  }
View Full Code Here

Examples of org.jfree.layouting.layouter.model.LayoutElement

    final CSSNumericValue nval = (CSSNumericValue) value;
    if (CSSNumericType.NUMBER.equals(nval.getType()) == false)
    {
      return; // syntax error, do nothing
    }
    final LayoutElement parent = currentNode.getParent();
    if (parent == null)
    {
      return; // no parent to resolve against ...
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.