I use JsInterop to map Kinetic.js
<http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v5.1.0.js> I
created the following interfaces:
@JsType(prototype = "$wnd.Kinetic.Node")
public interface KNode {
}
@JsType(prototype = "$wnd.Kinetic.Container")
public interface KContainer extends KNode {
/**
* Add a node to this container.
* @param child A child node
*/
public void add(KNode child);
}
@JsType(prototype = "$wnd.Kinetic.Stage")
public interface KStage extends KContainer {
public static abstract class Statics {
public static native KStage create(Element stageContainer, int stageWidth,
int stageHeight) /*-{
return new $wnd.Kinetic.Stage({
container : stageContainer,
width : stageWidth,
height : stageHeight
});
}-*/;
}
}
@JsType(prototype = "$wnd.Kinetic.Layer")
public interface KLayer extends KContainer {
public static abstract class Statics {
public static native KLayer create() /*-{
return new $wnd.Kinetic.Layer();
}-*/;
}
}
In my Java class I call:
KStage stage = KStage.Statics.create(stageContainer, stageWidth, stageHeight
);
KLayer baseLayer = KLayer.Statics.create();
stage.add(baseLayer);
Running in SDM I get the following error in the last line (stage.add(..)):
SEVERE: (TypeError) : 'undefined' is not a function (evaluating
'this.stage_0_g$.add_219_g$(this.baseLayer_0_g$)')com.google.gwt.core.client.JavaScriptException:
(TypeError) : 'undefined' is not a function (evaluating
'this.stage_0_g$.add_219_g$(this.baseLayer_0_g$)')
at Unknown.wrap_4_g$(Unknown Source)
at Unknown.entry0_0_g$(Unknown Source)
at Unknown.anonymous(Unknown Source)
Did I miss something here?
--
You received this message because you are subscribed to the Google Groups "GWT
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-web-toolkit-contributors/21b4c183-df07-46c9-a91d-2c5b84cee6d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.