Browse Source

Remove redundant methods

tags/release-1.3.2
Manolo Carrasco 13 years ago
parent
commit
0a6c4e34c4

+ 5
- 29
gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java View File

@@ -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;
@@ -198,17 +197,6 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
return new GQuery(JSArray.create());
}
/**
* 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.
*/
@@ -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) {
@@ -352,17 +339,6 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
return $(Arrays.asList(widgets));
}
/**
* 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.
*/
@@ -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++) {

+ 1
- 2
gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java View 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.

+ 3
- 4
gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java View 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;

Loading…
Cancel
Save