From e3edf6debf7cb5ee6ffc2f12ee1ad72880304a8e Mon Sep 17 00:00:00 2001 From: Julien Dramaix Date: Fri, 4 Mar 2011 20:10:44 +0000 Subject: [PATCH] remove useless functions --- .../gwt/query/client/plugins/Widgets.java | 66 ++++--------------- .../gwt/query/client/GQueryWidgetsTest.java | 2 +- .../samples/client/GwtQueryWidgetModule.java | 4 +- 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 { 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 initFunctions 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 initFunctions 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 { * 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 initFunctions 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 { * 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 { 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 initFunctions will be called on the new - * {@link TextBox} created by passing it in parameter. - * - * A {@link TextBox} is created if the element is a input with type - * text, a div or aspan element. - */ - public TextBox textBox(Function... initFunctions) { - return widget(new TextBoxWidgetFactory(), initFunctions); - } - + /** * Create a {@link TextBox} widget for each selected element. The * initFunctions will be called on each new {@link TextBox} @@ -147,14 +105,14 @@ public class Widgets extends QueuePlugin { * A {@link TextBox} is created if the element is a input with type * text, a div or aspan 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 widget(WidgetFactory factory, + protected W widget(WidgetFactory factory, Function... initFunctions) { return widget(get(0), factory, initFunctions); @@ -180,7 +138,7 @@ public class Widgets extends QueuePlugin { /** * Create and return a widget using the given factory and the given options */ - protected W widget(Element e, + protected W widget(Element e, WidgetFactory 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 = $("").appendTo(document).as(Widgets.Widgets).button(); + b2 = $("").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) { -- 2.39.5