]> source.dussan.org Git - gwtquery.git/commitdiff
adding outerWidth and outerHeight methods which are in the jquery API. Patch by julie...
authorManolo Carrasco <manolo@apache.org>
Mon, 25 Oct 2010 12:48:13 +0000 (12:48 +0000)
committerManolo Carrasco <manolo@apache.org>
Mon, 25 Oct 2010 12:48:13 +0000 (12:48 +0000)
gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java

index a06ad1f67df984738433f4e0ef6aab02a2e39dc8..f2af28279d40724e8f4264ae817eabd0675b6706 100644 (file)
@@ -1529,6 +1529,46 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
   public GQuery one(int eventbits, final Object data, final Function f) {\r
     return as(Events).one(eventbits, data, f);\r
   }\r
+  \r
+  /**\r
+   * Get the current computed height for the first element in the set of matched elements, \r
+   * including padding, border, but not the margin.\r
+   */\r
+  public int outerHeight(){\r
+    return outerHeight(false);\r
+  }\r
+  \r
+  /**\r
+   * Get the current computed height for the first element in the set of matched elements, \r
+   * including padding, border, and optionally margin.\r
+   */\r
+  public int outerHeight(boolean includeMargin){\r
+    int outerHeight  = get(0).getOffsetHeight(); //height including padding and border\r
+    if (includeMargin){\r
+      outerHeight+=GQUtils.cur( get(0), "marginTop", true)+GQUtils.cur( get(0), "marginBottom", true);\r
+    }\r
+    return  outerHeight;\r
+  }   \r
+  \r
+  /**\r
+   * Get the current computed width for the first element in the set of matched elements, \r
+   * including padding, border, but not the margin.\r
+   */\r
+  public int outerWidth(){\r
+    return outerWidth(false);\r
+  }\r
+  \r
+  /**\r
+   * Get the current computed width for the first element in the set of matched elements, \r
+   * including padding and border and optionally margin.\r
+   */\r
+  public int outerWidth(boolean includeMargin){\r
+    int outerWidth  = get(0).getOffsetWidth(); //width including padding and border\r
+    if (includeMargin){\r
+      outerWidth+=GQUtils.cur( get(0), "marginRight", true)+GQUtils.cur( get(0), "marginLeft", true);\r
+    }\r
+    return  outerWidth;\r
+  } \r
 \r
   /**\r
    * Get a set of elements containing the unique parents of the matched set of\r
@@ -2545,5 +2585,4 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
       dataCache.delete(id);\r
     }\r
   }\r
-\r
 }\r
index d579e64433cbbf73473136ae2c8744dce4882761..149969e3d7a96c46946fa8a707e950dd3c0296aa 100644 (file)
@@ -716,6 +716,30 @@ public interface LazyGQuery<T> extends LazyBase<T>{
    */
   LazyGQuery<T> one(int eventbits, Object data, Function f);
 
+  /**
+   * Get the current computed width for the first element in the set of matched elements, 
+   * including padding, border, but not the margin.
+   */
+  int outerWidth();
+
+  /**
+   * Get the current computed width for the first element in the set of matched elements, 
+   * including padding and border and optionally margin.
+   */
+  int outerWidth(boolean includeMargin);
+
+  /**
+   * Get the current computed height for the first element in the set of matched elements, 
+   * including padding, border, but not the margin.
+   */
+  int outerHeight();
+
+  /**
+   * Get the current computed height for the first element in the set of matched elements, 
+   * including padding, border, and optionally margin.
+   */
+  int outerHeight(boolean includeMargin);
+
   /**
    * Get a set of elements containing the unique parents of the matched set of
    * elements.