I can use removeFromParent to get rid of something on the RootPanel from a class that doesnt have onModuleLoad in it. However, can you add a widget to the RootPanel from another class? I cannot figure out how to do so. So for example:
public classA extends EntryPoint{
public void onModuleLoad(){
MyPanel panel = new MyPanel();
RootPanel.get("a").add(panel);
}
}
Then inside the MyPanel class inside an onclick actions I would want to do this:
Object s = event.getSource();
Button sButton = (Button)s;
sButton.getParent().removeFromParent();
this works, but now we have remove panel from from the rootpanel, and I want to replace it with a new panel. How do I do that from this other class. I am not sure if I have to access RootPanel, which seems to be not possible, or if I need to have another entryPoint which doesn't seem to make sense. Any advice would be appreciated.