diff options
author | Julien Dramaix <julien.dramaix@gmail.com> | 2011-03-04 20:10:44 +0000 |
---|---|---|
committer | Julien Dramaix <julien.dramaix@gmail.com> | 2011-03-04 20:10:44 +0000 |
commit | e3edf6debf7cb5ee6ffc2f12ee1ad72880304a8e (patch) | |
tree | 27ad6a6622068143c2e725eeee5faaab1b061147 | |
parent | cb386194b14972335388be3166aebbfa7df0e4a3 (diff) | |
download | gwtquery-e3edf6debf7cb5ee6ffc2f12ee1ad72880304a8e.tar.gz gwtquery-e3edf6debf7cb5ee6ffc2f12ee1ad72880304a8e.zip |
remove useless functions
3 files changed, 15 insertions, 57 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java index ea0fee16..f30b2901 100755 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java @@ -15,9 +15,6 @@ */
package com.google.gwt.query.client.plugins;
-import java.util.ArrayList;
-import java.util.List;
-
import com.google.gwt.dom.client.Element;
import com.google.gwt.query.client.Function;
import com.google.gwt.query.client.GQuery;
@@ -25,16 +22,18 @@ import com.google.gwt.query.client.plugins.widgets.ButtonWidgetFactory; import com.google.gwt.query.client.plugins.widgets.DateBoxWidgetFactory;
import com.google.gwt.query.client.plugins.widgets.RichTextWidgetFactory;
import com.google.gwt.query.client.plugins.widgets.TabPanelWidgetFactory;
-import com.google.gwt.query.client.plugins.widgets.TabPanelWidgetFactory.TabPanelOptions;
import com.google.gwt.query.client.plugins.widgets.TextBoxWidgetFactory;
import com.google.gwt.query.client.plugins.widgets.WidgetFactory;
-import com.google.gwt.query.client.plugins.widgets.WidgetOptions;
+import com.google.gwt.query.client.plugins.widgets.TabPanelWidgetFactory.TabPanelOptions;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.TabPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.datepicker.client.DateBox;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Widgets plugin for Gwt Query. Be careful, this plugin is still experimental.
* The api can change in next releases.
@@ -55,33 +54,14 @@ public class Widgets extends QueuePlugin<Widgets> { super(gq);
}
- /**
- * Create an return a {@link TabPanel} widget with the first selected
- * elements. Each div element will create a tab and the first h3 element
- * inside the div will be used as title. The <code>initFunctions</code> will
- * be called on the new {@link TabPanel} created by passing it in parameter.
- *
- */
- public TabPanel tabPanel(Function... initFunctions) {
- return tabPanel(new TabPanelOptions());
- }
-
- /**
- * Create an return a {@link TabPanel} widget with the first selected elements
- * by using a {@link TabPanelOptions}. The <code>initFunctions</code> will be
- * called on each new {@link Button} created by passing them in parameter.
- */
- public TabPanel tabPanel(TabPanelOptions o, Function... initFunctions) {
- return widget(new TabPanelWidgetFactory(o), initFunctions);
- }
/**
* Create {@link TabPanel} widget for each selected elements. Each div element
* will create a tab and the first h3 element inside the div will be used as
* title
*/
- public Widgets tabPanels(Function... initFunctions) {
- return tabPanels(new TabPanelOptions(), initFunctions);
+ public Widgets tabPanel(Function... initFunctions) {
+ return tabPanel(new TabPanelOptions(), initFunctions);
}
/**
@@ -89,19 +69,10 @@ public class Widgets extends QueuePlugin<Widgets> { * element inside a selected element will create a tab and the first h3
* element inside the div will be used as title
*/
- public Widgets tabPanels(TabPanelOptions o, Function... initFunctions) {
+ public Widgets tabPanel(TabPanelOptions o, Function... initFunctions) {
return widgets(new TabPanelWidgetFactory(o), initFunctions);
}
- /**
- * Create an return a {@link Button} widget with the first element of the
- * query.The <code>initFunctions</code> will be called on the new
- * {@link Button} created by passing it in parameter.
- *
- */
- public Button button(Function... initFunctions) {
- return widget(new ButtonWidgetFactory(), initFunctions);
- }
/**
* Create a {@link Button} widget for each selected element. The
@@ -109,7 +80,7 @@ public class Widgets extends QueuePlugin<Widgets> { * created by passing them in parameter.
*
*/
- public Widgets buttons(Function... initFunctions) {
+ public Widgets button(Function... initFunctions) {
return widgets(new ButtonWidgetFactory(), initFunctions);
}
@@ -125,20 +96,7 @@ public class Widgets extends QueuePlugin<Widgets> { public Widgets richtext(Function... initFunctions) {
return widgets(new RichTextWidgetFactory(), initFunctions);
}
-
-
- /**
- * Create an return a {@link TextBox} widget with the first element of the
- * query.The <code>initFunctions</code> will be called on the new
- * {@link TextBox} created by passing it in parameter.
- *
- * A {@link TextBox} is created if the element is a <i>input</i> with type
- * text, a <i>div</i> or a<i>span</i> element.
- */
- public TextBox textBox(Function... initFunctions) {
- return widget(new TextBoxWidgetFactory(), initFunctions);
- }
-
+
/**
* Create a {@link TextBox} widget for each selected element. The
* <code>initFunctions</code> will be called on each new {@link TextBox}
@@ -147,14 +105,14 @@ public class Widgets extends QueuePlugin<Widgets> { * A {@link TextBox} is created if the element is a <i>input</i> with type
* text, a <i>div</i> or a<i>span</i> element.
*/
- public Widgets textBoxes(Function... initFunctions) {
+ public Widgets textBox(Function... initFunctions) {
return widgets(new TextBoxWidgetFactory(), initFunctions);
}
/**
* Create and return a widget using the given factory and the given options
*/
- public <W extends Widget> W widget(WidgetFactory<W> factory,
+ protected <W extends Widget> W widget(WidgetFactory<W> factory,
Function... initFunctions) {
return widget(get(0), factory, initFunctions);
@@ -180,7 +138,7 @@ public class Widgets extends QueuePlugin<Widgets> { /**
* Create and return a widget using the given factory and the given options
*/
- protected <W extends Widget, O extends WidgetOptions> W widget(Element e,
+ protected <W extends Widget> W widget(Element e,
WidgetFactory<W> factory, Function... initFunctions) {
W widget = factory.create(e);
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryWidgetsTest.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryWidgetsTest.java index 3ae8a405..25a811f4 100644 --- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryWidgetsTest.java +++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryWidgetsTest.java @@ -112,7 +112,7 @@ public class GQueryWidgetsTest extends GWTTestCase { assertEquals(b1, b2); - b2 = $("<button>Click-me</button>").appendTo(document).as(Widgets.Widgets).button(); + b2 = $("<button>Click-me</button>").appendTo(document).as(Widgets.Widgets).button().widget(); b2.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { $(b1).css("color", "red"); diff --git a/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java b/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java index 20d59ccb..212c36f9 100644 --- a/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java +++ b/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java @@ -33,9 +33,9 @@ public class GwtQueryWidgetModule implements EntryPoint { public void onModuleLoad() {
- $(".inputText").as(Widgets).textBoxes();
+ $(".inputText").as(Widgets).textBox();
- $(".btn").as(Widgets).buttons(new Function() {
+ $(".btn").as(Widgets).button(new Function() {
public void f(Widget w) {
|