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.pentaho.reporting.libraries.css.dom.LayoutElement

  private void handleNone (final DocumentContext process,
                           final LayoutElement currentNode)
  {
    final double fontSize;
    final LayoutElement parent = currentNode.getParentLayoutElement();
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    if (parent == null)
    {
      // fall back to normal;
      final CSSValue value = layoutContext.getValue(FontStyleKeys.FONT_SIZE);
      final LayoutOutputMetaData metaData = process.getOutputMetaData();
      final int resolution = (int) metaData.getNumericFeatureValue(OutputProcessorFeature.DEVICE_RESOLUTION);
      fontSize = StyleSheetUtility.convertLengthToDouble(value, resolution);
    }
    else
    {
      final CSSValue value = parent.getLayoutStyle().getValue(FontStyleKeys.FONT_SIZE);
      final LayoutOutputMetaData metaData = process.getOutputMetaData();
      final int resolution = (int) metaData.getNumericFeatureValue(OutputProcessorFeature.DEVICE_RESOLUTION);
      fontSize = StyleSheetUtility.convertLengthToDouble(value, resolution);
    }
    layoutContext.setValue(LineStyleKeys.LINE_HEIGHT, CSSNumericValue.createValue(CSSNumericType.PT, fontSize));
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.dom.LayoutElement

    }
  }

  protected CSSColorValue getCurrentColor (final LayoutElement currentNode)
  {
    final LayoutElement parent = currentNode.getParentLayoutElement();
    if (parent != null)
    {
      final LayoutStyle layoutContext = parent.getLayoutStyle();
      final CSSValue value = layoutContext.getValue(ColorStyleKeys.COLOR);
      if (value instanceof CSSColorValue)
      {
        return (CSSColorValue) value;
      }
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.dom.LayoutElement

//    Log.debug ("Resolving style for " +
//            layoutContext.getTagName() + ":" +
//            layoutContext.getPseudoElement());

    final LayoutElement parent = element.getParentLayoutElement();
    final LayoutStyle initialStyle = getInitialStyle();
    final LayoutStyle style = element.getLayoutStyle();

    // Stage 0: Initialize with the built-in defaults
    // The copy will return false if it couldn't do the copy automatically
    if (style.copyFrom(initialStyle) == false)
    {
      // manually copy all styles from the initial style-set..
      for (int i = 0; i < keys.length; i++)
      {
        final StyleKey key = keys[i];
        style.setValue(key, initialStyle.getValue(key));
      }
    }

    // Stage 1a: Add the parent styles (but only the one marked as inheritable).

    // If our element has a parent, get the parent's style information
    // so we can "inherit" the styles that support that kind of thing
    if (parent != null)
    {
      final LayoutStyle parentStyle;
      parentStyle = parent.getLayoutStyle();
      final StyleKey[] inheritedKeys = getInheritedKeys();
      for (int i = 0; i < inheritedKeys.length; i++)
      {
        final StyleKey key = inheritedKeys[i];
        style.setValue(key, parentStyle.getValue(key));
      }
    }

    // At this point, the parentStyle contains the "foundation" from which
    // the current element's style information will come....

    // Stage 1b: Find all matching stylesheet styles for the given element.
    performSelectionStep(element, style);

    // Stage 1c: Add the contents of the style attribute, if there is one ..
    // the libLayout style is always added: This is a computed style and the hook
    // for a element neutral user defined tweaking ..

    final Object libLayoutStyleValue = element.getAttribute(Namespaces.LIBLAYOUT_NAMESPACE, "style");
    // You cannot override element specific styles with that. So an HTML-style
    // attribute has more value than a LibLayout-style attribute.
    addStyleFromAttribute(element, libLayoutStyleValue);

    if (strictStyleMode)
    {
      performStrictStyleAttr(element);
    }
    else
    {
      performCompleteStyleAttr(element);
    }

    // Stage 2: Compute the 'specified' set of values.
    // Find all explicitly inherited styles and add them from the parent.
    final CSSInheritValue inheritInstance = CSSInheritValue.getInstance();
    if (parent == null)
    {
      for (int i = 0; i < keys.length; i++)
      {
        final StyleKey key = keys[i];
        final Object value = style.getValue(key);
        if (inheritInstance.equals(value))
        {
          style.setValue(key, initialStyle.getValue(key));
        }
      }
    }
    else
    {
      final LayoutStyle parentStyle = parent.getLayoutStyle();
      for (int i = 0; i < keys.length; i++)
      {
        final StyleKey key = keys[i];
        final Object value = style.getValue(key);
        if (inheritInstance.equals(value))
View Full Code Here

Examples of org.pentaho.reporting.libraries.css.dom.LayoutElement

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

Examples of org.pentaho.reporting.libraries.css.dom.LayoutElement

  }

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

Examples of org.pentaho.reporting.libraries.css.dom.LayoutElement

  }

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

Examples of org.pentaho.reporting.libraries.css.dom.LayoutElement

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

Examples of org.pentaho.reporting.libraries.css.dom.LayoutElement

                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    final CSSValue value = layoutContext.getValue(key);
    final LayoutElement parent = currentNode.getParentLayoutElement();

    if (value instanceof CSSNumericValue == false)
    {
      if (parent == null)
      {
        layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, baseFontSize));
      }
      else
      {
        final LayoutStyle parentContext = parent.getLayoutStyle();
        layoutContext.setValue(key, parentContext.getValue(key));
      }
      return;
    }
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.