voyent
Ice:panelToolTip with forms  XML
Forum Index -> General Help
Author Message
StormTAG

Joined: 30/Sep/2008 00:00:00
Messages: 15
Offline


I'm running into a bit of an issue with the panelToolTip. I'm hoping there's a way around this before I have to go and do semi-major refactoring.

When I put a panelToolTip in my div which is position:absolute; or position:relative;, it goes wonky. I looked it up and found that this is a problem, so I pulled it into its own file which I include without any surrounding panelGroups/divs.

Now, I'm getting an error concerning "findForm" on JSPX compile time. It doesn't do this when I put the tooltips back into the same form (which is currently, within a position:relative div.)

So it seems that the tooltips have to be in the same form as the panelGroup that uses it OR the panelGroup is not in a form. This is, unfortunately, going to make me have to change a lot of markup to get forms in the right spots. Hopefully someone can help me!

Some code...

This breaks.
Code:
 <ice:form>
    <ice:panelGroup panelTooltip="staticTooltip" >
       <ice:outputText value="Hovering on this text will bring a panelTooltip" />
    </ice:panelGroup>
 </ice:form>
       
 <ice:panelTooltip id="staticTooltip" style="width: 300px; height: 200px; background: #FFFFFF;">
    <f:facet name="body">
       <ice:outputText value="This panelTooltip is static." />
    </f:facet>
 </ice:panelTooltip>
 


I'm using the 1.6.2 release with Apache and FireFox.
StormTAG

Joined: 30/Sep/2008 00:00:00
Messages: 15
Offline


Guess I'm going to have to rework a lot of code, huh?
mark.collette


Joined: 07/Feb/2005 00:00:00
Messages: 1692
Offline


What happens if they're in different forms, but the panelTooltip comes after/below the panelGroup in your jspx/xhtml source?
[Email]
StormTAG

Joined: 30/Sep/2008 00:00:00
Messages: 15
Offline


Yeah, if I include the tool tip inside the panel group that will spawn it, it works fine. It's not how my original design was going to work, but I think I can work with that.

Thanks!


For any who come after and read this having any similar problems, IceFaces seems to throw null pointers if you try to add a Tooltip to a panelgroup when that tooltip is in another form.

This was the stack trace I was getting:

Code:
java.lang.NullPointerException
 	com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.findForm(DomBasicRenderer.java:562)
 	com.icesoft.faces.util.CoreUtils.addPanelTooltip(CoreUtils.java:167)
 	com.icesoft.faces.component.ext.renderkit.GroupRenderer.encodeEnd(GroupRenderer.java:215)
 	javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
 	com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:362)
 	com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:92)
 	javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
 	com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:571)
 	com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:575)
 	com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:575)
 	com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:575)
 	com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:575)
 	com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:544)
 	com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:159)
 	com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
 	com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
 	com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
 	com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:18)
 	com.icesoft.faces.context.View$2.respond(View.java:44)
 	com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:167)
 	com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet$ThreadBlockingRequestResponse.respondWith(ThreadBlockingAdaptingServlet.java:36)
 	com.icesoft.faces.context.View.servePage(View.java:274)
 	com.icesoft.faces.webapp.http.core.MultiViewServer.service(MultiViewServer.java:62)
 	com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
 	com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:160)
 	com.icesoft.faces.webapp.http.servlet.SessionDispatcher$1.service(SessionDispatcher.java:38)
 	com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
 	com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)
 	com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:55)
 	com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
 	com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:91)
 	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 
mark.collette


Joined: 07/Feb/2005 00:00:00
Messages: 1692
Offline


That NPE looks like it couldn't actually find the PanelTooltip from the expression you provided to the panelGroup's panelTooltip property.

Essentially, JSF uses a syntax where you can just specify the panelTooltip's id, and if it's in the same NamingContainer it will find it. Or, you can prefix the id with a colon, and it will search from the root of the component tree. ICEfaces adds a syntax where you can prefix it with two colons, and then any number of colons to denote looking up that number of NamingContainers for the panelTooltip. Most likely, you're simply not adding enough colons before the panelTooltip's id. When they're in different forms, so that the panelGroup's id is "formA:pg" and the panelTooltip's id is "formB:ptt", then the value you should use is probably something like ":::formb:ptt". One major thing to remember is that dataTable, ice:columns, and other container omponents are also NamingContainers, and so moving up past them requires adding another prefixing colon.
[Email]
StormTAG

Joined: 30/Sep/2008 00:00:00
Messages: 15
Offline


Wow. Learn something new every day. Didn't know there was such a colon syntax.
incarnate

Joined: 31/Aug/2008 00:00:00
Messages: 43
Offline


Mark, can you please explain a bit more? Specifically, can I lookup tooltips using facelets?
I have following view configuration:
Template (stripped a bit):
Code:
 <f:view xmlns:f="http://java.sun.com/jsf/core"
         xmlns:ice="http://www.icesoft.com/icefaces/component"
         xmlns:ui="http://java.sun.com/jsf/facelets"
         locale="#{resourceProvider.currentLocale}">
     <ice:portlet>
         <ice:form>
             <ice:panelGroup styleClass="page-breadcrumb">
                 <ui:insert name="breadcrumb"/>
             </ice:panelGroup>
             <ice:panelGrid width="100%" columns="2" columnClasses="col-50p-top">
                 <ice:panelGroup styleClass="page-area1">
                     <ui:insert name="entries"/>
                 </ice:panelGroup>
                 <ice:panelGroup styleClass="page-area1">
                     <ui:insert name="selected"/>
                  </ice:panelGroup>
             </ice:panelGrid>
         </ice:form>
         <ice:form id="tooltips">
             <ui:insert name="tooltips"/>
         </ice:form>
     </ice:portlet>
 </f:view>
 


And view itself (stripped a lot):
Code:
 <f:view xmlns:f="http://java.sun.com/jsf/core"
         xmlns:ice="http://www.icesoft.com/icefaces/component"
         xmlns:ui="http://java.sun.com/jsf/facelets">
 <ui:composition template="/templates/simple-management-list-view.jspx">
 <ui:define name="breadcrumb">
     <ice:outputText value="#{msg['administration.identity.realms.title']}"/>
     <ice:outputText value="#{resourceProvider.config.breadcrumbSeparator}"/>
 </ui:define>
 <ui:define name="entries">
     <ice:dataTable ...>
          <ice:column>
              <ice:panelGroup panelTooltip=":tooltips:realmInfo"/>
          </ice:column>
     </ice:dataTable>
 </ui:define>
 <ui:define name="selected">
     ...
 </ui:define>
 <ui:define name="tooltips">
     <ice:panelTooltip id="realmInfo"...>
         <f:facet name="header">
             ...
         </f:facet>
         <f:facet name="body">
               ...
         </f:facet>
     </ice:panelTooltip>
 </ui:define>
 </ui:composition>
 </f:view>
 


If I deploy this one I have the same NPE as above; firebug shows me that form is injected most properly:
Code:
<form onsubmit="return false;" method="post" id="PC_7_T2O3S5O3086K202V68168710G0_:tooltips" enctype="application/x-www-form-urlencoded" class="iceFrm" action="javascript:;">.....</form>

So, hypothetically, I should be able to find component with ":tooltips:realmInfo". Right?
incarnate

Joined: 31/Aug/2008 00:00:00
Messages: 43
Offline


Seems like D2DFaceletsViewHandler inherits findComponent() method from D2DViewHandler. That gives me the point that search should be done exactly the way you told. But it just does not...
What issue can cause NPE then?
incarnate

Joined: 31/Aug/2008 00:00:00
Messages: 43
Offline


just to be sure, I've also tried setting id="prtlt" on <ice:portlet> tag and referencing my tooltip as :prtlt:tooltips:realmInfo
No luck =(
mark.collette


Joined: 07/Feb/2005 00:00:00
Messages: 1692
Offline


I'm surprised that including the portlet id doesn't make it work. But since you stripped your code down, for demonstration purposes, there's no way of knowing how many naming containers have been omitted. But, luckily, you have access to Firebug, so let's make use of that. If you Inspect the panelGroup that you want to bring up the panelTooltip over, and Inspect the panelTooltip itself, in the DOM, you should be able to find out their respective ids. From that, you should be able to come up with either the precise absolute id, with the single leading colon, or a relative id, involving two leading colons, and however many colons to represent moving up naming containers.
[Email]
 
Forum Index -> General Help
Go to:   
Powered by JForum 2.1.7ice © JForum Team