Author: nbelaevski
Date: 2008-04-06 12:27:01 -0400 (Sun, 06 Apr 2008)
New Revision: 7619
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
Log:
http://jira.jboss.com/jira/browse/RF-2128
http://jira.jboss.com/jira/browse/RF-2725
http://jira.jboss.com/jira/browse/RF-2150
http://jira.jboss.com/jira/browse/RF-2702
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-04-05
14:21:35 UTC (rev 7618)
+++
branches/3.1.x/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java 2008-04-06
16:27:01 UTC (rev 7619)
@@ -24,16 +24,14 @@
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.javascript.ScriptUtils;
import org.richfaces.component.UIModalPanel;
/**
@@ -152,4 +150,5 @@
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-04-05
14:21:35 UTC (rev 7618)
+++
branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/css/modalPanel.xcss 2008-04-06
16:27:01 UTC (rev 7619)
@@ -51,15 +51,11 @@
}
.dr-mpnl-pnl-a {
+ outline-style: none;
position: absolute;
left: -32000px;
}
- .rich-mp-content {
- height: 100%;
- width: 100%;
- }
-
</f:verbatim>
<u:selector name=".dr-mpnl-spacer, .dr-mpnl-resizer">
@@ -75,8 +71,6 @@
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-04-05
14:21:35 UTC (rev 7618)
+++
branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2008-04-06
16:27:01 UTC (rev 7619)
@@ -51,7 +51,7 @@
ModalPanel.Context = Class.create();
ModalPanel.Context.prototype = {
initialize: function(modalPanel) {
- this.cdiv = modalPanel.contentTable;
+ this.cdiv = modalPanel.contentDiv;
this.isPositionFixed = Richfaces.getComputedStyle(this.cdiv, "position") ==
"fixed";
},
@@ -103,7 +103,6 @@
this.cursorDiv = id + "CursorDiv";
this.cdiv = id + "CDiv";
this.contentDiv = id + "ContentDiv";
- this.contentTable = id + "ContentTable";
this.shadowDiv = id + "ShadowDiv";
this.context = new ModalPanel.Context(this);
@@ -402,7 +401,7 @@
}
},
- _show: function(event, opts, synchronous) {
+ show: function(event, opts) {
this.preventFocus();
var element = this.id;
@@ -453,7 +452,6 @@
var eContentDiv = $(this.contentDiv);
var eShadowDiv = $(this.shadowDiv);
- var eContentTable = $(this.contentTable);
if (this.options.autosized) {
eContentDiv.style.overflow = "";
@@ -472,7 +470,7 @@
if (eIframe) {
eIframe.style.width = options.width + (/px/.test(options.width) ? '' :
'px');
}
- eContentTable.style.width = options.width + (/px/.test(options.width) ? '' :
'px');
+ eContentDiv.style.width = options.width + (/px/.test(options.width) ? '' :
'px');
eShadowDiv.style.width = options.width + (/px/.test(options.width) ? '' :
'px');
}
@@ -484,7 +482,7 @@
if (eIframe) {
eIframe.style.height = options.height + (/px/.test(options.height) ? '' :
'px');
}
- eContentTable.style.height = options.height + (/px/.test(options.height) ? ''
: 'px');
+ eContentDiv.style.height = options.height + (/px/.test(options.height) ? '' :
'px');
eShadowDiv.style.height = options.height + (/px/.test(options.height) ? '' :
'px');
}
@@ -602,33 +600,17 @@
Element.hide(eCdiv);
element.style.visibility = "";
- var showFunction = function() {
- Element.show(eCdiv);
-
- this.lastOnfocus();
-
- var event = {};
- event.parameters = opts || {};
- if (this.eventOnShow) this.eventOnShow(event);
-
- this.shown = true;
- };
-
- if (synchronous) {
- showFunction.call(this);
- } else {
- setTimeout(showFunction.bind(this), 0);
- }
+ Element.show(eCdiv);
+
+ this.lastOnfocus();
+
+ var event = {};
+ event.parameters = opts || {};
+ if (this.eventOnShow) this.eventOnShow(event);
+
+ this.shown = true;
},
- syncShow: function(event, opts) {
- this._show(event, opts, true);
- },
-
- show: function(event, opts) {
- this._show(event, opts, false);
- },
-
startDrag: function(border) {
for (var k = 0; k < this.borders.length; k++ ) {
//this.borders[k].hide();
@@ -696,6 +678,10 @@
}
},
+ _getStyle: function(elt, name) {
+ return parseInt(elt.style[name].replace("px", ""), 10);
+ },
+
doResizeOrMove: function(diff) {
var vetoes = {};
var cssHash = {};
@@ -704,14 +690,14 @@
var vetoeChange = false;
var newSize;
- var eContentTable = $(this.contentTable);
+ var eContentDiv = $(this.contentDiv);
var eShadowDiv = $(this.shadowDiv);
// Avoid currentStyle bug in opera
if (RichFaces.navigatorType() != "OPERA")
- newSize = Richfaces.getComputedStyleSize(eContentTable, "width");
+ newSize = Richfaces.getComputedStyleSize(eContentDiv, "width");
else
- newSize = parseInt(eContentTable.style.width.replace("px", ""),
10);
+ newSize = this._getStyle(eContentDiv, "width");
var oldSize = newSize;
newSize += diff.deltaWidth || 0;
@@ -742,16 +728,16 @@
}
var newPos;
- newPos = Richfaces.getComputedStyleSize(eCdiv, "left");
+ newPos = this._getStyle(eCdiv,
"left");//Richfaces.getComputedStyleSize(eCdiv, "left");
newPos += diff.deltaX;
cssHash.left = newPos + 'px';
}
// Avoid currentStyle bug in opera
if (RichFaces.navigatorType() != "OPERA")
- newSize = Richfaces.getComputedStyleSize(eContentTable, "height");
+ newSize = Richfaces.getComputedStyleSize(eContentDiv, "height");
else
- newSize = parseInt(eContentTable.style.height.replace("px", ""),
10);
+ newSize = this._getStyle(eContentDiv,
"height")//;Richfaces.getComputedStyleSize(eContentDiv, "height");
var oldSize = newSize;
newSize += diff.deltaHeight || 0;
@@ -787,7 +773,7 @@
eCdiv.mpTop = newPos;
cssHash.top = newPos + 'px';
} else {
- newPos = Richfaces.getComputedStyleSize(eCdiv, "top");
+ newPos = this._getStyle(eCdiv,
"top");//Richfaces.getComputedStyleSize(eCdiv, "top");
newPos += diff.deltaY;
cssHash.top = newPos + 'px';
}
@@ -795,7 +781,7 @@
Element.setStyle(eCdiv, cssHash);
- Element.setStyle(eContentTable, cssHashWH);
+ Element.setStyle(eContentDiv, cssHashWH);
this.correctShadowSize();
if (this.iframe) {
Element.setStyle($(this.iframe), cssHashWH);
@@ -858,8 +844,8 @@
correctShadowSize: function(event) {
var eShadowDiv = $(this.shadowDiv);
- var eContentTable = $(this.contentTable);
- if (!eShadowDiv || !eContentTable) {
+ var eContentDiv = $(this.contentDiv);
+ if (!eShadowDiv || !eContentDiv) {
return;
}
var eIframe = $(this.iframe);
@@ -871,8 +857,8 @@
dx = eShadowDiv.offsetWidth-eShadowDiv.clientWidth;
dy = eShadowDiv.offsetHeight-eShadowDiv.clientHeight;
}
- var w = eContentTable.offsetWidth;
- var h = eContentTable.offsetHeight;
+ var w = eContentDiv.offsetWidth;
+ var h = eContentDiv.offsetHeight;
eShadowDiv.style.width = (w-dx)+"px";
eShadowDiv.style.height = (h-dy)+"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-04-05
14:21:35 UTC (rev 7618)
+++
branches/3.1.x/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2008-04-06
16:27:01 UTC (rev 7619)
@@ -48,9 +48,10 @@
onmousedown="#{component.attributes['onmaskmousedown']}"
onmousemove="#{component.attributes['onmaskmousemove']}"
onmouseover="#{component.attributes['onmaskmouseover']}"
- onmouseout="#{component.attributes['onmaskmouseout']}" />
- <div class="dr-mpnl-mask-div rich-mpnl-mask-div"
id="#{clientId}CursorDiv"
- style="filter: alpha(opacity=1); z-index: -200"></div>
+ onmouseout="#{component.attributes['onmaskmouseout']}">
+
+ <a href="#" class="dr-mpnl-pnl-a"
id="#{clientId}FirstHref">_</a>
+ </div>
<div id="#{clientId}CDiv" class="dr-mpnl-panel rich-mpnl_panel"
>
@@ -80,16 +81,39 @@
<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; 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">
+
+ <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">
- <a href="#" class="dr-mpnl-pnl-a"
id="#{clientId}FirstHref" >_</a>
- <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>
@@ -120,14 +144,18 @@
<f:call name="renderChildren" />
</vcp:body>
<f:clientid var="clientId"/>
- <a href="#" class="dr-mpnl-pnl-a"
id="#{clientId}LastHref" >_</a>
</td>
</tr>
</table>
</div>
- </td></tr></tbody></table>
</div>
+ <div class="dr-mpnl-mask-div rich-mpnl-mask-div"
id="#{clientId}CursorDiv"
+ style="filter: alpha(opacity=1); z-index: -200">
+
+ <a href="#" class="dr-mpnl-pnl-a"
id="#{clientId}LastHref">_</a>
+ </div>
+
<script type="text/javascript">
new ModalPanel('#{clientId}',
{