aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManolo Carrasco <manolo@apache.org>2011-09-05 18:20:04 +0000
committerManolo Carrasco <manolo@apache.org>2011-09-05 18:20:04 +0000
commit4d91ee517b619b6e0526c4464f698aa8eb0a0081 (patch)
treef3ed9790f2a7538e16bd628686046c968e81a727
parent15ae17b35ba87164d46e48e351783035b9eecbf2 (diff)
downloadgwtquery-4d91ee517b619b6e0526c4464f698aa8eb0a0081.tar.gz
gwtquery-4d91ee517b619b6e0526c4464f698aa8eb0a0081.zip
Little changes to facilitate the export of gquery to javascript. Add snapshot suffix to version number
-rw-r--r--archetype/pom.xml2
-rw-r--r--devtest/pom.xml2
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java8
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java5
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java8
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImplIE.java4
-rwxr-xr-xgwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Effects.java58
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/LazyEffects.java4
-rw-r--r--samples/pom.xml2
9 files changed, 50 insertions, 43 deletions
diff --git a/archetype/pom.xml b/archetype/pom.xml
index 378dda55..9219a8ed 100644
--- a/archetype/pom.xml
+++ b/archetype/pom.xml
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.googlecode.gwtquery</groupId>
<artifactId>gquery-archetype</artifactId>
- <version>1.1.0.rc1-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
<packaging>maven-archetype</packaging>
<name>GwtQuery Archetype</name>
<description>This archetype generates a Gwt-2.2.0 project with all set to use GwtQuery and its plugins</description>
diff --git a/devtest/pom.xml b/devtest/pom.xml
index a648882d..14604e62 100644
--- a/devtest/pom.xml
+++ b/devtest/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>com.googlecode.gwtquery</groupId>
<artifactId>gwtquery-project</artifactId>
- <version>1.1.0.rc1-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
</parent>
<artifactId>devtest</artifactId>
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
index 0208b69f..4a4daffd 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
@@ -728,8 +728,8 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
* @param funcs an array of {@link Function} called once the animation is
* complete
*/
- public GQuery animate(String prop, Function... funcs) {
- return as(Effects).animate(prop, funcs);
+ public GQuery animate(Object stringOrProperties, Function... funcs) {
+ return as(Effects).animate(stringOrProperties, funcs);
}
/**
@@ -787,8 +787,8 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
* complete
* @param duration the duration in milliseconds of the animation
*/
- public GQuery animate(String prop, int duration, Function... funcs) {
- return as(Effects).animate(prop, duration, funcs);
+ public GQuery animate(Object stringOrProperties, int duration, Function... funcs) {
+ return as(Effects).animate(stringOrProperties, duration, funcs);
}
/**
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 946a11e3..16ab8ec7 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
@@ -32,6 +32,7 @@ import com.google.gwt.dom.client.OptionElement;
import com.google.gwt.dom.client.SelectElement;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.HasCssName;
+import com.google.gwt.dom.client.StyleInjector.StyleInjectorImpl;
import com.google.gwt.dom.client.TextAreaElement;
import com.google.gwt.query.client.css.HasCssValue;
import com.google.gwt.query.client.css.TakesCssValue;
@@ -218,7 +219,7 @@ public interface LazyGQuery<T> extends LazyBase<T>{
* @param funcs an array of {@link Function} called once the animation is
* complete
*/
- LazyGQuery<T> animate(String prop, Function... funcs);
+ LazyGQuery<T> animate(Object stringOrProperties, Function... funcs);
/**
* The animate() method allows you to create animation effects on any numeric
@@ -275,7 +276,7 @@ public interface LazyGQuery<T> extends LazyBase<T>{
* complete
* @param duration the duration in milliseconds of the animation
*/
- LazyGQuery<T> animate(String prop, int duration, Function... funcs);
+ LazyGQuery<T> animate(Object stringOrProperties, int duration, Function... funcs);
/**
* Append content to the inside of every matched element. This operation is
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java
index d24eeb41..7cd8b90f 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImpl.java
@@ -96,7 +96,11 @@ public class DocumentStyleImpl {
if (!force) {
return ret == null ? "" : ret;
} else {
- return getComputedStyle(elem, JsUtils.hyphenize(name), name, null);
+ try {
+ return getComputedStyle(elem, JsUtils.hyphenize(name), name, null);
+ } catch (Exception e) {
+ return ret;
+ }
}
}
@@ -168,7 +172,7 @@ public class DocumentStyleImpl {
protected native String getComputedStyle(Element elem, String hyphenName,
String camelName, String pseudo) /*-{
var cStyle = $doc.defaultView.getComputedStyle(elem, pseudo);
- return cStyle ? cStyle.getPropertyValue(hyphenName) : null;
+ return cStyle && cStyle.getPropertyValue ? cStyle.getPropertyValue(hyphenName) : null;
}-*/;
protected static final JsNamedArray<String> elemdisplay = JsNamedArray.create();
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImplIE.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImplIE.java
index b4d436a3..318a81a9 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImplIE.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/impl/DocumentStyleImplIE.java
@@ -63,7 +63,8 @@ public class DocumentStyleImplIE extends DocumentStyleImpl {
* Remove a style property from an element.
*/
public native void removeStyleProperty(Element elem, String prop) /*-{
- elem.style.removeAttribute(prop);
+ if (elem && elem.style && elem.removeAttribute)
+ elem.style.removeAttribute(prop);
}-*/;
@@ -84,6 +85,7 @@ public class DocumentStyleImplIE extends DocumentStyleImpl {
protected native String getComputedStyle(Element elem, String hyphenName,
String camelName, String pseudo) /*-{
// code lifted from jQuery
+ if (!elem.style || !elem.currentStyle || !elem.runtimeStyle) return null;
var style = elem.style;
var ret = elem.currentStyle[hyphenName] || elem.currentStyle[camelName];
if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Effects.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Effects.java
index bb36a611..aa163633 100755
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Effects.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Effects.java
@@ -66,6 +66,30 @@ public class Effects extends QueuePlugin<Effects> {
super(gq);
}
+ private void queueAnimation(final Element e, final GQAnimation anim, final int duration) {
+ if (isOff()) {
+ anim.onStart();
+ anim.onComplete();
+ } else {
+ queue(e, DEFAULT_NAME, new Function() {
+ public void cancel(Element e) {
+ Animation anim = (Animation) data(e, ACTUAL_ANIMATION, null);
+ if (anim != null) {
+ anim.cancel();
+ }
+ }
+ public void f(Element e) {
+ data(e, ACTUAL_ANIMATION, anim);
+ anim.run(duration);
+ }
+ });
+ }
+ }
+
+ protected boolean isOff() {
+ return Fx.off;
+ }
+
/**
* The animate() method allows you to create animation effects on any numeric
* Attribute, CSS property, or color CSS property.
@@ -129,30 +153,6 @@ public class Effects extends QueuePlugin<Effects> {
}
return this;
}
-
- private void queueAnimation(final Element e, final GQAnimation anim, final int duration) {
- if (isOff()) {
- anim.onStart();
- anim.onComplete();
- } else {
- queue(e, DEFAULT_NAME, new Function() {
- public void cancel(Element e) {
- Animation anim = (Animation) data(e, ACTUAL_ANIMATION, null);
- if (anim != null) {
- anim.cancel();
- }
- }
- public void f(Element e) {
- data(e, ACTUAL_ANIMATION, anim);
- anim.run(duration);
- }
- });
- }
- }
-
- protected boolean isOff() {
- return Fx.off;
- }
/**
*
@@ -211,10 +211,10 @@ public class Effects extends QueuePlugin<Effects> {
* @param funcs an array of {@link Function} called once the animation is
* complete
*/
- public Effects animate(String prop, Function... funcs) {
- return animate(prop, 500, funcs);
+ public Effects animate(Object stringOrProperties, Function... funcs) {
+ return animate(stringOrProperties, 500, funcs);
}
-
+
/**
* The animate() method allows you to create animation effects on any numeric
* Attribute, CSS properties, or color CSS property.
@@ -270,8 +270,8 @@ public class Effects extends QueuePlugin<Effects> {
* complete
* @param duration the duration in milliseconds of the animation
*/
- public Effects animate(String prop, int duration, Function... funcs) {
- return animate($$(prop), duration, Easing.LINEAR, funcs);
+ public Effects animate(Object stringOrProperties, int duration, Function... funcs) {
+ return animate(stringOrProperties, duration, Easing.LINEAR, funcs);
}
/**
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 0f94e76a..da467921 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
@@ -140,7 +140,7 @@ public interface LazyEffects<T> extends LazyBase<T>{
* @param funcs an array of {@link Function} called once the animation is
* complete
*/
- LazyEffects<T> animate(String prop, Function... funcs);
+ LazyEffects<T> animate(Object stringOrProperties, Function... funcs);
/**
* The animate() method allows you to create animation effects on any numeric
@@ -197,7 +197,7 @@ public interface LazyEffects<T> extends LazyBase<T>{
* complete
* @param duration the duration in milliseconds of the animation
*/
- LazyEffects<T> animate(String prop, int duration, Function... funcs);
+ LazyEffects<T> animate(Object stringOrProperties, int duration, Function... funcs);
/**
* Animate the set of matched elements using the clip property. It is possible
diff --git a/samples/pom.xml b/samples/pom.xml
index 217eb89e..0af9e8ae 100644
--- a/samples/pom.xml
+++ b/samples/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>com.googlecode.gwtquery</groupId>
<artifactId>gwtquery-project</artifactId>
- <version>1.1.0.rc1-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
</parent>
<name>GwtQuery Samples</name>