Re: Using the Frame class, and adding Elements to it directly - doesn't display?

2012-06-06 Thread King_V
Thomas,

Thanks.  I think I might be missing something very obvious, because
I'm looking at the APIs, and I have no idea how to do what you're
suggesting.

Code-wise, how do I get the document within the frame, so that I can
add the new Elements to it?

- Joe

On Jun 5, 6:24 pm, Thomas Broyer t.bro...@gmail.com wrote:
 You're adding your elements as children of the frame, which is used as a 
 fallback in case the browser does support frames. You should add them to the 
 document that's displayed within the frame.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Using the Frame class, and adding Elements to it directly - doesn't display?

2012-06-06 Thread Thomas Broyer


On Wednesday, June 6, 2012 6:13:04 PM UTC+2, King_V wrote:

 Thomas, 

 Thanks.  I think I might be missing something very obvious, because 
 I'm looking at the APIs, and I have no idea how to do what you're 
 suggesting. 

 Code-wise, how do I get the document within the frame, so that I can 
 add the new Elements to it?


Frame frame = ...;
FrameElement frameElt = frame.getElement().cast();
Document frameDoc = frameElt.getContentDocument();

You'll probably have to attach your Frame first, and possibly even wait for 
the LoadHandler to be called back (even for an about:blank)

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/OwrGv_nxY3EJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Using the Frame class, and adding Elements to it directly - doesn't display?

2012-06-06 Thread King_V
Thanks, that helped a lot, works as expected now!

- Joe

On Jun 6, 12:46 pm, Thomas Broyer t.bro...@gmail.com wrote:
 On Wednesday, June 6, 2012 6:13:04 PM UTC+2, King_V wrote:

  Thomas,

  Thanks.  I think I might be missing something very obvious, because
  I'm looking at the APIs, and I have no idea how to do what you're
  suggesting.

  Code-wise, how do I get the document within the frame, so that I can
  add the new Elements to it?

 Frame frame = ...;
 FrameElement frameElt = frame.getElement().cast();
 Document frameDoc = frameElt.getContentDocument();

 You'll probably have to attach your Frame first, and possibly even wait for
 the LoadHandler to be called back (even for an about:blank)

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Using the Frame class, and adding Elements to it directly - doesn't display?

2012-06-05 Thread King_V
All,

I've got this very short program, and I don't understand why it's not
working.  I am creating a Frame object, trying to append element
children to it, and while the Frame instance seems to be aware of its
children, they do not get displayed.

Here is what I have.  What am I doing wrong?  When I attach to the
RootPanel, I get a blank rectangular square with nothing in it.
Inspection with Firebug also shows that the head and body elements are
empty.


public class TestFrameAndElement implements EntryPoint {

  public void onModuleLoad() {
Frame frame = new Frame();
Element html = DOM.createElement(html);
Element head = DOM.createElement(head);
Element body = DOM.createElement(body);
Element element = DOM.createElement(div);
element.setInnerHTML(spanhello/spanspan style=\color: blue;
\goodbye/span);
html.appendChild(head);
html.appendChild(body);
body.appendChild(element);
frame.getElement().appendChild(html);
RootPanel.get().add(frame);
System.out.println(Frame children:  +
frame.getElement().getChildCount());
System.out.println(HTML children :  +
frame.getElement().getChild(0).getChildCount());
System.out.println(HEAD children :  +
frame.getElement().getChild(0).getChild(0).getChildCount());
System.out.println(BODY children :  +
frame.getElement().getChild(0).getChild(1).getChildCount());
System.out.println(DIV  children :  +
frame.getElement().getChild(0).getChild(1).getChild(0).getChildCount());
  }
}

I've also noticed that if I do NOT add any elements, there is still an
html/head/body in the Frame section when I inspect with Firebug, but
in the code, the first sysout returns 0 and of course I have to
comment out the rest of the sysout statements.

How do I correctly work with this?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Using the Frame class, and adding Elements to it directly - doesn't display?

2012-06-05 Thread Thomas Broyer
You're adding your elements as children of the frame, which is used as a 
fallback in case the browser does support frames. You should add them to the 
document that's displayed within the frame.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/RBDQBVG5qikJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.