1
votes

I have a requirement like communicating two vaadin portlets in Liferay. One portlet is with vaadin tree view showing reports name(webi reports).While clicking on the tree,I have to open the corresponding report in another portlet.

Could anyone please suggest your ideas and share the details in meeting this requirement.

Thaks in advance.

2

2 Answers

1
votes

One straightforward solution would be the Vaadin IPC add-on. See details and examples at: http://vaadin.com/addon/vaadin-ipc-for-liferay

Note, that this requires to use 6.x version of Vaadin.

0
votes
I have instlled vaadin control panel for liferay and installed vaadin liferay ipc in tomcat.
The below codes of two portlets sender and receiver .But I cannt able to receive.PLease help in solving this 

**sender :**

import com.vaadin.Application;
import com.vaadin.addon.ipcforliferay.LiferayIPC;
import com.vaadin.ui.Label;
import com.vaadin.ui.Window;

@SuppressWarnings("serial")
public class SenderipcApplication extends Application {

    public void init() {
        Window window = new Window();

        setMainWindow(window);

        Label label = new Label("Hello Senderipc!");

        window.addComponent(label);

        LiferayIPC ipc = new LiferayIPC();
        ipc.sendEvent("eventid1", "This is sender 1");

        window.addComponent(ipc);
    }

}



**receiver**

package senderipc;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.EventRequest;
import javax.portlet.EventResponse;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.ResourceRequest;
import javax.portlet.ResourceResponse;

import com.vaadin.Application;
import com.vaadin.addon.ipcforliferay.LiferayIPC;
import com.vaadin.addon.ipcforliferay.event.LiferayIPCEvent;
import com.vaadin.addon.ipcforliferay.event.LiferayIPCEventListener;
import com.vaadin.terminal.gwt.server.PortletApplicationContext2.PortletListener;
import com.vaadin.ui.Label;
import com.vaadin.ui.Window;

   public class receiveripc extends Application implements PortletListener {



     String name="";
     String data = "";
    public void init() {
        Window window = new Window("Vaadin Portlet Application");
        window.setName("sample");
        setMainWindow(window);
        window.addComponent(new Label("Hello Vaadin fgfgfgsgsdg!"));
        name=window.getName().toString();
        LiferayIPC liferayipc = new LiferayIPC();

        liferayipc.setImmediate(false);
        liferayipc.setWidth("200px");
        liferayipc.setHeight("200px");
        liferayipc.getDescription();


        liferayipc.addListener("eventid1", new LiferayIPCEventListener() {
            public void eventReceived(LiferayIPCEvent event)
            {
                // Do something with the message data

                data = event.getEventId();
             //  getMainWindow().

               getWindow(name).showNotification("Received hello: " + data);


          //     printData(window,data);

            }
        });
        window.addComponent(liferayipc);
        window.addComponent(new Label(data+"++++++++++gsdgsdgsdgsd++++++555Hello Vaadin hhfhhdfhdfh!"));
    //    window.addComponent(new Label(data+"++++Hello Vaadin usetttttttttttt!"));
    }

//  public Window getWindow() {
//      // TODO Auto-generated method stub
//       Window window1 = window;
//      return window1;
//  }

    protected void printData(Window window, String data) {
        // TODO Auto-generated method stub 
         window.addComponent(new Label(data + "Hello Vaadin userhghjgjgkjh!"));
    }

    @Override
    public void handleRenderRequest(RenderRequest request,
            RenderResponse response, Window window) {
        // TODO Auto-generated method stub

    }

    @Override
    public void handleActionRequest(ActionRequest request,
            ActionResponse response, Window window) {
        // TODO Auto-generated method stub

    }

    @Override
    public void handleEventRequest(EventRequest request,
            EventResponse response, Window window) {
        // TODO Auto-generated method stub

    }

    @Override
    public void handleResourceRequest(ResourceRequest request,
            ResourceResponse response, Window window) {
        // TODO Auto-generated method stub

    }



//  LiferayIPCEvent event=null;
//  event.getData();
//  LiferayIPCEventListener listener=null;
//  listener.eventReceived(event);

}