/** * Returns the numeric value of a css property. */ public double cur(String prop) { return cur(prop, false); }
/** * Returns the computed top position of the first element matched. */ public int top() { return (int) cur("top", true); }
/** * Get the current computed, pixel, width of the first matched element. It does not include * margin, padding nor border. */ public int width() { return (int) cur("width", true); }
/** * Get the current computed, pixel, height of the first matched element. It does not include * margin, padding nor border. */ public int height() { return (int) cur("height", true); }
/** * Returns the inner width of the first matched element, including padding but not the vertical * scrollbar width, border, or margin. */ public int innerWidth() { return (int) cur("clientWidth", true); }
/** * Returns the inner height of the first matched element, including padding but not the vertical * scrollbar height, border, or margin. */ public int innerHeight() { return (int) cur("clientHeight", true); }
/** * Returns the computed left position of the first element matched. */ public int left() { return (int) cur("left", true); }
private int getSideBorderPadding(GQuery elmt, boolean isHidden) { if (isHidden) { //bug in gquery when one parent of the element is hidden return (int) (elmt.cur("padding-left", true) + elmt.cur("padding-right", true) + elmt.cur("border-left-width", true) + elmt.cur("border-right-width", true)); } return elmt.outerWidth() - elmt.width(); }
protected int getSideBorderPadding(GQuery elmt, boolean isHidden) { if (isHidden) { // bug in gquery when one parent of the element is hidden return (int) (elmt.cur("padding-left", true) + elmt.cur("padding-right", true) + elmt.cur("border-left-width", true) + elmt.cur("border-right-width", true)); } return elmt.outerWidth() - elmt.width(); }
/** * Get the current computed height for the first element in the set of matched elements, including * padding, border, and optionally margin. */ public int outerHeight(boolean includeMargin) { if (isEmpty()) { return 0; } // height including padding and border int outerHeight = (int) cur("offsetHeight", true); if (includeMargin) { outerHeight += cur("marginTop", true) + cur("marginBottom", true); } return outerHeight; }
/** * Get the current computed width for the first element in the set of matched elements, including * padding and border and optionally margin. */ public int outerWidth(boolean includeMargin) { if (isEmpty()) { return 0; } // width including padding and border int outerWidth = (int) cur("offsetWidth", true); if (includeMargin) { outerWidth += cur("marginRight", true) + cur("marginLeft", true); } return outerWidth; }
protected int getSideBorderPadding(GQuery elmt, boolean isHidden) { if (isHidden) { // bug in gquery when one parent of the element is hidden return (int) (elmt.cur("padding-left", true) + elmt.cur("padding-right", true) + elmt.cur("border-left-width", true) + elmt.cur("border-right-width", true)); } return elmt.outerWidth() - elmt.width(); }
/** * Use the method in the gquery class. * $(elem).cur(prop, force); */ @Deprecated public static double cur(Element elem, String prop, boolean force) { return GQuery.$(elem).cur(prop, force); }
private void resultDoHighlight(GQuery el) { if (el == null || el.length() == 0) { return; } resultClearHighlight(); resultHighlight = el; resultHighlight.addClass(css.highlighted()); int maxHeight = (int) searchResults.cur("maxHeight", true); int visibleTop = searchResults.scrollTop(); int visibleBottom = maxHeight + visibleTop; int highTop = resultHighlight.position().top + searchResults.scrollTop(); int highBottom = highTop + resultHighlight.outerHeight(); if (highBottom >= visibleBottom) { int toScroll = highBottom - maxHeight; searchResults.scrollTop(toScroll > 0 ? toScroll : 0); } else if (highTop < visibleTop) { searchResults.scrollTop(highTop); } }