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

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


  }

  @Override
  protected void onResize(int width, int height) {
    super.onResize(width, height);
    Size frameWidth = getElement().getFrameSize();

    if (!isAutoHeight()) {
      height -= frameWidth.getHeight() + appearance.getBar(getElement()).getOffsetHeight();
    }
    if (!isAutoWidth()) {
      width -= frameWidth.getWidth();
    }

    appearance.getBody(getElement()).setSize(width, height, true);
    appearance.getBar(getElement()).setWidth(width, true);
View Full Code Here


    if (!isAttached()) {
      return;
    }

    Size size = new Size(w, h);
    if (cacheSizes && lastSize != null && lastSize.equals(size)) {
      return;
    }

    List<FastMap<Object>> list = makeVisible();

    lastSize = size;

    Size ads = adjustSize(size);

    int aw = ads.getWidth();
    int ah = ads.getHeight();

    if (width != -1 && height != -1 && width != Integer.MIN_VALUE && height != Integer.MIN_VALUE && !deferHeight) {
      getElement().setSize(aw, ah, adjustSize);
    } else if (width != -1 && width != Integer.MIN_VALUE) {
      getElement().setWidth(aw, adjustSize);
View Full Code Here

      h = Util.parseInt(height, -1);
    } else {
      h = getOffsetHeight();
    }

    Size size = new Size(w, h);
    if (cacheSizes && lastSize != null && lastSize.equals(size)) {
      return;
    }

    lastSize = size;
View Full Code Here

  /**
   * Clears the size cache and resets to the last known size.
   */
  public void syncSize() {
    Size oldSize = lastSize;
    lastSize = null;
    if (isAttached() && oldSize != null) {
      setPixelSize(oldSize.getWidth(), oldSize.getHeight());
    }
  }
View Full Code Here

   * Returns the viewports size.
   *
   * @return the viewport size
   */
  public static Size getViewportSize() {
    return new Size(getViewportWidth(), getViewportHeight());
  }
View Full Code Here

   * @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

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.