Author: a.izobov
Date: 2007-06-04 10:51:32 -0400 (Mon, 04 Jun 2007)
New Revision: 998
Modified:
trunk/richfaces/modal-panel/src/main/config/component/modalPanel.xml
trunk/richfaces/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
trunk/richfaces/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
trunk/richfaces/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
Log:
http://jira.jboss.com/jira/browse/RF-195 fixed
Modified: trunk/richfaces/modal-panel/src/main/config/component/modalPanel.xml
===================================================================
--- trunk/richfaces/modal-panel/src/main/config/component/modalPanel.xml 2007-06-04
14:08:52 UTC (rev 997)
+++ trunk/richfaces/modal-panel/src/main/config/component/modalPanel.xml 2007-06-04
14:51:32 UTC (rev 998)
@@ -149,6 +149,25 @@
Pop-up shadow depth for suggestion content
</description>
</property>
+
+ <property>
+ <name>onshow</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Event must occurs after panel opened
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+
+ <property>
+ <name>onhide</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Event must occurs after panel closed
+ </description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+
</component>
</components>
Modified:
trunk/richfaces/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
===================================================================
---
trunk/richfaces/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java 2007-06-04
14:08:52 UTC (rev 997)
+++
trunk/richfaces/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java 2007-06-04
14:51:32 UTC (rev 998)
@@ -21,11 +21,17 @@
package org.richfaces.renderkit;
+import java.io.IOException;
+
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import org.ajax4jsf.framework.renderer.AjaxComponentRendererBase;
+import org.ajax4jsf.framework.renderer.ComponentVariables;
+import org.ajax4jsf.framework.renderer.ComponentsVariableResolver;
+import org.ajax4jsf.framework.util.javascript.ScriptUtils;
import org.richfaces.component.UIModalPanel;
+import org.richfaces.component.util.ViewUtil;
/**
* @author Nick Belaevski - nbelaevski(a)exadel.com
@@ -70,7 +76,19 @@
}
}
}
-
+
+ public void initializeResources(FacesContext context, UIModalPanel panel)
+ throws IOException {
+ ComponentVariables variables =
+ ComponentsVariableResolver.getVariables(this, panel);
+
+ String onshow =
ScriptUtils.toScript(panel.getAttributes().get("onshow"));
+ variables.setVariable("onshow", onshow);
+ String onhide =
ScriptUtils.toScript(panel.getAttributes().get("onhide"));
+ variables.setVariable("onhide", onhide);
+ }
+
+
// protected String buildOptions(FacesContext context, UIModalPanel panel) {
// return getOptions(context, panel, getUtils());
// }
Modified:
trunk/richfaces/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
===================================================================
---
trunk/richfaces/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2007-06-04
14:08:52 UTC (rev 997)
+++
trunk/richfaces/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2007-06-04
14:51:32 UTC (rev 998)
@@ -152,6 +152,14 @@
this.cdiv.mpUseExpr = true;
}
+ if (this.options.onshow && this.options.onshow != ""){
+ this.eventOnShow = new
Function("event",this.options.onshow).bindAsEventListener(this);
+ }
+ if (this.options.onhide && this.options.onhide != ""){
+ this.eventOnHide = new
Function("event",this.options.onhide).bindAsEventListener(this);
+ }
+
+
ModalPanel.panels.push(this);
},
@@ -399,6 +407,8 @@
}
this.id.style.visibility = "";
+
+ if (this.eventOnShow) this.eventOnShow();
},
startDrag: function(border) {
@@ -443,6 +453,8 @@
this.parent.appendChild(this.id);
this.floatedToBody = false;
}
+
+ if (this.eventOnHide) this.eventOnHide();
},
doResizeOrMove: function(diff) {
Modified:
trunk/richfaces/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
===================================================================
---
trunk/richfaces/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2007-06-04
14:08:52 UTC (rev 997)
+++
trunk/richfaces/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2007-06-04
14:51:32 UTC (rev 998)
@@ -30,6 +30,7 @@
<f:call name="checkOptions" />
+ <f:call name="initializeResources" />
<div id="#{clientId}Container"
style="position: absolute; display: none; z-index: #{component.zindex};"
@@ -124,7 +125,10 @@
left: "#{component.left}",
top: "#{component.top}",
- zindex: #{component.zindex}
+ zindex: #{component.zindex},
+
+ onshow: #{onshow},
+ onhide: #{onhide}
});
</script>
</div>