Wrap rich:popupPanel as Composite Component not working
beecom3000 Jan 13, 2011 11:15 PMFor RichFaces 4 M5, I try to wrap rich:popupPanel component as composite component so I can reuse the header control across the application. The code is shown below:
<cc:interface>
<cc:attribute name="header" required="true" />
<cc:attribute name="width" default="550" />
<cc:attribute name="height" default="550" />
</cc:interface>
<cc:implementation>
<rich:popupPanel
id="#{cc.clientId}"
modal="false"
resizable="true"
autosized="true"
width="#{cc.attrs.width}"
height="#{cc.attrs.height}">
<f:facet name="header">#{cc.attrs.header}</f:facet>
<f:facet name="controls">
<h:outputLink
value="#"
onclick="onWindowMin(#{rich:component('#{cc.clientId}')}); return false;">
<h:graphicImage value="/images/window/win_minimize.png" id="toggleIcon"/>
</h:outputLink>
<h:outputLink
value="#"
onclick="#{rich:component('#{cc.clientId}')}.hide(); return false;">
<h:graphicImage value="/images/window/win_close.png" id="closeIcon"/>
</h:outputLink>
</f:facet>
<cc:insertChildren/>
</rich:popupPanel>
</cc:implementation>
</body>
</html>
and then use it in one of the pages
<h:inputText id="targetChla" valueChangeListener="#{susLoadPlot.onTargetChlaChange}">
<a4j:ajax event="keyup" execute="@this" render="targetSusLoad targetPercentReduction"/>
<rich:componentControl target="disclaimerDialog" operation="show" />
</h:inputText>
<widget:dialog id="disclaimerDialog" header="Disclaimer!">
<h:outputText escape="false" value="#{msg['module.disclaimer']}" />
</widget:dialog>
However, when I use the component, the following exception is thrown
SEVERE: javax.faces.FacesException: Component ID discliamerDialog:j_id2 has already been found in the view.
+id: discliamerDialog
type: javax.faces.component.UINamingContainer@199f755
+id: j_id2
type: javax.faces.component.UIPanel@1fdff07
+id: discliamerDialog
type: org.richfaces.component.UIPopupPanel@16e9494
+id: j_id2
type: javax.faces.component.UIPanel@724356
+id: j_idt71
But if i don't define id inside the composite component, rich:componentControl does not work as it cannot find the exact match id
Tried to use following instead but still not working
<rich:componentControl target="#{rich:findComponent('disclaimerDialog*')}" operation="show" />
Any solution to this?