Let's try to make this work, and put the clear solution on this forum !
I had my portlet class extending com.vaadin.Application. Now, in addition, I make it implement com.vaadin.terminal.gwt.server.PortletApplicationContext2.PortletListener.
Tomek Lipski:
1
2 ApplicationContext applicationContext = getContext();
3 if (applicationContext instanceof PortletApplicationContext2) {
4 PortletApplicationContext2 portletCtx = (PortletApplicationContext2) applicationContext;
5 portletCtx.addPortletListener(this, this);
6 } else {
7 mainWindow.addComponent(new Label(getMessage("please.use.from.a.portlet")));
8 }
I have three candidates for ApplicationContext. I choose com.vaadin.service.ApplicationContext.
I had mainWindow created in init(). To make your code work, I have made the mainWindow an attribute of my portlet class :
1private Window mainWindow;
Yesterday I got a big Liferay "internal error" after all of that, so I thought it had broken everything, so I rolled back. But today I have done it again, more slowly, and... it seems to work !
When I do a soft reload, that is a reload without the "?restartApplication", the init() method does not get called, and in my console I get :
1
2
3handleResourceRequest
4handleRenderRequest
5handleResourceRequest
Why do I have 2 handleResourceRequest calls ? No idea.
The good thing is thehandleRenderRequest call. So I will write all my reloading code in it.
Nicolas
Please sign in to flag this as inappropriate.