Author: sergeyhalipov
Date: 2008-01-24 12:24:28 -0500 (Thu, 24 Jan 2008)
New Revision: 5602
Modified:
branches/3.1.x/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss
branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
branches/3.1.x/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
branches/3.1.x/ui/modal-panel/src/test/java/org/richfaces/component/ModalPanelComponentTest.java
trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
trunk/ui/modal-panel/src/test/java/org/richfaces/component/ModalPanelComponentTest.java
Log:
http://jira.jboss.com/jira/browse/RF-1654 http://jira.jboss.com/jira/browse/RF-1652
Modified:
branches/3.1.x/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
===================================================================
---
branches/3.1.x/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java 2008-01-24
16:58:55 UTC (rev 5601)
+++
branches/3.1.x/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java 2008-01-24
17:24:28 UTC (rev 5602)
@@ -152,26 +152,4 @@
return result.toString();
}
- public String getContentStyle(FacesContext context, UIModalPanel panel) {
- StringBuffer result = new StringBuffer();
-
- result.append("overflow: hidden; ");
-
- String style = (String)panel.getAttributes().get("style");
- if (null != style && !"".equals(style)) {
- result.append(style).
- append(" ");
-
- }
- int minHeight = panel.getMinHeight();
- int minWidth = panel.getMinWidth();
- if (minWidth > -1) {
- result.append("min-width: " + minWidth + "; ");
- }
- if (minHeight > -1) {
- result.append("min-height: " + minHeight + "; ");
- }
-
- return result.toString();
- }
}
Modified:
branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss
===================================================================
---
branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss 2008-01-24
16:58:55 UTC (rev 5601)
+++
branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss 2008-01-24
17:24:28 UTC (rev 5602)
@@ -52,6 +52,11 @@
left: -32000px;
}
+ .rich-mp-content {
+ height: 100%;
+ width: 100%;
+ }
+
</f:verbatim>
<u:selector name=".dr-mpnl-spacer, .dr-mpnl-resizer">
@@ -62,11 +67,13 @@
<f:verbatim>
<![CDATA[
-.dr-mpnl-pnl{
+.dr-mpnl-pnl {
border-width: 1px;
border-style: solid;
padding : 1px;
background-color: inherit;
+ height: 100%;
+ width: 100%;
}
.dr-mpnl-pnl-h{
Modified:
branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
===================================================================
---
branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2008-01-24
16:58:55 UTC (rev 5601)
+++
branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2008-01-24
17:24:28 UTC (rev 5602)
@@ -456,6 +456,7 @@
var eContentDiv = $(this.contentDiv);
var eShadowDiv = $(this.shadowDiv);
+ var eContentTable = $(this.contentTable);
if (this.options.autosized) {
eContentDiv.style.overflow = "";
@@ -474,7 +475,7 @@
if (eIframe) {
eIframe.style.width = options.width + (/px/.test(options.width) ? '' :
'px');
}
- eContentDiv.style.width = options.width + (/px/.test(options.width) ? '' :
'px');
+ eContentTable.style.width = options.width + (/px/.test(options.width) ? '' :
'px');
eShadowDiv.style.width = options.width + (/px/.test(options.width) ? '' :
'px');
}
@@ -486,7 +487,7 @@
if (eIframe) {
eIframe.style.height = options.height + (/px/.test(options.height) ? '' :
'px');
}
- eContentDiv.style.height = options.height + (/px/.test(options.height) ? '' :
'px');
+ eContentTable.style.height = options.height + (/px/.test(options.height) ? ''
: 'px');
eShadowDiv.style.height = options.height + (/px/.test(options.height) ? '' :
'px');
}
@@ -687,19 +688,19 @@
var vetoeChange = false;
var newSize;
- var eContentDiv = $(this.contentDiv);
+ var eContentTable = $(this.contentTable);
var eShadowDiv = $(this.shadowDiv);
// Avoid currentStyle bug in opera
if (RichFaces.navigatorType() != "OPERA")
- newSize = Richfaces.getComputedStyleSize(eContentDiv, "width");
+ newSize = Richfaces.getComputedStyleSize(eContentTable, "width");
else
- newSize = parseInt(eContentDiv.style.width.replace("px", ""),
10);
+ newSize = parseInt(eContentTable.style.width.replace("px", ""),
10);
var oldSize = newSize;
newSize += diff.deltaWidth || 0;
- if (newSize >= this.minWidth) {
+ if (newSize >= this.minWidth || this.options.autosized) {
if (diff.deltaWidth) {
cssHashWH.width = newSize + 'px';
}
@@ -724,29 +725,22 @@
diff.deltaX = vetoes.vx;
}
var newPos;
- if (eCdiv.mpUseExpr) {
- newPos = eCdiv.mpLeft || 0;
- newPos += diff.deltaX;
-
- eCdiv.mpLeft = newPos;
- cssHash.left = newPos + 'px';
- } else {
- newPos = Richfaces.getComputedStyleSize(eCdiv, "left");
- newPos += diff.deltaX;
- cssHash.left = newPos + 'px';
- }
+
+ newPos = Richfaces.getComputedStyleSize(eCdiv, "left");
+ newPos += diff.deltaX;
+ cssHash.left = newPos + 'px';
}
// Avoid currentStyle bug in opera
if (RichFaces.navigatorType() != "OPERA")
- newSize = Richfaces.getComputedStyleSize(eContentDiv, "height");
+ newSize = Richfaces.getComputedStyleSize(eContentTable, "height");
else
- newSize = parseInt(eContentDiv.style.height.replace("px", ""),
10);
+ newSize = parseInt(eContentTable.style.height.replace("px", ""),
10);
var oldSize = newSize;
newSize += diff.deltaHeight || 0;
- if (newSize >= this.minHeight) {
+ if (newSize >= this.minHeight || this.options.autosized) {
if (diff.deltaHeight) {
cssHashWH.height = newSize + 'px';
}
@@ -785,8 +779,8 @@
Element.setStyle(eCdiv, cssHash);
- Element.setStyle(eContentDiv, cssHashWH);
- Element.setStyle(eShadowDiv, cssHashWH);
+ Element.setStyle(eContentTable, cssHashWH);
+ this.correctShadowSize();
if (this.iframe) {
Element.setStyle($(this.iframe), cssHashWH);
}
@@ -847,21 +841,28 @@
},
correctShadowSize: function(event) {
- var eContentDiv = $(this.contentDiv);
var eShadowDiv = $(this.shadowDiv);
- if (!eContentDiv || !eShadowDiv) {
+ var eContentTable = $(this.contentTable);
+ if (!eShadowDiv || !eContentTable) {
return;
}
var eIframe = $(this.iframe);
- var cWidth = eContentDiv.clientWidth;
- var cHeight = eContentDiv.clientHeight;
+ var dx = 0;
+ var dy = 0;
+ if (!Richfaces.browser.isIE)
+ {
+ dx = eShadowDiv.offsetWidth-eShadowDiv.clientWidth;
+ dy = eShadowDiv.offsetHeight-eShadowDiv.clientHeight;
+ }
+ var w = eContentTable.offsetWidth;
+ var h = eContentTable.offsetHeight;
+ eShadowDiv.style.width = (w-dx)+"px";
+ eShadowDiv.style.height = (h-dy)+"px";
- eShadowDiv.style.width = cWidth+"px";
- eShadowDiv.style.height = cHeight+"px";
if (eIframe) {
- eIframe.style.width = cWidth+"px";
- eIframe.style.height = cHeight+"px";
+ eIframe.style.width = w+"px";
+ eIframe.style.height = h+"px";
}
}
}
Modified:
branches/3.1.x/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
===================================================================
---
branches/3.1.x/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2008-01-24
16:58:55 UTC (rev 5601)
+++
branches/3.1.x/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2008-01-24
17:24:28 UTC (rev 5602)
@@ -80,8 +80,13 @@
<div id="#{clientId}ShadowDiv" class="dr-mpnl-shadow
rich-mpnl-shadow"
style="#{component.shadowStyle}" >
</div>
- <table id="#{clientId}ContentTable" cellpadding="0"
cellspacing="0" border="0" style="position: absolute; z-index:
2;"><tbody><tr><td class="dr-mpnl-pnl">
- <div id="#{clientId}ContentDiv"
style="#{this:getContentStyle(context, component)}"
class="rich-mp-content">
+ <table id="#{clientId}ContentTable" cellpadding="0"
cellspacing="0" border="0"
+ style="position: absolute; z-index: 2; width: #{component.minWidth}px; height:
#{component.minHeight}px; #{component.attributes['style']};">
+ <tbody>
+ <tr>
+ <td class="dr-mpnl-pnl">
+
+ <div id="#{clientId}ContentDiv" style="overflow: hidden;"
class="rich-mp-content">
<a href="#" class="dr-mpnl-pnl-a"
id="#{clientId}FirstHref" >_</a>
<table style="height: 100%; width: 100%;" border="0"
cellpadding="0" cellspacing="0">
Modified:
branches/3.1.x/ui/modal-panel/src/test/java/org/richfaces/component/ModalPanelComponentTest.java
===================================================================
---
branches/3.1.x/ui/modal-panel/src/test/java/org/richfaces/component/ModalPanelComponentTest.java 2008-01-24
16:58:55 UTC (rev 5601)
+++
branches/3.1.x/ui/modal-panel/src/test/java/org/richfaces/component/ModalPanelComponentTest.java 2008-01-24
17:24:28 UTC (rev 5602)
@@ -124,7 +124,7 @@
HtmlElement htmlContentDiv =
renderedView.getHtmlElementById(modalPanel.getClientId(facesContext) +
"ContentDiv");
assertNotNull(htmlContentDiv);
-
assertTrue(htmlContentDiv.getAttributeValue("class").contains("dr-mpnl-pnl"));
+
assertTrue(htmlContentDiv.getAttributeValue("class").contains("rich-mp-content"));
HtmlElement header =
renderedView.getHtmlElementById(modalPanel.getClientId(facesContext) +
"Header");
assertNotNull(header);
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-01-24
16:58:55 UTC (rev 5601)
+++
trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java 2008-01-24
17:24:28 UTC (rev 5602)
@@ -160,21 +160,4 @@
public void writeEventHandlerFunction(FacesContext context, UIComponent component,
String eventName) throws IOException{
RendererUtils.writeEventHandlerFunction(context, component, eventName);
}
-
- public String getContentStyle(FacesContext context, UIModalPanel panel) {
- StringBuffer result = new StringBuffer();
-
- result.append("overflow: hidden; ");
-
- int minHeight = panel.getMinHeight();
- int minWidth = panel.getMinWidth();
- if (minWidth > -1) {
- result.append("min-width: " + minWidth + "px; ");
- }
- if (minHeight > -1) {
- result.append("min-height: " + minHeight + "px; ");
- }
-
- return result.toString();
- }
}
Modified: trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
===================================================================
--- trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2008-01-24
16:58:55 UTC (rev 5601)
+++ trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2008-01-24
17:24:28 UTC (rev 5602)
@@ -85,8 +85,8 @@
<tbody>
<tr>
<td class="dr-mpnl-pnl">
-
- <div id="#{clientId}ContentDiv"
style="#{this:getContentStyle(context, component)}"
class="rich-mp-content">
+
+ <div id="#{clientId}ContentDiv" style="overflow: hidden;"
class="rich-mp-content">
<a href="#" class="dr-mpnl-pnl-a"
id="#{clientId}FirstHref" >_</a>
<table style="height: 100%; width: 100%;" border="0"
cellpadding="0" cellspacing="0">
Modified:
trunk/ui/modal-panel/src/test/java/org/richfaces/component/ModalPanelComponentTest.java
===================================================================
---
trunk/ui/modal-panel/src/test/java/org/richfaces/component/ModalPanelComponentTest.java 2008-01-24
16:58:55 UTC (rev 5601)
+++
trunk/ui/modal-panel/src/test/java/org/richfaces/component/ModalPanelComponentTest.java 2008-01-24
17:24:28 UTC (rev 5602)
@@ -124,7 +124,7 @@
HtmlElement htmlContentDiv =
renderedView.getHtmlElementById(modalPanel.getClientId(facesContext) +
"ContentDiv");
assertNotNull(htmlContentDiv);
-
assertTrue(htmlContentDiv.getAttributeValue("class").contains("dr-mpnl-pnl"));
+
assertTrue(htmlContentDiv.getAttributeValue("class").contains("rich-mp-content"));
HtmlElement header =
renderedView.getHtmlElementById(modalPanel.getClientId(facesContext) +
"Header");
assertNotNull(header);