1 2 Previous Next 20 Replies Latest reply on Jul 20, 2011 10:07 AM by blabno

    Watermark component

    blabno Master

      Hello Community!


      I've just created watermark component for RF 3.3.4-SNAPSHOT. Soon I will migrate it to 4.0.

      Please post your feedback.


      Demo, download and subversion address are here.


      Make sure to use default script and style loading strategies.

        • 1. Watermark component
          psesi Newbie

          Thanks for making this component available - I've been looking for just this type of support for some time. I have downloaded the library and tested. I wasn't able to get it to work immediately because the *.watermark.js scripts aren't being automatically included in the page referencing the <watermark:watermark> component. If I "manually" include the script files on the page, things work as expected. I have not used a custom component like this before, so I may have gotten something wrong in configuration. As a quick rundown, I copied the watermark "resources-config.xml" and "watermark-component-dependcies.xml" to META-INF, "watermark.tld" to WEB-INF, copied in "watermark.tablib.xml", added to web.xml facelets.LIBRARIES context-param, and in faces-config.xml added  <component> and <renderer> entries for org.richfaces.Watermark. I am using the Richfaces 3.3.3 final library. Any help on the matter would be much appreciated!

          • 2. Re: Watermark component
            blabno Master

            Custom components require default loading strategy. Do you have this in web.xml?


            {code}    <context-param>










            Why "ALL" strategy does not work? Well, during RF build all components' scripts are aggregated into one file. Then at runtime it is that file that gets included in stead of each component's script. Now, was custom component available during the build? No, that's why it is custom, it was created later thus it was not included into ALL file. The same goes for styles.

            • 3. Watermark component
              psesi Newbie

              Right! Thanks for the quick and informative response. Had the load strategies set to ALL as you suspected. Changed them to DEFAULT and all is working as expected. Thanks again for your help - and for the watermark!

              • 4. Watermark component
                Srinivasan Mahadevan Newbie

                Hi Bernard,


                  The component looks great.


                  Between, i have a query, what are the steps we need to follow to migrate from the existing RF version to 4.0?


                  Does 4.0 version components are compatible with the RF previous versions ?






                • 5. Watermark component
                  blabno Master

                  Component is not ready for RF4.0 due to lack of community feedback. If you want I can migrate it to RF4.x soon.


                  Components from RF3 are not compatible with 4.x.

                  • 6. Watermark component
                    Srinivasan Mahadevan Newbie

                    So i can Assume that 4.x components are not compatible with RF 3 versions right?






                    • 8. Watermark component
                      Dragan Misita Newbie

                      Hi, thanks for the good work. However, just tried it, and was working properly on a regular inputText, but did not work for me on a rich:calendar. Any insight would be greatly appreciated.




                      • 9. Watermark component
                        Dragan Misita Newbie

                        I suspect, the reason would be that the id given to the calendar component, is not the actual id of the input text component rendered.

                        • 10. Watermark component
                          blabno Master

                          Exactly, it's because input control has component id+suffix. Focus component does support suffixes but watermark does not, yet.

                          I'm not sure how should I implement this.


                          One way is using "for" attribute. However now we get to issue: what if we put id of non-jsf component as value of "for"? Should the component throw exception that no component with given id was found or assert (like in focus) that it may be client side non-jsf element.

                          In latter case it could throw javascript error if no element was found.

                          Next issue with "for" is re-rendering. You have to remember always to re-render also all components that point to re-rendered component in their "for".


                          Other way would be supporting only jsf components and using the assumption that component id + suffix would be enough, thus adding "suffix" attribute only.


                          If you see other options please let me know.

                          • 11. Watermark component
                            Dragan Misita Newbie

                            From my point of view, supporting jsf components would be a priority. If someone is using a non-jsf components, then may as well use jQuery plugin directly. My problem is that I could not make neither one support a calendar component, and am reluctant to enable the feature on some, but not other input fields. Thanks again.

                            • 12. Watermark component
                              blabno Master

                              Dragan, you can download artifact again, i've modified it to support "for" and "suffix" attributes". It is still under the same version.

                              • 13. Watermark component
                                Dragan Misita Newbie

                                Thanks a lot Bernard. Did not expect such a quick reaction. Amazing. I will give it a try. 

                                • 14. Watermark component
                                  Radha Krishnan Newbie

                                  Hi Bernard,


                                  I have downloaded the jar and made necessary configurations (DEFAULT in web.xml) to display watermark in one of the textbox, it didn't work.

                                  I am using JSF 1.2, RichFaces 3.3.1. Do i need to upgrade the richfaces to any other higher version to use this watermark??




                                  1 2 Previous Next