Hi Pavi,

This is a 'feature' which has been reported. It doesn't seem to have a
particularly high priority.

What happens is that when you 'get' a rootpanel, it is cached and remains
cached.

If that slot is changed in any other way than via the same rootpanel ID then
you will get the cached version and not what is in the DOM.

For example:

        HTMLPanel a = new HTMLPanel("<div id='slot'>A</div>");
        HTMLPanel b = new HTMLPanel("<div id='slot'>B</div>");

        RootPanel.get("id").add(a);
        Window.alert(RootPanel.get("slot").getElement().getInnerText());

        RootPanel.get("id").clear();

        RootPanel.get("id").add(b);
        Window.alert(RootPanel.get("slot").getElement().getInnerText());
 will alert 'A' and then 'A' again, even though the DOM has 'B' in it.

There's a bug report here, added in December:
http://code.google.com/p/google-web-toolkit/issues/detail?id=1937&can=5

In August, there was a response:

This is kind of a weird corner-case. To make this happen, you have to create
multiple
RootPanels for the same id, which means that you have to remove a
RootPanel's element
from the DOM. I would almost propose that RootPanel specifically disallow
this, and
assert that its element still be attached to the DOM whenever
RootPanel.get(id) is
called.
So basically, don't use it like that.

What I do is take a copy and take out the caching for existing apps, and for
new ones, design so that the element is definitely attached to the DOM when
I use HTMLPanel adds

I don't think there will be a change in the near future - I'm the only
person to have starred the issue in the tracker :-)

But people *do* trip up on this occasionally - you know it's in the DOM -
you can print it out the HTML and see the slot - but RootPanel.get shows you
the old version.

Ian

http://examples.roughian.com


2008/9/19 Pavi <[EMAIL PROTECTED]>

>
> I am attempting to create a web application that use more than one GWT
> apps.
> 1. The initial Portal app is a has Panel containing two TabPanels
> 2. The first and second tabs are GWT modules.
>
> The package structure is as below:
> TestGwt\src\com\mygwt\portal
> TestGwt\src\com\mygwt\admin
> TestGwt\src\com\mygwt\myapp
>
> Each of the html in the gwtapps have id "portal_slot1", "admin_slot1"
> and "myapp_slot1"
>
> The issues is when I am trying to invoke individual applications the
> app looks fine. When I access the admin and myapp from inside the
> portal, I get a null pointer due to
> RootPanel.get("admin_slot1").add(button);
>
> I then tried include "admin_slot1" and "myapp_slot1" in the
> Portal.html and everything looks fine but the items I add to the Admin
> and Myapp gets added in Portal also... i.e I see two of everything.
> One inside the tabs and one on the main Porta.html. I finally set
> "admin_slot1" and "myapp_slot1" to invisible in Portal's entry point.
>
> Is there any other alternative? Am I doing something wrong or breaking
> some best practice rules?
>
> >

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