Externalresource + Liferay

Hi!

How can I open the externalresource in Liferay? When used only in Vaadin environment it works, but when Vaadin is integrated in Liferay, it doesn’t work anymore.

I use it like this window.open(new ExternalResource(url));

It opens the window, but not the url.

Thanks in advance.

The url actually seems to open well in mainwindow, but not in subwindow.

Any ideas how to open the url in subWindow?

Thanks.

The problem is the Window class, which represents at the same time a top-level window and a subwindow. Some of its API only applies to one, other parts to the other. We are planning to address this issue in the future to make things clearer.

Window.open() only applies to top-level windows. To achieve a similar effect in a subwindow, use the
Embedded
component with TYPE_BROWSER.

I actually tried like this in class that extends Window:

setContent(layout);
embedded = new Embedded(“”, new ExternalResource(url));
embedded.setType(Embedded.TYPE_BROWSER);
embedded.requestRepaint();
embedded.setImmediate(true);
embedded.setSizeFull();
layout.addComponent(embedded);

And this worked well in Vaadin environment, but not in Liferay anymore.

Thanks.

This code just opens the url in an iframe. It should not have anything Liferay specific. What was the problem?

It just opens the window, but doesn’t add anything inside. The window is totally empty. We used earlier only Vaadin environment and then it worked perfectly well. I haven’t changed the code at all.

Heli

Try to set size for the embedded. Would it help?

Actually we have changed the functionality now that it opens a new browser window as a pop-up window. I don’t have now time to change everything and try with different size. Reverting back wouldn’t be enough and it would mean quite a lot more.