Sunday, 22 January 2012

Liferay Client Side IPC using javaScript and call Icefaces Backing bean

To Communicate portlets by clientSide using javaScript,
Liferay Provide javascript function trigger and bind.
you can trigger a event from one portlet and send data to another 
portlet where you bind event using liferay javaScript function.


  • Trigger a event from sender Portlet.
 

   Liferay.trigger('event-name', {parameter: 'parameter'});



  • Now in another receiver portlet you have to bind the same event-name which one you have trigger from sender portlet.

      Liferay.bind('event-name',
             function(event, data){
                
                   var message = data.
parameter;
        }); 



  •   In Icefaces portlet if you want to communicate with you backing bean.Icefaes support iceSubmit(form,element,event).So you can trigger iceface commandButton or CommandLink using javaScript.Icefaces commandButton/Link have actionListener/Action fired on iceSubmit javaScript Call.

             Liferay.bind('event-name',
                  function(event, data){
                    var message = data.
parameter;
                    var form = document.getElementById('formName');
                    var element = document.getElementById('element');//button/Link
                    var evObj=document.createEvent("MouseEvents");
evObj.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);

                    iceSubmit(form,element,evObj);
                  // or you can trigger element click 
                 // element.click();
             });




............................................................................ 

Monday, 2 January 2012

Icefaces Facelet Custom Component

How to create Icefaces Facelet Custom Component.

Do the following configuration
Add following Jar files
    el-ri.jar
    icefaces-facelets.jar
    servlet-api.jar
   
in web.xml

<context-param>
    <param-name>facelets.DEVELOPMENT</param-name>
    <param-value>true</param-value>
</context-param>

<context-param>
    <param-name>facelets.LIBRARIES</param-name>
    <param-value>/WEB-INF/facelets/tags/externalcomp.taglib.xml</param-value>
</context-param>


in faces-config.xml

<application>
    <view-handler>com.icesoft.faces.facelets.D2DFaceletViewHandler</view-handler>
</application>


now create "externalcomp.taglib.xml" in /WEB-INF/facelets/tags/ and add following

<facelet-taglib>
    <namespace>http://www.abctaglib.com/jsf</namespace>
    <tag>
        <tag-name>MyComponent</tag-name>
        <source>mycomponent.jspx</source>
    </tag>
</facelet-taglib>

   
Now you can use your custom tag in your jspx file including folloeing content..


<ui:composition xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ice="http://www.icesoft.com/icefaces/component"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:mycomp="http://www.abctaglib.com/jsf">
               
        <mycomp:MyComponent .... here you can pass your parameter ....  ></mycomp:MyComponent>
        /// like
        <mycomp:MyComponent myvalue="10"></mycomp:MyComponent>
        //.....
        //.....
       
</ui:composition>



<mycomp:MyComponent myvalue="10"></mycomp:MyComponent>

You can use myvalue parameter in "mycomponent.jspx".
for example in "mycomponent.jspx" you want to print "myvalue",

<ice:outputText id="fromMyValue" value="#{myvalue}" />




...................................................................................................................

Infinidb _CpNoTf_ problem

infinidb table with a varchar column insert string as a '_CpNoTf_' while using Cpimport. The Problem is occured if inserted string ...