From 388f7591e68d10749f2439132c35b97b9b24c683 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 11 Nov 2013 15:34:52 +0200 Subject: [PATCH] Add missing getBorderX methods (#9153) Change-Id: Ica1130b042a0ddbcccfc4e63bdcf28a68327659e --- .../src/com/vaadin/client/LayoutManager.java | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java index 5d27527793..4fb656b16d 100644 --- a/client/src/com/vaadin/client/LayoutManager.java +++ b/client/src/com/vaadin/client/LayoutManager.java @@ -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: + * + * + * 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: + * + * + * 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: + * + * + * 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: + * + * + * 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 -- 2.39.5