4 Replies Latest reply on Dec 1, 2014 4:13 AM by sesharao_n

    Tooltip programmatically does not show!


      Hi guys!


      I have a really weird problem trying to use a ToolTip created programmatically inside a rich:dataTable column. I'm using Richfaces 4.2.2 Final.


      This is the java code snippet where I create the tooltip:


      UITooltip toolTip = new UITooltip();
      toolTip.setValueExpression("value", uEL.createValueExpression("#{dynamicItem.toolTip}", String.class));


      dynamicItem.toolTip has the String I want the tooltip show. I don't know if this is the right way to create a tooltip programmatically. It is a natural way for me.


      So when I run my application and check the list of items generated, the tooltip does not show and in the firebug console I have an error telling me that RichFaces.ui.Tooltip is not a constructor. As follows:


      I have no idea why is this happening.


      I have saw in some posts people using the HtmlToolTip class to create a tooltip programmatically, but I can't find that class in my application. So I guess I'm missing some JAR which has that class. Could you guys tell me which JAR I have to use in order to can instantiate the HtmlToolTip class?

      These are some JARs I'm using right now:






      Well, I hope somebody can help me out with this. I would appreciete a lot.

      Thanks in advance!



        • 1. Re: Tooltip programmatically does not show!

          Hey Ernesto, you are hitting issue where programatically added components does not load their resources.


          You will need to place tooltip on initially rendered view - you can make it rendered=false, but it needs to be there.


          Update: ouch, or better approach: you can load all the resources in one bundle, see:


          1 of 1 people found this helpful
          • 2. Re: Tooltip programmatically does not show!

            Hi Lukas!


            Thanks for answering. I don't understand how creating a Tooltip programmatically, has to do something with loading resources. For me, it's just a matter of create a component, set it a value and then finally attach it to the column.

            The data I need to put in the Tooltip is available just at runtime. Besides, I need to create the Tooltip at the moment I'm creating the column of the datatable in order to attach the tooltip to it.


            I read the post you gave me and added the context-param in web.xml. I suppose I missed to pack the several resources I have like css, javascript and the like, because I had some errors "NetworkError: 404 Not Found" as you can see in the following image:


            But at the end I'm still getting the same error regarding the Tooltip (as you can see), so I can say, even though I have had the resources packages, the Tooltip is still not working.


            Can you explain me in detail how could I place the tooltip "on initially rendered view" as you said before? I can't understand how's the relation between "placing some component in a render view" and "creating it programmatically". In the case when we use a Binding I can understand that relation, but not now.


            Thanks in advance for your help!

            • 3. Re: Tooltip programmatically does not show!

              Hi Lukas!


              I did what you told me and added a few lines in my web.xml taken from https://community.jboss.org/wiki/Troubleshooting-ResourceOptimization#comment-10489 so I have my tooltips working fine right now.

              These are the lines I added:


                  <servlet-name>Resource Servlet</servlet-name>
                  <servlet-name>Resource Servlet</servlet-name>


              But I have the error I put in the comments section of the Troubleshooting - Resource Optimization as you saw before.


              I'm gonna put it in another discussion. Thanks!

              • 4. Re: Tooltip programmatically does not show!

                By setting id to the component through programmatically, I am able to resolve this.


                Below you can find some sample code,

                private UIComponent createLocationContainer(IExecutionPlan IEplan) {

                  UIComponent locationContainer = this.htmlGenerator.createContainer("locationContainer");

                  locationContainer.setId("v" + Calendar.getInstance().getTimeInMillis() + new Random().nextInt());  //Setting Unique Id


                  UIComponent nodeNameContainer = this.htmlGenerator.createContainer("nodeNameContainer");

                  nodeNameContainer.setId("v" + Calendar.getInstance().getTimeInMillis() + new Random().nextInt()); //Setting Unique Id


                  /** Adds a popup with terminalservices * */
                  UITooltip terminalServicesTooltip = new UITooltip();




                  terminalServicesTooltip.setStyleClass("infoPopup bigPopup");


                   this.htmlGenerator.createTextLine("Terminal Services in " + location.getName(), "heading"));



                   //Tool tip should also be popped up when hovering the globe itself


                   nodeNameContainer.getChildren().add(this.htmlGenerator.createTextLine(this.location.getName(), "nodeHeading"));



                   return locationContainer;