Problem with Website Embedding

30 views
Skip to first unread message

Eugen Besel

unread,
Mar 14, 2016, 1:50:05 PM3/14/16
to GWTP

Hello together,

I have a small GWTP App which uses gwt(2.8.0-beta1) and gwtp 1.5.2. this app should be embedded into another html page.
So I took a look into gwtp docu and implemented MyRootPresenter with:

public class MyRootPresenter extends RootPresenter {

private static final Logger LOG = Logger.getLogger(MyRootPresenter.class.getName());

public static final class MyRootView extends RootView{
@Override
public void setInSlot(Object slot, IsWidget content) {
LOG.info("enter SetInSlot in MyRootPresenter");
RootPanel.get("mainContent").add(content);
}
}

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

and ClientModule with
bind(RootPresenter.class).to(MyRootPresenter.class).asEagerSingleton();

I'm not sure, whether it works, because:

If I don't have any div element in my index.html with id = "mainContent", then I still can see my application. (I would expected, that some error occurs)
I add a log into the method setInSlot in MyRootPresenter und set a breakepoint, but neither log nor breakepoint fired. It seems for me, that the application don't go to the setInSlot.

Can you please tell me what should I do? I have also following code in my application:


RootPanel.get("mainContent").getElement().getAttribute("data-customerId");


on this point exception fired, that RootPanel.get("mainContent") doesnt exist.

thank you very much.

Clay Harris

unread,
Mar 14, 2016, 2:04:25 PM3/14/16
to GWTP
It appears that what you're doing is overriding the view's setInSlot, which only applies when setting things in the presenter/view's slot, not setting the location of the presenter and view themselves.

I'm not sure of the best way to set a GWTP app in a specific element on a page, I've only used it as a full SPA, but maybe that will help a bit.

--
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/d/optout.
Message has been deleted

Eugen Besel

unread,
Mar 14, 2016, 5:45:24 PM3/14/16
to GWTP

Eugen Besel

unread,
Mar 14, 2016, 6:07:21 PM3/14/16
to GWTP
I found what I have implemented wrong :)
Constructor of MyRootPresenter should inject the new class MyRootView and not the old RootView.



Am Montag, 14. März 2016 18:50:05 UTC+1 schrieb Eugen Besel:
Reply all
Reply to author
Forward
0 new messages