Преглед изворни кода

Fix a disanbiguity introduced with SafeHtml patch

When using gwt-2.8.0 and java8 gwt compiler is more restrictive and
when you override a method(Object) with certain classes like
Interfaces or JSO, there is an error like:
The method $(Object) is ambiguous for the type GQuery.

Also updated lazy interface with new methods.
tags/gwtquery-project-1.5-beta1
Manolo Carrasco пре 9 година
родитељ
комит
f3c92755f5

+ 4
- 8
gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java Прегледај датотеку

if (o instanceof String) { if (o instanceof String) {
return $((String) o); return $((String) o);
} }
if (o instanceof SafeHtml) {
return $(((SafeHtml) o).asString());
}
if (o instanceof GQuery) { if (o instanceof GQuery) {
return (GQuery) o; return (GQuery) o;
} }
return $(selectorOrHtml, document); return $(selectorOrHtml, document);
} }
/**
* This function accepts a SafeHtml creating a GQuery element containing those elements.
*/
public static GQuery $(SafeHtml safeHtml) {
return $(safeHtml.asString());
}

/** /**
* This function accepts a string containing a CSS selector which is then used to match a set of * This function accepts a string containing a CSS selector which is then used to match a set of
* elements, or it accepts raw HTML creating a GQuery element containing those elements. The * elements, or it accepts raw HTML creating a GQuery element containing those elements. The
* its structure -- it is that element that will enwrap everything else. * its structure -- it is that element that will enwrap everything else.
*/ */
public GQuery wrap(SafeHtml safeHtml) { public GQuery wrap(SafeHtml safeHtml) {
return wrap(safeHtml.asString());
return wrap($(safeHtml));
} }


/** /**

+ 68
- 0
gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java Прегледај датотеку

import com.google.gwt.query.client.js.JsNodeArray; import com.google.gwt.query.client.js.JsNodeArray;
import com.google.gwt.query.client.plugins.Effects; import com.google.gwt.query.client.plugins.Effects;
import com.google.gwt.query.client.plugins.effects.PropertiesAnimation.Easing; import com.google.gwt.query.client.plugins.effects.PropertiesAnimation.Easing;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;


import java.util.List; import java.util.List;
*/ */
LazyGQuery<T> after(String html); LazyGQuery<T> after(String html);


/**
* Insert content after each of the matched elements. The elements must already be inserted into
* the document (you can't insert an element after another if it's not in the page).
*/
LazyGQuery<T> after(SafeHtml safeHtml);

/** /**
* *
* The animate() method allows you to create animation effects on any numeric HTML Attribute, * The animate() method allows you to create animation effects on any numeric HTML Attribute,
*/ */
LazyGQuery<T> append(String html); LazyGQuery<T> append(String html);


/**
* Append content to the inside of every matched element. This operation is similar to doing an
* appendChild to all the specified elements, adding them into the document.
*/
LazyGQuery<T> append(SafeHtml safeHtml);

/** /**
* All of the matched set of elements will be inserted at the end of the element(s) specified by * All of the matched set of elements will be inserted at the end of the element(s) specified by
* the parameter other. * the parameter other.
*/ */
LazyGQuery<T> appendTo(String html); LazyGQuery<T> appendTo(String html);


/**
* 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.
*/
LazyGQuery<T> appendTo(SafeHtml safeHtml);

/** /**
* Convert to Plugin interface provided by Class literal. * Convert to Plugin interface provided by Class literal.
*/ */
*/ */
LazyGQuery<T> html(String html); LazyGQuery<T> html(String html);


/**
* Set the innerHTML of every matched element.
*/
LazyGQuery<T> html(SafeHtml safeHtml);

/** /**
* Get the id of the first matched element. * Get the id of the first matched element.
*/ */
*/ */
LazyGQuery<T> queue(String queueName, Function... f); LazyGQuery<T> queue(String queueName, Function... f);


/**
* Specify a function to execute when the DOM is fully loaded.
*
* While JavaScript provides the load event for executing code when a page is rendered, this event
* is not seen if we attach an event listener after the document has been loaded.
* This guarantees that our gwt code will be executed either it's executed synchronously before the
* DOM has been rendered (ie: single script linker in header) or asynchronously.
*/
Promise ready(Function... fncs);

/** /**
* Removes all matched elements from the DOM. * Removes all matched elements from the DOM.
*/ */
*/ */
LazyGQuery<T> wrap(String html); LazyGQuery<T> wrap(String html);


/**
* Wrap each matched element with the specified SafeHtml content. This wrapping process is most useful
* for injecting additional structure into a document, without ruining the original semantic
* qualities of a document. This works by going through the first element provided (which is
* generated, on the fly, from the provided SafeHtml) and finds the deepest descendant element within
* its structure -- it is that element that will enwrap everything else.
*/
LazyGQuery<T> wrap(SafeHtml safeHtml);

/** /**
* Wrap all the elements in the matched set into a single wrapper element. This is different from * Wrap all the elements in the matched set into a single wrapper element. This is different from
* .wrap() where each element in the matched set would get wrapped with an element. This wrapping * .wrap() where each element in the matched set would get wrapped with an element. This wrapping
*/ */
LazyGQuery<T> wrapAll(String html); LazyGQuery<T> wrapAll(String html);


/**
* Wrap all the elements in the matched set into a single wrapper element. This is different from
* .wrap() where each element in the matched set would get wrapped with an element. This wrapping
* process is most useful for injecting additional structure into a document, without ruining the
* original semantic qualities of a document.
*
* This works by going through the first element provided (which is generated, on the fly, from
* the provided SafeHtml) and finds the deepest descendant element within its structure -- it is that
* element that will enwrap everything else.
*/
LazyGQuery<T> wrapAll(SafeHtml safeHtml);

/** /**
* Wrap the inner child contents of each matched element (including text nodes) with an HTML * Wrap the inner child contents of each matched element (including text nodes) with an HTML
* structure. This wrapping process is most useful for injecting additional structure into a * structure. This wrapping process is most useful for injecting additional structure into a
*/ */
LazyGQuery<T> wrapInner(String html); LazyGQuery<T> wrapInner(String html);


/**
* Wrap the inner child contents of each matched element (including text nodes) with an SafeHtml
* structure. This wrapping process is most useful for injecting additional structure into a
* document, without ruining the original semantic qualities of a document. This works by going
* through the first element provided (which is generated, on the fly, from the provided SafeHtml) and
* finds the deepest ancestor element within its structure -- it is that element that will enwrap
* everything else.
*/
LazyGQuery<T> wrapInner(SafeHtml safeHtml);

} }

Loading…
Откажи
Сачувај