Package org.pentaho.reporting.libraries.css.dom

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


    }
  }

  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

//    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

        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

  }

  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

  }

  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

    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

                      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

    final LayoutOutputMetaData metaData = process.getOutputMetaData();
    final int resolution = (int) metaData.getNumericFeatureValue(OutputProcessorFeature.DEVICE_RESOLUTION);

    final CSSConstant constant = (CSSConstant) value;
    final LayoutElement parent = currentNode.getParentLayoutElement();
    if (parent != null)
    {
      final CSSValue parentFontSizeValue = parent.getLayoutStyle().getValue(FontStyleKeys.FONT_SIZE);

      final double parentFontSize = StyleSheetUtility.convertLengthToDouble(parentFontSizeValue, resolution);
      if (RelativeFontSize.LARGER.equals(value))
      {
        final double scaleFactor = getScaleLargerFactor(parentFontSize);
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.css.dom.LayoutElement

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.