aboutsummaryrefslogtreecommitdiffstats
path: root/gwtquery-core/src/main/java/gwtquery/client/Effects.java
diff options
context:
space:
mode:
authorRay Cromwell <cromwellian@gmail.com>2009-04-30 21:43:29 +0000
committerRay Cromwell <cromwellian@gmail.com>2009-04-30 21:43:29 +0000
commit96375a486ad02ebe30af85a7dddc48b7f3e7349d (patch)
tree2fe65f44995720fc8b477b3845fd2c985e6f6d29 /gwtquery-core/src/main/java/gwtquery/client/Effects.java
parent94e9626e350487ade2617ebf0706897d77df1b17 (diff)
downloadgwtquery-96375a486ad02ebe30af85a7dddc48b7f3e7349d.tar.gz
gwtquery-96375a486ad02ebe30af85a7dddc48b7f3e7349d.zip
Refactored to com.google.gwt.query
Fixup javadocs Add tests
Diffstat (limited to 'gwtquery-core/src/main/java/gwtquery/client/Effects.java')
-rw-r--r--gwtquery-core/src/main/java/gwtquery/client/Effects.java152
1 files changed, 0 insertions, 152 deletions
diff --git a/gwtquery-core/src/main/java/gwtquery/client/Effects.java b/gwtquery-core/src/main/java/gwtquery/client/Effects.java
deleted file mode 100644
index 21fabb86..00000000
--- a/gwtquery-core/src/main/java/gwtquery/client/Effects.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package gwtquery.client;
-
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.NodeList;
-import com.google.gwt.animation.client.Animation;
-
-public class Effects extends GQuery {
-
- static {
- GQuery.registerPlugin(Effects.class, new EffectsPlugin());
- }
-
- public static final Class<Effects> Effects = Effects.class;
-
- public Effects(Element element) {
- super(element);
- }
-
- public Effects(JSArray elements) {
- super(elements);
- }
-
- public Effects(NodeList list) {
- super(list);
- }
-
- /**
- * function( prop, speed, easing, callback ) {
- var optall = jQuery.speed(speed, easing, callback);
-
- return this[ optall.queue === false ? "each" : "queue" ](function(){
-
- var opt = jQuery.extend({}, optall), p,
- hidden = this.nodeType == 1 && jQuery(this).is(":hidden"),
- self = this;
-
- for ( p in prop ) {
- if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
- return opt.complete.call(this);
-
- if ( ( p == "height" || p == "width" ) && this.style ) {
- // Store display property
- opt.display = jQuery.css(this, "display");
-
- // Make sure that nothing sneaks out
- opt.overflow = this.style.overflow;
- }
- }
-
- if ( opt.overflow != null )
- this.style.overflow = "hidden";
-
- opt.curAnim = jQuery.extend({}, prop);
-
- jQuery.each( prop, function(name, val){
- var e = new jQuery.fx( self, opt, name );
-
- if ( /toggle|show|hide/.test(val) )
- e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
- else {
- var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
- start = e.cur(true) || 0;
-
- if ( parts ) {
- var end = parseFloat(parts[2]),
- unit = parts[3] || "px";
-
- // We need to compute starting value
- if ( unit != "px" ) {
- self.style[ name ] = (end || 1) + unit;
- start = ((end || 1) / e.cur(true)) * start;
- self.style[ name ] = start + unit;
- }
-
- // If a +=/-= token was provided, we're doing a relative animation
- if ( parts[1] )
- end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
-
- e.custom( start, end, unit );
- } else
- e.custom( start, val, "" );
- }
- });
-
- // For JS strict compliance
- return true;
- });
- },
- * @return
- */
- public Effects animate(Properties props, String speed, String easing,
- Function callback) {
- return this;
- }
-
- public Effects fadeOut() {
- Animation a = new Animation() {
-
- public void onCancel() {
- }
-
- public void onComplete() {
- for (int i = 0; i < elements.getLength(); i++) {
- elements.getItem(i).getStyle().setProperty("opacity", "0");
- elements.getItem(i).getStyle().setProperty("display", "none");
- }
- }
-
- public void onStart() {
- }
-
- public void onUpdate(double progress) {
- for (int i = 0; i < elements.getLength(); i++) {
- elements.getItem(i).getStyle()
- .setProperty("opacity", String.valueOf(1.0 - progress));
- }
- }
- };
- a.run(1000);
- return this;
- }
-
- public Effects fadeIn() {
- Animation a = new Animation() {
-
- public void onCancel() {
- }
-
- public void onComplete() {
- }
-
- public void onStart() {
- }
-
- public void onUpdate(double progress) {
- for (int i = 0; i < elements.getLength(); i++) {
- elements.getItem(i).getStyle()
- .setProperty("opacity", String.valueOf(progress));
- }
- }
- };
- a.run(1000);
- return this;
- }
-
- public static class EffectsPlugin implements Plugin<Effects> {
-
- public Effects init(GQuery gq) {
- return new Effects(gq.get());
- }
- }
-}