Examples of LayoutStyle


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

  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.LayoutStyle

    return new StyleKey[]{ColorStyleKeys.COLOR};
  }

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

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

//    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))
        {
          final CSSValue parentValue = parentStyle.getValue(key);
          if (parentValue == null)
          {
            style.setValue(key, initialStyle.getValue(key));
          }
          else
View Full Code Here

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

  protected CSSValue resolveValue (final DocumentContext process,
                                   final LayoutElement currentNode,
                                   final StyleKey key)
  {
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSConstant == false)
    {
      final CSSValue fallback = getFallback();
      if (fallback != null)
      {
View Full Code Here

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

  public void resolve (final DocumentContext process,
                       final LayoutElement currentNode,
                       final StyleKey key)
  {

    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    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()))
      {
        // The element will be inside a block-context (same behaviour as
        // for floats)
        layoutContext.setValue(BoxStyleKeys.DISPLAY_MODEL, DisplayModel.BLOCK_INSIDE);
        layoutContext.setValue(BoxStyleKeys.DISPLAY_ROLE, DisplayRole.BLOCK);
        return;
      }
      layoutContext.setValue(PositioningStyleKeys.POSITION, Position.STATIC);
      return;
    }

    final CSSConstant value = (CSSConstant) resolveValue(process, currentNode, key);
    layoutContext.setValue(PositioningStyleKeys.POSITION, value);
    if (Position.ABSOLUTE.equals(value) ||
        Position.FIXED.equals(value))
    {
      // http://www.w3.org/TR/REC-CSS2/visuren.html#propdef-float
      // this is specified in 9.7: Relationships between 'display',
      // 'position', and 'float':

      // Quote: Otherwise, 'position' has the value 'absolute' or 'fixed',
      // 'display' is set to 'block' and 'float' is set to 'none'. The position
      // of the box will be determined by the 'top', 'right', 'bottom' and
      // 'left' properties and the box's containing block.
      layoutContext.setValue(BoxStyleKeys.DISPLAY_MODEL, DisplayModel.BLOCK_INSIDE);
      layoutContext.setValue(BoxStyleKeys.DISPLAY_ROLE, DisplayRole.BLOCK);
      layoutContext.setValue(BoxStyleKeys.FLOAT, Floating.NONE);
    }
  }
View Full Code Here

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

   */
  public void resolve(final DocumentContext process,
                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSNumericValue == false)
    {
      return;
    }

    final LayoutOutputMetaData metaData = process.getOutputMetaData();
    final int resolution = (int) metaData.getNumericFeatureValue(OutputProcessorFeature.DEVICE_RESOLUTION);
    final double fontSize = StyleSheetUtility.convertLengthToDouble(value, resolution);
    final double length = StyleSheetUtility.convertFontSizeToDouble(value, resolution, currentNode);

    if (fontSize < length)
    {
      layoutContext.setValue(FontStyleKeys.FONT_SMOOTH, FontSmooth.NEVER);
    }
    else
    {
      layoutContext.setValue(FontStyleKeys.FONT_SMOOTH, FontSmooth.ALWAYS);
    }
  }
View Full Code Here

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

  public void resolve(final DocumentContext process,
                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    //Log.debug ("Processing: " + currentNode);
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    final LayoutOutputMetaData outputMetaData = process.getOutputMetaData();
    final CSSValue cssValue = layoutContext.getValue(key);
    if (cssValue instanceof CSSValueList)
    {

      final CSSValueList list = (CSSValueList) cssValue;
      for (int i = 0; i < list.getLength(); i++)
      {
        final CSSValue item = list.getItem(i);
        if (item instanceof CSSConstant)
        {
          final CSSConstant c = (CSSConstant) lookupValue((CSSConstant) item);
          final CSSValue family = outputMetaData.getNormalizedFontFamilyName(c);
          if (family != null)
          {
            layoutContext.setValue(key, family);
            return;
          }
          // Ignore, although this is not ok.
          DebugLog.log("Invalid state after setting predefined font family.");
        }
        else if (item instanceof CSSStringValue)
        {
          final CSSStringValue sval = (CSSStringValue) item;
          final CSSValue value = process.getOutputMetaData().getNormalizedFontFamilyName(sval);
          if (value != null)
          {
            layoutContext.setValue(key, value);
            return;
          }
        }
      }
    }
    else if (cssValue instanceof CSSConstant)
    {
      if (FontFamilyValues.NONE.equals(cssValue))
      {
        // that means: No text at all.
        return;
      }
    }


    layoutContext.setValue(key, outputMetaData.getDefaultFontFamily());
  }
View Full Code Here

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

   */
  public void resolve(final DocumentContext process,
                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    final CSSValue value = layoutContext.getValue(PageStyleKeys.SIZE);

    String name = null;
    if (value instanceof CSSStringValue)
    {
      final CSSStringValue sval = (CSSStringValue) value;
      name = sval.getValue();
    }
    else if (value instanceof CSSConstant)
    {
      name = value.toString();
    }

    PageSize ps = null;
    if (name != null)
    {
      ps = PageSizeFactory.getInstance().getPageSizeByName(name);
    }

    if (ps == null)
    {
      ps = process.getOutputMetaData().getDefaultPageSize();
    }
    // if it is stll null, then the output target is not valid.
    // We will crash in that case ..
    final CSSValue page =
        new CSSValuePair(CSSNumericValue.createPtValue(ps.getWidth()),
            CSSNumericValue.createPtValue(ps.getHeight()));
    layoutContext.setValue(PageStyleKeys.SIZE, page);
  }
View Full Code Here

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

   */
  public void resolve(final DocumentContext process,
                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSConstant)
    {
      super.resolve(process, currentNode, key);
    }
    else if (value instanceof CSSStringValue)
    {
      // do nothing, accept it as is...
    }
    else
    {
      layoutContext.setValue(key, getFallback());
    }
  }
View Full Code Here

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

   */
  public void resolve(final DocumentContext process,
                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSNumericValue == false)
    {
      // no limit ..
      return;
    }

    final int resolution = (int)
        process.getOutputMetaData().getNumericFeatureValue(OutputProcessorFeature.DEVICE_RESOLUTION);
    layoutContext.setValue(key, StyleSheetUtility.convertFontSize(value, resolution, currentNode));
  }
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.