Code is fairly simple.
uibinder:
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui">
<g:ScrollPanel width="100%" height="100%" ui:field="mainScrollPanel"/>
</ui:UiBinder>
The view class's onLoad() (this is an Activites and Places app that uses MVP). So this view is on the right side of a splitterpanel. The left side has a stackpanel (think of the mail example). When the appropriate stack panel item is selected, this view appears on the right of the splitter.
public class ReviewView extends ResizeComposite
{
...
private String html; // Set in a separate method and called before onLoad(). This HTML comes from an external source.
...
public void onLoad()
{
mainScrollPanel.clear();
HTMLPanel htmlPanel = new HTMLPanel( html );
mainScrollPanel.add( htmlPanel );
Element submitButtonElement = htmlPanel.getElementById( "save" ); // This appears to work, without being deferred. I tried it defered also.
Button submitButton = Button.wrap( submitButtonElement ); // This is where the assert exception occurs.
}
}
Of course the HTMLPanel has a parent widget, the ReviewView. And it is nested inside of a ScrollPanel, which is nested in a SplitterLayoutPanel, which is inside a RootLayoutPanel. There are probably widgets attached to all of those. So, can this be done? One solution in the posts is to wrap() from the inside out. With an A&P app this seems nearly impossible as Widgets are always embedded in Widgets. What is the point of wrap() if it is so finicky()?
I also tried deferred method, replacing HTMLPanel with MyHtmlPanel:
onLoad() looks like this:
MyHtmlPanel htmlPanel = new MyHtmlPanel( html );
mainScrollPanel.add( htmlPanel );
And MyHtmlPanel looks like this:
private class MyHtmlPanel extends HTMLPanel
{
public MyHtmlPanel( String html )
{
super( html );
}
protected void onAttach()
{
Element submitButtonElement = this.getElementById( "save" ); // Appears to work.
Button submitButton = Button.wrap( submitButtonElement ); // Same error occurs here.
}
protected void onDetach()
{
}
}
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment