I am trying to wrap GWT element and using it for creating custom element using polymer:
-- @JsType(namespace = "test1")
public class JsInteropExport {
@JsConstructor
public JsInteropExport(){
}
@JsProperty
public SelectHandler handler = new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
Info.display("Click", ((TextButton) event.getSource()).getText() + " clicked");
}
};
@JsProperty
public TextButton gxtButton = new TextButton("GXT Button", handler);
}
//custom element:
<link rel="import" href="bower_components/paper-button/paper-button.html"/>
<dom-module id="sample-element">
<style>
</style>
<template>
<h1>Hello</h1>
<div id="gxtButtonId"/>
</template>
<script>
Polymer({
is: "sample-element",
_toggle: function(){
var test = new test1.JsInteropExport();
//getting GXT button
var gxtButton = test.gxtButton;
//getting handler
var handler = test.handler;
//trying to add handler
gxtButton.addSelectHandler(handler);
var line = document.createElement("p");
line.innerHTML = gxtButton;
document.getElementById("gxtButtonId").appendChild(line);
}
});
</script>
</dom-module>
//GXT button added successfully but, I am not able to call/use handler when performed on click event.
Please let me know if I am missing anything.
Thanks,
Gaurav
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment