From: Manuel Carrasco MoƱino Date: Sun, 3 Nov 2013 19:07:53 +0000 (+0100) Subject: Update lazy interfaces X-Git-Tag: release-1.4.0~35^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b10d40c6f59cae4899ab695ac319c829edd29e65;p=gwtquery.git Update lazy interfaces --- diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java index d34b503a..14cd6b44 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java @@ -12,23 +12,51 @@ * the License. */ package com.google.gwt.query.client; +import static com.google.gwt.query.client.plugins.QueuePlugin.*; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; - -import com.google.gwt.dom.client.Element; -import com.google.gwt.dom.client.Node; -import com.google.gwt.dom.client.NodeList; +import com.google.gwt.core.client.GWT; +import com.google.gwt.core.client.JavaScriptObject; +import com.google.gwt.core.client.JsArray; +import com.google.gwt.core.client.JsArrayMixed; +import com.google.gwt.core.client.JsArrayString; +import com.google.gwt.dom.client.*; +import com.google.gwt.dom.client.Style.Display; import com.google.gwt.dom.client.Style.HasCssName; -import com.google.gwt.query.client.GQuery.Offset; import com.google.gwt.query.client.css.CSS; import com.google.gwt.query.client.css.HasCssValue; import com.google.gwt.query.client.css.TakesCssValue; import com.google.gwt.query.client.css.TakesCssValue.CssSetter; +import com.google.gwt.query.client.impl.AttributeImpl; +import com.google.gwt.query.client.impl.DocumentStyleImpl; +import com.google.gwt.query.client.impl.SelectorEngine; +import com.google.gwt.query.client.js.JsCache; +import com.google.gwt.query.client.js.JsMap; import com.google.gwt.query.client.js.JsNamedArray; import com.google.gwt.query.client.js.JsNodeArray; +import com.google.gwt.query.client.js.JsObjectArray; +import com.google.gwt.query.client.js.JsUtils; import com.google.gwt.query.client.plugins.Effects; +import com.google.gwt.query.client.plugins.Events; +import com.google.gwt.query.client.plugins.Plugin; +import com.google.gwt.query.client.plugins.Widgets; +import com.google.gwt.query.client.plugins.ajax.Ajax; +import com.google.gwt.query.client.plugins.ajax.Ajax.Settings; +import com.google.gwt.query.client.plugins.deferred.Deferred; import com.google.gwt.query.client.plugins.effects.PropertiesAnimation.Easing; +import com.google.gwt.query.client.plugins.effects.Transitions; +import com.google.gwt.query.client.plugins.events.EventsListener; +import com.google.gwt.query.client.plugins.widgets.WidgetsUtils; +import com.google.gwt.regexp.shared.RegExp; +import com.google.gwt.user.client.DOM; +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.EventListener; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.Widget; +import com.google.gwt.query.client.LazyBase; public interface LazyGQuery extends LazyBase{ @@ -46,6 +74,12 @@ public interface LazyGQuery extends LazyBase{ */ LazyGQuery add(String selector); + /** + * Add the previous selection to the current selection. Useful for traversing elements, and then + * adding something that was matched before the last traversal. + */ + LazyGQuery addBack(); + /** * Adds the specified classes to each matched element. */ @@ -69,12 +103,6 @@ public interface LazyGQuery extends LazyBase{ */ LazyGQuery after(String html); - /** - * Add the previous selection to the current selection. Useful for traversing elements, and then - * adding something that was matched before the last traversal. - */ - LazyGQuery andSelf(); - /** * * The animate() method allows you to create animation effects on any numeric HTML Attribute, @@ -2189,6 +2217,37 @@ public interface LazyGQuery extends LazyBase{ */ String toString(); + /** + * The transition() method allows you to create animation effects on any numeric HTML Attribute, + * CSS property, or color using CSS3 transformations and transitions. + * + * It works similar to animate(), and support chainning and queueing. + * + * Example: + * $("#foo").transition("{ opacity: 0.1, scale: 2, x: 50, y: 50 }", 5000, EasingCurve.easeInBack); + * + * $("#bar") + * .transition("{ opacity: 0.1, scale: 2, x: 50, y: 50 }", 5000, EasingCurve.easeInBack) + * .transition("{x: +100, width: +40px}", 2000, EasingCurve.easeOut); + * + */ + LazyGQuery transition(Object stringOrProperties, int duration, Easing easing, Function... funcs); + + /** + * The transition() method allows you to create animation effects on any numeric HTML Attribute, + * CSS property, or color using CSS3 transformations and transitions. + * + * It works similar to animate() but has an extra parameter for delaying the animation, so as + * we dont have to use GQuery queue system for delaying executions, nor callbacks for firing more + * animations + * + * Example animate an element within 2 seconds: + * $("#foo") + * .transition("{ opacity: 0.1, scale: 2, x: 50, y: 50 }", 5000, 2000, EasingCurve.easeInBack); + * + */ + LazyGQuery transition(Object stringOrProperties, int duration, int delay, Easing easing, Function... funcs); + /** * Produces a string representation of the matched elements. */ diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyEffects.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyEffects.java index b7686302..cdcc61d2 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyEffects.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyEffects.java @@ -25,6 +25,7 @@ import com.google.gwt.query.client.plugins.effects.ClipAnimation.Direction; import com.google.gwt.query.client.plugins.effects.Fx; import com.google.gwt.query.client.plugins.effects.PropertiesAnimation; import com.google.gwt.query.client.plugins.effects.PropertiesAnimation.Easing; +import com.google.gwt.query.client.plugins.effects.PropertiesAnimation.EasingCurve; import com.google.gwt.query.client.LazyBase; public interface LazyEffects extends LazyBase{ @@ -45,9 +46,9 @@ public interface LazyEffects extends LazyBase{ *
    *  //move the element from its original position to the position top:500px and left:500px for 400ms.
    *  //use a swing easing function for the transition
-   *  $("#foo").animate(Properties.create("{top:'500px',left:'500px'}"), 400, Easing.SWING);
+   *  $("#foo").animate(Properties.create("{top:'500px',left:'500px'}"), 400, EasingCurve.swing);
    *  // Change the width and border attributes of a table
-   *  $("table").animate(Properties.create("{$width: '500', $border: '10'}"), 400, Easing.LINEAR);
+   *  $("table").animate(Properties.create("{$width: '500', $border: '10'}"), 400, EasingCurve.linear);
    * 
* * In addition to numeric values, each property can take the strings 'show', @@ -71,8 +72,8 @@ public interface LazyEffects extends LazyBase{ * Example: * *
-   *  $("#foo").animate("backgroundColor:'red', color:'#ffffff', borderColor:'rgb(129, 0, 70)'", 400, Easing.SWING);
-   *  $("#foo").animate($$("{backgroundColor:'red', color:'#ffffff', borderColor:'rgb(129, 0, 70)'}"), 400, Easing.SWING);
+   *  $("#foo").animate("backgroundColor:'red', color:'#ffffff', borderColor:'rgb(129, 0, 70)'", 400, EasingCurve.swing);
+   *  $("#foo").animate($$("{backgroundColor:'red', color:'#ffffff', borderColor:'rgb(129, 0, 70)'}"), 400, EasingCurve.swing);
    * 
* * @param p a {@link Properties} object containing css properties to animate. @@ -101,7 +102,7 @@ public interface LazyEffects extends LazyBase{ * //move the element from its original position to left:500px for 500ms * $("#foo").animate("left:'500'"); * // Change the width attribute of a table - * $("table").animate("$width:'500'"), 400, Easing.LINEAR); + * $("table").animate("$width:'500'"), 400, EasingCurve.swing); * * * In addition to numeric values, each property can take the strings 'show',