<rich:popupPanel> onresize & onmove
jjsteward Mar 4, 2011 3:48 PMHi all,
Could anyone help me with this problem? We are using the latest M6 snapshot...
I am trying to save the state & position of a popup so that after a redirect I can re-display the popup in exactly the same position.
I have a session scoped bean with the following fields:
@ManagedBean
@SessionScoped
public class LogNotesBean implements Serializable {
private boolean popupActive = false;
private String popupWidth = "550";
private String popupHeight = "500";
private String popupTop = "100";
private String popupLeft = "700";
.... accessors here ....
}
I have a masterLayout.xhtml file that includes my logNotes.xhtml page:
<html .. namespaces ...>
<f:view contentType="text/html">
.. header properties ...
<h:body>
.. other includes ...
<ui:include src="/modal/logNotes.xhtml"/>
</h:body>
</f:view>
</html>
Finally here is my logNotes.xhtml page:
<ui:composition .. namespaces ...>
<rich:popupPanel id="logNotesModal" modal="false" autosized="false" resizeable="true" show="#{logNotesBean.popupActive}" top="#{logNotesBean.popupTop}" left="#{logNotesBean.popupLeft}"
width="#{logNotesBean.popupWidth}" height="#{logNotesBean.popupHeight}">
<h:form id="logNotesForm">
<a4j:outputPanel id="logNotesOutputPanel">
... fields here ....
</a4j:outputPanel>
</h:form>
</rich:popupPanel>
</ui:composition>
I've tried creating an <a4j:jsFunction> but it doesn't do anything (I think because it is not in the same <h:form>):
<h:form id="popupForm">
<a4j:jsFunction id="popupResize" name="popupResize">
<a4j:param name="width" assignTo="#{logNotesBean.popupWidth}" />
<a4j:param name="height" assignTo="#{logNotesBean.popupHeight}" />
</a4j:jsFunction>
<a4j:jsFunction id="popupMove" name="popupMove">
<a4j:param name="top" assignTo="#{logNotesBean.popupTop}" />
<a4j:param name="left" assignTo="#{logNotesBean.popupLeft}" />
</a4j:jsFunction>
</h:form>
<rich:popupPanel onresize="popupResize(this.width,this.height)" onmove="popupMove(this.top,this.left)" .. other attributes>
I cannot surround the whole <rich:popupPanel> with a form because there is already a form element inside the popup. This is per documentation: http://docs.jboss.org/richfaces/latest_4_0_X/Component_Reference/en-US/html_single/#sect-Component_Reference-Panels_and_containers-richpopupPanel
Please let me know if there is another solution to this problem.
Thanks,
Jamie