diff options
4 files changed, 57 insertions, 296 deletions
diff --git a/devtest/pom.xml b/devtest/pom.xml index 2c69b0c4..add223c3 100644 --- a/devtest/pom.xml +++ b/devtest/pom.xml @@ -52,8 +52,7 @@ </testResources> <plugins> - - <plugin> + <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>gwt-maven-plugin</artifactId> <version>${gwtmaven}</version> @@ -67,8 +66,23 @@ <hostedWebapp>target/www</hostedWebapp> <soyc>true</soyc> </configuration> - </plugin> - + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-eclipse-plugin</artifactId> + <configuration> + <downloadSources>true</downloadSources> + <downloadJavadocs>false</downloadJavadocs> + <additionalBuildcommands> + <buildCommand> + <name>com.google.gwt.eclipse.core.gwtProjectValidator</name> + </buildCommand> + </additionalBuildcommands> + <additionalProjectnatures> + <projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature> + </additionalProjectnatures> + </configuration> + </plugin> </plugins> </build> </project> diff --git a/devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java b/devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java index f8f56215..912e16d8 100644 --- a/devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java +++ b/devtest/src/main/java/com/google/gwt/query/client/DevTestRunner.java @@ -18,12 +18,15 @@ package com.google.gwt.query.client; import static com.google.gwt.query.client.GQuery.$;
import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.query.client.js.JsUtils;
+import com.google.gwt.query.client.plugins.Events;
import com.google.gwt.query.client.plugins.effects.PropertiesAnimation;
import com.google.gwt.query.client.plugins.effects.PropertiesAnimation.Easing;
+import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Timer;
/**
@@ -46,13 +49,44 @@ public class DevTestRunner extends MyTestCase implements EntryPoint { public void onModuleLoad() {
try {
gwtSetUp();
- testPropertiesAnimationComputeEffects();
+ testLive();
+// testPropertiesAnimationComputeEffects();
} catch (Exception ex) {
ex.printStackTrace();
$(e).html("").after("<div>ERROR: " + ex.getMessage() + "</div>");
}
}
+ public void testAttrSelectors() {
+ System.out.println($("script:not([src])"));
+// System.out.println($("iframe:not([language])"));
+
+ }
+
+ public void testLive() {
+ $(e).html("<div id=d1 class='clickMe'>Content 1</div>");
+ GQuery q = $(".clickMe").live(Event.ONCLICK, new Function(){
+ public void f(Element e) {
+ $(e).css("color", "red");
+ }
+ });
+ $(e).append("<div id=d2 class='clickMe'>Content 2</div>");
+ assertEquals("", $("#d1").css("color"));
+
+ $(".clickMe", e).click();
+ assertEquals("red", $("#d1").css("color"));
+ assertEquals("red", $("#d2").css("color"));
+
+ $(".clickMe", e).css("color", "yellow");
+ $(".clickMe").die(Event.ONCLICK);
+ $(e).append("<div id=d3 class='clickMe'>Content 3</div>");
+ $(".clickMe", e).click();
+ assertEquals("yellow", $("#d1").css("color"));
+ assertEquals("yellow", $("#d2").css("color"));
+ assertEquals("", $("#d3").css("color"));
+ }
+
+
public void testPropertiesAnimationComputeEffects() {
$(e)
.html(
diff --git a/devtest/src/main/java/com/google/gwt/query/public/test.html b/devtest/src/main/java/com/google/gwt/query/public/test.html index aa38d9c8..fded2886 100644 --- a/devtest/src/main/java/com/google/gwt/query/public/test.html +++ b/devtest/src/main/java/com/google/gwt/query/public/test.html @@ -4,6 +4,8 @@ </head>
<body>
<script language="javascript" src="test.nocache.js"></script>
+ <script src="atest.nocache.js"></script>
+
</body>
</html>
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyWidgets.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyWidgets.java index cbc1581e..21822380 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyWidgets.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyWidgets.java @@ -14,308 +14,19 @@ * the License. */ 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.GQuery; -import com.google.gwt.query.client.plugins.widgets.ButtonWidgetFactory; -import com.google.gwt.query.client.plugins.widgets.CheckBoxWidgetFactory; -import com.google.gwt.query.client.plugins.widgets.DateBoxWidgetFactory; -import com.google.gwt.query.client.plugins.widgets.DecoratorPanelWidgetFactory; -import com.google.gwt.query.client.plugins.widgets.DisclosurePanelWidgetFactory; -import com.google.gwt.query.client.plugins.widgets.ListBoxWidgetFactory; -import com.google.gwt.query.client.plugins.widgets.PasswordTextBoxWidgetFactory; -import com.google.gwt.query.client.plugins.widgets.RadioButtonWidgetFactory; -import com.google.gwt.query.client.plugins.widgets.StackPanelWidgetFactory; -import com.google.gwt.query.client.plugins.widgets.SuggestBoxWidgetFactory; -import com.google.gwt.query.client.plugins.widgets.TabPanelWidgetFactory; -import com.google.gwt.query.client.plugins.widgets.TextAreaWidgetFactory; -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.WidgetInitializer; import com.google.gwt.query.client.plugins.widgets.WidgetsUtils; -import com.google.gwt.query.client.plugins.widgets.DisclosurePanelWidgetFactory.DisclosurePanelOptions; -import com.google.gwt.query.client.plugins.widgets.ListBoxWidgetFactory.ListBoxOptions; -import com.google.gwt.query.client.plugins.widgets.RadioButtonWidgetFactory.RadioButtonOption; -import com.google.gwt.query.client.plugins.widgets.StackPanelWidgetFactory.StackPanelOptions; -import com.google.gwt.query.client.plugins.widgets.SuggestBoxWidgetFactory.SuggestBoxOptions; -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.CheckBox; -import com.google.gwt.user.client.ui.DecoratorPanel; -import com.google.gwt.user.client.ui.DisclosurePanel; -import com.google.gwt.user.client.ui.ListBox; -import com.google.gwt.user.client.ui.PasswordTextBox; -import com.google.gwt.user.client.ui.RadioButton; -import com.google.gwt.user.client.ui.StackPanel; -import com.google.gwt.user.client.ui.SuggestBox; -import com.google.gwt.user.client.ui.TabPanel; -import com.google.gwt.user.client.ui.TextArea; -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; import com.google.gwt.query.client.LazyBase; public interface LazyWidgets<T> extends LazyBase<T>{ /** - * Create a {@link Button} widget for each selected element. The - * <code>initializers</code> will be called on each new {@link Button} created - * by passing them in parameter. - * - */ - LazyWidgets<T> button(); - - /** - * Create a {@link Button} widget for each selected element. The - * <code>initializers</code> will be called on each new {@link Button} created - * by passing them in parameter. - * - */ - LazyWidgets<T> button(WidgetInitializer<Button> initializers); - - /** - * Create a {@link DateBox} widget for each selected element. The - * <code>initializers</code> will be called on each new {@link Button} created - * by passing them in parameter. - */ - LazyWidgets<T> datebox(); - - /** - * Create a {@link DateBox} widget for each selected element. The - * <code>initializers</code> will be called on each new {@link Button} created - * by passing them in parameter. - */ - LazyWidgets<T> datebox(WidgetInitializer<DateBox> initializers); - - /** - * Create a {@link DisclosurePanel} widget for each selected elements. - */ - LazyWidgets<T> disclosurePanel(); - - /** - * Create a {@link DisclosurePanel} widget for each selected elements. - */ - LazyWidgets<T> disclosurePanel(DisclosurePanelOptions o, WidgetInitializer<DisclosurePanel> initializers); - - /** - * Create a {@link DisclosurePanel} widget for each selected elements. - */ - LazyWidgets<T> disclosurePanel(DisclosurePanelOptions o); - - /** - * Create {@link DisclosurePanel} widget for each selected elements. - */ - LazyWidgets<T> disclosurePanel(WidgetInitializer<DisclosurePanel> initializers); - - /** - * Create a {@link ListBox} widget for each selected element. The - * <code>initializers</code> will be called on each new {@link ListBox} - * created by passing them in parameter. - * - */ - LazyWidgets<T> listBox(ListBoxOptions options, WidgetInitializer<ListBox> initializers); - - /** - * Create a {@link ListBox} widget for each selected element. The - * <code>initializers</code> will be called on each new {@link ListBox} - * created by passing them in parameter. - * - */ - LazyWidgets<T> listBox(ListBoxOptions options); - - /** - * Create a {@link ListBox} widget for each selected element. The - * <code>initializers</code> will be called on each new {@link ListBox} - * created by passing them in parameter. - */ - LazyWidgets<T> listBox(WidgetInitializer<ListBox> initializers); - - /** - * Create a {@link ListBox} widget for each selected element. - */ - LazyWidgets<T> listBox(); - - /** - * Create a {@link PasswordTextBox} widget for each selected element. - */ - LazyWidgets<T> passwordBox(); - - /** - * Create a {@link CheckBox} widget for each selected element. - */ - LazyWidgets<T> checkBox(WidgetInitializer<CheckBox> initializers); - - /** - * Create a {@link CheckBox} widget for each selected element. - */ - LazyWidgets<T> checkBox(); - - /** - * Create a {@link PasswordTextBox} widget for each selected element. The - * <code>initializers</code> will be called on each new - * {@link PasswordTextBox} created by passing them in parameter. - * - */ - LazyWidgets<T> passwordBox(WidgetInitializer<PasswordTextBox> initializers); - - /** - * Create a {@link StackPanel} widget for each selected elements. Each div - * element inside a selected element will create a tab and the first h3 - * element inside the div will be used as title - */ - LazyWidgets<T> stackPanel(StackPanelOptions o, WidgetInitializer<StackPanel> initializers); - - /** - * Create a {@link StackPanel} widget for each selected elements. Each div - * element inside a selected element will create a tab and the first h3 - * element inside the div will be used as title - */ - LazyWidgets<T> stackPanel(StackPanelOptions o); - - /** - * 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 - */ - LazyWidgets<T> stackPanel(WidgetInitializer<StackPanel> initializers); - - /** - * 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 - */ - LazyWidgets<T> stackPanel(); - - /** - * Create {@link RadioButton} widget for each selected elements. All - * {@link RadioButton} created will be group under the same name specified in - * the {@link RadioButtonOption o} - */ - LazyWidgets<T> radioButton(RadioButtonOption o, WidgetInitializer<RadioButton> initializers); - - /** - * Create {@link RadioButton} widget for each selected elements. All - * {@link RadioButton} created will be group under the same name specified in - * the {@link RadioButtonOption o} - */ - LazyWidgets<T> radioButton(RadioButtonOption o); - - /** - * Create {@link RadioButton} widget for each selected elements. All - * {@link RadioButton} created will be group under the same name - */ - LazyWidgets<T> radioButton(WidgetInitializer<RadioButton> initializers); - - /** - * Create {@link RadioButton} widget for each selected elements. All - * {@link RadioButton} created will be group under the same name - */ - LazyWidgets<T> radioButton(); - - /** - * Create a {@link SuggestBox} widget for each selected element. The - * <code>initializers</code> will be called on each new {@link SuggestBox} - * created by passing them in parameter. - * - */ - LazyWidgets<T> suggestBox(SuggestBoxOptions options, WidgetInitializer<SuggestBox> initializers); - - /** - * Create a {@link SuggestBox} widget for each selected element. The - * <code>initializers</code> will be called on each new {@link SuggestBox} - * created by passing them in parameter. - * - */ - LazyWidgets<T> suggestBox(SuggestBoxOptions options); - - /** - * Create a {@link SuggestBox} widget for each selected element. The - * <code>initializers</code> will be called on each new {@link SuggestBox} - * created by passing them in parameter. - * - */ - LazyWidgets<T> suggestBox(WidgetInitializer<SuggestBox> initializers); - - /** - * Create a {@link SuggestBox} widget for each selected element. - */ - LazyWidgets<T> suggestBox(); - - /** - * Create a {@link TabPanel} widget for each selected elements. Each div - * element inside a selected element will create a tab and the first h3 - * element inside the div will be used as title - */ - LazyWidgets<T> tabPanel(TabPanelOptions o, WidgetInitializer<TabPanel> initializers); - - /** - * Create a {@link TabPanel} widget for each selected elements. Each div - * element inside a selected element will create a tab and the first h3 - * element inside the div will be used as title - */ - LazyWidgets<T> tabPanel(TabPanelOptions o); - - /** - * 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 - */ - LazyWidgets<T> tabPanel(WidgetInitializer<TabPanel> initializers); - - /** - * 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 - */ - LazyWidgets<T> tabPanel(); - - /** - * Create a {@link TextBox} widget for each selected element. The - * <code>initializers</code> will be called on each new {@link TextBox} - * created by passing them in parameter. - * - */ - LazyWidgets<T> textBox(); - - /** - * Create a {@link TextBox} widget for each selected element. The - * <code>initializers</code> will be called on each new {@link TextBox} - * created by passing them in parameter. - * - */ - LazyWidgets<T> textBox(WidgetInitializer<TextBox> initializers); - - /** - * Create a {@link TextArea} widget for each selected element. The - * <code>initializers</code> will be called on each new {@link TextBox} - * created by passing them in parameter. - * - */ - LazyWidgets<T> textArea(); - - /** - * Create a {@link TextArea} widget for each selected element. The - * <code>initializers</code> will be called on each new {@link TextBox} - * created by passing them in parameter. - * - */ - LazyWidgets<T> textArea(WidgetInitializer<TextArea> initializers); - - /** - * Create a {@link DecoratorPanel} widget for each selected element. - */ - LazyWidgets<T> decoratorPanel(); - - /** - * Create a {@link DecoratorPanel} widget for each selected element. The - * <code>initializers</code> will be called on each new {@link DecoratorPanel} - * created by passing them in parameter. - * - */ - LazyWidgets<T> decoratorPanel(WidgetInitializer<DecoratorPanel> initializers); - - /** * Try to create a widget using the given factory and the given options for * each element of the query. Returns a new gquery set of elements with the * new widgets created. |