Package org.eclipse.jst.pagedesigner.css2.value

Examples of org.eclipse.jst.pagedesigner.css2.value.Length


   * @return
   */
  private int getInsetProperty(String propertyName) {
    Object obj = this.getStyleProperty(propertyName);
    if (obj instanceof Length) {
      Length l = (Length) obj;
      if (l.isPercentage()) {
        return 0; // FIXME:
      }
            return l.getValue();
    }

    return 0;
  }
View Full Code Here


    ICSSStyle style = this.getFigure().getCSSStyle();
    if (style == null) {
      _cellWidth = -1;
    } else {
      Object width = style.getStyleProperty(ICSSPropertyID.ATTR_WIDTH);
      Length recommendedWidth = (width instanceof Length) ? (Length) width
          : null;

      int rw = 0;
      if (recommendedWidth == null || recommendedWidth.getValue() <= 0) {
        rw = 0;
      } else {
        if (recommendedWidth.isPercentage()) {
          // percentage width is used for remaining width
          // distribution, so not used here.
          int colspan = this.getColSpan();
          for (int i = 0; i < colspan; i++) {
            tableInfo.setWidthPercentage(this.getColumnIndex() + i,
                recommendedWidth.getValue() / colspan);
          }
        } else {
          rw = recommendedWidth.getValue();
          if (!style.isSizeIncludeBorderPadding()) {
            rw += style.getBorderInsets().getWidth()
                + style.getPaddingInsets().getWidth();
          }
          if (this.getColSpan() == 1) {
View Full Code Here

  private int getRecommendedWidth() {
    int containerWidth = getContainerWidth();
    Object leftObj = _style.getStyleProperty(ICSSPropertyID.ATTR_LEFT);
    if (leftObj != null && leftObj instanceof Length) {
      Length left = (Length) leftObj;
      int intLeft = left.getValue();
      if (left.isPercentage()) {
        intLeft = containerWidth * intLeft / 100;
      }
      if (intLeft < containerWidth) {
        return containerWidth - intLeft;
      }
View Full Code Here

  private int getIncrement(FlowBox blockInfo) {
    int valign = getVerticalAlignType(blockInfo);
    if (valign == LENGTH) {
      int increment = 0;
      Length length = (Length) blockInfo.getVerticalAlignData();
      if (length.isPercentage()) {
        increment = length.getValue() * getFontHeight() / 100;
      } else {
        increment = length.getValue();
      }
      return increment;
    }
    return 0;
  }
View Full Code Here

    ICSSStyle style = this.getFigure().getCSSStyle();
    if (style == null) {
      _cellHeight = -1;
    } else {
      Object height = style.getStyleProperty(ICSSPropertyID.ATTR_HEIGHT);
      Length recommendedHeight = (height instanceof Length) ? (Length) height
          : null;

      int rh = 0;
      if (recommendedHeight == null || recommendedHeight.getValue() <= 0) {
        rh = 0;
      } else {
        if (recommendedHeight.isPercentage()) {
          int rowspan = this.getRowSpan();
          for (int i = 0; i < rowspan; i++) {
            tableInfo.setHeightPercentage(this.getRowIndex() + i,
                recommendedHeight.getValue() / rowspan);
          }
        } else {
          rh = recommendedHeight.getValue();
        }
        if (!style.isSizeIncludeBorderPadding()) {
          rh += style.getBorderInsets().getHeight()
              + style.getPaddingInsets().getHeight();
        }
View Full Code Here

   */
  protected int getLengthValue(ICSSStyle style, String property) {
    int lengthValue = 0;
    if (style != null) {
      Object object = style.getStyleProperty(property);
      Length lengthObj = (object instanceof Length) ? (Length) object
          : null;

      if (lengthObj != null) {
        lengthValue = lengthObj.getValue();
        if (lengthObj.isPercentage()) {
          if (ICSSPropertyID.ATTR_WIDTH.equalsIgnoreCase(property)
              || ICSSPropertyID.ATTR_MIN_WIDTH
                  .equalsIgnoreCase(property)) {
            lengthValue = this.getFlowContext().getCurrentLine().getRecommendedContentWidth()
                * lengthValue / 100;
View Full Code Here

    ICSSStyle style = this.getFigure().getCSSStyle();
    if (style == null) {
      this._rowHeight = -1;
    } else {
      Object height = style.getStyleProperty(ICSSPropertyID.ATTR_HEIGHT);
      Length recommendedHeight = (height instanceof Length) ? (Length) height
          : null;

      int rh = 0;
      if (recommendedHeight == null || recommendedHeight.getValue() <= 0) {
        rh = 0;
      } else {
        if (recommendedHeight.isPercentage()) {
          // not supported.
        } else {
          rh = recommendedHeight.getValue();
        }
        if (rh > 0 && !style.isSizeIncludeBorderPadding()) {
          rh += style.getBorderInsets().getHeight()
              + style.getPaddingInsets().getHeight();
        }
View Full Code Here

    }

    // ok, user specified left or right. let's calculate the left
    int leftValue;
    if (left instanceof Length) {
      Length leftLength = (Length) left;
      leftValue = leftLength.getValue();
      if (leftLength.isPercentage()) {
        leftValue = (horizontal ? containingPositionedFigure
            .getBounds().width : containingPositionedFigure
            .getBounds().height)
            * leftValue / 100;
      }
    } else {
      Length rightLength = (Length) right;
      int lengthValue = rightLength.getValue();
      if (rightLength.isPercentage()) {
        lengthValue = (horizontal ? containingPositionedFigure
            .getBounds().width : containingPositionedFigure
            .getBounds().height)
            * lengthValue / 100;
      }
View Full Code Here

      return calculateTDOverride(element, propertyName);
    } else if ("img".equalsIgnoreCase(htmltag)) { //$NON-NLS-1$
      String border = DOMUtil.getAttributeIgnoreCase(element, "border");// ICSSPropertyID.ATTR_BORDERSIZE); //$NON-NLS-1$
      if (border != null) {
        try {
          return new Length(Integer.parseInt(border), false);
        } catch (Exception ex) {
          // Integer processing, no need to report.
        }
      }
    }
View Full Code Here

        return null;
      } else if (borderstr.trim().length() == 0) {
        return Length.LENGTH_1;
      } else {
        try {
          return new Length(Integer.parseInt(borderstr), false);
        } catch (Exception ex) {
          frame = borderstr;
        }
      }
    }
    // ok, we got a value for frame.
    if (TableUtil.matchFrame(extractEdge(propertyName), frame)) {
      if (borderstr != null) {
        try {
          return new Length(Integer.parseInt(borderstr), false);
        } catch (Exception ex) {
          // ignore. pass through to return length_1
        }
      }
      return Length.LENGTH_1;
View Full Code Here

TOP

Related Classes of org.eclipse.jst.pagedesigner.css2.value.Length

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.