-
1. Re: Tooltip programmatically does not show!
lfryc Aug 15, 2012 1:28 PM (in response to ealonso04)1 of 1 people found this helpfulHey 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:
http://rik-ansikter.blogspot.cz/2012/02/optimizing-resource-loading-with.html
-
2. Re: Tooltip programmatically does not show!
ealonso04 Aug 15, 2012 5:50 PM (in response to lfryc)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!
ealonso04 Aug 16, 2012 11:32 AM (in response to ealonso04)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>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/org.richfaces.resources/*</url-pattern>
</servlet-mapping>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!
sesharao_n Dec 1, 2014 4:13 AM (in response to ealonso04)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
serviceVisitedNodes(locationContainer);
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.setFollowMouse(false);
terminalServicesTooltip.setHorizontalOffset(0);
terminalServicesTooltip.setVerticalOffset(0);
terminalServicesTooltip.setStyleClass("infoPopup bigPopup");terminalServicesTooltip.getChildren().add(
this.htmlGenerator.createTextLine("Terminal Services in " + location.getName(), "heading"));
terminalServicesTooltip.getChildren().add(this.createTerminalServiceContainer(IEplan));nodeNameContainer.getChildren().add(terminalServicesTooltip);
//Tool tip should also be popped up when hovering the globe itself
locationContainer.getChildren().add(terminalServicesTooltip);nodeNameContainer.getChildren().add(this.htmlGenerator.createTextLine(this.location.getName(), "nodeHeading"));
locationContainer.getChildren().add(nodeNameContainer);
return locationContainer;
}