Vaadin integration in Liferay

Hello,

I am testing Vaadin as we need to use a portal and I saw that the framework can be integrated with Liferay.
I have several questions about that.
I created 2 Vaadin portlets.

  1. The first one fires a portlet event. I have to make some process before sending this event, so I was wondering how to add something like a clickListener on the Link (that uses an ExternalResource to fire the portlet event)
  2. Is that possible to fire this event in a different way? (using another component like button?)
  3. The second portlet should listen to the portlet event fired by the first one.
    All I have is
    java.lang.ClassCastException: com.vaadin.terminal.gwt.server.ApplicationPortlet cannot be cast to javax.portlet.EventPortlet
    at com.sun.portal.portletcontainer.appengine.filter.FilterChainImpl.doFilter(FilterChainImpl.java:152)
    at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:63)

    I must do something wrong but I don’t know where.

Thanks for your help

First a small disclaimer: As there seems to be different types of “events” I might little off here, but let’s try…

For me it seems that EventPortlet is part of the Portlet 2.0 API, which is not implemented in the Vaadin.
There is
PortletApplicationContext
that can be used to register PortletListeners.

In a Vaadin application init you can use something like:

 if (getContext() instanceof PortletApplicationContext) {
  PortletApplicationContext ctx =
   (PortletApplicationContext) getContext();
  ctx.addPortletListener(this, new SomePortletListener());
 }

/** Implementation of PortletListener */
private class SomePortletListener implements PortletListener {

 public void handleActionRequest(
  ActionRequest request, ActionResponse response) {

  mainWindow.addComponent(new Label("Action received"));

 }

 public void handleRenderRequest(
  RenderRequest request, RenderResponse response) {
   doSomethingWithRequest();
 }

These have nothing to do with the events used inside an Vaadin application (button clicks, value change, etc), but just a way to integrate into surrounding portlet environment.

What Sami said, regarding EventPortlet.

Regarding this:

You can use Button, use the LINK -style if you want it to look like a link. Then open the ExternalResource with window.open().

Best Regards,
Marc

I think this support might be easy to add to the application by extending the
ApplicationPortlet
of Vaadin with implementing the
EventPortlet
interface and modifying the portlet.xml to use the extended ApplicationPortlet as the portlet-class.

public class MyApplicationPortlet extends ApplicationPortlet implements EventPortlet

This is just an idea that popped into my mind. I don’t know if it would really work. :slight_smile: