ActiveLink does not work when setSharedRenderParameter used inside event ha

I have 2 vaadin portlets. Portlet 1 and portlet2 in liferay on different pages. Want to navigate from portlet 1 to portlet 2 and pass a parameter. below is my code.

Problem is when the event handler is invoked the page refreshes and does not go to portlet2. I think this has got something to do with a new action being created internally by Vaadin when setSharedRenderParameter is invoked and that action is opening the same window.

Does any one know how to work around?

ActiveLink link = new ActiveLink("search", new ExternalResource("/web/guest/liferay-benefits"));
        link.addListener(new LinkActivatedListener() {

            public void linkActivated(LinkActivatedEvent event) {
            	PortletApplicationContext2 ctx = ..
            	Window mainWindow = ..
ctx.setSharedRenderParameter(mainWindow, "projectName", "Address");