]> source.dussan.org Git - gwtquery.git/commitdiff
remove useless functions
authorJulien Dramaix <julien.dramaix@gmail.com>
Fri, 4 Mar 2011 20:10:44 +0000 (20:10 +0000)
committerJulien Dramaix <julien.dramaix@gmail.com>
Fri, 4 Mar 2011 20:10:44 +0000 (20:10 +0000)
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Widgets.java
gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryWidgetsTest.java
samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java

index ea0fee16de91c524dfb29013e3df7fdaac454e61..f30b290117749c575801baa936e12de9e891cb97 100755 (executable)
@@ -15,9 +15,6 @@
  */\r
 package com.google.gwt.query.client.plugins;\r
 \r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
 import com.google.gwt.dom.client.Element;\r
 import com.google.gwt.query.client.Function;\r
 import com.google.gwt.query.client.GQuery;\r
@@ -25,16 +22,18 @@ import com.google.gwt.query.client.plugins.widgets.ButtonWidgetFactory;
 import com.google.gwt.query.client.plugins.widgets.DateBoxWidgetFactory;\r
 import com.google.gwt.query.client.plugins.widgets.RichTextWidgetFactory;\r
 import com.google.gwt.query.client.plugins.widgets.TabPanelWidgetFactory;\r
-import com.google.gwt.query.client.plugins.widgets.TabPanelWidgetFactory.TabPanelOptions;\r
 import com.google.gwt.query.client.plugins.widgets.TextBoxWidgetFactory;\r
 import com.google.gwt.query.client.plugins.widgets.WidgetFactory;\r
-import com.google.gwt.query.client.plugins.widgets.WidgetOptions;\r
+import com.google.gwt.query.client.plugins.widgets.TabPanelWidgetFactory.TabPanelOptions;\r
 import com.google.gwt.user.client.ui.Button;\r
 import com.google.gwt.user.client.ui.TabPanel;\r
 import com.google.gwt.user.client.ui.TextBox;\r
 import com.google.gwt.user.client.ui.Widget;\r
 import com.google.gwt.user.datepicker.client.DateBox;\r
 \r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
 /**\r
  * Widgets plugin for Gwt Query. Be careful, this plugin is still experimental.\r
  * The api can change in next releases.\r
@@ -55,33 +54,14 @@ public class Widgets extends QueuePlugin<Widgets> {
     super(gq);\r
   }\r
 \r
-  /**\r
-   * Create an return a {@link TabPanel} widget with the first selected\r
-   * elements. Each div element will create a tab and the first h3 element\r
-   * inside the div will be used as title. The <code>initFunctions</code> will\r
-   * be called on the new {@link TabPanel} created by passing it in parameter.\r
-   * \r
-   */\r
-  public TabPanel tabPanel(Function... initFunctions) {\r
-    return tabPanel(new TabPanelOptions());\r
-  }\r
-\r
-  /**\r
-   * Create an return a {@link TabPanel} widget with the first selected elements\r
-   * by using a {@link TabPanelOptions}. The <code>initFunctions</code> will be\r
-   * called on each new {@link Button} created by passing them in parameter.\r
-   */\r
-  public TabPanel tabPanel(TabPanelOptions o, Function... initFunctions) {\r
-    return widget(new TabPanelWidgetFactory(o), initFunctions);\r
-  }\r
 \r
   /**\r
    * Create {@link TabPanel} widget for each selected elements. Each div element\r
    * will create a tab and the first h3 element inside the div will be used as\r
    * title\r
    */\r
-  public Widgets tabPanels(Function... initFunctions) {\r
-    return tabPanels(new TabPanelOptions(), initFunctions);\r
+  public Widgets tabPanel(Function... initFunctions) {\r
+    return tabPanel(new TabPanelOptions(), initFunctions);\r
   }\r
 \r
   /**\r
@@ -89,19 +69,10 @@ public class Widgets extends QueuePlugin<Widgets> {
    * element inside a selected element will create a tab and the first h3\r
    * element inside the div will be used as title\r
    */\r
-  public Widgets tabPanels(TabPanelOptions o, Function... initFunctions) {\r
+  public Widgets tabPanel(TabPanelOptions o, Function... initFunctions) {\r
     return widgets(new TabPanelWidgetFactory(o), initFunctions);\r
   }\r
 \r
-  /**\r
-   * Create an return a {@link Button} widget with the first element of the\r
-   * query.The <code>initFunctions</code> will be called on the new\r
-   * {@link Button} created by passing it in parameter.\r
-   * \r
-   */\r
-  public Button button(Function... initFunctions) {\r
-    return widget(new ButtonWidgetFactory(), initFunctions);\r
-  }\r
 \r
   /**\r
    * Create a {@link Button} widget for each selected element. The\r
@@ -109,7 +80,7 @@ public class Widgets extends QueuePlugin<Widgets> {
    * created by passing them in parameter.\r
    * \r
    */\r
-  public Widgets buttons(Function... initFunctions) {\r
+  public Widgets button(Function... initFunctions) {\r
     return widgets(new ButtonWidgetFactory(), initFunctions);\r
   }\r
 \r
@@ -125,20 +96,7 @@ public class Widgets extends QueuePlugin<Widgets> {
   public Widgets richtext(Function... initFunctions) {\r
     return widgets(new RichTextWidgetFactory(), initFunctions);\r
   }\r
-\r
-\r
-  /**\r
-   * Create an return a {@link TextBox} widget with the first element of the\r
-   * query.The <code>initFunctions</code> will be called on the new\r
-   * {@link TextBox} created by passing it in parameter.\r
-   * \r
-   * A {@link TextBox} is created if the element is a <i>input</i> with type\r
-   * text, a <i>div</i> or a<i>span</i> element.\r
-   */\r
-  public TextBox textBox(Function... initFunctions) {\r
-    return widget(new TextBoxWidgetFactory(), initFunctions);\r
-  }\r
-\r
+  \r
   /**\r
    * Create a {@link TextBox} widget for each selected element. The\r
    * <code>initFunctions</code> will be called on each new {@link TextBox}\r
@@ -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\r
    * text, a <i>div</i> or a<i>span</i> element.\r
    */\r
-  public Widgets textBoxes(Function... initFunctions) {\r
+  public Widgets textBox(Function... initFunctions) {\r
     return widgets(new TextBoxWidgetFactory(), initFunctions);\r
   }\r
 \r
   /**\r
    * Create and return a widget using the given factory and the given options\r
    */\r
-  public <W extends Widget> W widget(WidgetFactory<W> factory,\r
+  protected <W extends Widget> W widget(WidgetFactory<W> factory,\r
       Function... initFunctions) {\r
 \r
     return widget(get(0), factory, initFunctions);\r
@@ -180,7 +138,7 @@ public class Widgets extends QueuePlugin<Widgets> {
   /**\r
    * Create and return a widget using the given factory and the given options\r
    */\r
-  protected <W extends Widget, O extends WidgetOptions> W widget(Element e,\r
+  protected <W extends Widget> W widget(Element e,\r
       WidgetFactory<W> factory, Function... initFunctions) {\r
 \r
     W widget = factory.create(e);\r
index 3ae8a40506af14cc32644ce625dc41eb60c93091..25a811f4972235aa88c1b8afa9f30f521385cbbf 100644 (file)
@@ -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");
index 20d59ccb2aac23b517032555c57e74a5d69fa062..212c36f93a247c81b85a464240d6933300767e49 100644 (file)
@@ -33,9 +33,9 @@ public class GwtQueryWidgetModule implements EntryPoint {
 \r
   public void onModuleLoad() {\r
 \r
-    $(".inputText").as(Widgets).textBoxes();\r
+    $(".inputText").as(Widgets).textBox();\r
     \r
-    $(".btn").as(Widgets).buttons(new Function() {\r
+    $(".btn").as(Widgets).button(new Function() {\r
       \r
       public void f(Widget w) {\r
         \r