Same code, different JDK -> Different behaviour!
demetrio812 Nov 11, 2007 1:58 PMHi,
I have a data grid with images, it look like that:
<h:form> <rich:dataGrid id="tabPhotogallery" columns="4" width="100%" columnClasses="thumbnail" value="#{articoloHelper.getImmaginiArticolo(idArticolo)}" var="img"> <a:commandLink style="text-decoration:none;" oncomplete="Richfaces.showModalPanel('mpAnteprima')"> <f:setPropertyActionListener value="#{img}" target="#{articoloHelper.immagineSelezionata}" /> <s:graphicImage border="0" value="#{articoloHelper.getImmagineDocumento(img.id, img.tipologiaDocumento.estensione, false)}" /> </a:commandLink> <br/> <h:outputText style="font-weight: bold;" value="#{img.nome}" ></h:outputText> </rich:dataGrid> </h:form>
When the user clicks on one image it update the articoloHelper.immagineSelezionata value with the selected image and show the follow modalPanel:
<rich:modalPanel id="mpAnteprima" resizeable="false" shadowOpacity="true" shadowDepth="true" autosized="true" zindex="2000"> <f:facet name="header"> <h:outputText value="#{articoloHelper.immagineSelezionata.nome}" /> </f:facet> <f:facet name="controls"> <h:form> <h:outputLink value="javascript:Richfaces.hideModalPanel('mpAnteprima')"> <h:graphicImage style="vertical-align: middle" url="/layout/immagini/pulsanti/close.png" border="0" /> </h:outputLink> </h:form> </f:facet> <a:outputPanel ajaxRendered="true"> <s:graphicImage rendered="#{articoloHelper.immagineSelezionata!=null}" value="#{articoloHelper.getImmagineDocumento(articoloHelper.immagineSelezionata.id, articoloHelper.immagineSelezionata.tipologiaDocumento.estensione, true)}" /> <br/><br/><h:outputText value="#{articoloHelper.immagineSelezionata.descrizione}"></h:outputText> </a:outputPanel> <p align="center"> <h:outputLink value="javascript:Richfaces.hideModalPanel('mpAnteprima')"> Chiudi </h:outputLink> </p> </rich:modalPanel>
I had to put an outputPanel with reRendered set to true because putting reRender="mpAnteprima" in the commandLink doesn't the oncomplete javascript open the pane (I think it's a timing issue, because if I put an alert before the showPanel it works, but of course it shows the alert).
Btw this code works (the panel is in the center of the screen) if I use JDK 1.5 but when I use the jdk 1.6 it is not centered and that is because it first open the panel centering the little panel without image, then it loads the image and autosize without moving the top and left position so it is not centered.
How can I fix this?
Thanks
Demetrio Filocamo