Ok, so when I was having this problem I was just experimenting with
the very simple UI that comes with the sample app.

I also tried keeping the SimplePanel and having the Activity return a
HeaderPanel consisting of a label and an image (the second method
mentioned in Ashton's Answer). I thought this didn't work. And I saw
comments in blogs and forums that seemed to indicate this doesn't
work. But once I started actually building up the UI with a DockPanel
and nested TabPanel, etc., all of the sudden everything started
displaying properly. I don't know why. It was probably a bug in my
code I suppose. But I'm on my way now. I don't care to go back and
diagnose exactly what went wrong. :)

But thanks for your suggestion Chris!

Corey

On Jun 11, 2:15 pm, "Chris McBrien" <[email protected]> wrote:
> Ate you perhaps using a layoutpanel?  I believe simplepanel descends from 
> panel.
>
> For layoutpanels use rootlaylout.get
>
> sorry for my poor typing. I'm trying to tap this out quickly on my mobile.  
>
> Corey <[email protected]> wrote:
>
> I'm trying to modify the GWT 2.1 HelloMVP example code to use a more
> complex 
> UI.http://code.google.com/p/google-web-toolkit/downloads/detail?name=Tut...
>
> My problem is that ActivityManager.setDisplay only accepts objects
> that implementAcceptsOneWidget. LayoutPanel and other ComplexPanel's
> don't implementAcceptsOneWidget. The example code uses a SimplePanel
> instead.
>
> I've found a few discussions on this 
> problem:http://stackoverflow.com/questions/5143196/is-there-a-acceptsonewidge...http://www.tempura.org/rants/2010/10/using-layoutpanels-with-gwt-2-1s...
>
> People suggest the solution is to create a subclass of the
> ComplexPanel I want that implements theAcceptsOneWidgetinterface.
> Like so:
>
> public class PanelForView extends LayoutPanel implementsAcceptsOneWidget{
>     IsWidget myWidget = null;
>
>     @Override
>     public void setWidget(IsWidget w) {
>         if (myWidget != w)  {
>             if (myWidget != null) {
>                 remove(myWidget);
>             }
>
>             if (w != null) {
>                 add(w);
>             }
>
>             myWidget = w;
>         }
>     }
>
> }
>
> This sounds great but it doesn't seem to work for me. Perhaps because
> I'm using GWT 2.3 instead of 2.1 or 2.2. In my EntryPoint I expect to
> simply replace the SimplePanel with my new PanelForView class and have
> the app run as before. Like so:
>
> public class HelloMVP implements EntryPoint {
>         private Place defaultPlace = new HelloPlace("World!");
> //      private SimplePanel appWidget = new SimplePanel(); // Replace this
> with PanelForView
>         private PanelForView appWidget = new PanelForView(); // This compiles
> but doesn't work.
> //      private SimpleLayoutPanel appWidget = new SimpleLayoutPanel(); //
> This doesn't work either.
>
>         public void onModuleLoad() {
>                 // Create ClientFactory using deferred binding so we can 
> replace
> with different
>                 // impls in gwt.xml
>                 ClientFactory clientFactory = GWT.create(ClientFactory.class);
>                 EventBus eventBus = clientFactory.getEventBus();
>                 PlaceController placeController =
> clientFactory.getPlaceController();
>
>                 // Start ActivityManager for the main widget with our 
> ActivityMapper
>                 ActivityMapper activityMapper = new
> AppActivityMapper(clientFactory);
>                 ActivityManager activityManager = new
> ActivityManager(activityMapper, eventBus);
>                 activityManager.setDisplay(appWidget);
>
>                 // Start PlaceHistoryHandler with our PlaceHistoryMapper
>                 AppPlaceHistoryMapper historyMapper=
> GWT.create(AppPlaceHistoryMapper.class);
>                 PlaceHistoryHandler historyHandler = new
> PlaceHistoryHandler(historyMapper);
>                 historyHandler.register(placeController, eventBus, 
> defaultPlace);
>
>                 RootPanel.get().add(appWidget);
>                 // Goes to place represented on URL or default place
>                 historyHandler.handleCurrentHistory();
>         }
>
> }
>
> This compiles fine but when I run it, I see nothing but a blank screen
> now. Is there something extra I have to do to initialize a
> ComplexPanel? Am I just misunderstanding something? I've tried adding
> Widgets and calling setSize to no avail. This is my first GWT project.
>
> Thanks for your time.
>
> Corey
>
> --
> 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 
> athttp://groups.google.com/group/google-web-toolkit?hl=en.

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