Webinar: Filthy Rich Portlets with ICEfaces and Liferay

UPDATE: March 17, 2011

This blog post refers to an old version of ICEfaces (1.8). I would encourage you to try out the ICEfaces 2 versions of these portlets here: http://www.portletfaces.org/portletfaces-bridge/examples


ORIGINAL POST FOLLOWS: September 30, 2008

Note: An archive of the webinar is now available on ICEfaces .org in both .wmv and quicktime:
http://www.icefaces.org/main/resources/webinars.iface (3rd item in the Archive Webinar list)

Also, here is a video+transcript of a similar presentation given at the JSFOne conference:
http://java.dzone.com/videos/filthy-rich-portlets

Webinar Title: Filthy Rich Portlets with ICEfaces and Liferay

Webinar Date/Time: Tuesday, October 14, 2008 1:00 PM - 2:00 PM EDT

Webinar Link: https://www1.gotomeeting.com/ojoin/451479046/1859554

Webinar Slides and Demo Downloads:

The sources are meant to be extracted into the "plugins" folder of the Liferay Plugins SDK. Fore more info, download the the Liferay Plugins SDK documentation.

Webinar Overview:

  • Portals and Portlets
  • Liferay Portal
  • JSF Portlets
  • ICEfaces Portlets
  • Standard Inter-Portlet Communication
  • Ajax Push Inter-Portlet Communication


 

Blogs
Where can I download the war files for these sample? I tried to open the source project with Netbeans and Eclipse, but IDE could not recognize the project.
I updated the blog entry with some more info regarding the Liferay Plugins SDK, which will help you get the samples running in the portal. The ZIPs do not contain any IDE project files. The build.xml files require the Liferay Plugins SDK to execute properly.

Thanks for helping me clarify these points!
thanks for the clarification. It would be really handy for testing if you can include the war files for downloading. As people like me are not familiar with Liferay Plugins SDK or just me emoticon
Really interested in having a look into the ICEfaces IPC AJAX Push portlet, but on 5.1.1. Should it work? I added to the SDK and deployed but I get the following exception during deployment :

org.dom4j.DocumentException: Error on line 3 of document file:///C:/projects/liferay5.1.0/tomcat/20081006023146275/WEB-INF/portlet.xml : Document is invalid: no grammar found. Nested exception: Document is invalid: no grammar found.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
...(cont)

Nested exception:
org.xml.sax.SAXParseException: Document is invalid: no grammar found.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
...(cont)

Nested exception: org.xml.sax.SAXParseException: Document is invalid: no grammar found.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
...(cont)
Because of http://support.liferay.com/browse/LEP-7118 I recommend trying Liferay 5.1.2

Also, when you work with the Plugins SDK, make sure the version of the Plugins SDK matches the version of the portal.
I eventually found the solution. I had to copy xercesImpl.jar into the ../tomcat/lib/ext folder from the ../tomcat/webapps/ROOT/WEB-INF/lib folder. The exception went away.

Now only one issue - session timeout. It appears to work independently from Liferay's timeout. Have you investigated how to tie the two together so the user never gets the ICEface one displayed?
I'm not sure if this applies to the exact problem you're experiencing, but according to Nate Cavanaugh (Liferay's UI designer), you should be able to simply call:

Liferay.Session.extend() and prevent the banner from showing up, and extend the session.

So your function would look like:
function updateLiferaySession(){
Liferay.Session.autoExtend = false;
Liferay.Session.extend();
}

Then you should be able to extend the session at your leisure.
Hi, sorry if this is not directly related to the Webinar, but I was wondering if you know how to enable Liferay's "file browser feature" (FCKEditor file browser) in the ice:inputRichText component?

And/or if the Liferay InputHTML component is available in the portletfaces project?

I think this would be a greate topic for a blog post or wiki post emoticon

Thank you for greate examples on ICEfaces+Liferay!

- Erik
Thanks for the kind words Erik. Yes, PortletFaces has a JSF component named pf:inputHTML that manifests itself with the FCKEditor. The Java code for the component has been there for some time, but I just committed an update to faces-config.xml that enables auto-registration of the component and its renderer when the PortletFaces JAR is included in your portlet's WEB-INF/lib folder.
I managed to get the inputHTML component to work. I had to add a portletfaces-common.taglib.xml in WEB-INF and add

<tag>
<tag-name>inputHTML</tag-name>
<component>
<component-type>com.liferay.portletfaces.component.InputHTML</component-type>
</component>
</tag>

also i added

<context-param>
<param-name>facelets.LIBRARIES</param-name>
<param-value>/WEB-INF/portletfaces-common.taglib.xml
</param-value>
</context-param>

to web.xml.

In order to get it workin with ICEfaces i had to edit the InputHTMLRenderer.java because

long plid = portletFacesUtil.getPlid();

threw a nullPointerException, so I used

ThemeDisplay themeDisplay = (ThemeDisplay) ((RenderRequest) (facesContext.getExternalContext().getRequest())).getAttribute(WebKeys.THEME_DISPLAY);

Do you know why portletFacesUtil is null?

I haven't tested it very much, but the editor is displayed and filebrowsing works (though I get an error when uploading files).

I would really like to be able to integrate the <ice:inputRichText> component with the Liferay Connector to enabel filebrowsing using the icefaces component, do you know of any reason why this should be a problem?

I will look in to it and maby post a wiki if a make it emoticon

Thanks for the help!
Turns out that integrating the Liferay Connector into the <ice:inputRichText> component was pretty easy. I only had to configure the customConfigPath attribute and point to a custom fckconfig.jsp file. Maby I'll write a short how-to if anybody else are interested.

Erik
Erik,

Please write something how you managed to add file browsing stuff to inputRichText !

I have some other problems with inputrichtext and portlets (ver 1.7.2). Were you using the same ?

Thanks !
ThemeDisplay themeDisplay = (ThemeDisplay) ((RenderRequest) (facesContext.getExternalContext().getRequest())).getAttribute(WebKeys.THEME_DISPLAY);

Do you know why portletFacesUtil is null?

Because Liferay is setting it to null explicitely (they call it recycle). ThemeDisplay is "aproximatelly" available at the constructor time of your backing bean if xhtml page required creation of that backing bean.

Neil, is there an exact rule when the ThemeDisplay is available, maybe it's related to JSF lifetime cycles ?
UPDATE!

An archive of the webinar is now available on ICEfaces .org in both .wmv and quicktime:
http://www.icefaces.org/main/resources/webinars.iface (3rd item in the Archive Webinar list)

Also, here is a video+transcript of a similar presentation given at the JSFOne conference:
http://java.dzone.com/videos/filthy-rich-portlets
Hi Neil!

Thanks for the great work. I managed to deploy and use ICEfaces IPC Ajax Push Portlet portlet. It works OK. But I need to use to the newest version of icefaces. Unfortunately after trying to update icefaces libraries to newer version (from 1.7.1 to 1.8.1) this sample portlet doesn't want to work. After clicking on one of customers on customer list, second portlet doesn't rerender itself. I receive no exception - only one warning in log file. Here is this warning

"Push Server not found - the Push Server must be deployed to support multiple asynchronous applications. "

I am using liferay 5.2.3 and glassfish v2. Could you please tell me what to do to make it possible to use the newest icefaces with ajax push based IPC?
Just in case... do you have the speed-filters-enabled option set to false in your liferay-plugin-package.properties file? See this forum post for more details: http://www.liferay.com/web/guest/community/forums/-/message_boards/message/1979279
Thank you Neil for the examples!

But I have a problem when I use your Demo 4 (let's call the portlets A1 and B1) with another couple of communicating portlets A2 and B2 (in another war).

In a typical 2 columns layout, if I put one of your portlets in first position (top-left) in my page:
- The IPC for your example works fine (action on portlet A1 -> re-render of portlet B1)
- The IPC in my adapted example seems to be "broken" (Action on portlet A2 -> portlet B2 not re-rendered, but the shared value is in the session; a refresh of the whole page makes it appear)

The opposite is also true: if it is one of "my" portlets which is placed first (top-left), the portlets of your example are not rerendered after an action.

It seems to be a RenderManager problem.

Do anyone have an idea about this?
Thank you Neil for the examples!

But I have a problem when I use your Demo 4 (let's call the portlets A1 and B1) with another couple of communicating portlets A2 and B2 (in another war).

In a typical 2 columns layout, if I put one of your portlets in first position (top-left) in my page:
- The IPC for your example works fine (action on portlet A1 -> re-render of portlet B1)
- The IPC in my adapted example seems to be "broken" (Action on portlet A2 -> portlet B2 not re-rendered, but the shared value is in the session; a refresh of the whole page makes it appear)

The opposite is also true: if it is one of "my" portlets which is placed first (top-left), the portlets of your example are not rerendered after an action.

It seems to be a RenderManager problem.

Do anyone have an idea about this issue?
I'm responding to my-self:

To make many ajax push applications work on the same portal it's necessary to use the push-server web app and the latest version of IceFaces (I was using the 1.7 and the built-in push-server functionnality).

web.xml of push-server.war and the web.xml of portlets need to be adapted to use push-server.
I'm back with a new "problem":

I don't realy understand how the "groups" system, specified in the "getOnDemandRenderer" methods, works.

It renders all the views depending on the bean that has a render manager with this group?

It renders all the chanched views?

According to the IceFaces documentation, the render groups are made for re-rendering components between all clients (the chat room example) but I have experienced something different: the re-rendering is actually working only on the view of the client that have triggered the change. It's fine for me because I don't need to re-render all clients on my actions but it's quite confusing.

Can someone just explain me how the render groups work in a portlet (with IPC) context.
I am unable to download Demo source codes.. can you please give me another links

Thanks In Advance,
Tejash
The links for this are not working. It says I do not have permission.
Thanks for pointing that out -- I had to grant permission on the folder containing the items. However, I would encourage you to try out the JSF 2.0 versions of these portlets here: http://www.portletfaces.org/portletfaces-bridge/examples