diff options
Diffstat (limited to 'gwtquery-core/src/main/java/gwtquery/client/$.java')
-rw-r--r-- | gwtquery-core/src/main/java/gwtquery/client/$.java | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/gwtquery-core/src/main/java/gwtquery/client/$.java b/gwtquery-core/src/main/java/gwtquery/client/$.java new file mode 100644 index 00000000..273c951c --- /dev/null +++ b/gwtquery-core/src/main/java/gwtquery/client/$.java @@ -0,0 +1,81 @@ +package gwtquery.client; + +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.Node; +import com.google.gwt.dom.client.NodeList; + +/** + * + */ +public class $ { + + public static GQuery $(String selectorOrHtml) { + return GQuery.$(selectorOrHtml); + } + + public static <T extends GQuery> T $(T gq) { + return GQuery.$(gq); + } + + /** + * 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 second parameter is is a class + * reference to a plugin to be used. + */ + public static <T extends GQuery> T $(String selector, Class<T> plugin) { + return GQuery.$(selector, plugin); + } + + /** + * 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 second parameter is the context to + * use for the selector. + */ + public static GQuery $(String selector, Node context) { + return GQuery.$(selector, context); + } + + /** + * 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 second parameter is the context to + * use for the selector. The third parameter is the class plugin to use. + */ + public static <T extends GQuery> GQuery $(String selector, Node context, + Class<T> plugin) { + return GQuery.$(selector, context, plugin); + } + + /** + * Wrap a GQuery around existing Elements. + */ + public static GQuery $(NodeList<Element> elements) { + return GQuery.$(elements); + } + + /** + * Wrap a GQuery around an existing Element. + */ + public static GQuery $(Element element) { + return GQuery.$(element); + } + + /** + * Wrap a JSON object + */ + public static Properties $$(String properties) { + return GQuery.$$(properties); + } + + /** + * Registers a GQuery plugin + * @param plugin + * @param pluginFactory + */ + public static void registerPlugin(Class<? extends GQuery> plugin, + Plugin<? extends GQuery> pluginFactory) { + GQuery.registerPlugin(plugin, pluginFactory); + } +} |