You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Madan Narra <ma...@gmail.com> on 2007/05/24 14:33:02 UTC
[ Tobago ] Regarding variable scope in Sheet and Popup
Hi All,
I have a sheet which has a column which holds small tumbnail images which
has a <tc:link> surrounded.
When the link is clicked , a popup opens which shows the same image
(tumbnail) in a bigger version.
This is the following code i used for this..
<tc:sheet value="#{searchItems.Items}" id="sheet" var="searchItem">
<tc:column label="">
<tc:panel id="image">
<tc:link>
*<tc:image value="#{
facesContext.externalContext.request.contextPath}/ImageServlet?file=#{
searchItem.code}.jpg" width="20px" height="20px"/> *<%-- Smaller Image --%>
<tc:attribute name="renderedPartially"
value="imagePopup"/>
<f:facet name="popup">
<tc:popup width="225px" height="270px"
id="imagePopup">
<tc:box label="#{searchItem.name}">
<f:facet name="layout">
<tc:gridLayout rows="200px;20px"
columns="200px"/>
</f:facet>
*<tc:image value="#{
facesContext.externalContext.request.contextPath}/ImageServlet?file=#{
searchItem.code}.jpg" width="200px" height="200px"/> * <%-- Bigger Image
--%>
<tc:cell>
<f:facet name="layout">
<tc:gridLayout
columns="*;80px"/>
</f:facet>
<tc:cell/>
<tc:button label="Close">
<tc:attribute
name="popupClose" *value*="immediate"/>
</tc:button>
</tc:cell>
</tc:box>
</tc:popup>
</f:facet>
</tc:link>
</tc:panel>
</tc:column>
</tc:sheet>
As shown above in Bold, the smaller image gets displayed fine with rendered
URL as such
" http://localhost:8080/Store/ImageServlet?file=60406.jpg "
But for the bigger image the URL is rendered as such "
http://localhost:8080/Store/ImageServlet?file=.jpg "
The code ( *#{searchItem.code}.jpg* ) was not rendered in the popup as it
has done for the smaller image outside the popup code.
Even the label for <tc:box> ( *{searchItem.name}* )in the popup is not
rendered. just seeing a blank space.
The same *#{searchItem.name}* & *#{searchItem.code}* are working fine
outside the popup in the sheet.
Is this the expected behaviour or am missing anything ?
--
Regards,
Madan N
Re: [ Tobago ] Regarding variable scope in Sheet and Popup
Posted by Madan Narra <ma...@gmail.com>.
Thnx Volker ,
Its working with your logic...
Regards,
Madan N
Re: [ Tobago ] Regarding variable scope in Sheet and Popup
Posted by Volker Weber <v....@inexso.de>.
Hi Madan,
it is currently not possible to update content of sheet partially.
for your problem there is a workaround:
place the popup as direct facet of the sheet
and use the tc:popupReference tag inside the tc:link.
you need a additional bean property for the codeValue and a
actionListener method.
<tc:link actionListener="#{bean.prepareImage}" >
<tc:popupReference for="imagePopup"/>
<f:parameter name="code" value="#{searchItem.code}"/>
<tc:image .../>
</tc:link>
the image inside the popup:
<tc:image value="#{facesContext.externalContext.request.contextPath}/ImageServlet?file=#{bean.codeValue
}.jpg"
the java code for the listenerMethod:
private String codeValue;
public void prepareImage(ActionEvent event) {
UIComponent link = event.getComponent();
codeValue = ComponentUtil.findParameter(link, "code");
}
public String getCodeValue() {
return codeValue;
}
something like this.
Regards,
Volker
2007/5/24, Madan Narra <ma...@gmail.com>:
> Hi All,
>
> I have a sheet which has a column which holds small tumbnail images which
> has a <tc:link> surrounded.
>
> When the link is clicked , a popup opens which shows the same image
> (tumbnail) in a bigger version.
>
> This is the following code i used for this..
>
> <tc:sheet value="#{searchItems.Items}" id="sheet" var="searchItem">
> <tc:column label="">
> <tc:panel id="image">
> <tc:link>
> <tc:image
> value="#{facesContext.externalContext.request.contextPath
> }/ImageServlet?file=#{searchItem.code}.jpg" width="20px" height="20px"/>
> <%-- Smaller Image --%>
> <tc:attribute name="renderedPartially"
> value="imagePopup"/>
> <f:facet name="popup">
> <tc:popup width="225px" height="270px"
> id="imagePopup">
> <tc:box label="#{
> searchItem.name}">
> <f:facet
> name="layout">
> <tc:gridLayout
> rows="200px;20px" columns="200px"/>
> </f:facet>
> <tc:image
> value="#{facesContext.externalContext.request.contextPath}/ImageServlet?file=#{searchItem.code
> }.jpg" width="200px" height="200px"/> <%-- Bigger Image --%>
> <tc:cell>
> <f:facet
> name="layout">
>
> <tc:gridLayout columns="*;80px"/>
> </f:facet>
> <tc:cell/>
> <tc:button
> label="Close">
>
> <tc:attribute name="popupClose" value="immediate"/>
> </tc:button>
> </tc:cell>
> </tc:box>
> </tc:popup>
> </f:facet>
> </tc:link>
> </tc:panel>
> </tc:column>
> </tc:sheet>
>
> As shown above in Bold, the smaller image gets displayed fine with rendered
> URL as such
> " http://localhost:8080/Store/ImageServlet?file=60406.jpg "
>
> But for the bigger image the URL is rendered as such "
> http://localhost:8080/Store/ImageServlet?file=.jpg "
>
> The code ( #{searchItem.code}.jpg ) was not rendered in the popup as it has
> done for the smaller image outside the popup code.
>
> Even the label for <tc:box> ( {searchItem.name} )in the popup is not
> rendered. just seeing a blank space.
>
> The same #{searchItem.name} & #{searchItem.code} are working fine outside
> the popup in the sheet.
>
> Is this the expected behaviour or am missing anything ?
>
> --
> Regards,
> Madan N