Author: amarkhel
Date: 2010-09-10 15:00:58 -0400 (Fri, 10 Sep 2010)
New Revision: 19156
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js
Log:
* RF-9148
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java 2010-09-10
16:23:58 UTC (rev 19155)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java 2010-09-10
19:00:58 UTC (rev 19156)
@@ -199,19 +199,26 @@
utils.addToScriptHash(options, "resizeable", panel.isResizeable(),
"false");
utils.addToScriptHash(options, "overlapEmbedObjects",
panel.isOverlapEmbedObjects(), "false");
utils.addToScriptHash(options, "visualOptions",
writeVisualOptions(context, panel));
- utils.addToScriptHash(options, "onresize",
attributes.get("onresize"));
- utils.addToScriptHash(options, "onmove",
attributes.get("onmove"));
- utils.addToScriptHash(options, "onshow",
attributes.get("onshow"));
- utils.addToScriptHash(options, "onhide",
attributes.get("onhide"));
- utils.addToScriptHash(options, "onbeforeshow",
attributes.get("onbeforeshow"));
- utils.addToScriptHash(options, "onbeforehide",
attributes.get("onbeforehide"));
+ utils.addToScriptHash(options, "onresize",
buildEventFunction(attributes.get("onresize")));
+ utils.addToScriptHash(options, "onmove",
buildEventFunction(attributes.get("onmove")));
+ utils.addToScriptHash(options, "onshow",
buildEventFunction(attributes.get("onshow")));
+ utils.addToScriptHash(options, "onhide",
buildEventFunction(attributes.get("onhide")));
+ utils.addToScriptHash(options, "onbeforeshow",
buildEventFunction(attributes.get("onbeforeshow")));
+ utils.addToScriptHash(options, "onbeforehide",
buildEventFunction(attributes.get("onbeforehide")));
result.append(ScriptUtils.toScript(options));
result.append(");");
return result.toString();
}
- public Map<String, Object> getHandledVisualOptions(AbstractPopupPanel panel) {
+ private Object buildEventFunction(Object eventFunction) {
+ if(eventFunction != null && eventFunction.toString().length() > 0) {
+ return "new Function(\"" + eventFunction.toString() +
"\");";
+ }
+ return null;
+ }
+
+ public Map<String, Object> getHandledVisualOptions(AbstractPopupPanel panel) {
String options = panel.getVisualOptions();
Map<String, Object> result;
result = prepareVisualOptions(options, panel);
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js 2010-09-10
16:23:58 UTC (rev 19155)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js 2010-09-10
19:00:58 UTC (rev 19156)
@@ -68,6 +68,7 @@
this.cdiv = $(richfaces.getDomElement(id + "_container"));
this.contentDiv = $(richfaces.getDomElement(id + "_content"));
this.shadowDiv = $(richfaces.getDomElement(id + "_shadow"));
+ this.shadeDiv = $(richfaces.getDomElement(id + "_shade"));
this.scrollerDiv = $(richfaces.getDomElement(id + "_content_scroller"));
this.borders = new Array();
@@ -215,9 +216,10 @@
},
show: function(event, opts) {
+ var element = this.cdiv;
if(!this.shown &&
this.invokeEvent("beforeshow",event,null,element)) {
this.preventFocus();
- var element = this.div;
+
if (!this.domReattached) {
this.parent = element.parent();
@@ -243,7 +245,9 @@
if (newParent != this.parent) {
this.saveInputValues(element);
- element.insertBefore(newParent.firstChild);
+ this.shadeDiv.insertAfter(newParent.lastChild);
+ this.shadowDiv.insertAfter(newParent.lastChild);
+ this.cdiv.insertAfter(newParent.lastChild);
this.domReattached = true;
} else {
this.parent.show();
@@ -475,7 +479,7 @@
},
hide: function(event, opts) {
- var element = this.id;
+ var element = this.cdiv;
this.restoreFocus();
if (this.shown &&
this.invokeEvent("beforehide",event,null,element)) {
@@ -487,7 +491,8 @@
if (this.parent) {
if (this.domReattached) {
this.saveInputValues(element);
-
+ this.parent.append(this.shadeDiv);
+ this.parent.append(this.shadowDiv);
this.parent.append(element);
this.domReattached = false;
@@ -510,7 +515,7 @@
}
this.shown = false;
-
+ this.invokeEvent("hide",event,null,element)
}
},
@@ -748,7 +753,7 @@
invokeEvent: function(eventName, event, value, element) {
- var eventFunction = this.options['on'+eventName];
+ var eventFunction = eval(this.options['on'+eventName]);
var result;
if (eventFunction) {