]> source.dussan.org Git - vaadin-framework.git/commitdiff
Add missing getBorderX methods (#9153)
authorArtur Signell <artur@vaadin.com>
Mon, 11 Nov 2013 13:34:52 +0000 (15:34 +0200)
committerArtur Signell <artur@vaadin.com>
Mon, 11 Nov 2013 13:35:12 +0000 (15:35 +0200)
Change-Id: Ica1130b042a0ddbcccfc4e63bdcf28a68327659e

client/src/com/vaadin/client/LayoutManager.java

index 5d27527793530cd8135dcd6f375c52ae81d3c6c0..4fb656b16d2cbed868ff56a6100605f653f0aca4 100644 (file)
@@ -1028,6 +1028,98 @@ public class LayoutManager {
         return getMeasuredSize(element, nullSize).getBorderWidth();
     }
 
+    /**
+     * Gets the top border of the given element, provided that it has been
+     * measured. These elements are guaranteed to be measured:
+     * <ul>
+     * <li>ManagedLayotus and their child Connectors
+     * <li>Elements for which there is at least one ElementResizeListener
+     * <li>Elements for which at least one ManagedLayout has registered a
+     * dependency
+     * </ul>
+     * 
+     * A negative number is returned if the element has not been measured. If 0
+     * is returned, it might indicate that the element is not attached to the
+     * DOM.
+     * 
+     * @param element
+     *            the element to get the measured size for
+     * @return the measured top border of the element in pixels.
+     */
+    public int getBorderTop(Element element) {
+        assert needsMeasure(element) : "Getting measurement for element that is not measured";
+        return getMeasuredSize(element, nullSize).getBorderTop();
+    }
+
+    /**
+     * Gets the left border of the given element, provided that it has been
+     * measured. These elements are guaranteed to be measured:
+     * <ul>
+     * <li>ManagedLayotus and their child Connectors
+     * <li>Elements for which there is at least one ElementResizeListener
+     * <li>Elements for which at least one ManagedLayout has registered a
+     * dependency
+     * </ul>
+     * 
+     * A negative number is returned if the element has not been measured. If 0
+     * is returned, it might indicate that the element is not attached to the
+     * DOM.
+     * 
+     * @param element
+     *            the element to get the measured size for
+     * @return the measured left border of the element in pixels.
+     */
+    public int getBorderLeft(Element element) {
+        assert needsMeasure(element) : "Getting measurement for element that is not measured";
+        return getMeasuredSize(element, nullSize).getBorderLeft();
+    }
+
+    /**
+     * Gets the bottom border of the given element, provided that it has been
+     * measured. These elements are guaranteed to be measured:
+     * <ul>
+     * <li>ManagedLayotus and their child Connectors
+     * <li>Elements for which there is at least one ElementResizeListener
+     * <li>Elements for which at least one ManagedLayout has registered a
+     * dependency
+     * </ul>
+     * 
+     * A negative number is returned if the element has not been measured. If 0
+     * is returned, it might indicate that the element is not attached to the
+     * DOM.
+     * 
+     * @param element
+     *            the element to get the measured size for
+     * @return the measured bottom border of the element in pixels.
+     */
+    public int getBorderBottom(Element element) {
+        assert needsMeasure(element) : "Getting measurement for element that is not measured";
+        return getMeasuredSize(element, nullSize).getBorderBottom();
+    }
+
+    /**
+     * Gets the right border of the given element, provided that it has been
+     * measured. These elements are guaranteed to be measured:
+     * <ul>
+     * <li>ManagedLayotus and their child Connectors
+     * <li>Elements for which there is at least one ElementResizeListener
+     * <li>Elements for which at least one ManagedLayout has registered a
+     * dependency
+     * </ul>
+     * 
+     * A negative number is returned if the element has not been measured. If 0
+     * is returned, it might indicate that the element is not attached to the
+     * DOM.
+     * 
+     * @param element
+     *            the element to get the measured size for
+     * @return the measured right border of the element in pixels.
+     */
+    public int getBorderRight(Element element) {
+        assert needsMeasure(element) : "Getting measurement for element that is not measured";
+        return getMeasuredSize(element, nullSize).getBorderRight();
+    }
+
     /**
      * Gets the padding width (left padding + right padding) of the given
      * element, provided that it has been measured. These elements are