GWT animation: fade in and fade out : Animation « GWT « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Class
8. Collections Data Structure
9. Data Type
10. Database SQL JDBC
11. Design Pattern
12. Development Class
13. EJB3
14. Email
15. Event
16. File Input Output
17. Game
18. Generics
19. GWT
20. Hibernate
21. I18N
22. J2EE
23. J2ME
24. JDK 6
25. JNDI LDAP
26. JPA
27. JSP
28. JSTL
29. Language Basics
30. Network Protocol
31. PDF RTF
32. Reflection
33. Regular Expressions
34. Scripting
35. Security
36. Servlets
37. Spring
38. Swing Components
39. Swing JFC
40. SWT JFace Eclipse
41. Threads
42. Tiny Application
43. Velocity
44. Web Services SOA
45. XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorial
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java » GWT » AnimationScreenshots 
GWT animation: fade in and fade out


/*
 * Created on May 23, 2006
 
 * Copyright 2006, Robert Hanson
 * This library is dustributed under the GNU-LGPL 2.1.
 * http://creativecommons.org/licenses/LGPL/2.1/
 */
package org.hanson.gwt.widgets.client;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Widget;

/**
 * Effect is a wrapper for the Scriptaculous effects JavaScript library,
 * which can be found at http://script.aculo.us/.
 
 * Example of using an effect with options:
 
 * <pre>
 *   Effect.highlight(widget, new EffectOption[]{
 *       new EffectOption("startcolor", "#ff0000")
 *   });
 * </pre>
 
 * Example of using an effect with no options:
 
 * <pre>
 *   Effect.fade(widget);
 * </pre>
 *
 * Example of using an effect on a specific element id:
 
 * <pre>
 *   Effect.switchOff(RootPanel.get("leftNav"));
 * </pre>
 
 * You must reference the Scriptaculous JavaScript code in your HTML
 * page to be able to use the wrapper.  Failure to do so will result in 
 * error messages similar to this, "'$wnd.Effect.Fade' is null or not an object".
 
 * <pre> 
 *  &lt;script type="text/javascript" src="script/prototype.js">&lt;/script>
 *  &lt;script type="text/javascript" src="script/scriptaculous.js">&lt;/script>
 * </pre>
 
 * You will also need to add the gwt-widgets jar file to your project classpath, 
 * and add the following reference in your .gwt.xml file:
 
 * <pre>
 *  &lt;inherits name='org.hanson.gwt.widgets.WidgetLibrary'/>
 * </pre>
 *  
 @author Robert Hanson <iamroberthanson[at]gmail.com> http://roberthanson.blogspot.com
 */
public class Effect
{

    
    public static void appear (Widget widget) {
        appear(widget.getElement()null);
    }

    public static void appear (Widget widget, EffectOption[] opts) {
        appear(widget.getElement(), buildOptions(opts));
    }

    private native static void appear (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.Appear(element, opts);
    }-*/;



    
    public static void blindDown (Widget widget) {
        blindDown(widget.getElement()null);
    }

    public static void blindDown (Widget widget, EffectOption[] opts) {
        blindDown(widget.getElement(), buildOptions(opts));
    }

    private native static void blindDown (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.BlindDown(element, opts);
    }-*/;



    
    public static void blindUp (Widget widget) {
        blindUp(widget.getElement(), createJsObject());
    }

    public static void blindUp (Widget widget, EffectOption[] opts) {
        blindUp(widget.getElement(), buildOptions(opts));
    }

    private native static void blindUp (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.BlindUp(element, opts);
    }-*/;



    
    public static void dropOut (Widget widget) {
        dropOut(widget.getElement()null);
    }

    public static void dropOut (Widget widget, EffectOption[] opts) {
        dropOut(widget.getElement(), buildOptions(opts));
    }

    private native static void dropOut (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.DropOut(element, opts);
    }-*/;



    
    public static void fade (Widget widget) {
        fade(widget.getElement()null);
    }

    public static void fade (Widget widget, EffectOption[] opts) {
        fade(widget.getElement(), buildOptions(opts));
    }

    private native static void fade (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.Fade(element, opts);
    }-*/;



    
    public static void fold (Widget widget) {
        fold(widget.getElement()null);
    }

    public static void fold (Widget widget, EffectOption[] opts) {
        fold(widget.getElement(), buildOptions(opts));
    }

    private native static void fold (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.Fold(element, opts);
    }-*/;



    
    public static void grow (Widget widget) {
        grow(widget.getElement()null);
    }

    public static void grow (Widget widget, EffectOption[] opts) {
        grow(widget.getElement(), buildOptions(opts));
    }

    private native static void grow (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.Grow(element, opts);
    }-*/;



    
    public static void highlight (Widget widget) {
        highlight(widget.getElement()null);
    }

    public static void highlight (Widget widget, EffectOption[] opts) {
        highlight(widget.getElement(), buildOptions(opts));
    }

    private native static void highlight (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.Highlight(element, opts);
    }-*/;



    
    public static void keepFixed (Widget widget) {
        keepFixed(widget.getElement()null);
    }

    public static void keepFixed (Widget widget, EffectOption[] opts) {
        keepFixed(widget.getElement(), buildOptions(opts));
    }

    private native static void keepFixed (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.KeepFixed(element, opts);
    }-*/;



    
    public static void move (Widget widget) {
        move(widget.getElement()null);
    }

    public static void move (Widget widget, EffectOption[] opts) {
        move(widget.getElement(), buildOptions(opts));
    }

    private native static void move (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.Move(element, opts);
    }-*/;



    
    public static void moveBy (Widget widget) {
        moveBy(widget.getElement()null);
    }

    public static void moveBy (Widget widget, EffectOption[] opts) {
        moveBy(widget.getElement(), buildOptions(opts));
    }

    private native static void moveBy (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.MoveBy(element, opts);
    }-*/;



    
    public static void opacity (Widget widget) {
        opacity(widget.getElement()null);
    }

    public static void opacity (Widget widget, EffectOption[] opts) {
        opacity(widget.getElement(), buildOptions(opts));
    }

    private native static void opacity (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.Opacity(element, opts);
    }-*/;



    
    public static void parallel (Widget widget) {
        parallel(widget.getElement()null);
    }

    public static void parallel (Widget widget, EffectOption[] opts) {
        parallel(widget.getElement(), buildOptions(opts));
    }

    private native static void parallel (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.Parallel(element, opts);
    }-*/;



    
    public static void puff (Widget widget) {
        puff(widget.getElement()null);
    }

    public static void puff (Widget widget, EffectOption[] opts) {
        puff(widget.getElement(), buildOptions(opts));
    }

    private native static void puff (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.Puff(element, opts);
    }-*/;



    
    public static void pulsate (Widget widget) {
        pulsate(widget.getElement()null);
    }

    public static void pulsate (Widget widget, EffectOption[] opts) {
        pulsate(widget.getElement(), buildOptions(opts));
    }

    private native static void pulsate (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.Pulsate(element, opts);
    }-*/;



    
    public static void scale (Widget widget) {
        scale(widget.getElement()null);
    }

    public static void scale (Widget widget, EffectOption[] opts) {
        scale(widget.getElement(), buildOptions(opts));
    }

    private native static void scale (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.Scale(element, opts);
    }-*/;



    
    public static void scrollTo (Widget widget) {
        scrollTo(widget.getElement()null);
    }

    public static void scrollTo (Widget widget, EffectOption[] opts) {
        scrollTo(widget.getElement(), buildOptions(opts));
    }

    private native static void scrollTo (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.ScrollTo(element, opts);
    }-*/;



    
    public static void shake (Widget widget) {
        shake(widget.getElement()null);
    }

    public static void shake (Widget widget, EffectOption[] opts) {
        shake(widget.getElement(), buildOptions(opts));
    }

    private native static void shake (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.Shake(element, opts);
    }-*/;



    
    public static void shrink (Widget widget) {
        shrink(widget.getElement()null);
    }

    public static void shrink (Widget widget, EffectOption[] opts) {
        shrink(widget.getElement(), buildOptions(opts));
    }

    private native static void shrink (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.Shrink(element, opts);
    }-*/;



    
    public static void slideDown (Widget widget) {
        slideDown(widget.getElement()null);
    }

    public static void slideDown (Widget widget, EffectOption[] opts) {
        slideDown(widget.getElement(), buildOptions(opts));
    }

    private native static void slideDown (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.SlideDown(element, opts);
    }-*/;



    
    public static void slideUp (Widget widget) {
        slideUp(widget.getElement()null);
    }

    public static void slideUp (Widget widget, EffectOption[] opts) {
        slideUp(widget.getElement(), buildOptions(opts));
    }

    private native static void slideUp (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.SlideUp(element, opts);
    }-*/;



    
    public static void squish (Widget widget) {
        squish(widget.getElement()null);
    }

    public static void squish (Widget widget, EffectOption[] opts) {
        squish(widget.getElement(), buildOptions(opts));
    }

    private native static void squish (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.Squish(element, opts);
    }-*/;



    
    public static void switchOff (Widget widget) {
        switchOff(widget.getElement()null);
    }

    public static void switchOff (Widget widget, EffectOption[] opts) {
        switchOff(widget.getElement(), buildOptions(opts));
    }

    private native static void switchOff (Element element, JavaScriptObject opts/*-{
        new $wnd.Effect.SwitchOff(element, opts);
    }-*/;


    
    
    private static JavaScriptObject buildOptions (EffectOption[] opts) {
        JavaScriptObject jso = createJsObject();
        for (int i = 0; i < opts.length; i++) {
            addOption(jso, opts[i].getName(), opts[i].getValue());
        }
        return jso;
    }

    private static native void addOption (JavaScriptObject jso, String name, String value/*-{
        jso[name] = value;
    }-*/;

    private static native JavaScriptObject createJsObject () /*-{
        return new Object();
    }-*/;

}


           
       
Related examples in the same category
w__w__w.j_a___v_a___2s__._co_m__ | |Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.