3 Replies Latest reply on May 29, 2015 7:11 AM by pujar.santosh

    Overriding Richfaces renderers not working

    pujar.santosh

      Hello all,

      We are currently trying to upgrade the Richfaces libraries to 4.5.5 Final in our application.

      Since, we have local look & feel guidelines, we had to customize the Richfaces Calendar and InputNumberSpinner components color theme according to the local guidelines.

      To support the required look and feel, we had overridden the Richfaces renderers for both of above components in our code base. These overridden renderer classes are bundled in a separate library/jar have it's own faces-config.xml with below render-kit definition.

      <render-kit>
           <render-kit-id>HTML_BASIC</render-kit-id>
           <renderer>
                <component-family>javax.faces.Input</component-family>
                <renderer-type>org.richfaces.InputNumberSpinnerRenderer</renderer-type>
                <renderer-class>com.nsn.calypso.inputnumberspinner.CDKInputNumberSpinnerRenderer</renderer-class>
           </renderer>
           <renderer>
                 <component-family>org.richfaces.Calendar</component-family>
                 <renderer-type>org.richfaces.CalendarRenderer</renderer-type>
                 <renderer-class>com.nsn.calypso.calendar.CalypsoCalendarRenderer</renderer-class>
              </renderer>
      </render-kit>

      The above customization was working fine with Richfaces 4.3.7.

      But, now these customized themes/renderers are not at all loaded to application when it is launched with Richfaces 4.5.5 libraries.

      Could you please help me to resolve the issues. It is blocker issue for Richfaces upgrade.

      Thank you & BRs,
      Santosh

        • 1. Re: Overriding Richfaces renderers not working
          michpetrov

          I've tried overriding the Calendar renderer and it worked (I had the render-kit defined in faces-config of the app). I suppose your jars might be read "out of order" so that the classes aren't overwritten but I don't know if that can be changed. The component and renderer names have not changed.

          • 2. Re: Overriding Richfaces renderers not working
            pujar.santosh

            Hello Michal Petrov,

             

            Since, it was working was Richfaces 4.3.7 in both tomcat and websphere, we are unable to identify the reason for issue.

            I will try to investigate more based on your suggestion.

             

            Thanks for the support!

            • 3. Re: Overriding Richfaces renderers not working
              pujar.santosh

              Yeah, finally I solved it!!

               

              Proper code merging between Richfaces renderer classes and overriding classes solved the tomcat server issue. However, the components were not renderer with customized renderer classes when the application was deployed in Webshpere.

              Though the faces-configs of local library loaded after the one of Richfaces, Richfaces renderers were overwriting the local renderer class while preparing the renderer kit in Websphere due to server JSF's sorting logic. To resolve the issue, I needed to add ordering configurations in local libraries faces-config.xml:

               

                  <ordering>

                      <after>

                          <others />

                      </after>

                  </ordering>

               

              I think, if JSF had supported a additional configuration like <overwrite>true/false</overwrite> under render tag of renderer kit in faces-config.xml, users can use it to override the third-party library renderers easily as they require. This will also help user to not to bother about the uncertain library loading order in any servers.