PresenterWidgets not shown with custom RootPresenter

37 views
Skip to first unread message

blizarazu

unread,
Sep 26, 2013, 4:03:55 AM9/26/13
to gwt-pl...@googlegroups.com
Hi,

I need to show my GWT application inside a div, so I wrote a custom RootPresenter as described in the documentation:
http://code.google.com/p/gwt-platform/wiki/GettingStarted?tm=6#Embedding_a_GWTP_app_in_a_webpage

The problem I am having now is that none of the PresenterWidgets are loaded. However, if I run the page using the default GWTP's RootPresenter everything is shown fine.

I placed a div with id "myContainer" in my welcome page and my RootPresenter presenter looks like this:


public class MyRootPresenter extends RootPresenter {

    @Inject
    public MyRootPresenter(EventBus eventBus, RootView view) {
        super(eventBus, view);
    }

    @Override
    public void setInSlot(Object slot, PresenterWidget<?> content) {
        RootPanel.get("myContainer").add(content);
    }

}


The binding in the Gin module is done this way:

bind(RootPresenter.class).to(MyRootPresenter.class).asEagerSingleton();

 The PresenterWidgets are added in the onReveal method of the presenter that is revealed as root content:

@Override
    protected void onReveal() {
        super.onReveal();

        setInSlot(TYPE_SetRegisterContent, registerPresenter);
        setInSlot(TYPE_SetLoginContent, loginPresenter);
    }

registerPresenter and loginPresenter are PresenterWidget type variables which are  injected using Gin:

bindSingletonPresenterWidget(LoginPresenter.class, LoginPresenter.MyView.class, LoginView.class);

 As I said, all the presenters are shown if I use the default RootPresenter, but none of them if I use a custom RootPresenter.

Can anyone help me solving this problem? I really need to show the application into a div.

Thank you.

Christopher Viel

unread,
Sep 26, 2013, 5:41:50 PM9/26/13
to gwt-pl...@googlegroups.com
What is your RootView?

I don't recommend you override the setInSlot from RootPResenter: you are just preventing GWTP's core to reparent and handle presenter widgets properly. Instead, override setInSlot from RootView as described here https://github.com/ArcBees/GWTP/wiki/Website-Embedding.

--
You received this message because you are subscribed to the Google Groups "GWTP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gwt-platform...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages