/** * Get the id of the first matched element. */ public String id() { return attr("id"); }
private void setTabIndex() { String tabIndexProperty = $selectElement.attr(TABINDEX_PROPERTY); if (tabIndexProperty != null && tabIndexProperty.length() > 0) { $selectElement.attr(TABINDEX_PROPERTY, -1); if (isMultiple) { searchField.attr(TABINDEX_PROPERTY, tabIndexProperty); } else { selectedItem.attr(TABINDEX_PROPERTY, tabIndexProperty); searchField.attr(TABINDEX_PROPERTY, -1); } } }
protected OptionItem getOptionItem(GQuery result) { String highId = result.attr("id"); int position = Integer.parseInt(highId.substring(highId.lastIndexOf("_") + 1)); return (OptionItem) selectItems.get(position); }
protected OptionItem getOptionItem(GQuery result) { String highId = result.attr("id"); int position = Integer.parseInt(highId.substring(highId.lastIndexOf("_") + 1)); return (OptionItem) selectItems.get(position); }
@Override public void set(String value) { $(el).attr(attr, value); } };
/** * Set the id of the first matched element. */ public GQuery id(String id) { return eq(0).attr("id", id); }
@Override protected void setTabIndexProperty(String tabIndexProperty) { getSearchField().attr(TABINDEX_PROPERTY, tabIndexProperty); }
private boolean activateField(Event e) { if (!isMultiple && !activeField) { searchField.attr(TABINDEX_PROPERTY, selectedItem.attr(TABINDEX_PROPERTY)); selectedItem.attr(TABINDEX_PROPERTY, -1); } container.addClass(css.chznContainerActive()); activeField = true; searchField.val(searchField.val()); searchField.focus(); return false; }
/** * Set a key/value object as properties to all matched elements. * * Example: $("img").attr(new Properties("src: 'test.jpg', alt: 'Test Image'")) */ public GQuery attr(Properties properties) { for (String name : properties.keys()) { attr(name, properties.getStr(name)); } return this; }
@Override public void set(Boolean val) { if (val) { $(el).attr(attr, value); } else { $(el).removeAttr(attr); } } };
/** * Set a single property to a computed value, on all matched elements. */ public GQuery attr(String key, Function closure) { int i = 0; for (Element e : elements) { Object val = closure.f(e.<com.google.gwt.dom.client.Element> cast(), i++); $(e).attr(key, val); } return this; }
protected void choiceDestroy(GQuery link) { choices--; showSearchFieldDefault(defaultText); if (isMultiple() && choices > 0 && searchField.val() != null && searchField.val().length() < 1) { resultsHide(); } resultDeselect(Integer.parseInt(link.attr("rel")), link.attr("data-chosen-value")); link.parents("li").first().remove(); }
protected void choiceDestroy(GQuery link) { choices--; showSearchFieldDefault(defaultText); if (isMultiple() && choices > 0 && searchField.val() != null && searchField.val().length() < 1) { resultsHide(); } resultDeselect(Integer.parseInt(link.attr("rel")), link.attr("data-chosen-value")); link.parents("li").first().remove(); }
private void choiceDestroy(GQuery link) { choices--; showSearchFieldDefault(); if (isMultiple && choices > 0 && searchField.val() != null && searchField.val().length() < 1) { resultsHide(); } resultDeselect(Integer.parseInt(link.attr("rel"))); link.parents("li").first().remove(); }