Package com.sencha.gxt.core.client.util

Examples of com.sencha.gxt.core.client.util.Size


   * @param adjust if true sizes get adjusted
   *
   * @return the element's bounds
   */
  public final Rectangle getBounds(boolean local, boolean adjust) {
    Size s = getSize(adjust);
    Rectangle rect = new Rectangle();
    rect.setWidth(s.getWidth());
    rect.setHeight(s.getHeight());
    if (local) {
      rect.setX(getLeft(true));
      rect.setY(getTop(true));
    } else {
      Point p = getXY();
View Full Code Here


        width += Util.parseInt(map.get(s), 0);
      } else {
        height += Util.parseInt(map.get(s), 0);
      }
    }
    return new Size(width, height);
  }
View Full Code Here

   */
  public final Size getSize(boolean content) {
    int w = getOffsetWidth();
    int h = getOffsetHeight();
    if (content) {
      Size frameWidth = getFrameSize();
      w -= frameWidth.getWidth();
      h -= frameWidth.getHeight();
    }
    return new Size(Math.max(0, w), Math.max(0, h));
  }
View Full Code Here

    }

    int offsetWidth = Style.DEFAULT;
    int offsetHeight = Style.DEFAULT;
    if (w == Style.DEFAULT && h == Style.DEFAULT) {
      Size s = getSize(contentOnly);
      offsetWidth = s.getWidth();
      offsetHeight = s.getHeight();
      if (s.getWidth() > 0) {
        w = s.getWidth();
      }
      if (s.getHeight() > 0) {
        h = s.getHeight();
      }
    } else if (w == Style.DEFAULT) {
      offsetWidth = getWidth(contentOnly);
      if (offsetWidth > 0) {
        w = offsetWidth;
      }
    } else if (h == Style.DEFAULT) {
      offsetHeight = getHeight(contentOnly);
      if (offsetHeight > 0) {
        h = offsetHeight;
      }
    }

    List<String> l = new ArrayList<String>();
    if (w == Style.DEFAULT) {
      l.add("width");
    }
    if (h == Style.DEFAULT) {
      l.add("height");
    }
    Map<String, String> map = getComputedStyle(l);
    if (map != null) {
      String wid = map.get("width");
      if (wid != null) {
        w = Util.parseInt(wid, Style.DEFAULT);
        if (offsetWidth == 0 && isBorderBox && contentOnly && w != Style.DEFAULT && !GXT.isIE()) {
          w -= getFrameWidth(Side.LEFT, Side.RIGHT);
        } else if (GXT.isIE() && isBorderBox && w != Style.DEFAULT && contentOnly) {
          w -= getFrameWidth(Side.LEFT, Side.RIGHT);
        } else if (offsetWidth == 0 && !isBorderBox && !contentOnly && w != Style.DEFAULT) {
          w += getFrameWidth(Side.LEFT, Side.RIGHT);
        }
      }
      String hei = map.get("height");
      if (hei != null) {
        h = Util.parseInt(hei, Style.DEFAULT);
        if (offsetHeight == 0 && isBorderBox && contentOnly && h != Style.DEFAULT && !GXT.isIE()) {
          h -= getFrameWidth(Side.TOP, Side.BOTTOM);
        } else if (GXT.isIE() && isBorderBox && h != Style.DEFAULT && contentOnly) {
          h -= getFrameWidth(Side.TOP, Side.BOTTOM);
        } else if (offsetHeight == 0 && !isBorderBox && !contentOnly && h != Style.DEFAULT) {
          h += getFrameWidth(Side.TOP, Side.BOTTOM);
        }
      }
    }
    if (w == Style.DEFAULT && h == Style.DEFAULT) {
      return new Size(offsetWidth, offsetHeight);
    }
    return new Size(w != Style.DEFAULT ? w : offsetWidth, h != Style.DEFAULT ? h : offsetHeight);
  }
View Full Code Here

   * @param height the new height
   * @param adjust <code>true</code> to adjust for box model issues
   */
  public final void setSize(int width, int height, boolean adjust) {
    if (adjust && !isBorderBox()) {
      Size frameWidth = getFrameSize();
      width -= frameWidth.getWidth();
      height -= frameWidth.getHeight();
    }
    if (width >= 0) {
      getStyle().setPropertyPx("width", width);
    }
    if (height >= 0) {
View Full Code Here

  }

  @Override
  protected void doLayout() {
    if (widget != null) {
      Size size = getElement().getStyleSize();
      int width = -1;
      if (!isAutoWidth()) {

        if (options.getLabelAlign() == LabelAlign.TOP) {
          width = size.getWidth() - getLeftRightMargins(widget);
        } else {
          XElement wrapper = appearance.getChildElementWrapper(getElement());
          width = (wrapper != null ? wrapper.getWidth(true) : size.getWidth()) - getLeftRightMargins(widget);
        }

        if (GXT.isIE6()) {
          width -= 5;
        }
      }
      int height = -1;

      if (!isAutoHeight()) {
        height = size.getHeight() - getTopBottomMargins(widget);
      }

      applyLayout(widget, width, height);
    }
  }
View Full Code Here

    if (body == null) {
      return;
    }

    XElement c = grid.getElement();
    Size csize = c.getStyleSize();

    if (GXTLogConfiguration.loggingIsEnabled()) {
      logger.finest("layout() " + csize);
    }

    int vw = csize.getWidth();
    if (vw < 10 || (csize.getHeight() < 20 && !grid.isHideHeaders())) {
      return;
    }

    if (!skipResize) {
      resize();
View Full Code Here

  protected void resize() {
    if (body == null) {
      return;
    }

    Size csize = grid.getElement().getStyleSize();

    if (GXTLogConfiguration.loggingIsEnabled()) {
      logger.finest("resize() " + csize);
    }

    int vw = csize.getWidth();
    int vh = 0;
    if (vw < 10 || csize.getHeight() < 22) {
      return;
    }

    if (grid.isAutoHeight()) {
      scroller.setWidth(vw);
    }

    int hdHeight = headerElem.getHeight(false);
    vh = csize.getHeight() - hdHeight;

    if (footer != null) {
      vh -= footer.getOffsetHeight();
    }
View Full Code Here

  @Override
  public void onResize(XElement parent, int width, int height) {
    Element div = parent.getFirstChildElement();

    Size adj = adjustTextAreaSize(width, height);

    if (width != -1) {
      div.getStyle().setWidth(width, Unit.PX);
      width = adj.getWidth();
      div.getFirstChildElement().getStyle().setWidth(width, Unit.PX);
    }

    if (height != -1) {
      height = adj.getHeight();
      div.getFirstChildElement().getStyle().setHeight(height, Unit.PX);
    }
  }
View Full Code Here

    }

    String inputStyles = "";
    String wrapStyles = "";

    Size adjusted = adjustTextAreaSize(width, height);

    if (width != -1) {
      wrapStyles += "width:" + width + "px;";
      width = adjusted.getWidth();
      inputStyles += "width:" + width + "px;";
    }

    if (height != -1) {
      height = adjusted.getHeight();
      inputStyles += "height: " + height + "px;";
    }

    String cls = style.area() + " " + style.field();
    if (empty) {
View Full Code Here

TOP

Related Classes of com.sencha.gxt.core.client.util.Size

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.