Hi:
You should add attach event handler to the RichTextArea,like this :
addAttachHandler(new AttachEvent.Handler() {
public void onAttachOrDetach(AttachEvent arg0) {
if(arg0.isAttached()){
Element body = ((FrameElement)
getElement().cast()).getContentDocument().getBody();
//...
}
}
})
2012/8/14 Alex Luya <[email protected]>
> **
> *RichTextBox has such dom level hierarchy:*
>
> <iframe> <html> <body>
> //****************I need to manipulate this body element </body>
> </html> </iframe>
>
> ------------------------------
>
>
> I found setting style name to iframe doesn't work,and It must be set to
> body element. I tried to do it like this(in constructor):
>
> ------------------------------
>
> Element body = ((FrameElement)
> getElement().cast()).getContentDocument().getBody();
> body.setClassName("richTextArea");
>
>
> A NPE got thrown out on this boy element,and even I wrapper them like this:
>
> ------------------------------
>
> Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override
> public void execute() { Element body = ((FrameElement)
> getElement().cast()).getContentDocument().getBody();
> body.setClassName("richTextArea"); }
> });
>
>
> And the actually problem is RichTextBox got rendered weirdly,when it is
> attached to DOM,its inner stuff(html,body) didn't got generated,even I
> wrapper these lines into onload() method,NPE got thrown out sometime,but if
> wrapping them into a timer,then schedule a relative long waiting time,no
> NPEs,but you know,I can't let something depends on this unpredicted
> "relative long waiting time".And I do need manipulate body element to
> register cut/paste event by JSNI,Can anyone tell how to get body element
> correctly?
>
> --
> 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.
>
--
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.