private String generateContainerId() { String id = DEFAULT_CONTAINER_ID + idCounter++; while (!$("#" + id).isEmpty()) { idCounter++; id = DEFAULT_CONTAINER_ID + idCounter; } return id; }
private String generateContainerId() { String id = DEFAULT_CONTAINER_ID + idCounter++; while (!$("#" + id).isEmpty()) { idCounter++; id = DEFAULT_CONTAINER_ID + idCounter; } return id; }
/** * Checks the current selection against an expression and returns true, if at least one element of * the selection fits the given expression. Does return false, if no element fits or the * expression is not valid. */ public boolean is(String... filters) { return !filter(filters).isEmpty(); }
/** * 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); }
/** * 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 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; }
private GQuery getFocusableElement() { GQuery chosen = getChosenElement(); GQuery focusableElement = chosen.children("a"); if (focusableElement.isEmpty()) { focusableElement = chosen.find("input"); } return focusableElement; } }
private GQuery getFocusableElement() { GQuery chosen = getChosenElement(); GQuery focusableElement = chosen.children("a"); if (focusableElement.isEmpty()) { focusableElement = chosen.find("input"); } return focusableElement; }
/** * 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; }
private GQuery getFocusableElement() { GQuery chosen = getChosenElement(); GQuery focusableElement = chosen.children("a"); if (focusableElement.isEmpty()) { focusableElement = chosen.find("input"); } return focusableElement; } }
@Override protected com.google.gwt.user.client.Element getStyleElement() { GQuery chosenElement = getChosenElement(); if (!chosenElement.isEmpty()) { return chosenElement.get(0).cast(); } return super.getStyleElement(); }
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 void singleDeselectControlBuild() { if (allowSingleDeselect && selectedItem.find("abbr").isEmpty()) { selectedItem.find("span").first().after( "<abbr class=\"" + css.searchChoiceClose() + " " + css.iconCross() + "\"></abbr>"); } }
private boolean searchResultsMouseUp(Event e) { Element targetEvent = e.getEventTarget().cast(); GQuery $e = $(targetEvent); GQuery target = $e.hasClass(css.activeResult()) ? $e : $e.parents("." + css.activeResult()).first(); if (!target.isEmpty()) { resultHighlight = target; resultSelect(e); } return false; }
protected boolean searchResultsMouseUp(Event e) { Element targetEvent = e.getEventTarget().cast(); GQuery $e = $(targetEvent); GQuery target = $e.hasClass(css.activeResult()) ? $e : $e.parents("." + css.activeResult()).first(); if (!target.isEmpty()) { resultHighlight = target; resultSelect(e); } return false; }
protected boolean searchResultsMouseUp(Event e) { Element targetEvent = e.getEventTarget().cast(); GQuery $e = $(targetEvent); GQuery target = $e.hasClass(css.activeResult()) ? $e : $e.parents("." + css.activeResult()).first(); if (!target.isEmpty()) { resultHighlight = target; resultSelect(e); } return false; }
boolean searchResultsMouseOver(Event e) { Element targetEl = e.getEventTarget().cast(); GQuery $e = $(targetEl); GQuery target = $e.hasClass(css.activeResult()) ? $e : $e.parents("." + css.activeResult()).first(); if (!target.isEmpty()) { resultDoHighlight(target); } return false; }
private boolean choicesClick(Event e) { e.preventDefault(); Element target = e.getEventTarget().cast(); GQuery $e = $(target); if (activeField && !($e.hasClass(getCss().searchChoice()) || !$e.parents("." + getCss().searchChoice()).isEmpty()) && !resultsShowing) { resultsShow(); } return true; }