Hi, I'm trying to implement an application with Google Maps and a TabSet. If I use the map in the first tab everything works fine.
However, if I put the Map in the second Tab like this
I'm getting the following error:
Uncaught JavaScript exception [java.lang.AssertionError: A widget that has an existing parent widget may not be added to the detach list
Do you have any ideas, how i could solve this ?
Code:
public class MapTab implements EntryPoint {
private TabSet topMenu = new TabSet();
private HLayout Layout1 = new HLayout();
private HLayout Layout2 = new HLayout();
private SectionStack Stack1 = new SectionStack();
private SectionStack Stack2 = new SectionStack();
private SectionStackSection Sts1 = new SectionStackSection("Section1");
private SectionStackSection Sts2 = new SectionStackSection("Section2");
private SectionStackSection Sts3 = new SectionStackSection("Section3");
private SectionStackSection Sts4 = new SectionStackSection("Section4");
private Tab Tab1 = new Tab("Tab1");
private Tab Tab2 = new Tab("Tab2");
private MapWidget map = new MapWidget();
public void onModuleLoad() {
Stack1.addSection(Sts1);
Stack1.addSection(Sts2);
Stack1.setWidth("200px");
Stack2.addSection(Sts3);
Stack2.addSection(Sts4);
Stack2.setWidth("200px");
Layout1.addMember(Stack1);
Layout1.addMember(map);
Layout1.setWidth100();
Layout1.setHeight100();
Layout2.addMember(Stack2);
Layout2.addMember(new Label("I am a Label"));
Layout2.setWidth100();
Layout2.setHeight100();
Tab1.setPane(Layout1);
Tab2.setPane(Layout2);
topMenu.addTab(Tab1);
topMenu.addTab(Tab2);
topMenu.setHeight100();
topMenu.setWidth100();
map.setWidth("500px");
map.setHeight("500px");
map.addControl(new LargeMapControl());
topMenu.selectTab(0);
RootPanel.get().add(topMenu);
}
}
Code:
Layout1.addMember(Stack1);
Layout1.addMember(new Label("I am a Label"));
Layout1.setWidth100();
Layout1.setHeight100();
Layout2.addMember(Stack2);
Layout2.addMember(map);
Uncaught JavaScript exception [java.lang.AssertionError: A widget that has an existing parent widget may not be added to the detach list
Do you have any ideas, how i could solve this ?
Comment