2012-10-10 3 views
1

Liferay에서 두 개의 vaadin 포틀릿 통신과 같은 요구 사항이 있습니다. 하나의 포틀릿은 보고서 이름 (webi reports)을 보여주는 vaadin 트리보기와 함께 있습니다. 트리를 클릭하는 동안 다른 포틀릿에서 해당 보고서를 열어야합니다.Vaadin 포틀릿을 사용하는 Liferay 6.1의 포틀릿 간 통신

누구든지 아이디어를 제안하고이 요구 사항을 충족하는 데 세부 사항을 공유해주십시오.

미리 타크.

답변

0
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); 

} 
관련 문제