Package org.jfree.layouting.layouter.context

Examples of org.jfree.layouting.layouter.context.LayoutContext


   */
  public void resolve (final LayoutProcess process,
                       final LayoutElement element,
                       final StyleKey key)
  {
    final LayoutContext layoutContext = element.getLayoutContext();
    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSValueList == false)
    {
      return; // do nothing.
    }

View Full Code Here


   */
  public void resolve (final LayoutProcess process,
                       final LayoutElement currentNode,
                       final StyleKey key)
  {
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    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

   */
  public void resolve(final LayoutProcess process,
                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSStringValue)
    {
      // this is a sub-string alignment.
      return;
    }

    final CSSConstant alignValue =
            (CSSConstant) resolveValue(process, currentNode, key);
    layoutContext.setValue(TextStyleKeys.TEXT_ALIGN, alignValue);
  }
View Full Code Here

   */
  public void resolve(final LayoutProcess process,
                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    final CSSValue displayRole = layoutContext.getValue(BoxStyleKeys.DISPLAY_ROLE);
    final CSSValue floating;
    if (DisplayRole.NONE.equals(displayRole))
    {
      floating = Floating.NONE;
    }
    else
    {
      floating = resolveValue(process, currentNode, key);
    }

    if (Floating.NONE.equals(floating) == false)
    {
      //  Otherwise, if 'float' has a value other than 'none', 'display'
      // is set to 'block' and the box is floated.
      layoutContext.setValue(BoxStyleKeys.DISPLAY_MODEL, DisplayModel.BLOCK_INSIDE);
      layoutContext.setValue(BoxStyleKeys.DISPLAY_ROLE, DisplayRole.BLOCK);
    }

    layoutContext.setValue(key, Floating.NONE);
  }
View Full Code Here

   */
  public void resolve(final LayoutProcess process,
                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    final CSSValue value = layoutContext.getValue(key);
    CSSStringValue lineEllipsis = null;
    CSSStringValue blockEllipsis = null;
    if (value instanceof CSSValueList)
    {
      final CSSValueList vlist = (CSSValueList) value;
      if (vlist.getLength() == 2)
      {
        lineEllipsis = filterString(vlist.getItem(0));
        blockEllipsis = filterString(vlist.getItem(1));
      }
      else if (vlist.getLength() == 1)
      {
        lineEllipsis = filterString(vlist.getItem(0));
        blockEllipsis = filterString(vlist.getItem(0));
      }
    }
    if (lineEllipsis == null)
    {
      lineEllipsis = new CSSStringValue(CSSStringType.STRING, "..");
    }
    if (blockEllipsis == null)
    {
      blockEllipsis = new CSSStringValue(CSSStringType.STRING, "..");
    }

    layoutContext.setValue(TextStyleKeys.X_BLOCK_TEXT_OVERFLOW_ELLIPSIS, blockEllipsis);
    layoutContext.setValue(TextStyleKeys.X_LINE_TEXT_OVERFLOW_ELLIPSIS, lineEllipsis);
  }
View Full Code Here

   */
  public void resolve (final LayoutProcess process,
                       final LayoutElement element,
                       final StyleKey key)
  {
    final LayoutContext layoutContext = element.getLayoutContext();
    final ContentSpecification contentSpecification =
            layoutContext.getContentSpecification();
    final CSSValue value = layoutContext.getValue(key);
    if (value instanceof CSSConstant)
    {
      if (ContentValues.NONE.equals(value))
      {
        contentSpecification.setStrings(DEFAULT_CONTENT);
View Full Code Here

   */
  public void resolve (final LayoutProcess process,
                       final LayoutElement currentNode,
                       final StyleKey key)
  {
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    layoutContext.setValue(key, CSSNumericValue.createValue(CSSNumericType.PT, 1));
  }
View Full Code Here

  public void resolve(final LayoutProcess process,
                         final LayoutElement currentNode,
                         final StyleKey key)
  {
    //Log.debug ("Processing: " + currentNode);
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    final FontSpecification fs =
            layoutContext.getFontSpecification();
    final OutputProcessorMetaData 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++)
View Full Code Here

   */
  public void resolve(final LayoutProcess process,
                      final LayoutElement currentNode,
                      final StyleKey key)
  {
    final LayoutContext layoutContext = currentNode.getLayoutContext();
    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

    }
  }

  private void buildStyle(final RenderBox box, final StyleBuilder builder)
  {
    final LayoutContext layoutContext = box.getLayoutContext();
    if (layoutContext == null)
    {
      // this is either the logical page box or one of the direct anchestors
      // of said box.
      return;
    }

    final FontSpecification fs = layoutContext.getFontSpecification();
    final double fontSize = fs.getFontSize();
    builder.append(FontStyleKeys.FONT_SIZE, toPointString(fontSize), "pt");
    builder.append(FontStyleKeys.FONT_FAMILY, fs.getFontFamily());
    builder.append(FontStyleKeys.FONT_WEIGHT,
        layoutContext.getValue(FontStyleKeys.FONT_WEIGHT));
    builder.append(FontStyleKeys.FONT_STYLE,
        layoutContext.getValue(FontStyleKeys.FONT_STYLE));
    builder.append(TextStyleKeys.TEXT_ALIGN, layoutContext.getValue(TextStyleKeys.TEXT_ALIGN));
    builder.append(TextStyleKeys.TEXT_ALIGN_LAST, layoutContext.getValue(TextStyleKeys.TEXT_ALIGN_LAST));

    final NodeLayoutProperties nlp = box.getNodeLayoutProperties();
    //final BoxLayoutProperties blp = box.getBoxLayoutProperties();
    final ComputedLayoutProperties sblp = box.getComputedLayoutProperties();
    builder.append(LineStyleKeys.VERTICAL_ALIGN, nlp.getVerticalAlignment());

    if (sblp.getPaddingTop() > 0 ||
        sblp.getPaddingLeft() > 0 ||
        sblp.getPaddingBottom() > 0 ||
        sblp.getPaddingRight() > 0)
    {
      if (sblp.getPaddingTop() > 0 || assumeZeroPaddings == false)
      {
        builder.append(BoxStyleKeys.PADDING_TOP,
            toPointString(sblp.getPaddingTop()), "pt");
      }
      if (sblp.getPaddingLeft() > 0 || assumeZeroPaddings == false)
      {
        builder.append(BoxStyleKeys.PADDING_LEFT,
            toPointString(sblp.getPaddingLeft()), "pt");
      }
      if (sblp.getPaddingBottom() > 0 || assumeZeroPaddings == false)
      {
        builder.append(BoxStyleKeys.PADDING_BOTTOM,
            toPointString(sblp.getPaddingBottom()), "pt");
      }
      if (sblp.getPaddingRight() > 0 || assumeZeroPaddings == false)
      {
        builder.append(BoxStyleKeys.PADDING_RIGHT,
            toPointString(sblp.getPaddingRight()), "pt");
      }
    }
    else if (assumeZeroPaddings == false)
    {
      builder.append("padding", false, "0");
    }

    if (sblp.getMarginLeft() != 0 ||
        sblp.getMarginRight() != 0 ||
        sblp.getMarginTop() != 0 ||
        sblp.getMarginBottom() != 0)
    {
      if (sblp.getMarginLeft() > 0 || assumeZeroMargins == false)
      {
        builder.append(BoxStyleKeys.MARGIN_LEFT,
            toPointString(sblp.getMarginLeft()), "pt");
      }
      if (sblp.getMarginRight() > 0 || assumeZeroMargins == false)
      {
        builder.append(BoxStyleKeys.MARGIN_RIGHT,
            toPointString(sblp.getMarginRight()), "pt");
      }
      if (sblp.getMarginTop() > 0 || assumeZeroMargins == false)
      {
        builder.append(BoxStyleKeys.MARGIN_TOP,
            toPointString(sblp.getMarginTop()), "pt");
      }
      if (sblp.getMarginBottom() > 0 || assumeZeroMargins == false)
      {
        builder.append(BoxStyleKeys.MARGIN_BOTTOM,
            toPointString(sblp.getMarginBottom()), "pt");
      }
    }
    else if (assumeZeroMargins == false)
    {
      builder.append("margin", false, "0");
    }

    final String bgColor = toColorString(layoutContext.getValue
        (BorderStyleKeys.BACKGROUND_COLOR));
    if (bgColor != null)
    {
      builder.append(BorderStyleKeys.BACKGROUND_COLOR, bgColor);
    }
    final String fgColor = toColorString(layoutContext.getValue(ColorStyleKeys.COLOR));
    if (fgColor != null)
    {
      builder.append(ColorStyleKeys.COLOR, fgColor);
    }

    if (sblp.getBorderTop() > 0 || sblp.getBorderLeft() > 0 ||
        sblp.getBorderBottom() > 0 || sblp.getBorderRight() > 0)
    {
      if (sblp.getBorderTop() > 0)
      {
        builder.append(BorderStyleKeys.BORDER_TOP_COLOR, layoutContext.getValue(BorderStyleKeys.BORDER_TOP_COLOR));
        builder.append(BorderStyleKeys.BORDER_TOP_STYLE, layoutContext.getValue(BorderStyleKeys.BORDER_TOP_STYLE));
        builder.append(BorderStyleKeys.BORDER_TOP_WIDTH, toPointString(sblp.getBorderTop()), "pt");
      }
      else if (assumeZeroBorders == false)
      {
        builder.append(BorderStyleKeys.BORDER_TOP_STYLE, BorderStyle.NONE);
      }

      if (sblp.getBorderLeft() > 0)
      {
        builder.append(BorderStyleKeys.BORDER_LEFT_COLOR, layoutContext.getValue(BorderStyleKeys.BORDER_LEFT_COLOR));
        builder.append(BorderStyleKeys.BORDER_LEFT_STYLE, layoutContext.getValue(BorderStyleKeys.BORDER_LEFT_STYLE));
        builder.append(BorderStyleKeys.BORDER_LEFT_WIDTH, toPointString(sblp.getBorderLeft()), "pt");
      }
      else if (assumeZeroBorders == false)
      {
        builder.append(BorderStyleKeys.BORDER_LEFT_STYLE, BorderStyle.NONE);
      }

      if (sblp.getBorderBottom() > 0)
      {
        builder.append(BorderStyleKeys.BORDER_BOTTOM_COLOR, layoutContext.getValue(BorderStyleKeys.BORDER_BOTTOM_COLOR));
        builder.append(BorderStyleKeys.BORDER_BOTTOM_STYLE, layoutContext.getValue(BorderStyleKeys.BORDER_BOTTOM_STYLE));
        builder.append(BorderStyleKeys.BORDER_BOTTOM_WIDTH, toPointString(sblp.getBorderBottom()), "pt");
      }
      else if (assumeZeroBorders == false)
      {
        builder.append(BorderStyleKeys.BORDER_BOTTOM_STYLE, BorderStyle.NONE);
      }

      if (sblp.getBorderRight() > 0)
      {
        builder.append(BorderStyleKeys.BORDER_RIGHT_COLOR, layoutContext.getValue(BorderStyleKeys.BORDER_RIGHT_COLOR));
        builder.append(BorderStyleKeys.BORDER_RIGHT_STYLE, layoutContext.getValue(BorderStyleKeys.BORDER_RIGHT_STYLE));
        builder.append(BorderStyleKeys.BORDER_RIGHT_WIDTH, toPointString(sblp.getBorderRight()), "pt");
      }
      else if (assumeZeroBorders == false)
      {
        builder.append(BorderStyleKeys.BORDER_RIGHT_STYLE, BorderStyle.NONE);
View Full Code Here

TOP

Related Classes of org.jfree.layouting.layouter.context.LayoutContext

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.