Internationalisation does not work in nested composite component
anonym365451 Jul 11, 2011 8:43 AMHello everybody,
I want to have own composite components. The texts should come from property files.
I can use rich components within my components without any problem using +cc.resourceBundleMap+.
e.g.
{code}
<rich:popupPanel id="myNestedRichPopupPanel"
modal="true"
resizeable="false"
style="margin-left:6px;margin-right:6px;"
width="300"
onmaskclick="#{rich:component('myNestedRichPopupPanel')}.hide()">
<f:facet name="header">
<!-- cc.attrs.header -->
<h:outputText value="#{cc.resourceBundleMap.headerText}" />
</f:facet>
<f:facet name="controls">
<h:outputLink value="#"
onclick="#{rich:component('myNestedRichPopupPanel')}.hide(); return false;">
X
</h:outputLink>
</f:facet>
<composite:insertChildren/>
<br/>
Additional text inside the popup:<br/>
<h:outputText value="#{cc.resourceBundleMap.contentText}"/>
</rich:popupPanel>
{code}
But if a pass a value to another of my components the value seems to be ignored. It is not set within my component bean.
{code}
<composite:implementation>
<h:commandButton value="Open own composite component with nested rich:popupPanel">
<rich:componentControl event="click" target="myNestedPopupPanel"
operation="show" />
</h:commandButton>
<br/>
<my:popupPanel id="myNestedPopupPanel" header="#{cc.resourceBundleMap.headerText}">
<composite:insertChildren/>
<br/>
Additional text inside the popup:<br/>
<h:outputText value="#{cc.resourceBundleMap.contentText}"/>
</my:popupPanel>
...
{code}
MyPopupPanel is as follows:
The component definition:
{code}
<composite:interface componentType="MyPopupPanel">
<composite:attribute name="header" required="true" type="java.lang.String" />
</composite:interface>
<composite:implementation>
<rich:popupPanel id="#{cc.id}"
modal="true"
resizeable="false"
style="margin-left:6px;margin-right:6px;"
width="#{cc.width}"
onmaskclick="#{rich:component(cc.id)}.hide()">
<f:facet name="header">
<!-- cc.attrs.header -->
<h:outputText value="#{cc.header}" />
</f:facet>
<f:facet name="controls">
<h:outputLink value="#"
onclick="#{rich:component(cc.id)}.hide(); return false;">
X
</h:outputLink>
</f:facet>
<composite:insertChildren/>
</rich:popupPanel>
</composite:implementation>
{code}
The java class:
{code}
@FacesComponent(value="MyPopupPanel")
public class RESUIPopupPanel extends UIComponentBase {
private String header = "Default header text from Java class (should not appear)";
//private String header = null;
/**
*
*/
public RESUIPopupPanel() {
}
@Override
public String getFamily() {
return "javax.faces.NamingContainer";
}
public int getWidth() {
return 350;
}
... getter/setter of header
}
{code}
A war file is attached. Sources should be included there.
The index.xhtml page shows three buttons.
The first button opens a popup as I want to implement it: a custom component nested within a surrounding custom component. There the header of the popup is not overwritten as expected.
The second button opens a popup whose header is set to a hard coded text without usage of a property file.
The third button opens a rich:popup instead of my own.
Does anybody know what is wrong here?
I am using richfaces 4.0.0 tested on tomcat7 and weblogic 10.3.5.
-
testWebApp.war 3.1 MB