Statistics
| Branch: | Tag: | Revision:

root / web_client / src / gr / grnet / pithos / web / client / animation / FadeOut.java @ 0737a2a4

History | View | Annotate | Download (2.5 kB)

1 ab1eb3f8 Christos Stathis
/*
2 58777026 Christos Stathis
 * Copyright 2011 GRNET S.A. All rights reserved.
3 58777026 Christos Stathis
 *
4 58777026 Christos Stathis
 * Redistribution and use in source and binary forms, with or
5 58777026 Christos Stathis
 * without modification, are permitted provided that the following
6 58777026 Christos Stathis
 * conditions are met:
7 58777026 Christos Stathis
 *
8 58777026 Christos Stathis
 *   1. Redistributions of source code must retain the above
9 58777026 Christos Stathis
 *      copyright notice, this list of conditions and the following
10 58777026 Christos Stathis
 *      disclaimer.
11 58777026 Christos Stathis
 *
12 58777026 Christos Stathis
 *   2. Redistributions in binary form must reproduce the above
13 58777026 Christos Stathis
 *      copyright notice, this list of conditions and the following
14 58777026 Christos Stathis
 *      disclaimer in the documentation and/or other materials
15 58777026 Christos Stathis
 *      provided with the distribution.
16 58777026 Christos Stathis
 *
17 58777026 Christos Stathis
 * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
18 58777026 Christos Stathis
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 58777026 Christos Stathis
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 58777026 Christos Stathis
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
21 58777026 Christos Stathis
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 58777026 Christos Stathis
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 58777026 Christos Stathis
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 58777026 Christos Stathis
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 58777026 Christos Stathis
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 58777026 Christos Stathis
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27 58777026 Christos Stathis
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 58777026 Christos Stathis
 * POSSIBILITY OF SUCH DAMAGE.
29 58777026 Christos Stathis
 *
30 58777026 Christos Stathis
 * The views and conclusions contained in the software and
31 58777026 Christos Stathis
 * documentation are those of the authors and should not be
32 58777026 Christos Stathis
 * interpreted as representing official policies, either expressed
33 58777026 Christos Stathis
 * or implied, of GRNET S.A.
34 ab1eb3f8 Christos Stathis
 */
35 ab1eb3f8 Christos Stathis
package gr.grnet.pithos.web.client.animation;
36 ab1eb3f8 Christos Stathis
37 ab1eb3f8 Christos Stathis
import com.google.gwt.animation.client.Animation;
38 ab1eb3f8 Christos Stathis
import com.google.gwt.user.client.DOM;
39 ab1eb3f8 Christos Stathis
import com.google.gwt.user.client.ui.Widget;
40 ab1eb3f8 Christos Stathis
41 ab1eb3f8 Christos Stathis
42 ab1eb3f8 Christos Stathis
public class FadeOut extends Animation {
43 ab1eb3f8 Christos Stathis
        Widget widget;
44 ab1eb3f8 Christos Stathis
45 ab1eb3f8 Christos Stathis
        int initialOpacity = 100;
46 ab1eb3f8 Christos Stathis
        double currOpacity = 100;
47 ab1eb3f8 Christos Stathis
48 ab1eb3f8 Christos Stathis
        public FadeOut(Widget aWidget){
49 ab1eb3f8 Christos Stathis
                widget = aWidget;
50 ab1eb3f8 Christos Stathis
        }
51 ab1eb3f8 Christos Stathis
52 ab1eb3f8 Christos Stathis
        @Override
53 ab1eb3f8 Christos Stathis
        protected void onUpdate(double progress) {
54 ab1eb3f8 Christos Stathis
                if(currOpacity>0.0){
55 ab1eb3f8 Christos Stathis
                        progress = 1.0 - progress;
56 ab1eb3f8 Christos Stathis
                        currOpacity = initialOpacity*progress;
57 ab1eb3f8 Christos Stathis
                        DOM.setStyleAttribute(widget.getElement(), "opacity", ""+new Double(currOpacity/100d));
58 ab1eb3f8 Christos Stathis
                        //required for ie to work
59 ab1eb3f8 Christos Stathis
                        //Disabled because IE has bugs rendering non-opaque objects
60 ab1eb3f8 Christos Stathis
                        //int opacityToSet = new Double(currOpacity).intValue();
61 ab1eb3f8 Christos Stathis
                        //DOM.setStyleAttribute(widget.getElement(), "filter", "alpha(opacity="+currOpacity+")");
62 ab1eb3f8 Christos Stathis
                }
63 ab1eb3f8 Christos Stathis
        }
64 ab1eb3f8 Christos Stathis
65 ab1eb3f8 Christos Stathis
        /*
66 ab1eb3f8 Christos Stathis
        protected void onComplete() {
67 ab1eb3f8 Christos Stathis
                super.onComplete();
68 ab1eb3f8 Christos Stathis
                hpanel.clear();
69 ab1eb3f8 Christos Stathis
                html = new HTML(" ");
70 ab1eb3f8 Christos Stathis
                hpanel.getParent().setVisible(false);
71 ab1eb3f8 Christos Stathis
        }
72 ab1eb3f8 Christos Stathis
        */
73 ab1eb3f8 Christos Stathis
74 ab1eb3f8 Christos Stathis
}