When an option value is considered by Javascript as a numeric value, the way it is build by the GWT side will make is seen as a String. As the Javascript side may perform numeric operation on it, it may led to unexpected result. For example, calling Effect.opacity with a from equal to 0.0 and a to to 1.0 will result with a final opacity being equal to 10 !!!
The solution is to add a private native function in EffectOption like the following:
private static native JavaScriptObject parseDouble(String value) /*-{
return parseFloat(value);
}-*/;
and fix the following constructor:
public EffectOption (String name, double value)
{
this.name = name;
this.value = /*Double.toString(value)*/parseDouble(String.valueOf(value));
}
Please note that I should have defined the native function as following:
private static native JavaScriptObject parseDouble(double value) /*-{
return value;
}-*/;
and the constructor will be:
public EffectOption (String name, double value)
{
this.name = name;
this.value = /*Double.toString(value)*/parseDouble(value);
}
But this will cause the GWT Shell to generated exceptions (as of GWT 1.3.3, seems to be fixed by the trunk but there are some incompatibilities in the JavaScriptObject hierarchy.