Examples of LayoutStyle


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

   */
  public void resolve (final DocumentContext process,
                       final LayoutElement element,
                       final StyleKey key)
  {
    final LayoutStyle layoutContext = element.getLayoutStyle();
    final ContentSpecification contentSpecification =
        (ContentSpecification) layoutContext.getValue(InternalStyleKeys.INTERNAL_CONTENT);
    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSConstant)
    {
      if (ContentValues.NONE.equals(value))
      {
        contentSpecification.setStrings(DEFAULT_CONTENT);
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 CSSNumericValue nval = (CSSNumericValue) value;
    if (CSSNumericType.PERCENTAGE.equals(nval.getType()) == false)
    {
      return;
    }
    double percentage = nval.getValue();
    if (percentage < 0)
    {
      percentage = 0;
    }
    if (percentage > 100)
    {
      percentage = 100;
    }
    layoutContext.setValue(TextStyleKeys.TEXT_KASHIDA_SPACE,
            CSSNumericValue.createValue(CSSNumericType.PERCENTAGE, percentage));
  }
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 (LineHeight.NONE.equals(value))
    {
      // query the anchestor, if there's one ..
      handleNone(process, currentNode);
      return;
    }

    if (LineHeight.NORMAL.equals(value))
    {
      handleNormal(process, currentNode);
      return;
    }

    if (value instanceof CSSNumericValue == false)
    {
      // fall back to normal ..
      handleNormal(process, currentNode);
      return;
    }

    final CSSNumericValue nval = (CSSNumericValue) value;
    if (isLengthValue(nval))
    {
      layoutContext.setValue(LineStyleKeys.LINE_HEIGHT, nval);
      return;
    }

    final double factor;
    if (nval.getType().equals(CSSNumericType.PERCENTAGE))
    {
      factor = nval.getValue() / 100d;
    }
    else if (nval.getType().equals(CSSNumericType.NUMBER))
    {
      factor = nval.getValue();
    }
    else
    {
      handleNormal(process, currentNode);
      return;
    }


    final LayoutOutputMetaData metaData = process.getOutputMetaData();
    final int resolution = (int) metaData.getNumericFeatureValue(OutputProcessorFeature.DEVICE_RESOLUTION);
    final double fontSize = StyleSheetUtility.convertLengthToDouble(value, resolution);
    layoutContext.setValue(LineStyleKeys.LINE_HEIGHT,
            CSSNumericValue.createValue(CSSNumericType.PT, fontSize * factor));

  }
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 boolean rightToLeft = Direction.RTL.equals
        (layoutContext.getValue(TextStyleKeys.DIRECTION));
    final CSSValue blockProgression = layoutContext.getValue(TextStyleKeys.BLOCK_PROGRESSION);
    // this might be invalid ...
    if (BlockProgression.TB.equals(blockProgression))
    {
      if (rightToLeft)
      {
        layoutContext.setValue(key, new CSSValuePair(RIGHT_BOTTOM, LEFT_TOP));
      }
      else
      {
        layoutContext.setValue(key, new CSSValuePair(LEFT_TOP, LEFT_TOP));
      }
    }
    else if (BlockProgression.RL.equals(blockProgression))
    {
      if (rightToLeft)
      {
        layoutContext.setValue(key, new CSSValuePair(LEFT_TOP, LEFT_TOP));
      }
      else
      {
        layoutContext.setValue(key, new CSSValuePair(RIGHT_BOTTOM, LEFT_TOP));
      }
    }
    else if (BlockProgression.LR.equals(blockProgression))
    {
      if (rightToLeft)
      {
        layoutContext.setValue(key, new CSSValuePair(RIGHT_BOTTOM, RIGHT_BOTTOM));
      }
      else
      {
        layoutContext.setValue(key, new CSSValuePair(LEFT_TOP, LEFT_TOP));
      }
    }
  }
View Full Code Here

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

  }

  private void handleNormal (final DocumentContext process,
                             final LayoutElement currentNode)
  {
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    final CSSValue value = layoutContext.getValue(FontStyleKeys.FONT_SIZE);
    final LayoutOutputMetaData metaData = process.getOutputMetaData();
    final int resolution = (int) metaData.getNumericFeatureValue(OutputProcessorFeature.DEVICE_RESOLUTION);
    final double fontSize = StyleSheetUtility.convertLengthToDouble(value, resolution);
    if (fontSize < 10)
    {
      layoutContext.setValue(LineStyleKeys.LINE_HEIGHT,
              CSSNumericValue.createValue(CSSNumericType.PT, fontSize * 1.2));
    }
    else if (fontSize < 24)
    {
      layoutContext.setValue(LineStyleKeys.LINE_HEIGHT,
              CSSNumericValue.createValue(CSSNumericType.PT, fontSize * 1.1));
    }
    else
    {
      layoutContext.setValue(LineStyleKeys.LINE_HEIGHT,
              CSSNumericValue.createValue(CSSNumericType.PT, fontSize * 1.05));
    }

  }
View Full Code Here

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

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

                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    // as this is an 'auto' handler, we can assume that 'auto' is the
    // current value
    final LayoutStyle layoutContext = currentNode.getLayoutStyle();
    final CSSValue value = layoutContext.getValue(FontStyleKeys.FONT_SIZE);

    final LayoutOutputMetaData metaData = process.getOutputMetaData();
    final int resolution = (int) metaData.getNumericFeatureValue(OutputProcessorFeature.DEVICE_RESOLUTION);
    final double fontSize = StyleSheetUtility.convertLengthToDouble(value, resolution);
    final double threshold = metaData.getNumericFeatureValue(OutputProcessorFeature.FONT_SMOOTH_THRESHOLD);
    if (fontSize < threshold)
    {
      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 element,
                      final StyleKey key)
  {
    final LayoutStyle layoutContext = element.getLayoutStyle();
    final ContentSpecification contentSpecification =
        (ContentSpecification) layoutContext.getValue(InternalStyleKeys.INTERNAL_CONTENT);

    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSConstant)
    {
      if (ContentValues.NONE.equals(value))
      {
        contentSpecification.setAllowContentProcessing(false);
View Full Code Here

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

                               final ContentSpecification contentSpecification)
  {
    contentSpecification.setAllowContentProcessing(false);
    contentSpecification.setInhibitContent(false);

    final LayoutStyle layoutContext = element.getLayoutStyle();
    final CSSValue value =
        layoutContext.getValue(ListStyleKeys.LIST_STYLE_IMAGE);
    if (value != null)
    {
      final ContentToken token = createToken(process, element, value);
      if (token != 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 style = currentNode.getLayoutStyle();
    CSSValue value = style.getValue(key);

    if (value instanceof CSSColorValue)
    {
      return;
    }


    // it might as well be a RGB- or HSL- function.

    if (value instanceof CSSFunctionValue)
    {
      final CSSFunctionValue functionValue = (CSSFunctionValue) value;
      final StyleValueFunction function = FunctionFactory.getInstance().getStyleFunction
                      (functionValue.getFunctionName());
      if (function == null)
      {
        value = HtmlColors.BLACK;
      }
      else
      {
        try
        {
          value = function.evaluate(process, currentNode, functionValue);
        }
        catch (FunctionEvaluationException e)
        {
          value = HtmlColors.BLACK;
        }
      }

      if (value instanceof CSSColorValue)
      {
        style.setValue(key, value);
        return;
      }
    }


    if (value instanceof CSSConstant == false)
    {
      style.setValue(key, HtmlColors.BLACK);
      return;
    }
    if (CSSSystemColors.CURRENT_COLOR.equals(value))
    {
      style.setValue(key, getCurrentColor(currentNode));
      return;
    }

    final CSSValue c = ColorUtil.parseIdentColor(value.getCSSText());
    if (c != null)
    {
      style.setValue(key, c);
    }
    else
    {
      style.setValue(key, HtmlColors.BLACK);
    }
  }
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.