Tooltip with Graphic

UI Components for JSF
Post Reply
sudhik.sk@gmail.com
Posts: 5
Joined: 08 Jun 2017, 20:29

04 Dec 2019, 00:40

I'm trying to display a graphic for tooltip. Below is my code snippet. I tried to put this image almost everywhere.

webapp/resources/images/logo_allianz.gif
src/main/resources/images/logo_allianz.gif
server/images/logo_allianz.gif

Nothing works. I just get a blank small tool tip like box when I hover over the header text.

<p:panel id="nonParaGroupFap" toggleableHeader="true" toggleable="true">
<f:facet name="header">
<h:outputText id="SectionName" value="#{currSection.friendlyName}"/>
</f:facet>
<p:tooltip id="sectionToolTip" for="SectionName">
<p:graphicImage name="resources/images/logo_allianz.gif" />
</p:tooltip>
</p:panel>


Also, could anyone answer below:
1. Does the graphic image for tooltip has any limitations on extension or size
2. Can we display a html page as tooltip ? If yes, I may not have to convert html pages to graphics

tandraschko
PrimeFaces Core Developer
Posts: 3671
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

04 Dec 2019, 11:59

Google about how h:graphicImage works exactly. There is also a "library" attribute.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

sudhik.sk@gmail.com
Posts: 5
Joined: 08 Jun 2017, 20:29

04 Dec 2019, 22:20

Thanks.

Is there any documentation on how it works.

I'm trying to load tooltip graphics dynamically under a repeat. Everytime it shows the same graphic though.

<ui:repeat value="${currsectionGroup.formSections}" var="currSection">
<p:panel id="nonParaGroupFap" toggleableHeader="true" toggleable="true" collapsed="#{! currSection.editable}" rendered="#{draftClaimsView.isSectionDisplayable(currSection)}">
<f:facet name="header">
<h:outputText id="SectionName" value="#{currSection.friendlyName}"/>
</f:facet>
<p:tooltip id="sectionToolTip" for="SectionName">
<p:graphicImage value="#{fapImageView.fapImage}">
<f:param name="fapName" value="#{currSection.name}" />
</p:graphicImage>
</p:tooltip>
</p:panel>
</ui:repeat>


public StreamedContent getFapImage(){
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
String fapName = externalContext.getRequestParameterMap().get("fapName");
System.out.println(fapName);
try{
String fileName = "C:\\Work\\Images\\";
if(fapName == null){
System.out.println("In null");
fileName += "null.png";
}
else if(fapName.startsWith("ICHARTA")){
System.out.println("In incharta");
fileName += "tooltip.png";
} else {
System.out.println("In else");
fileName += "logo.gif";
}

System.out.println(fileName);
InputStream stream = new FileInputStream(fileName);
return new DefaultStreamedContent(stream, "image/png", "fapName");
}catch(Exception ex){
ex.printStackTrace();
return null;
}
}

tandraschko
PrimeFaces Core Developer
Posts: 3671
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

04 Dec 2019, 22:55

Please please please use google and stackoverflow before asking question. Everything discussed many many times ago: https://lmgtfy.com/?q=primefaces+graphicimage+repeat
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests