5 Replies Latest reply on Jan 14, 2012 6:19 PM by svkap

    custom component development

    svkap

      Hello.

       

      I am trying to implement rating component (using JQuery rating plugin - http://www.fyneworks.com/jquery/star-rating/ ).

      I first started with declaring the component as xhtml (you can see it in WebContent/resources/playerfinder/rating.xhtml). However, because of the c:forEach tag I decided that it would be better to implement it using Java classes.

       

      I have 3 problems:

       

      1.# {ratingTestBean.rate} is not evaluated (it was ok with the xhtml declaration approach)

      2. All radio inputs have onclick="alert('Input clicked!');" but it is not called.

      3. I struggle with adding ajax behaviour. Although I read a ton of jsf custom component matherials I still cannot figure out how to implement an ajax event and send the data back to the bean..

       

      I'd be happy to commit the component to RichFaces when it is ready.

        • 1. Re: custom component development
          svkap

          Hello again.

           

          I am almost there. I have only 1 problem left. On ajax events the component is not rendered properly. You can see the pics. I have attached the latest code as well. Probably it is a common problem with JQuery plugins.. I'd appreciate any hints.

           

          1.gif2.gif

          • 2. Re: custom component development
            svkap

            and again...

             

            The component is ready.

             

            The problem with the ajax render was resolved by adding script for binding the JQuery plugin (see last lines of UIRatingRenderer.encodeMarkup for details).

             

            You can download the sources and the component from: http://jsf.playerfinder.net/components.html . I hope these comments and of course the component itself will be useful.

             

            PrimeFaces have the same component but I had to rewrite it because for some strange reason PrimeFaces were loading my ViewScoped beans twice (RF loads the bean and then PrimeFaces decide to load it again for their component). I have tested mine along with RF and it looks good.

            • 3. Re: custom component development
              blabno

              Thanks for contributing this component.

              I wonder if it should substitute h:selectOneRadio (so have it's own value and f:selectItems) or should it be an addition. What do you think people?

              • 4. Re: custom component development
                blabno

                sv kap, I've rewritten your component to RF standard structure and prepared demo for it.

                Source can be found here. Once I find some time I'll share my thoughts on your component.

                I've also added info about your component here.

                • 5. Re: custom component development
                  svkap

                  Bernard, thank you for the effort. I'd be happy to receive some feedback. I've added some new components and cleaned the code. I have also created examples and component demos here: http://jsf.playerfinder.net/ . I started a new thread for the components here: http://community.jboss.org/thread/177423