On Sep 11, 10:40 am, Ian Bambury <[email protected]> wrote: > If I understand you correctly, you should be able to do what you say you > did. E.g. if your HTML has a div with an id of "someId" and some text > content, then this > > VerticalPanel p = new VerticalPanel(); > p.add(new Label("Hello")); > p.setBorderWidth(3); > RootPanel.get().add(p); > > will add a bordered box with "Hello" underneath it, as you'd expect. > > and this > > VerticalPanel p = new VerticalPanel(); > RootPanel r = RootPanel.get("someId"); > p.add(r); > p.add(new Label("Hello")); > p.setBorderWidth(3); > RootPanel.get().add(p); > > will put the text from the div inside the VP > > Ian > I haven't tried it but it probably would work. I actually don't need to add RootPanel wrappers inside a non-root panel, it was just a typo. The reason my code did not work and yours probably would is the last line: > RootPanel.get().add(p); Which my code did not do...and as Thomas stated, I had moved the vertical panel to somewhere that was not attached yet. To give some context, the reason for this is to create a view within a view. This is a trivialized example of what I need -- without getting into details, but let's say you wanted to show a pop-up that can show the same app inside itself. So, I have an immutable wrapper like this: public class Layout { private Panel header; private Panel menu; ... public Layout(Panel header, Panel menu, ...) { this.header = header... } public Panel getHeader( ) { return header; } ... } In onModuleLoad, I create two of these: Layout layout = new Layout(RootPanel.get("header"), ...) Layout internalLayout = new Layout(new VerticalPanel( ), ...) I pass the layout reference to main app presenters, and I pass the internal layout to a presenter with a view that can show a pop-up of the app inside itself. This works. It wasn't working before because I was erroneously passing the "layout" reference to the internal view presenter, which caused the root panels to get moved, and thus return null, thus leading to NPE, etc. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Re: RootPanel.get(String) + weirdness
- RootPanel.get(String) + <DIV> weirdness davis
- Re: RootPanel.get(String) + <DIV> weirdness Ian Bambury
- Re: RootPanel.get(String) + <DIV> weirdness Sri
- Re: RootPanel.get(String) + <DIV> weirdness davis
- Re: RootPanel.get(String) + <DIV> weirdne... Ian Bambury
- Re: RootPanel.get(String) + <DIV> weirdne... Thomas Broyer
- Re: RootPanel.get(String) + <DIV> weirdne... Ian Bambury
- Re: RootPanel.get(String) + <DIV> wei... davis
Reply via email to
- RootPanel.get(String) + <DIV> weirdness davis
- Re: RootPanel.get(String) + <DIV> weirdness Ian Bambury
- Re: RootPanel.get(String) + <DIV> weirdness Sri
- Re: RootPanel.get(String) + <DIV> weirdness davis
- Re: RootPanel.get(String) + <DIV> weirdne... Ian Bambury
- Re: RootPanel.get(String) + <DIV> weirdne... Thomas Broyer
- Re: RootPanel.get(String) + <DIV> weirdne... Ian Bambury
- Re: RootPanel.get(String) + <DIV> wei... davis
