Following code is used to set attribute style to body element and
register cut/paste code to it,but failed.Strangelly,when
debugging,variable body is not null and attribute "style" exists,but
frame hasn't this child.Running work doesn't work as expected,and NPE
got thrown out when call setBodyContent()
public class TextAreaExt extends RichTextArea
{
private BodyElement body;
@Override
protected void onLoad()
{
super.onLoad();
body = ((FrameElement)
getElement().cast()).getContentDocument().getBody();
body.setAttribute("style", "color:gray;");
registerOnCut(body);
}
public void setBodyContent(String text)
{
body.setInnerText(text);
}
private native void registerOnCut(BodyElement element) /*-{
var that = this;
console.log("registerOnCut");
element.oncut = $entry(function(event) {
//invoke method to adjust height based on content
return false;
});
element.onpaste = $entry(function(event) {
//invoke method to adjust height based on content
return false;
});
}-*/;
}
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.