[richfaces-svn-commits] JBoss Rich Faces SVN: r5975 - in trunk/ui/modal-panel/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Feb 8 22:48:18 EST 2008


Author: nbelaevski
Date: 2008-02-08 22:48:17 -0500 (Fri, 08 Feb 2008)
New Revision: 5975

Modified:
   trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
   trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
   trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
Log:
http://jira.jboss.com/jira/browse/RF-2150

Modified: trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
===================================================================
--- trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java	2008-02-09 03:48:12 UTC (rev 5974)
+++ trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java	2008-02-09 03:48:17 UTC (rev 5975)
@@ -24,17 +24,15 @@
 import java.io.IOException;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Set;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 
-import org.ajax4jsf.renderkit.AjaxComponentRendererBase;
+import org.ajax4jsf.javascript.ScriptUtils;
 import org.ajax4jsf.renderkit.ComponentVariables;
 import org.ajax4jsf.renderkit.ComponentsVariableResolver;
 import org.ajax4jsf.renderkit.RendererUtils;
-import org.ajax4jsf.javascript.ScriptUtils;
 import org.richfaces.component.UIModalPanel;
 
 /**
@@ -160,4 +158,5 @@
 	public void writeEventHandlerFunction(FacesContext context, UIComponent component, String eventName) throws IOException{
 		RendererUtils.writeEventHandlerFunction(context, component, eventName);
 	}
+	
 }

Modified: trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
===================================================================
--- trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js	2008-02-09 03:48:12 UTC (rev 5974)
+++ trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js	2008-02-09 03:48:17 UTC (rev 5975)
@@ -561,12 +561,10 @@
 					var cw = getSizeElement().clientWidth;
 					if (RichFaces.navigatorType() == RichFaces.OPERA)
 					{
-					 	_left = (cw - eContentDiv.parentNode.getWidth()) / 2;
+					 	_left = (cw - eContentDiv.getWidth()) / 2;
 					}
 					else {
-					 	var _width = Richfaces.getComputedStyleSize(eContentDiv.parentNode, "width");
-					 	if (isNaN(_width))
-					 		_width = eContentDiv.parentNode.clientWidth;
+					 	var _width = eContentDiv.clientWidth;
 						_left = (cw - _width) / 2;
 					 }
 	
@@ -583,12 +581,10 @@
 					var cw = getSizeElement().clientHeight;
 					if (RichFaces.navigatorType() == RichFaces.OPERA)
 					{
-					 	_top = (cw - eContentDiv.parentNode.getHeight()) / 2;
+					 	_top = (cw - eContentDiv.getHeight()) / 2;
 					}
 					else {
-						var _height = Richfaces.getComputedStyleSize(eContentDiv.parentNode, "height");
-						if (isNaN(_height))
-							_height = eContentDiv.parentNode.clientHeight;
+						var _height = eContentDiv.clientHeight;
 						_top = (cw - _height) / 2;
 					}
 				}
@@ -954,7 +950,7 @@
 	}
 }
 
-Richfaces.showModalPanel = function (id, opts, event) {
+Richfaces._showModalPanel = function (id, opts, event, sync) {
 	
 	var invoke = 
 		(RichFaces.MSIE == RichFaces.navigatorType()) ?
@@ -979,12 +975,25 @@
 		panel = Richfaces.findModalPanel(id);
 	}
 	invoke(function() {
-		panel.component.show(event, opts);
+		if (sync) {
+			panel.component.syncShow(event, opts);
+		} else {
+			panel.component.show(event, opts);
+		}
 	});
 	
 	
 };
 
+Richfaces.showModalPanel = function (id, opts, event) {
+	Richfaces._showModalPanel(id, opts, event, false);
+};
+
+Richfaces.syncShowModalPanel = function (id, opts, event) {
+	Richfaces._showModalPanel(id, opts, event, true);
+};
+
+
 Richfaces.hideModalPanel = function (id, opts, event) {
 	var panel = $(id);
 	if (!panel) {

Modified: trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
===================================================================
--- trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx	2008-02-09 03:48:12 UTC (rev 5974)
+++ trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx	2008-02-09 03:48:17 UTC (rev 5975)
@@ -81,10 +81,39 @@
 				<div id="#{clientId}ShadowDiv" class="dr-mpnl-shadow rich-mpnl-shadow"
 					style="#{component.shadowStyle}" >
 			   	</div>
-							
-				<div id="#{clientId}ContentDiv" style="position: absolute; z-index: 2; overflow: hidden; width: #{component.minWidth}px; height: #{component.minHeight}px; #{component.attributes['style']}" class="dr-mpnl-pnl rich-mp-content">
+				
+				<c:object var="divStyle" type="java.lang.String" />
+				<c:object var="tableStyle" type="java.lang.String" />
+				
+				<jsp:scriptlet>
+					<![CDATA[
+						if (component.isAutosized()) {
+							int minWidth = component.getMinWidth();
+							int minHeight = component.getMinHeight();
+
+							int width = component.getWidth();
+							int height = component.getHeight();
+
+							if (width < 0 || width < minWidth) {
+								width = minWidth;
+							}
+
+							if (height < 0 || height < minHeight) {
+								height = minHeight;
+							}
+
+							tableStyle += "width: " + (width > 0 ? width : 1) + "px;";
+							tableStyle += "height: " + (height > 0 ? height : 1) + "px;";
+
+						} else {
+							tableStyle = "height: 100%; width: 100%;";
+						}
+					]]>
+				</jsp:scriptlet>
+				
+				<div id="#{clientId}ContentDiv" style="position: absolute; z-index: 2; overflow: hidden; #{component.attributes['style']}" class="dr-mpnl-pnl rich-mp-content">
 						
-			        <table style="height: 100%; width: 100%;" border="0" cellpadding="0" cellspacing="0">
+			        <table style="#{tableStyle}" border="0" cellpadding="0" cellspacing="0">
 						<jsp:scriptlet>
 							<![CDATA[if(component.getFacet("header")!=null && component.getFacet("header").isRendered()) {]]>
 						</jsp:scriptlet>




More information about the richfaces-svn-commits mailing list