Package com.extjs.gxt.ui.client.util

Examples of com.extjs.gxt.ui.client.util.Size


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


   */
  public Size getSize(boolean content) {
    int w = getWidth();
    int h = getHeight();
    if (content) {
      Size frameWidth = getFrameSize();
      w -= frameWidth.width;
      h -= frameWidth.height;
    }
    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.width;
      offsetHeight = s.height;
      if (s.width > 0) {
        w = s.width;
      }
      if (s.height > 0) {
        h = s.height;
      }
    } 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 = getStyleAttribute(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("lr");
        } else if (GXT.isIE && isBorderBox && w != Style.DEFAULT && contentOnly) {
          w -= getFrameWidth("lr");
        } else if (offsetWidth == 0 && !isBorderBox && !contentOnly && w != Style.DEFAULT) {
          w += getFrameWidth("lr");
        }
      }
      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("tb");
        } else if (GXT.isIE && isBorderBox && h != Style.DEFAULT && contentOnly) {
          h -= getFrameWidth("tb");
        } else if (offsetHeight == 0 && !isBorderBox && !contentOnly && h != Style.DEFAULT) {
          h += getFrameWidth("tb");
        }
      }
    }
    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 adjust <code>true</code> to adjust for box model issues
   * @return this
   */
  public El setSize(int width, int height, boolean adjust) {
    if (adjust && !isBorderBox()) {
      Size frameWidth = getFrameSize();
      width -= frameWidth.width;
      height -= frameWidth.height;
    }
    if (width >= 0) {
      dom.getStyle().setPropertyPx("width", width);
View Full Code Here

    if (lastSize != null) {
      if (lastSize.width == w && lastSize.height == h) {
        return;
      }
    }
    lastSize = new Size(w, h);
    header.resizeColumns(false, true);
  }
View Full Code Here

    layout();
    return f;
  }

  protected Size adjustBodySize() {
    return new Size(0, 0);
  }
View Full Code Here

    ComponentHelper.doDetach(bottomComponent);
  }

  // internal, used for performance reasons
  protected Size getFrameSize() {
    Size elFrameSize = el().getFrameSize();
    Size bwrapFrameSize = bwrap.getFrameSize();

    Size mcFrameSize = null;
    if (frame) {
      Element mc = bwrap.subChild(3).dom;
      mcFrameSize = fly(mc).getFrameSize();
    }

    int w = elFrameSize.width + bwrapFrameSize.width;
    if (frame) {
      Element l = bwrap.dom.getFirstChildElement().cast();
      w += (fly(l).getFrameWidth("l") + fly(l).firstChild().getFrameWidth("r"));
      w += mcFrameSize.width;
    }

    int h = elFrameSize.height + bwrapFrameSize.height;
    if (frame) {
      Element hd = el().dom.getFirstChildElement().cast();
      Element ft = bwrap.dom.getLastChild().cast();
      h += (fly(hd).getHeight() + fly(ft).getHeight());
      h += mcFrameSize.height;
    } else {
      if (head != null) {
        h += head.getOffsetHeight();
      }
      if (foot != null) {
        h += foot.getHeight();
      }
    }
    h += (tbar != null ? tbar.getHeight() : 0) + (bbar != null ? bbar.getHeight() : 0);

    return new Size(w, h);
  }
View Full Code Here

  }

  @Override
  protected void onResize(int width, int height) {
    super.onResize(width, height);
    Size frameSize = getFrameSize();
    Size adjustBodySize = adjustBodySize();
    if (isAutoWidth()) {
      getLayoutTarget().setWidth("auto");
    } else if (width != -1) {
      width -= frameSize.width;
      if (tbar != null) {
View Full Code Here

  }

  @Override
  protected void onResize(int width, int height) {
    super.onResize(width, height);
    Size frameSize = el().getFrameSize();
    startBtn.setSize(width - frameSize.width, height - frameSize.height);
  }
View Full Code Here

   
    afterShow();
  }

  protected Point position() {
    Size s = XDOM.getViewportSize();
    int left = s.width - config.width - 10 + XDOM.getBodyScrollLeft();
    int top = s.height - config.height - 10 - (level * (config.height + 10))
        + XDOM.getBodyScrollTop();
    return new Point(left, top);
  }
View Full Code Here

TOP

Related Classes of com.extjs.gxt.ui.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.