/** * Returns the numeric value of a css property. * * The parameter force has a special meaning: - When force is false, returns the value of the css * property defined in the set of style attributes. - When true returns the real computed value. */ public double cur(String prop, boolean force) { return isEmpty() ? 0 : getStyleImpl().cur(get(0), prop, force); }
/** * Get the innerHTML of the first matched element. */ public String html() { return isEmpty() ? "" : get(0).getInnerHTML(); }
/** * Scrolls the first matched element into view. */ public GQuery scrollIntoView() { if (!isEmpty()) { scrollIntoViewImpl(get(0)); } return this; }
/** * Return true if the first element is visible.isVisible. */ public boolean isVisible() { return isEmpty() ? false : getStyleImpl().isVisible(get(0)); }
/** * Return the value at the named data store for the first element in the set of matched * elements. */ @SuppressWarnings("unchecked") public <T> T data(String name) { return isEmpty() ? null : (T) data(get(0), name, null); }
/** * Access a property on the first matched element. This method makes it easy to retrieve a * property value from the first matched element. If the element does not have an attribute with * such a name, empty string is returned. Attributes include title, alt, src, href, width, style, * etc. */ public String attr(String name) { return isEmpty() ? "" : get(0).getAttribute(name); }
/** * Return the value at the named data store for the first element in the set of matched * elements, as set by data(name, value), with desired return type. * * @param clz return type class literal */ public <T> T data(String name, Class<? extends T> clz) { return isEmpty() ? null : data(get(0), name, null, clz); }
/** * Bind a set of functions to the blur event of each matched element. Or trigger the blur event if * no functions are provided. */ public GQuery blur(Function... f) { bindOrFire(Event.ONBLUR, null, f); if (!isEmpty() && f.length == 0) { get(0).blur(); } return this; }
/** * Bind a set of functions to the focus event of each matched element. Or trigger the event and * move the input focus to the first element if no functions are provided. */ public GQuery focus(Function... f) { bindOrFire(Event.ONFOCUS, null, f); if (!isEmpty() && f.length == 0) { get(0).focus(); } return this; }
@Override protected com.google.gwt.user.client.Element getStyleElement() { GQuery chosenElement = getChosenElement(); if (!chosenElement.isEmpty()) { return chosenElement.get(0).cast(); } return super.getStyleElement(); }
/** * Get the current offset of the first matched element, in pixels, relative to the document. The * returned object contains two integer properties, top and left. The method works only with * visible elements. */ public Offset offset() { Element e = get(0); return e == null ? new Offset(0, 0) : new Offset(e.getAbsoluteLeft(), e.getAbsoluteTop()); }
protected void setupEnabledSearchField() { container.removeClass(css.chznDisabled()); InputElement.as(searchField.get(0)).setDisabled(false); }
@Override protected com.google.gwt.user.client.Element getStyleElement() { GQuery chosenElement = getChosenElement(); if (!chosenElement.isEmpty()) { return chosenElement.get(0).cast(); } return super.getStyleElement(); }
/** * Select all options with value present in <code>values</code> array and update the component. * @param values */ public void setSelectedValue(String... values) { for (String value : values){ Element element = $("option[value='" + value + "']", this).get(0); if (element != null) { OptionElement.as(element).setSelected(true); } } update(); }
private boolean containerMouseUp(Event e) { Element target = e.getEventTarget().cast(); GQuery $e = $(target); if (!$e.isEmpty() && "ABBR".equalsIgnoreCase($e.get(0).getNodeName()) && !isDisabled) { resultsReset(); return false; } return true; }
protected void setupEnabledSearchField() { container.removeClass(css.chznDisabled()); InputElement.as(searchField.get(0)).setDisabled(false); }
private boolean containerMouseUp(Event e) { Element target = e.getEventTarget().cast(); GQuery $e = $(target); if (!$e.isEmpty() && "ABBR".equalsIgnoreCase($e.get(0).getNodeName()) && !isDisabled) { resultsReset(e); return false; } return true; }
private boolean containerMouseUp(Event e) { Element target = e.getEventTarget().cast(); GQuery $e = $(target); if (!$e.isEmpty() && "ABBR".equalsIgnoreCase($e.get(0).getNodeName()) && !isDisabled) { resultsReset(); return false; } return true; }
private Element attachTemporary(Element elem) { Element lastParent = $(elem).parents().last().get(0); if (lastParent == null) { // the element itself is detached lastParent = elem; } Document.get().getBody().appendChild(lastParent); return lastParent; }
protected void containerMouseDownImpl(Event e, GQuery element) { if (!activeField) { $(document).click(clickTestAction); resultsShow(); } else if (!element.isEmpty() && (element.get(0) == selectedItem.get(0) || element.parents("a." + css.chznSingle()).length() > 0)) { e.preventDefault(); resultsToggle(); } if (!element.hasClass(css.activeResult())) { activateField(); } }