]> source.dussan.org Git - gwtquery.git/commitdiff
Remove redundant methods
authorManolo Carrasco <manolo@apache.org>
Mon, 28 Feb 2011 21:52:09 +0000 (21:52 +0000)
committerManolo Carrasco <manolo@apache.org>
Mon, 28 Feb 2011 21:52:09 +0000 (21:52 +0000)
gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java
gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java

index e5c2ce4cbbde190ea63d5845d4edf42350587cf3..59fae4b37ca5be02c71b20c3126c4851436ca537 100644 (file)
@@ -21,7 +21,6 @@ import static com.google.gwt.query.client.plugins.Widgets.Widgets;
 \r
 import java.util.ArrayList;\r
 import java.util.Arrays;\r
-import java.util.Collection;\r
 import java.util.HashMap;\r
 import java.util.List;\r
 \r
@@ -198,17 +197,6 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
     return new GQuery(JSArray.create());\r
   }\r
 \r
-  /**\r
-   * Wrap a GQuery around a collection of existing widget.\r
-   */\r
-  public static GQuery $(Collection<Widget> widgetList){\r
-    JSArray elements = JSArray.create();\r
-    for (Widget w : widgetList){\r
-      elements.addNode(w.getElement());\r
-    }\r
-    return $(elements);\r
-  }\r
-\r
   /**\r
    * Wrap a GQuery around an existing element.\r
    */\r
@@ -238,13 +226,12 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
   }\r
   \r
   /**\r
-   * Create a new GQuery given a list of objects. \r
-   * Only node objects will be added;\r
+   * Create a new GQuery given a list of nodes, elements or widgets \r
    */\r
-  public static GQuery $(@SuppressWarnings("rawtypes") ArrayList a) {\r
+  public static GQuery $(@SuppressWarnings("rawtypes")List nodesOrWidgets) {\r
     JSArray elements = JSArray.create();\r
-    if (a != null) {\r
-      for (Object o : a ) {\r
+    if (nodesOrWidgets != null) {\r
+      for (Object o : nodesOrWidgets ) {\r
         if (o instanceof Node) {\r
           elements.addNode((Node)o);\r
         } else if (o instanceof Widget) {\r
@@ -352,17 +339,6 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
     return $(Arrays.asList(widgets));\r
   }\r
 \r
-  /**\r
-   * Wrap a GQuery around a List of existing widget.\r
-   */\r
-  public static <T extends Widget> GQuery $(List<T> widgets){\r
-    JSArray elements = JSArray.create();\r
-    for (Widget w : widgets){\r
-      elements.addNode(w.getElement());\r
-    }\r
-    return $(elements);\r
-  }\r
-\r
   /**\r
    * Wrap a JSON object.\r
    */\r
@@ -1631,7 +1607,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
    * producing a new array containing the return values.\r
    */\r
   @SuppressWarnings("unchecked")\r
-  public <W> ArrayList<W> map(Function f) {\r
+  public <W> List<W> map(Function f) {\r
     @SuppressWarnings("rawtypes")\r
     ArrayList ret = new ArrayList();\r
     for (int i = 0; i < elements().length; i++) {\r
index 5ec1d83175aca0f34000bf9c67e297c67c540a9c..c4616a8e9aeb99e907129ef5ceff4aba86e7c564 100644 (file)
@@ -19,7 +19,6 @@ import static com.google.gwt.query.client.plugins.Events.Events;
 import static com.google.gwt.query.client.plugins.Widgets.Widgets;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import com.google.gwt.core.client.GWT;
@@ -696,7 +695,7 @@ public interface LazyGQuery<T> extends LazyBase<T>{
    * Pass each element in the current matched set through a function, 
    * producing a new array containing the return values.
    */
-  <W> ArrayList<W> map(Function f);
+  <W> List<W> map(Function f);
 
   /**
    * Bind a set of functions to the mousedown event of each matched element.
index 5d5be8fd15e85099ac7f3d1345027f2f3b8d7d35..304dc9e8253136adfbc14e5cc941c4451deba5a2 100644 (file)
@@ -19,7 +19,7 @@ import static com.google.gwt.query.client.GQuery.$;
 import static com.google.gwt.query.client.GQuery.$$;
 import static com.google.gwt.query.client.GQuery.document;
 
-import java.util.ArrayList;
+import java.util.List;
 
 import junit.framework.Assert;
 
@@ -786,7 +786,6 @@ public class GQueryCoreTest extends GWTTestCase {
     assertEquals(true, isAttachedToTheDOM);
   }
   
-  @SuppressWarnings("unchecked")
   public void testGQueryWidgets() {
     final Button b1 = new Button("click-me");
     RootPanel.get().add(b1);
@@ -817,7 +816,7 @@ public class GQueryCoreTest extends GWTTestCase {
     String content = "<p id='1'/><p/><p id='2'/><p id='4'/>";
     $(e).html(content);
     
-    ArrayList<String> s = $("p", e).map(new Function() {
+    List<String> s = $("p", e).map(new Function() {
       public Object f(Element e, int i) {
         return null;
       }
@@ -837,7 +836,7 @@ public class GQueryCoreTest extends GWTTestCase {
     assertEquals("4", s.get(2));
     
 
-    ArrayList<Element> a = $("p", e).map(new Function() {
+    List<Element> a = $("p", e).map(new Function() {
       public Object f(Element e, int i) {
         String id = $(e).attr("id");
         return id.isEmpty() ? null: e;