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);
lc.setStyleName("H-Clouds");
lc.setWidth("1000");
lc.setHeight("100%");
leftCloud.add(lc);
leftCloud.setWidth("1000");
leftCloud.setHeight("100%");
add(leftCloud,0,0);
Any ideas? Scriptaculous 1.6.0 & 1.7.0
This is the error:
[ERROR] Uncaught exception escaped
java.lang.NullPointerException: null
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNative(ModuleSpaceIE6.java:377)
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNativeVoid(ModuleSpaceIE6.java:283)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:127)
at org.gwtwidgets.client.wrap.Effect.move(Effect.java:235)
but as I say, when I compile to JS to use Firebug and see what it's all
about, everything works like a champ.
-J
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
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNative(ModuleSpaceIE6.java:377)
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNativeVoid(ModuleSpaceIE6.java:283)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:127)
at org.gwtwidgets.client.wrap.Effect.opacity(Effect.java:288)
at org.gwtwidgets.client.wrap.Effect.opacity(Effect.java:285)
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
files.
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.
Thanks,
Dan
> 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
tracker...
Dan
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){
if(GWT.isScript()){
Effects.moveBy(w,new EffectOptions( duration, x, y etc);
}else{
Effects.moveBy(w,x,y);
}
}
I investigated further and it appears that the buildOptions method in
the org.gwtwidgets/client/wrap/Effect.java 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.
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
parallel.
/*
The EffectOption class revisited
*/
public class EffectOption {
private String name;
private Object value;
public EffectOption(String name, String value) {
this.name = name;
this.value = value;
}
public EffectOption(String name, double value) {
this.name = name;
this.value = new Double(value);
}
public EffectOption(String name, int value) {
this.name = name;
this.value = new Integer(value);
}
public EffectOption(String name, float value) {
this.name = name;
this.value = new Float(value);
}
public EffectOption(String name, boolean value) {
this.name = name;
this.value = new Boolean(value);
}
public EffectOption(String name, Callback callback) {
this.name = 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)
value));
} 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)
value).booleanValue());
} else {
addOption(jso, opts[i].getName(), value);
}
}
return jso;
}
Jeff