6 Replies Latest reply on Sep 22, 2013 3:17 PM by dabloem

    jQuery pnotify plugin version

    jcharnet

      Hello, Richfaces 4.3.2 uses pnotify version 1.0.2. Is it possible to upgrade to use the latest version, 1.2.0 ? I know that some new features won't work with the component rich:notify, but If I use directly pnotify javascripts functions, I could get the latest updates from pnotify.

       

      Is it possible ?

       

      Thanks,

       

      John

        • 1. Re: jQuery pnotify plugin version
          lfryc

          Hey John,

           

          you can try to upgrade a library using Resource Mappong:

          http://lukas.fryc.eu/blog/2012/02/re-routing-jsf-resource-requests-with.html

           

          You just need to find out what's a resource key for pnotify now and then place the new version in your app.

           

          Please let me know your findings, we could certainly upgrade.

          • 2. Re: jQuery pnotify plugin version
            jcharnet

            Thanks for your response.

            I'm trying your idea, I found some references to jquery.pnotify.js as a ResourceDependency in NotifyRendererBase. But I'm not sure that jquery.pnotify.js is a key. Actually I don't think it is.

            Is it possible that there is no key for pnotify ? Or does every resource used by richfaces have necessarily a key ?

             

            If you have some ideas on where I could debug, to find out the correct key, this would help.

            I tried debugging ResourceMappingFeature and ResourceMappingConfiguration, but I did not find a key for pnotify, and nor did my property (static-resource-mappings.properties) get called.

            The content of static-resource-mappings.properties is:

             

            jquery.pnotify.js=taxit.theme/js/jquery.pnotify.1.2.min.js

             

            The file static-resource-mappings.properties is on my src/main/resources/META-INF/richfaces/static-resource-mappings.properties.

            And my pnotify javascript is in:

            WebContent/resources/taxit.theme/js/jquery.pnotify.1.2.min.js

             

            Thanks again !

             

            John

             

            John,

            • 3. Re: jQuery pnotify plugin version
              lfryc

              The resource key is composed from resourceLibrary:resourceName:

              https://github.com/richfaces4/components/blob/master/validator/ui/src/main/java/org/richfaces/renderkit/html/NotifyRendererBase.java#L34

               

              so the correct key in properties file is:

               

              org.richfaces\:jquery.pnotify.js=...

              • 4. Re: jQuery pnotify plugin version
                jcharnet

                Perfect, it worked !

                One last question, is there any changes on how to use this feature when the following web.xml properties are set to true ?

                org.richfaces.resourceOptimization.enabled and org.richfaces.resourceMapping.enabled

                 

                When these properties were set to true, pnotify was bundled in a packed.js file, and I could not see any references for org.richfaces:jquery.pnotify.

                 

                 

                Thanks again  !

                 

                John

                • 5. Re: jQuery pnotify plugin version
                  lfryc

                  In fact, resource optimization will cause a org.richfaces:jquery.pnotify to point to packed.js, but you can still rewrite it, since custom mappings will be applied later than optimization's mappings.

                   

                  In this case you have two options:

                   

                  a) custom version of pnotify.js will be loaded and it will actually overwrite the plugin which was registered before (from packed.js)

                   

                  b) the (a) won't happen to work and you will need to re-build a packed.js file yourself, from scratch:

                  https://community.jboss.org/people/michpetrov/blog/2012/11/27/resource-optimization-with-maven-resources-plugin

                  • 6. Re: jQuery pnotify plugin version
                    dabloem

                    Hi John,

                     

                    I tried the above approach, however info, error messages are still displayed as regular notifications (due to css). Did you find a solution for this, if you experienced the same...