Scriptaculous Effect duration in Hosted mode

Skip to first unread message


Jan 5, 2007, 3:31:00 PM1/5/07
to Google Web Toolkit
I'm using & loving the the gwt-widget Effect class, but have been
bumping into problems using EffectOptions.

This works fine and dandy in IE7 && FF, but not in Hosted mode.

Effect.move(leftCloud, new EffectOption[] {
new EffectOption("x",-1000),
new EffectOption("y",0),
new EffectOption("duration",5.0)

If I get rid of the options it works fine in hosted mode as well.

Effect.moveBy(leftCloud, 0,-1000);

Here's wrapping leftCloud in a DIV.

myThing= new SimplePanel();
PNGImage lc = new PNGImage(Manager.myConstants.clouds_src(),120,120);



Any ideas? Scriptaculous 1.6.0 & 1.7.0

This is the error:
[ERROR] Uncaught exception escaped
java.lang.NullPointerException: null
at org.gwtwidgets.client.wrap.Effect.move(

but as I say, when I compile to JS to use Firebug and see what it's all
about, everything works like a champ.



Jan 18, 2007, 1:54:24 PM1/18/07
to Google Web Toolkit

Hi jdwyah,

I'm running into the same problem with opacity, and see this exception
in hosted mode only:

[WARN] Exception thrown into JavaScript

java.lang.NullPointerException: null

at org.gwtwidgets.client.wrap.Effect.opacity(
at org.gwtwidgets.client.wrap.Effect.opacity(

I looked at the org.gwtwidgets.client.wrap.Effect.opacity method, and
it looks like:
private native static void opacity (Element element,
JavaScriptObject opts)
$wnd._nativeExtensions = false;
new $wnd.Effect.Opacity(element, opts);

So, it looks like it's failing on the native call. I load the
effects.js and prototype.js files into the HTML file that I'm running
in hosted mode, but perhaps the hosted browser isn't seeing those

I'm using Scriptaculous 1.6.5 and gwt-widgets 0.1.3. GWT version
1.2.22. I have IE 6 running on my computer and don't see any
javascript errors there (when I compile to javascript).

Did you ever get this problem solved?

I searched on the bug list and didn't see anything.



Jan 18, 2007, 2:14:41 PM1/18/07
to Google Web Toolkit

mooreds wrote:

> I searched on the bug list and didn't see anything.

Err, I searched on both the GWT bug list and the gwt-widgets sf bug



Jan 19, 2007, 11:01:29 AM1/19/07
to Google Web Toolkit
Hey there.

Solution of the moment is just to wrap the call. Since it works fine in
FF & IE when it's compiled to JS and only fails in hosted development
mode I'm just writing a "compatibility mode" for my calls which doesn't
use the fancy EffectOptions.

public static void doMove(Widget w, int x, int y,int duration){

Effects.moveBy(w,new EffectOptions( duration, x, y etc);



Jan 19, 2007, 4:47:23 PM1/19/07
to Google Web Toolkit
Thanks. This won't really work for me, as I am trying to debug some of
the behavior of effect queueing.

I investigated further and it appears that the buildOptions method in
the org.gwtwidgets/client/wrap/ file is to blame. The
javascript object that is created there is not available in the Opacity
method in scriptaculous/effects.js (again, only in hosted mode). I
have some ideas on how to fix this (change the gwt-widget library,
create my own options JavaScript object and try with that), but am not
sure if I'll have time to investigate them.

Thanks for your workaround.


Jan 19, 2007, 8:55:32 PM1/19/07
to Google Web Toolkit
I will appreciate it if you guys can show me some examples of
Scriptaculous scale Effect and sample code. I have so far been unable
to scale successfully although other effects like fade and squish work
fine. I am trying to scale a panel with several image widgets on it.


Mar 19, 2007, 9:22:11 AM3/19/07
to Google Web Toolkit

I found something weird in GWT widgets library. It's just as if
options didnt worked... I suggest you just to try to put a duration
option that is not ambigous : lets say 10 seconds, or set a boolean
option to non-default value. You'll see, it didnt work.

The mistake is in the way EffectOption are builded.

I suggest you to just re-wrap the library and making the above
modifications... That worked fine for me. Actually, i completely re-
write this wrapping, adding more usefull classes to manage callback
and effects transitions. Plus, i'm curently working on queue and


The EffectOption class revisited


public class EffectOption {
private String name;

private Object value;

public EffectOption(String name, String value) { = name;
this.value = value;

public EffectOption(String name, double value) { = name;
this.value = new Double(value);

public EffectOption(String name, int value) { = name;
this.value = new Integer(value);

public EffectOption(String name, float value) { = name;
this.value = new Float(value);

public EffectOption(String name, boolean value) { = name;
this.value = new Boolean(value);

public EffectOption(String name, Callback callback) { = name;
this.value = callback;

public String getName() {
return name;

public Object getValue() {
return value;



The Effect class "JavaScriptObject buildOptions(EffectOption[] opts)"
's method revisited


private static JavaScriptObject buildOptions(EffectOption[] opts) {
JavaScriptObject jso = createJsObject();
for (int i = 0; i < opts.length; i++) {
Object value = opts[i].getValue();
if (value instanceof Callback) {
addCallback(jso, opts[i].getName(), new CallbackDelegate((Callback)
} else if (value instanceof Integer) {
addOption(jso, opts[i].getName(), ((Integer) value).intValue());
} else if (value instanceof Float) {
addOption(jso, opts[i].getName(), ((Float) value).floatValue());
} else if (value instanceof Double) {
addOption(jso, opts[i].getName(), ((Double) value).doubleValue());
} else if (value instanceof Boolean) {
addOption(jso, opts[i].getName(), ((Boolean)
} else {
addOption(jso, opts[i].getName(), value);
return jso;

Mar 20, 2007, 4:09:29 PM3/20/07
to Google Web Toolkit
I think there is also a bug in the GWT hosting mode: it seems it fails
if one of the argument passed to a JSNI method as a '.' inside. As and
the duration is a double, it almost met this condition.


Reply all
Reply to author
0 new messages