aboutsummaryrefslogtreecommitdiffstats
path: root/gwtquery-core/src/main/java/gwtquery/client/$.java
blob: 273c951cb491a0a01cc0914ff8258e2c28f4b8bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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);
  }
}