/** * Toggle among two or more function calls every other click. */ public GQuery toggle(final Function... fn) { for (Element e : elements) { $(e).click(new Function() { int click = 0; public boolean f(Event e) { int n = fn.length == 1 ? 0 : (click++ % fn.length); return fn[n].f(e); } }); } return this; }
@Override protected void bind() { super.bind(); getContainer().click(new Function() { @Override public boolean f(Event e) { e.preventDefault(); return false; } }); }
@Override protected void bind() { super.bind(); getContainer().click(new Function() { @Override public boolean f(Event e) { e.preventDefault(); return false; } }); }
@Override protected void bind() { super.bind(); getSearchChoices().click(new Function() { @Override public boolean f(Event e) { return choicesClick(e); } }); getSearchField().focus(new Function() { @Override public boolean f(Event e) { return inputFocus(e); } }); }
@Override protected void bind() { super.bind(); getSearchChoices().click(new Function() { @Override public boolean f(Event e) { return choicesClick(e); } }); getSearchField().focus(new Function() { @Override public boolean f(Event e) { return inputFocus(e); } }); }
@Override protected void containerMouseDownImpl(Event e, GQuery element) { if (pendingDestroyClick) { pendingDestroyClick = false; return; } if (!activeField) { getSearchField().val(""); $(document).click(clickTestAction); resultsShow(); } activateField(); }
@Override protected void containerMouseDownImpl(Event e, GQuery element) { if (pendingDestroyClick) { pendingDestroyClick = false; return; } if (!activeField) { getSearchField().val(""); $(document).click(clickTestAction); resultsShow(); } activateField(); }
@Override protected void bind() { super.bind(); getSearchResults().mousedown(new Function() { @Override public void f() { searchResultMouseDown(); } }); getContainer().on("click", "i[role='close']", new Function() { @Override public void f() { closeField(); } }); getContainer().click(new Function() { @Override public boolean f(Event e) { e.preventDefault(); return false; } }); }
@Override protected void bind() { super.bind(); getSearchResults().mousedown(new Function() { @Override public void f() { searchResultMouseDown(); } }); getContainer().on("click", "i[role='close']", new Function() { @Override public void f() { closeField(); } }); getContainer().click(new Function() { @Override public boolean f(Event e) { e.preventDefault(); return false; } }); }
public EditableText(Element element) { mySource = element; $(mySource).click(new Function() { @Override public boolean f(Event e) {
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(); } }
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(); } }
private void choiceBuild(OptionItem option) { if (isMultiple && maxSelectedOptionsReached()) { fireEvent(new MaxSelectedEvent(this)); return; } String choiceId = containerId + "_c_" + option.getArrayIndex(); choices++; searchContainer.before(ChozenTemplate.templates.choice(choiceId, css.searchChoice(), option.getHtml(), css.searchChoiceClose(), "" + option.getArrayIndex()).asString()); $('#' + choiceId).find("a").click(new Function() { public boolean f(final Event e) { choiceDestroyLinkClick(e); return false; } }); }
protected void addChoice(OptionItem option) { if (maxSelectedOptionsReached()) { fireEvent(new MaxSelectedEvent(this)); } else { String choiceId = getContainerId() + "_c_" + option.getArrayIndex(); choices++; SafeHtml html = fromTrustedString(option.getHtml()); searchContainer.before(ChosenTemplate.templates.choice(choiceId, getCss().searchChoice(), html, getCss().searchChoiceClose(), "" + option.getArrayIndex(), option.getValue(), getCss().iconCross()).asString()); $('#' + choiceId).find("a").click(new Function() { public boolean f(final Event e) { choiceDestroyLinkClick(e); return false; } }); } }
@Override protected void addChoice(OptionItem option) { if (maxSelectedOptionsReached()) { fireEvent(new MaxSelectedEvent(this)); } else { String choiceId = getContainerId() + "_c_" + option.getArrayIndex(); choices++; SafeHtml html = fromTrustedString(option.getHtml()); searchContainer.before(ChosenTemplate.templates.choice(choiceId, getCss().searchChoice(), html, getCss().searchChoiceClose(), "" + option.getArrayIndex(), option.getValue(), getCss().iconCross()).asString()); $('#' + choiceId).find("a").click(new Function() { public boolean f(final Event e) { choiceDestroyLinkClick(e); return false; } }); } }
private boolean containerMouseDown(Event e) { if (isDisabled) { return true; } Element target = e.getEventTarget().cast(); GQuery $e = $(target); boolean targetCloseLink = $e.hasClass(css.searchChoiceClose()); if (!resultsShowing) { e.stopPropagation(); } if (!pendingDestroyClick && !targetCloseLink) { if (!activeField) { if (isMultiple) { searchField.val(""); } $(document).click(clickTestAction); resultsShow(); } else if (!isMultiple && !$e.isEmpty() && ($e.get(0) == selectedItem.get(0) || $e.parents("a." + css.chznSingle()).length() > 0)) { e.preventDefault(); resultsToggle(); } activateField(e); } else { pendingDestroyClick = false; } return false; }