I was looking for / hoping for a way to augment existing HTML with GWT functionality.  Conceptually, I was thinking I might be able to do something like this:

public void onModuleLoad() {
	final RootPanel root = RootPanel.get();  // Says it support multiple widgets, but..
	final Document doc = Document.get();

	// What I'd like, but doesn't exist...
	FlowPanel header  = new FlowPanel( doc.getElementById("header") );

	// What I tried next, except it asserts cause setElement(..) was already called.
	FlowPanel content = new FlowPanel() {  // What I tried next
		{
			setElement( doc.getElementById("content") );
		}
	};

	// And if I needed to provide additional registration...
	root.add( header );
	root.add( content );
}
Considering how little the FlowLayout (and HtmlPanel for that matter) seems to do to manage its children, I very surprised I can't do something this simple.  The FlowLayout constructor doesn't seem to do anything interesting with its created div, so why can't I pass in my own?

The design goal is to allow be to build the top level, non-interactive structure in pure HTML.  Also, so get more reuse of that top level structure when moving from the minimize jump from one full-screen HTML layout during loading to the final loaded app, especially when I intend them to share so much of the same structure.  After loading, I'd hide or remove unnecessary elements, per usual.

Is there any inherent, underlying reason why GWT components can't take in existing DOM references to build their components?

If not, can someone help me with a quick example of a Composite that might use existing DOM elements?

If so, what is the recommended alternative to placing multiple GWT UI compionents into a existing DOM tree, possibly deeply structured with components at varied levels (i.e., not just sibling nodes)?

--
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.

Reply via email to