aboutsummaryrefslogtreecommitdiffstats
path: root/gwtquery-core
diff options
context:
space:
mode:
authorManolo Carrasco <manolo@apache.org>2011-02-28 21:52:09 +0000
committerManolo Carrasco <manolo@apache.org>2011-02-28 21:52:09 +0000
commit0a6c4e34c43c9731058d2acc0f3591a13f871135 (patch)
treec6513fed3c80cc857d015195f62f6574cf0e9331 /gwtquery-core
parent4f667da72fcd4b550ee844b98ff94586cb68d6a4 (diff)
downloadgwtquery-0a6c4e34c43c9731058d2acc0f3591a13f871135.tar.gz
gwtquery-0a6c4e34c43c9731058d2acc0f3591a13f871135.zip
Remove redundant methods
Diffstat (limited to 'gwtquery-core')
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java34
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java3
-rw-r--r--gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java7
3 files changed, 9 insertions, 35 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
index e5c2ce4c..59fae4b3 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
@@ -21,7 +21,6 @@ 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;
@@ -199,17 +198,6 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
}
/**
- * Wrap a GQuery around a collection of existing widget.
- */
- public static GQuery $(Collection<Widget> widgetList){
- JSArray elements = JSArray.create();
- for (Widget w : widgetList){
- elements.addNode(w.getElement());
- }
- return $(elements);
- }
-
- /**
* Wrap a GQuery around an existing element.
*/
public static GQuery $(Element element) {
@@ -238,13 +226,12 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
}
/**
- * Create a new GQuery given a list of objects.
- * Only node objects will be added;
+ * Create a new GQuery given a list of nodes, elements or widgets
*/
- public static GQuery $(@SuppressWarnings("rawtypes") ArrayList a) {
+ public static GQuery $(@SuppressWarnings("rawtypes")List nodesOrWidgets) {
JSArray elements = JSArray.create();
- if (a != null) {
- for (Object o : a ) {
+ if (nodesOrWidgets != null) {
+ for (Object o : nodesOrWidgets ) {
if (o instanceof Node) {
elements.addNode((Node)o);
} else if (o instanceof Widget) {
@@ -353,17 +340,6 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
}
/**
- * Wrap a GQuery around a List of existing widget.
- */
- public static <T extends Widget> GQuery $(List<T> widgets){
- JSArray elements = JSArray.create();
- for (Widget w : widgets){
- elements.addNode(w.getElement());
- }
- return $(elements);
- }
-
- /**
* Wrap a JSON object.
*/
public static Properties $$(String properties) {
@@ -1631,7 +1607,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
* producing a new array containing the return values.
*/
@SuppressWarnings("unchecked")
- public <W> ArrayList<W> map(Function f) {
+ public <W> List<W> map(Function f) {
@SuppressWarnings("rawtypes")
ArrayList ret = new ArrayList();
for (int i = 0; i < elements().length; i++) {
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java
index 5ec1d831..c4616a8e 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java
@@ -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.
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java
index 5d5be8fd..304dc9e8 100644
--- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java
+++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java
@@ -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;