Author: nbelaevski
Date: 2008-09-20 12:52:23 -0400 (Sat, 20 Sep 2008)
New Revision: 10520
Modified:
trunk/samples/modalpanel-sample/src/main/webapp/pages/index.jsp
trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
Log:
https://jira.jboss.org/jira/browse/RF-4011
Modified: trunk/samples/modalpanel-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/modalpanel-sample/src/main/webapp/pages/index.jsp 2008-09-20 16:06:31
UTC (rev 10519)
+++ trunk/samples/modalpanel-sample/src/main/webapp/pages/index.jsp 2008-09-20 16:52:23
UTC (rev 10520)
@@ -146,6 +146,7 @@
<a
href="javascript:Richfaces.showModalPanel(':_panel');">Show</a>
<a href="javascript:Richfaces.showModalPanel(':_panel', {left:
'120', top: 'auto'});">Show: left = 120; top = auto</a>
<a href="javascript:Richfaces.showModalPanel(':_panel', {top:
'auto', width: 800});">Show: width = 800; top = auto</a>
+ <a href="javascript:Richfaces.showModalPanel(':_panel', {width:
800, height: 600, minWidth: 700, minHeight: 500});">Show: minWidth = 700;
minHeight = 500; width: 800; height: 600;</a>
<a href="javascript:Richfaces.showModalPanel(':_panel', {width:
1});">Show: width = 1</a>
<a
href="javascript:Richfaces.showModalPanel('eventInfoID');">Show
autosized panel</a>
<a href="javascript:Richfaces.showModalPanel('eventInfoID', {width:
1100, height: 700});">Show big autosized panel</a>
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-09-20
16:06:31 UTC (rev 10519)
+++
trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2008-09-20
16:52:23 UTC (rev 10520)
@@ -80,6 +80,10 @@
return element;
}
+ModalPanel.getMinimumSize = function(size) {
+ return Math.max(size, 2*ModalPanel.Sizer.INITIAL_MIN + 2);
+};
+
ModalPanel.prototype = {
initialize: function(id, options) {
this["rich:destructor"] = "destroy";
@@ -92,8 +96,8 @@
this.baseZIndex = this.options.zindex ? this.options.zindex : 100;
- this.minWidth = Math.max(this.options.minWidth, 2*ModalPanel.Sizer.INITIAL_MIN + 2);
- this.minHeight = Math.max(this.options.minHeight, 2*ModalPanel.Sizer.INITIAL_MIN + 2);
+ this.minWidth = ModalPanel.getMinimumSize(this.options.minWidth);
+ this.minHeight = ModalPanel.getMinimumSize(this.options.minHeight);
this.div = id + "Div";
this.cursorDiv = id + "CursorDiv";
@@ -466,6 +470,10 @@
show: function(event, opts) {
if(!this.shown && this.invokeEvent("beforeshow",event,null,element))
{
+
+ this.currentMinHeight = ModalPanel.getMinimumSize((opts.minHeight || opts.minHeight ==
0) ? opts.minHeight : this.minHeight);
+ this.currentMinWidth = ModalPanel.getMinimumSize((opts.minWidth || opts.minWidth == 0)
? opts.minWidth : this.minWidth);
+
var element = this.id;
this.preventFocus();
@@ -524,16 +532,16 @@
}
if (options.width && options.width != -1) {
- if (this.minWidth > options.width) {
- options.width = this.minWidth;
+ if (this.currentMinWidth > options.width) {
+ options.width = this.currentMinWidth;
}
eContentElt.style.width = options.width + (/px/.test(options.width) ? '' :
'px');
}
if (options.height && options.height != -1) {
- if (this.minHeight > options.height) {
- options.height = this.minHeight;
+ if (this.currentMinHeight > options.height) {
+ options.height = this.currentMinHeight;
}
eContentElt.style.height = options.height + (/px/.test(options.height) ? '' :
'px');
@@ -676,6 +684,10 @@
hide: function(event, opts) {
if (this.shown && this.invokeEvent("beforehide",event,null,element))
{
+
+ this.currentMinHeight = undefined;
+ this.currentMinWidth = undefined;
+
this.restoreFocus();
this.enableSelects();
@@ -757,15 +769,15 @@
var oldSize = newSize;
newSize += diff.deltaWidth || 0;
- if (newSize >= this.minWidth || this.options.autosized) {
+ if (newSize >= this.currentMinWidth || this.options.autosized) {
if (diff.deltaWidth) {
cssHashWH.width = newSize + 'px';
}
} else {
if (diff.deltaWidth) {
- cssHashWH.width = this.minWidth + 'px';
+ cssHashWH.width = this.currentMinWidth + 'px';
- vetoes.vx = oldSize - this.minWidth;
+ vetoes.vx = oldSize - this.currentMinWidth;
}
vetoes.x = true;
@@ -793,15 +805,15 @@
var oldSize = newSize;
newSize += diff.deltaHeight || 0;
- if (newSize >= this.minHeight || this.options.autosized) {
+ if (newSize >= this.currentMinHeight || this.options.autosized) {
if (diff.deltaHeight) {
cssHashWH.height = newSize + 'px';
}
} else {
if (diff.deltaHeight) {
- cssHashWH.height = this.minHeight + 'px';
+ cssHashWH.height = this.currentMinHeight + 'px';
- vetoes.vy = oldSize - this.minHeight;
+ vetoes.vy = oldSize - this.currentMinHeight;
}
vetoes.y = true;