/** * All of the matched set of elements will be inserted at the end of the element(s) specified by * the parameter other. * * The operation $(A).appendTo(B) is, essentially, the reverse of doing a regular $(A).append(B), * instead of appending B to A, you're appending A to B. */ public GQuery appendTo(GQuery other) { other.append(this); return this; }
public void append(String xml) { g.append(JsUtils.parseXML(xml)); }
/** * All of the matched set of elements will be inserted at the end of the element(s) specified by * the parameter other. * * The operation $(A).appendTo(B) is, essentially, the reverse of doing a regular $(A).append(B), * instead of appending B to A, you're appending A to B. */ public GQuery appendTo(String html) { $(html).append(this); return this; }
/** * All of the matched set of elements will be inserted at the end of the element(s) specified by * the parameter other. * * The operation $(A).appendTo(B) is, essentially, the reverse of doing a regular $(A).append(B), * instead of appending B to A, you're appending A to B. */ public GQuery appendTo(Node n) { GQuery a = $(n); GQuery b = this; a.append(b); return this; }
public void append(XmlBuilder x) { g.append(x.getRootElement()); }
public void f() { try { // We clean up the returned string to smoothly append it to our document // Note: using '\s\S' instead of '.' because gwt String emulation does // not support java embedded flag expressions (?s) and javascript does // not have multidot flag. String s = arguments(0).toString().replaceAll("<![^>]+>\\s*", "") .replaceAll("</?html[\\s\\S]*?>\\s*", "") .replaceAll("<head[\\s\\S]*?</head>\\s*", "") .replaceAll("<script[\\s\\S]*?</script>\\s*", "") .replaceAll("</?body[\\s\\S]*?>\\s*", ""); // We wrap the results in a div s = "<div>" + s + "</div>"; Ajax.this.empty().append(filter.isEmpty() ? $(s) : $(s).find(filter)); if (onSuccess != null) { onSuccess.setElement(Ajax.this.get(0)); onSuccess.f(); } } catch (Exception e) { if (GWT.getUncaughtExceptionHandler() != null) { GWT.getUncaughtExceptionHandler().onUncaughtException(e); } } } });
@Override protected void searchFieldScale(int fWidth) { StringBuilder styleBlock = new StringBuilder("position:absolute; " + (isRTL() ? "right" : "left") + ": -1000px; top: -1000px; " + "visibility:hidden;"); String[] styleToCopy = {"font-size", "font-style", "font-weight", "font-family", "line-height", "text-transform", "letter-spacing"}; for (String style : styleToCopy) { styleBlock.append(style).append(':').append(getSearchField().css(style)).append(";"); } GQuery div = $("<div />").attr("style", styleBlock.toString()).text(getSearchField().val()); $("body").append(div); int w = div.width() + 25; div.remove(); if (w > fWidth - 10) { w = fWidth - 10; } getSearchField().css("width", w + "px"); }
@Override protected void searchFieldScale(int fWidth) { StringBuilder styleBlock = new StringBuilder("position:absolute; " + (isRTL() ? "right" : "left") + ": -1000px; top: -1000px; " + "visibility:hidden;"); String[] styleToCopy = {"font-size", "font-style", "font-weight", "font-family", "line-height", "text-transform", "letter-spacing"}; for (String style : styleToCopy) { styleBlock.append(style).append(':').append(getSearchField().css(style)).append(";"); } GQuery div = $("<div />").attr("style", styleBlock.toString()).text(getSearchField().val()); $("body").append(div); int w = div.width() + 25; div.remove(); if (w > fWidth - 10) { w = fWidth - 10; } getSearchField().css("width", w + "px"); }
private void searchFieldScale() { if (!isMultiple) { return; } StringBuilder styleBlock = new StringBuilder("position:absolute; " + (isRTL ? "right" : "left") + ": -1000px; top: -1000px; " + "visibility:hidden;"); String[] styleToCopy = { "font-size", "font-style", "font-weight", "font-family", "line-height", "text-transform", "letter-spacing"}; for (String style : styleToCopy) { styleBlock.append(style).append(':').append(searchField.css(style)); } GQuery div = $("<div />").attr("style", styleBlock.toString()).text(searchField.val()); $("body").append(div); int w = div.width() + 25; div.remove(); if (w > fWidth - 10) { w = fWidth - 10; } searchField.css("width", w + "px"); int ddTop = container.height(); dropdown.css("top", ddTop + "px"); }
private void noResults(String terms) { GQuery noResults = $(ChozenTemplate.templates.noResults(css.noResults(), resultsNoneFound).asString()); noResults.find("span").html(terms); searchResults.append(noResults); }
void noResults(String terms) { GQuery noResults = $(ChosenTemplate.templates.noResults(css.noResults(), resultsNoneFound).asString()); noResults.find("span").html(terms); searchResults.append(noResults); }
void noResults(String terms) { GQuery noResults = $(ChosenTemplate.templates.noResults(css.noResults(), resultsNoneFound).asString()); noResults.find("span").html(terms); searchResults.append(noResults); }
/** * Replaces all matched elements with elements selected by <code>target</code> . * * @return the GQuery element that was just replaced, which has been removed from the DOM and not * the new element that has replaced it. */ public GQuery replaceWith(GQuery target) { for (Element el : elements) { Element nextSibling = el.getNextSiblingElement(); if (nextSibling != null) { $(nextSibling).before(target); } else { Element parent = el.getParentElement(); $(parent).append(target); } $(el).remove(); } return this; }
/** * Replaces all matched elements with the specified HTML. * * @return the GQuery element that was just replaced, which has been removed from the DOM and not * the new element that has replaced it. */ public GQuery replaceWith(String html) { for (Element el : elements) { Element nextSibling = el.getNextSiblingElement(); if (nextSibling != null) { $(nextSibling).before(html); } else { Element parent = el.getParentElement(); $(parent).append(html); } $(el).remove(); } return this; }
/** * Load an external javascript library. The inserted script replaces the * element with the given id in the document. * * @deprecated use {@link com.google.gwt.query.client.plugins.ajax.Ajax#loadScript(String)} */ @Deprecated public static void loadScript(String url, String id) { GQuery gs = GQuery.$(DOM.createElement("script")); GQuery gp = GQuery.$("#" + id).parent(); if (gp.size() != 1) { gp = GQuery.$(GQuery.document.getBody()); } GQuery.$("#" + id).remove(); gp.append(gs.attr("src", url).attr("type", "text/javascript").attr("id", id)); }
/** * If the <code>oldElement</code> is a td, th, li tags, the new element will replaced its content. * In other cases, the <code>oldElement</code> will be replaced by the <code>newElement</code> * and the old element classes will be copied to the new element. */ private static void replaceOrAppend(Element oldElement, Element newElement) { assert oldElement != null && newElement != null; if (matchesTags(oldElement, appendingTags)) { GQuery.$(oldElement).html("").append(newElement); } else { GQuery.$(oldElement).replaceWith(newElement); // copy class String c = oldElement.getClassName(); if (!c.isEmpty()) { newElement.addClassName(c); } // copy id newElement.setId(oldElement.getId()); // ensure no duplicate id oldElement.setId(""); } }
/** * Insert a group to the list box. * * @param label the text of the group to be added * @param id the id of the optgroup element * @param index the index at which to insert it */ public void insertGroup(String label, String id, int index) { GQuery optGroup = $("<optgroup></optgroup>").attr("label", label); if (id != null) { optGroup.attr("id", id); } GQuery select = $(getElement()); int itemCount = SelectElement.as(getElement()).getLength(); if (index < 0 || index > itemCount) { select.append(optGroup); } else { GQuery before = select.children().eq(index); before.before(optGroup); } }
/** * Insert a group to the list box. * * @param label the text of the group to be added * @param id the id of the optgroup element * @param index the index at which to insert it */ public void insertGroup(String label, String id, int index) { GQuery optGroup = $("<optgroup></optgroup>").attr("label", label); if (id != null) { optGroup.attr("id", id); } GQuery select = $(getElement()); int itemCount = SelectElement.as(getElement()).getLength(); if (index < 0 || index > itemCount) { select.append(optGroup); } else { GQuery before = select.children().eq(index); before.before(optGroup); } }
/** * Insert a group to the list box. * * @param label the text of the group to be added * @param id the id of the optgroup element * @param index the index at which to insert it */ public void insertGroup(String label, String id, int index) { GQuery optGroup = $("<optgroup></optgroup>").attr("label", label); if (id != null){ optGroup.attr("id", id); } GQuery select = $(getElement()); int itemCount = SelectElement.as(getElement()).getLength(); if (index < 0 || index > itemCount) { select.append(optGroup); } else { GQuery before = select.children().eq(index); before.before(optGroup); } }
optgroup.append(option); } else { GQuery before = optgroup.children().eq(itemIndex);