// Path: src/main/java/com/tractionsoftware/gwt/user/client/animation/OpacityAnimation.java
// public class OpacityAnimation extends TractionAnimation {
// 
//     static final SetOpacityImpl impl = GWT.create(SetOpacityImpl.class);
// 
//     private Element[] elm;
//     private float fromOpacity;
// 
//     // note that we don't store toOpacity. instead we store the offset
//     // that we'll use to compute the animation.
//     private float addOpacity;
// 
//     /**
//      * Creates an OpacityAnimation
//      *
//      * @param elm The Elements to modify
//      * @param fromOpacity The opacity value at the start of the animation (0-1)
//      * @param toOpacity The opacity value at the end of the animation (0-1)
//      */
//     public OpacityAnimation(Element[] elm, float fromOpacity, float toOpacity) {
// 	this.elm = elm;
// 	this.fromOpacity = fromOpacity;
// 	this.addOpacity = toOpacity - fromOpacity;
//     }
// 
//     @Override
//     protected void onUpdate(double progress) {
// 	float newOpacity = fromOpacity + (float) (addOpacity * progress);
// 	for (Element e : elm) {
// 	    impl.setOpacity(e, newOpacity);
// 	}
//     }    
// 
//     /**
//      * Sets the animation to the starting point, canceling any
//      * animation in progress.
//      */
//     @Override
//     public void setPositionAtStart() {
// 	setPosition(0.0);
//     }
// 
//     /**
//      * Sets the animation to the end point, canceling any animation in
//      * progress.
//      */
//     @Override
//     public void setPositionAtEnd() {
// 	setPosition(1.0);
//     }
// 
//     /**
//      * Sets the animation to a particular point, cancelling an
//      * animation in progress. Note that the animation will always
//      * reset on run.
//      */
//     @Override
//     public void setPosition(double progress) {
// 	cancel();
// 	onUpdate(interpolate(progress));	
//     }
// 
// }


import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.tractionsoftware.gwt.user.client.animation.OpacityAnimation;
/*
 * Copyright 2010 Traction Software, Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.tractionsoftware.gwt.demo.opacity.client;


public class OpacityDemo implements EntryPoint {

    private TextBox startOpacity;
    private TextBox endOpacity;
    private TextBox duration;

    @Override
    public void onModuleLoad() {
	
	Panel controls = RootPanel.get("controls");
	
	startOpacity = createTextBox("1.0");
	endOpacity = createTextBox("0.1");
	duration = createTextBox("5000");

	addTextBox(controls, "Start Opacity", startOpacity);
	addTextBox(controls, "End Opacity", endOpacity);
	addTextBox(controls, "Duration", duration);

	Button start = new Button("Start");
	start.addClickHandler(new ClickHandler() {
	    @Override
            public void onClick(ClickEvent event) {
// Path: src/main/java/com/tractionsoftware/gwt/user/client/animation/OpacityAnimation.java
// public class OpacityAnimation extends TractionAnimation {
// 
//     static final SetOpacityImpl impl = GWT.create(SetOpacityImpl.class);
// 
//     private Element[] elm;
//     private float fromOpacity;
// 
//     // note that we don't store toOpacity. instead we store the offset
//     // that we'll use to compute the animation.
//     private float addOpacity;
// 
//     /**
//      * Creates an OpacityAnimation
//      *
//      * @param elm The Elements to modify
//      * @param fromOpacity The opacity value at the start of the animation (0-1)
//      * @param toOpacity The opacity value at the end of the animation (0-1)
//      */
//     public OpacityAnimation(Element[] elm, float fromOpacity, float toOpacity) {
// 	this.elm = elm;
// 	this.fromOpacity = fromOpacity;
// 	this.addOpacity = toOpacity - fromOpacity;
//     }
// 
//     @Override
//     protected void onUpdate(double progress) {
// 	float newOpacity = fromOpacity + (float) (addOpacity * progress);
// 	for (Element e : elm) {
// 	    impl.setOpacity(e, newOpacity);
// 	}
//     }    
// 
//     /**
//      * Sets the animation to the starting point, canceling any
//      * animation in progress.
//      */
//     @Override
//     public void setPositionAtStart() {
// 	setPosition(0.0);
//     }
// 
//     /**
//      * Sets the animation to the end point, canceling any animation in
//      * progress.
//      */
//     @Override
//     public void setPositionAtEnd() {
// 	setPosition(1.0);
//     }
// 
//     /**
//      * Sets the animation to a particular point, cancelling an
//      * animation in progress. Note that the animation will always
//      * reset on run.
//      */
//     @Override
//     public void setPosition(double progress) {
// 	cancel();
// 	onUpdate(interpolate(progress));	
//     }
// 
// }


// Path: src-demo/com/tractionsoftware/gwt/demo/opacity/client/OpacityDemo.java
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.tractionsoftware.gwt.user.client.animation.OpacityAnimation;

/*
 * Copyright 2010 Traction Software, Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.tractionsoftware.gwt.demo.opacity.client;


public class OpacityDemo implements EntryPoint {

    private TextBox startOpacity;
    private TextBox endOpacity;
    private TextBox duration;

    @Override
    public void onModuleLoad() {
	
	Panel controls = RootPanel.get("controls");
	
	startOpacity = createTextBox("1.0");
	endOpacity = createTextBox("0.1");
	duration = createTextBox("5000");

	addTextBox(controls, "Start Opacity", startOpacity);
	addTextBox(controls, "End Opacity", endOpacity);
	addTextBox(controls, "Duration", duration);

	Button start = new Button("Start");
	start.addClickHandler(new ClickHandler() {
	    @Override
            public void onClick(ClickEvent event) {
	        OpacityAnimation animation = new OpacityAnimation(new Element[] {