Author: amarkhel
Date: 2010-07-13 14:28:39 -0400 (Tue, 13 Jul 2010)
New Revision: 18008
Added:
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanelSizer.js
Log:
Added:
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanelSizer.js
===================================================================
---
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanelSizer.js
(rev 0)
+++
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/popupPanelSizer.js 2010-07-13
18:28:39 UTC (rev 18008)
@@ -0,0 +1,279 @@
+(function ($, richfaces) {
+
+ richfaces.ui = richfaces.ui || {};
+
+ richfaces.ui.PopupPanel.Sizer = function(id, modalPanel, cursor, sizer) {
+
+ $super.constructor.call(this,id);
+
+ };
+
+ var $super = richfaces.BaseComponent.extend(richfaces.BaseComponent,
richfaces.ui.PopupPanel.Sizer);
+ var $super = richfaces.ui.PopupPanel.Sizer.$super;
+ $.extend(richfaces.ui.PopupPanel.Sizer.prototype, (function (options) {
+ return {
+
+ name: "richfaces.ui.PopupPanel.Sizer",
+
+ doSetupSize: function (modalPanel, elt) {
+ var width = 0;
+ var height = 0;
+
+ var reductionData = modalPanel.reductionData;
+
+ if (reductionData) {
+ if (reductionData.w) {
+ width = reductionData.w / 2;
+ }
+
+ if (reductionData.h) {
+ height = reductionData.h / 2;
+ }
+ }
+
+ if (width > 0) {
+ if (elt.clientWidth > width) {
+ if (!elt.reducedWidth) {
+ elt.reducedWidth = jQuery(elt).css('width');
+ }
+ jQuery(elt).css('width', width + 'px');
+ } else if (width < 4 && elt.reducedWidth == 4 + 'px') {
+ jQuery(elt).css('width', width + 'px');
+ }
+ } else {
+ if (elt.reducedWidth) {
+ jQuery(elt).css('width', elt.reducedWidth);
+ elt.reducedWidth = undefined;
+ }
+ }
+
+ if (height > 0) {
+ if (elt.clientHeight > height) {
+ if (!elt.reducedHeight) {
+ elt.reducedHeight = jQuery(elt).css('height');
+ }
+ elt.style.height = height + 'px';
+ } else if (height < 4 && elt.reducedHeight == 4 + 'px') {
+ jQuery(elt).css('height', height + 'px');
+ }
+ } else {
+ if (elt.reducedHeight) {
+ jQuery(elt).css('height', elt.reducedHeight);
+ elt.reducedHeight = undefined;
+ }
+ }
+ },
+
+ doSetupPosition: function (modalPanel, elt, left, top) {
+ if(!isNaN(left) && !isNaN(top)){
+ jQuery(elt).css('left', left + 'px');
+ jQuery(elt).css('top', top + 'px');
+ }
+ },
+
+ doPosition: function (modalPanel, elt) {
+
+ },
+
+ doDiff: function (dx, dy) {
+
+ }
+ }
+
+ })());
+ richfaces.ui.PopupPanel.Sizer.Diff = function(dX, dY, dWidth, dHeight) {
+
+ this.deltaX = dX;
+ this.deltaY = dY;
+
+ this.deltaWidth = dWidth;
+ this.deltaHeight = dHeight;
+
+ };
+
+ richfaces.ui.PopupPanel.Sizer.Diff.EMPTY = function(){
+ return new richfaces.ui.PopupPanel.Sizer.Diff(0, 0, 0, 0);
+ },
+
+ richfaces.ui.PopupPanel.Sizer.N = function(){
+
+ }
+
+ $.extend(richfaces.ui.PopupPanel.Sizer.N.prototype,
richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.N.prototype, {
+
+
+ name: "richfaces.ui.PopupPanel.Sizer.N",
+
+ doPosition : function (popupPanel, elt) {
+ jQuery(elt).css('width',popupPanel.width() + 'px');
+ this.doSetupPosition(popupPanel, elt, 0, 0);
+ },
+
+ doDiff : function(dx, dy) {
+ return new richfaces.ui.PopupPanel.Sizer.Diff(0, dy, 0, -dy);
+ },
+
+ });
+
+ richfaces.ui.PopupPanel.Sizer.NW = function(){
+
+ }
+ $.extend(richfaces.ui.PopupPanel.Sizer.NW.prototype,
richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.NW.prototype, {
+
+ name: "richfaces.ui.PopupPanel.Sizer.NW",
+
+ doPosition : function (popupPanel, elt) {
+ this.doSetupSize(popupPanel, elt);
+ this.doSetupPosition(popupPanel, elt, 0, 0);
+ },
+
+ doDiff : function(dx, dy) {
+ return new richfaces.ui.PopupPanel.Sizer.Diff(dx, dy, -dx, -dy);
+ }
+
+ });
+
+ richfaces.ui.PopupPanel.Sizer.NE = function(){
+
+ }
+ $.extend(richfaces.ui.PopupPanel.Sizer.NE.prototype,
richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.NE.prototype, {
+
+ name: "richfaces.ui.PopupPanel.Sizer.NE",
+
+ doPosition : function (popupPanel, elt) {
+ this.doSetupSize(popupPanel, elt);
+ this.doSetupPosition(popupPanel, elt, popupPanel.width() - elt.clientWidth, 0);
+ },
+
+ doDiff : function(dx, dy) {
+ return new richfaces.ui.PopupPanel.Sizer.Diff(0, dy, dx, -dy);
+ }
+
+ });
+
+ richfaces.ui.PopupPanel.Sizer.E = function(){
+
+ }
+ $.extend(richfaces.ui.PopupPanel.Sizer.E.prototype,
richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.E.prototype, {
+
+ name: "richfaces.ui.PopupPanel.Sizer.E",
+
+ doPosition : function (popupPanel, elt) {
+ jQuery(elt).css('height', popupPanel.height() + 'px');
+ this.doSetupPosition(popupPanel, elt, popupPanel.width() - elt.clientWidth, 0);
+ },
+
+ doDiff : function(dx, dy) {
+ return new richfaces.ui.PopupPanel.Sizer.Diff(0, 0, dx, 0);
+ }
+
+ });
+
+ richfaces.ui.PopupPanel.Sizer.SE = function(){
+
+ }
+ $.extend(richfaces.ui.PopupPanel.Sizer.SE.prototype,
richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.prototype.SE, {
+
+ name: "richfaces.ui.PopupPanel.Sizer.SE",
+
+ doPosition : function (popupPanel, elt) {
+ this.doSetupSize(popupPanel, elt);
+ this.doSetupPosition(popupPanel, elt, popupPanel.width() - elt.clientWidth,
+ popupPanel.height() - elt.clientHeight);
+ },
+
+ doDiff : function(dx, dy) {
+ return new richfaces.ui.PopupPanel.Sizer.Diff(0, 0, dx, dy);
+ }
+
+ });
+
+ richfaces.ui.PopupPanel.Sizer.S = function(){
+
+ }
+ $.extend(richfaces.ui.PopupPanel.Sizer.S.prototype,
richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.S.prototype,{
+
+ name: "richfaces.ui.PopupPanel.Sizer.S",
+
+ doPosition : function (popupPanel, elt) {
+ jQuery(elt).css('width', popupPanel.width() + 'px');
+ this.doSetupPosition(popupPanel, elt, 0, popupPanel.height() - elt.clientHeight);
+ },
+
+ doDiff : function(dx, dy) {
+ return new richfaces.ui.PopupPanel.Sizer.Diff(0, 0, 0, dy);
+ }
+
+ });
+
+
+ richfaces.ui.PopupPanel.Sizer.SW = function(){
+
+ }
+ $.extend(richfaces.ui.PopupPanel.Sizer.SW.prototype,
richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.SW.prototype,{
+
+
+ name: "richfaces.ui.PopupPanel.Sizer.SW",
+
+ doPosition : function (popupPanel, elt) {
+ this.doSetupSize(popupPanel, elt);
+ this.doSetupPosition(popupPanel, elt, 0, popupPanel.height() - elt.clientHeight);
+ },
+
+ doDiff : function(dx, dy) {
+ return new richfaces.ui.PopupPanel.Sizer.Diff(dx, 0, -dx, dy);
+ }
+
+ });
+
+ richfaces.ui.PopupPanel.Sizer.W = function(){
+
+ }
+ $.extend(richfaces.ui.PopupPanel.Sizer.W.prototype,
richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.W.prototype,{
+
+
+ name: "richfaces.ui.PopupPanel.Sizer.W",
+
+ doPosition : function (popupPanel, elt) {
+ jQuery(elt).css('height', popupPanel.height() + 'px');
+ this.doSetupPosition(popupPanel, elt, 0, 0);
+ },
+
+ doDiff : function(dx, dy) {
+ return new richfaces.ui.PopupPanel.Sizer.Diff(dx, 0, -dx, 0);
+ }
+
+
+ });
+
+
+ richfaces.ui.PopupPanel.Sizer.Header = function(){
+
+ }
+ $.extend(richfaces.ui.PopupPanel.Sizer.Header.prototype,
richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.Header.prototype, {
+
+
+ name: "richfaces.ui.PopupPanel.Sizer.Header",
+
+ doPosition : function (popupPanel, elt) {
+
+ },
+
+ doDiff : function(dx, dy) {
+ return new richfaces.ui.PopupPanel.Sizer.Diff(dx, dy, 0, 0);
+ }
+
+
+ });
+
+
+})(jQuery, window.RichFaces);
\ No newline at end of file