Hi,

I am seeing some strange behavior and I am hoping that someone can
point me in the right direction.

I have a MainView.java/MainView.ui.xml, Content1View.java/
Content1.ui.xml, Content2View.java/Content2.ui.xml, etc type of
scenario.

The MainView.ui.xml has the following code:
...
<g:DocLayoutPanel unit='PX'>
 ...
   <g:center>
      <g:HTMLPanel ui:field="mainContentContainer">
         <div id="mainContent"></div>
      </g:HTMLPanel>
   </g:center>
...

The MainView.java has this:
...
@UiField
HTMLPanel mainContentContainer;

public void setMainContent(Widget mainContent) {
   mainContentContainer.add(mainContent, "mainContent")
}
...

So, at runtime, the main content gets added. The strange thing is that
it only works the first time the browser loads. If the code tries to
recreate the entire structure again from stracth, it doesn't work and
only the MainView part shows up on the screen.

The way I recreate the entire structure is I recreate the whole thing
from scratch every time (The container gets passed in as
RootLayoutPanel.get():
public showView(Widget mainContent, HasWidgets container) {
   MainView mainView = new MainView();
   mainView.setMainContent(mainContent);

   container.clear();
   container.add(mainView);
}

Following this type of code in the debugger, I can see how it adds the
mainContent HTML into the mainView **the first time** it runs. The
second time it runs the line mainContentContainer.add(mainContent,
"mainContent") seems to have no affect on the underlying HTML and
still shows the div as <div id="mainContent"></div>.

Can someone explain what I am doing wrong here?

Thanks,
Yaakov.

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

Reply via email to