Author: nbelaevski
Date: 2010-08-11 14:26:28 -0400 (Wed, 11 Aug 2010)
New Revision: 18560
Added:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panel.ecss
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanelBorders.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanelSizer.js
Removed:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/css/
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/script/
trunk/ui/output/ui/src/main/resources/META-INF/resources/css/
trunk/ui/output/ui/src/main/resources/META-INF/resources/script/
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelBaseRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
Log:
Component resources moved to "org.richfaces" library
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java 2010-08-11
17:28:46 UTC (rev 18559)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java 2010-08-11
18:26:28 UTC (rev 18560)
@@ -47,8 +47,9 @@
@ResourceDependencies( { @ResourceDependency(library = "javax.faces", name =
"jsf-uncompressed.js"),
@ResourceDependency(name = "jquery.js"), @ResourceDependency(name =
"richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
- @ResourceDependency(name = "richfaces-base-component.js"),
@ResourceDependency(name = "script/datascroller.js"),
- @ResourceDependency(name = "css/datascroller.ecss")
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"datascroller.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"datascroller.ecss")
})
public class DataScrollerBaseRenderer extends RendererBase {
Copied:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.ecss
(from rev 18558,
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/css/datascroller.ecss)
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.ecss
(rev 0)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.ecss 2010-08-11
18:26:28 UTC (rev 18560)
@@ -0,0 +1,123 @@
+.rf-ds{
+ white-space:nowrap;
+ display:inline-block;
+ font-size:'#{richSkin.generalSizeFont}';
+ padding:1px;
+ font-family:'#{richSkin.generalFamilyFont}';
+ background:'#{richSkin.tableBackgroundColor}';
+}
+
+a.rf-ds-dtl {
+ color: '#{richSkin.generalTextColor}';
+}
+
+a.rf-ds-btn {
+ color: '#{richSkin.generalTextColor}';
+}
+
+.rf-ds-cont {
+ white-space: nowrap;
+ display: inline-block;
+ font-size: '#{richSkin.generalSizeFont}';
+ padding: 1px;
+ font-family: '#{richSkin.generalFamilyFont}';
+ background: '#{richSkin.tableBackgroundColor}';
+}
+
+.rf-ds-cont-dec {
+ border-width: 1px;
+ border-style: solid;
+ border-color: '#{richSkin.tableBorderColor}';
+}
+
+.rf-ds-btn {
+ cursor: pointer;
+ padding: 2px 10px 3px 10px;
+ border-width: 1px;
+ border-style: solid;
+ border-color: '#{richSkin.tableBorderColor}';
+ display: inline-block;
+
+ background-position: top left;
+ background-repeat: repeat-x;
+ background-color: '#{richSkin.headerBackgroundColor}';
+ background-image:
"url(#{resource['org.richfaces.renderkit.html.images.DSButtonGradientImage']})";
+
+ font-size: '#{richSkin.generalSizeFont}';
+ font-family: '#{richSkin.generalFamilyFont}';
+ color: '#{richSkin.generalTextColor}';
+ text-decoration: none;
+ font-weight: normal;
+}
+
+.rf-ds-l {
+ margin-right: 1px;
+}
+
+.rf-ds-r {
+ margin-left: 1px;
+}
+
+.rf-ds-dtl {
+ cursor: pointer;
+ width: 2em;
+ text-align: center;
+ margin-left: 1px;
+ margin-right: 1px;
+ padding: 2px 2px 3px 2px;
+ border-width: 1px;
+ border-style: solid;
+ border-color: transparent;
+ border-top-width: 1px;
+ border-top-style: solid;
+ border-top-color: '#{richSkin.tableBorderColor}';
+
+ background-color: '#{richSkin.tableBackgroundColor}';
+ background-image:
"url(#{resource['org.richfaces.renderkit.html.images.DSDigitalGradientImage']})";
+
+
+ background-position: top left;
+ background-repeat: repeat-x;
+
+ display: inline-block;
+ font-size: '#{richSkin.generalSizeFont}';
+ font-family: '#{richSkin.generalFamilyFont}';
+ text-decoration: none;
+ color: '#{richSkin.generalTextColor}';
+ font-weight: normal;
+
+}
+
+.rf-ds-over {
+ border-width : 1px;
+ border-style: solid;
+ border-color: '#{richSkin.tableBorderColor}';
+ background-position: top left;
+ background-repeat: repeat-x;
+ background-color: '#{richSkin.tableBackgroundColor}';
+ background-image:
"url(#{resource['org.richfaces.renderkit.html.images.DSButtonOverGradientImage']})";
+}
+
+.rf-ds-press {
+ border-width: 1px;
+ border-style: solid;
+ border-color: '#{richSkin.tableBorderColor}';
+ background: '#{richSkin.additionalBackgroundColor}';
+}
+
+.rf-ds-cur {
+ cursor: default;
+ font-weight: bold;
+ border-width: 1px;
+ bordr-style: solid;
+ border-color: transparent;
+ border-bottom-width: 1px;
+ border-bottom-style: solid;
+ border-bottom-color: '#{richSkin.tableBorderColor}';
+ background: none;
+}
+
+.rf-ds-dis{
+ color: '#{richSkin.tableBorderColor}';
+ cursor: default;
+}
\ No newline at end of file
Copied:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js
(from rev 18558,
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/script/datascroller.js)
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js
(rev 0)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datascroller.js 2010-08-11
18:26:28 UTC (rev 18560)
@@ -0,0 +1,159 @@
+(function ($, richfaces) {
+
+ richfaces.ui = richfaces.ui || {};
+
+ var initButtons = function(buttons, css, component) {
+ var id;
+
+ var fn = function(e) {
+ e.data.fn.call(e.data.component, e);
+ }
+
+ var data = {};
+ data.component = component;
+
+ for(id in buttons) {
+ var element = $(document.getElementById(id));
+
+ data.id = id;
+ data.page = buttons[id];
+ data.element = element;
+ data.fn = component.processClick;
+
+ element.bind('click', copy(data), fn);
+
+ if(css) {
+ data.fn = component.processStyles;
+ data.css = css.mousedown;
+ element.bind('mousedown', copy(data), fn);
+
+ data.css = css.mouseup;
+ element.bind('mouseup', copy(data), fn);
+
+ data.css = css.mouseout;
+ element.bind('mouseout', copy(data), fn);
+
+ data.css = css.mouseover;
+ element.bind('mouseover', copy(data), fn);
+ }
+ }
+ };
+
+ var copy = function(data) {
+ var key;
+ var eventData = {};
+
+ for (key in data) {
+ eventData[key] = data[key];
+ }
+
+ return eventData;
+ };
+
+ richfaces.ui.DataScroller = function(id, submit, options) {
+
+ $super.constructor.call(this,id);
+
+ this.attachToDom(id);
+
+ this.options = options;
+ this.currentPage = options.currentPage;
+ var buttons = options.buttons;
+ var digitals = options.digitals;
+
+ if (submit && typeof submit == 'function') {
+ RichFaces.Event.bindById(id, this.getScrollEventName(), submit);
+ }
+
+ var css = {};
+
+ if(buttons) {
+ var leftButtons = buttons.left;
+ css.mouseover = "rf-ds-btn rf-ds-l";
+ css.mouseup = "rf-ds-btn rf-ds-l";
+ css.mouseout = "rf-ds-btn rf-ds-l";
+ css.mousedown = "rf-ds-btn rf-ds-l rf-ds-over";
+ initButtons(leftButtons,css, this);
+
+ var rightButtons = buttons.right;
+ css.mouseover = "rf-ds-btn rf-ds-r";
+ css.mouseup = "rf-ds-btn rf-ds-r";
+ css.mouseout = "rf-ds-btn rf-ds-r";
+ css.mousedown = "rf-ds-btn rf-ds-r rf-ds-over";
+ initButtons(rightButtons,css, this);
+ }
+
+ if(digitals) {
+ css.mouseover= "rf-ds-dtl rf-ds-over";
+ css.mouseup= "rf-ds-dtl rf-ds-over";
+ css.mouseout = "rf-ds-dtl";
+ css.mousedown="rf-ds-dtl rf-ds-press";
+ initButtons(digitals, css,this);
+ }
+ };
+
+ var $super = richfaces.BaseComponent.extend(richfaces.ui.DataScroller);
+ var $p = richfaces.BaseComponent.extend(richfaces.ui.DataScroller, {});
+ var $super = richfaces.ui.DataScroller.$super;
+
+ $.extend(richfaces.ui.DataScroller.prototype, (function (options) {
+
+ var scrollEventName = "rich:datascroller:onscroll";
+
+ return {
+
+ name: "RichFaces.ui.DataScroller",
+
+ processClick: function(event) {
+ var data = event.data;
+ if(data) {
+ var page = data.page;
+ if(page) {
+ this.switchToPage(page);
+ }
+ }
+ },
+
+ processStyles: function(event) {
+ var data = event.data;
+
+ if(data && (data.page != this.currentPage)) {
+ var element = data.element;
+ var css = data.css;
+
+ if(element && css) {
+ element.attr('class', css);
+ }
+ }
+ },
+
+ switchToPage: function(page) {
+ if (typeof page != 'undefined' && page != null) {
+ RichFaces.Event.fireById(this.id, this.getScrollEventName(), {'page' :
page});
+ }
+ },
+
+ next: function() {
+ this.switchToPage("fastforward");
+ },
+
+ previous: function() {
+ this.switchToPage("fastrewind");
+ },
+
+ first: function() {
+ this.switchToPage("first");
+ },
+
+ last: function() {
+ this.switchToPage("last");
+ },
+
+ getScrollEventName: function() {
+ return scrollEventName;
+ }
+ }
+
+ })());
+
+})(jQuery, window.RichFaces);
\ No newline at end of file
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelBaseRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelBaseRenderer.java 2010-08-11
17:28:46 UTC (rev 18559)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelBaseRenderer.java 2010-08-11
18:26:28 UTC (rev 18560)
@@ -35,7 +35,7 @@
* @since Jun 14, 2010
*/
//TODO nick - JSF have concept of library, it should be used instead of '/' in
resource names
-@ResourceDependency(name = "css/panel.ecss")
+@ResourceDependency(library = "org.richfaces", name = "panel.ecss")
public class PanelBaseRenderer extends RendererBase {
public PanelBaseRenderer() {
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java 2010-08-11
17:28:46 UTC (rev 18559)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java 2010-08-11
18:26:28 UTC (rev 18560)
@@ -19,9 +19,11 @@
//TODO nick - JSF have concept of library, it should be used instead of '/' in
resource names
@ResourceDependencies( { @ResourceDependency(name = "jquery.js"),
@ResourceDependency(name = "richfaces.js"),
- @ResourceDependency(name = "richfaces-base-component.js"),
@ResourceDependency(name = "script/popupPanel.js"),
- @ResourceDependency(name = "script/popupPanelBorders.js"),
@ResourceDependency(name = "script/popupPanelSizer.js"),
- @ResourceDependency(name = "css/popupPanel.ecss")
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"popupPanel.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"popupPanelBorders.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"popupPanelSizer.js"),
+ @ResourceDependency(library = "org.richfaces", name =
"popupPanel.ecss")
})
public class PopupPanelBaseRenderer extends RendererBase {
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-08-11
17:28:46 UTC (rev 18559)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-08-11
18:26:28 UTC (rev 18560)
@@ -22,18 +22,19 @@
package org.richfaces.renderkit.html;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.component.AbstractTogglePanelItem;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractTogglePanelItem;
+
/**
* @author akolonitsky
* @since -4712-01-01
@@ -44,7 +45,7 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(name = "script/TogglePanelItem.js") })
+ @ResourceDependency(library = "org.richfaces", name =
"TogglePanelItem.js") })
public class TogglePanelItemRenderer extends DivPanelRenderer {
private static final String LEAVE = "leave";
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-08-11
17:28:46 UTC (rev 18559)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-08-11
18:26:28 UTC (rev 18560)
@@ -22,6 +22,18 @@
package org.richfaces.renderkit.html;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSObject;
@@ -33,17 +45,6 @@
import org.richfaces.component.AbstractTogglePanel;
import org.richfaces.component.AbstractTogglePanelItem;
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
/**
* @author akolonitsky
* @since -4712-01-01
@@ -54,7 +55,7 @@
@ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(name = "script/TogglePanel.js") })
+ @ResourceDependency(library = "org.richfaces", name =
"TogglePanel.js") })
public class TogglePanelRenderer extends DivPanelRenderer {
private static final String VALUE_POSTFIX = "-value";
Copied:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
(from rev 18558,
trunk/ui/output/ui/src/main/resources/META-INF/resources/script/TogglePanel.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
(rev 0)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-08-11
18:26:28 UTC (rev 18560)
@@ -0,0 +1,390 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ /* SIMPLE INNER CLASS for handle switch operation*/
+ function SwitchItems(comp) {
+ this.comp = comp;
+ }
+
+ SwitchItems.prototype = {
+
+ /**
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {void}
+ * */
+ exec : function (oldPanel, newPanel) {
+ if (newPanel.switchMode == "server") {
+ return this.execServer(oldPanel, newPanel);
+ } else if (newPanel.switchMode == "ajax") {
+ return this.execAjax(oldPanel, newPanel);
+ } else if (newPanel.switchMode == "client") {
+ return this.execClient(oldPanel, newPanel);
+ } else {
+ rf.log.error("SwitchItems.exec : unknown switchMode (" +
this.comp.switchMode + ")");
+ }
+ },
+
+ /**
+ * @protected
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {Boolean} false
+ * */
+ execServer : function (oldPanel, newPanel) {
+ var continueProcess = oldPanel.__leave();
+ if (!continueProcess) {
+
+ return false;
+ }
+
+ this.__setActiveItem(newPanel.getName());
+
+ rf.submitForm(this.__getParentForm(), null, {});
+
+ return false;
+ },
+
+ /**
+ * @protected
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {Boolean} false
+ * */
+ execAjax : function (oldPanel, newPanel) {
+ var options = $.extend({}, this.comp.options["ajax"],
{}/*this.getParameters(newPanel)*/);
+
+ this.__setActiveItem(newPanel.getName());
+ rf.ajax(this.comp.id, null, options);
+ this.__setActiveItem(oldPanel.getName());
+
+ return false;
+ },
+
+ /**
+ * @protected
+ * @param {TogglePanelItem} oldPanel
+ * @param {TogglePanelItem} newPanel
+ *
+ * @return {undefined}
+ * - false - if process has been terminated
+ * - true - in other cases
+ * */
+ execClient : function (oldPanel, newPanel) {
+ var continueProcess = oldPanel.__leave();
+ if (!continueProcess) {
+ return false;
+ }
+
+ this.__setActiveItem(newPanel.getName());
+
+ newPanel.__enter();
+ this.__fireItemChange(oldPanel, newPanel);
+
+ return true;
+ },
+
+ /**
+ * @private
+ * */
+ __getParentForm : function () {
+ return $(rf.getDomElement(this.comp.id)).parent('form');
+ },
+
+ /**
+ * @private
+ * */
+ __setActiveItem : function (name) {
+ rf.getDomElement(this.__getValueInputId()).value = name;
+ this.comp.activeItem = name;
+ },
+
+ /**
+ * @private
+ * */
+ __getValueInputId: function () {
+ return this.comp.id + "-value"
+ },
+
+ /********************* Events *************************/
+
+ __fireItemChange : function (oldItem, newItem) {
+ return new rf.Event.fireById(this.comp.id, "itemchange", {
+ id: this.comp.id,
+ oldItem : oldItem,
+ newItem : newItem
+ });
+ }
+ };
+
+ /**
+ * @class TogglePanel
+ * @name TogglePanel
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ rf.ui.TogglePanel = rf.BaseComponent.extendClass({
+
+ // class name
+ name:"TogglePanel",
+
+ init : function (componentId, options) {
+ // call constructor of parent class
+ this.$super.constructor.call(this, componentId);
+ this.attachToDom(componentId);
+
+ this.options = options;
+ this.activeItem = this.options.activeItem;
+ this.items = this.options.items;
+ },
+
+ /***************************** Public Methods
********************************************************************/
+
+ /**
+ * @methodOf
+ * @name TogglePanel#getSelectItem
+ *
+ * @return {String} name of current selected panel item
+ */
+ getSelectItem: function () {
+ return this.activeItem;
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#switchToItem
+ *
+ * @param {String} name - panel item name to switch
+ * we can use meta names @first, @prev, @next and @last
+ * @return {Boolean} - false if something wrong and true if all is ok
+ */
+ switchToItem: function (name) {
+ var newPanel = this.getNextItem(name);
+ if (newPanel == null) {
+ rf.log.warn("TogglePanel.switchToItems(" + name + "): item
with name '" + name + "' not found");
+ return false;
+ }
+
+ var oldPanel = this.__getItemByName(this.getSelectItem());
+
+ var continueProcess = this.__fireBeforeItemChange(oldPanel, newPanel);
+ if (!continueProcess) {
+ rf.log.warn("TogglePanel.switchToItems(" + name + "):
switch has been canceled by beforeItemChange event");
+ return false
+ }
+
+ return new SwitchItems(this).exec(oldPanel, newPanel);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#getNextItem
+ *
+ * @param {String} name of TogglePanelItem or meta name (@first | @prev | @next |
@last)
+ * @return {TogglePanelItem} null if item not found
+ */
+ getNextItem : function (name) {
+ if (name) {
+ var newItemIndex = this.__ITEMS_META_NAMES[name];
+ if (newItemIndex) {
+ return this.__getItem(newItemIndex(this));
+ } else {
+ return this.__getItemByName(name);
+ }
+ } else {
+ return this.__getItemByName(this.nextItem());
+ }
+ },
+
+ /**
+ * please, remove this method when client side ajax events will be added
+ *
+ * */
+ onCompleteHandler : function (newItemName) {
+ var oldItem = this.__getItemByName(this.activeItem);
+ var newItem = this.__getItemByName(newItemName);
+
+ // Don't do like this and remove it ASAP
+ new SwitchItems(this).execClient(oldItem, newItem);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#getItems
+ *
+ * @return {TogglePanelItem[]} all defined panel items
+ */
+ getItems : function () {
+ return this.items;
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#getItemsNames
+ *
+ * @return {String[]} names of all defined items
+ */
+ getItemsNames: function () {
+ var res = [];
+ for (var item in this.items) {
+ res.push(this.items[item].getName());
+ }
+
+ return res;
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#nextItem
+ *
+ * @param {String} [itemName = activeItem]
+ * @return {String} name of next panel item
+ */
+ nextItem: function (itemName) {
+ var itemIndex = this.__getItemIndex(itemName || this.activeItem);
+ if (itemIndex == -1) {
+ return null;
+ }
+
+ return this.__getItemName(itemIndex + 1);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#firstItem
+ *
+ * @return {String} name of first panel item
+ */
+ firstItem: function () {
+ return this.__getItemName(0);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#lastItem
+ *
+ * @return {String} name of last panel item
+ */
+ lastItem: function () {
+ return this.__getItemName(this.items.length - 1);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanel#prevItem
+ *
+ * @param {String} itemName
+ * @return {String} name of prev panel item
+ * null if it is first item
+ */
+ prevItem: function (itemName) {
+ var itemIndex = this.__getItemIndex(itemName || this.activeItem);
+ if (itemIndex < 1) {
+ return null;
+ }
+
+ return this.__getItemName(itemIndex - 1);
+ },
+
+
/////////////////////////////////////////////////////////////////////////////////
+ //// Private
+
/////////////////////////////////////////////////////////////////////////////////
+
+ /********************* Methods *************************/
+
+ __ITEMS_META_NAMES : {
+ "@first" : function (comp) { return 0; },
+ "@prev" : function (comp) { return
comp.__getItemIndex(comp.activeItem) - 1; },
+ "@next" : function (comp) { return
comp.__getItemIndex(comp.activeItem) + 1; },
+ "@last" : function (comp) { return comp.items.length - 1; }
+ },
+
+ /**
+ * @private
+ * */
+ __getItemIndex : function (itemName) {
+ for (var i = 0; i < this.items.length; i++) {
+ if (this.items[i].getName() === itemName) {
+ return i;
+ }
+ }
+
+ rf.log.info("TogglePanel.getItemIndex: item with name '" +
itemName + "' not found");
+ return -1;
+ },
+
+ /**
+ * @private
+ * @param {Number} index - array index
+ *
+ * @return {TogglePanelItem}
+ * null - if item not found
+ * */
+ __getItem : function (index) {
+ if (index >= 0 && index < this.items.length) {
+ return this.items[index]
+ }
+
+ return null;
+ },
+
+ __getItemByName : function (name) {
+ return this.__getItem(this.__getItemIndex(name));
+ },
+
+ __getItemName : function (index) {
+ var item = this.__getItem(index);
+ if (item == null) {
+ return null;
+ }
+
+ return item.getName();
+ },
+
+ /**
+ * Fire Concealable Event
+ * */
+ __fireBeforeItemChange : function (oldItem, newItem) {
+ return rf.Event.fireById(this.id, "beforeitemchange", {
+ id: this.id,
+ oldItem : oldItem,
+ newItem : newItem
+ });
+ },
+
+ // class stuff
+ destroy: function () {
+ // rf.Event.unbindById(this.options.buttonId,
"."+this.namespace);
+ // rf.Event.unbindById(this.componentId,
"."+this.namespace);
+ // $super.destroy.call(this);
+ }
+ });
+})(jQuery, RichFaces);
Copied:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
(from rev 18558,
trunk/ui/output/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js)
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
(rev 0)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-08-11
18:26:28 UTC (rev 18560)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.TogglePanelItem = rf.BaseComponent.extendClass({
+
+ // class name
+ name:"TogglePanelItem",
+
+ init : function (componentId, options) {
+ // call constructor of parent class
+ this.$super.constructor.call(this, componentId);
+ this.$super.attachToDom.call(this, componentId);
+
+ this.options = options;
+ this.name = this.options.name;
+ this.togglePanelId = this.options.togglePanelId;
+ this.switchMode = this.options.switchMode;
+ },
+
+ /***************************** Public Methods
*****************************************************************/
+ /**
+ * @methodOf TogglePanelItem
+ * @name TogglePanelItem#getName
+ *
+ * @return {String} panel item name
+ */
+ getName: function () {
+ return this.options.name;
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanelItem#getTogglePanel
+ *
+ * @return {TogglePanel} parent TogglePanel
+ * */
+ getTogglePanel : function () {
+ return rf.$(this.togglePanelId);
+ },
+
+ /**
+ * @methodOf
+ * @name TogglePanelItem#isSelected
+ *
+ * @return {Boolean} true if this panel item is selected in the parent toggle
panel
+ * */
+ isSelected : function () {
+ return this.getName() == this.getTogglePanel().getSelectItem();
+ },
+
+
+ /***************************** Private Methods
****************************************************************/
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __enter : function () {
+ rf.getDomElement(this.id).style.display = "block";
+
+ return this.__fireEnter();
+ },
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __leave : function () {
+ var continueProcess = this.__fireLeave();
+ if (!continueProcess) {
+ return false;
+ }
+
+ rf.getDomElement(this.id).style.display = "none";
+ return true;
+ },
+
+ __fireLeave : function () {
+ return rf.Event.fireById(this.id, "__leave");
+ },
+
+ __fireEnter : function () {
+ return rf.Event.fireById(this.id, "__enter");
+ },
+
+ // class stuff
+ destroy: function () {
+ // rf.Event.unbindById(this.options.buttonId,
"."+this.namespace);
+ // rf.Event.unbindById(this.componentId,
"."+this.namespace);
+ // $super.destroy.call(this);
+ }
+ });
+})(jQuery, RichFaces);
Copied: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panel.ecss
(from rev 18558, trunk/ui/output/ui/src/main/resources/META-INF/resources/css/panel.ecss)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panel.ecss
(rev 0)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panel.ecss 2010-08-11
18:26:28 UTC (rev 18560)
@@ -0,0 +1,29 @@
+.rf-panel{
+ background-color:'#{richSkin.generalBackgroundColor}';
+ color:'#{richSkin.panelBorderColor}';
+ border-width:1px;
+ border-style:solid;
+ padding:1px;
+}
+
+.rf-panel-header{
+ background-color:'#{richSkin.headerBackgroundColor}';
+ border-color:'#{richSkin.headerBackgroundColor}';
+ font-size:'#{richSkin.headerSizeFont}';
+ color:'#{richSkin.headerTextColor}';
+ font-weight:'#{richSkin.headerWeightFont}';
+ font-family:'#{richSkin.headerFamilyFont}';
+ padding:2px;
+ border-width:1px;
+ border-style:solid;
+ background-position:top left;
+ background-repeat:repeat-x;
+ background-image:"url(#{resource['org.richfaces.renderkit.html.GradientA']})";
+}
+
+.rf-panel-body{
+ font-size:'#{richSkin.generalSizeFont}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ padding:10px;
+}
\ No newline at end of file
Copied:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss
(from rev 18558,
trunk/ui/output/ui/src/main/resources/META-INF/resources/css/popupPanel.ecss)
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss
(rev 0)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss 2010-08-11
18:26:28 UTC (rev 18560)
@@ -0,0 +1,163 @@
+.mp-button {
+ outline-style: none;
+ position: absolute;
+ clip: rect(0px 0px 1px 1px);
+ height: 0px;
+ width: 0px;
+ left: 0px;
+ top: 0px;
+ z-index: -300;
+ opacity:0.1;
+ filter : 'alpha(opacity=10)';
+}
+
+.mp_shade {
+ position : fixed;
+ width : 100%;
+ height : 100%;
+ top:0px;
+ left : 0px;
+ background : #D0D0D0;
+ opacity:0.5;
+ filter : 'alpha(opacity=50)';
+}
+.mp_iframe {
+ position : absolute;
+ width : 100%;
+ height : 100%;
+ top:0px;
+ left : 0px;
+ opacity:0.3;
+ filter : 'alpha(opacity=30)';
+}
+.mp_shadow {
+ position : fixed;
+ background-color : #000000;
+ opacity:0.1;
+ filter : 'alpha(opacity=10)';
+}
+.mp_container {
+ position : fixed;
+ border : '1px solid #{richSkin.panelBorderColor}';
+ background : '#{richSkin.generalBackgroundColor}';
+ z-index:100;
+}
+.mp_header {
+ background :
"url(#{resource['org.richfaces.renderkit.html.GradientA']})";
+ repeat-x : 'top left #{richSkin.headerBackgroundColor}';
+ position : relative;
+ padding-left : 10px;
+ cursor : move;
+ padding : 2px;
+}
+.mp_header_content {
+ overflow : hidden;
+ white-space : nowrap;
+ text-overflow: ellipsis;
+ font-weight : '#{richSkin.headerWeightFont}';
+ color : '#{richSkin.headerTextColor}';
+ font-family : '#{richSkin.headerFamilyFont}';
+ font-size : '#{richSkin.headerSizeFont}';
+ padding : 2px;
+ padding-left : 10px;
+}
+.mp_header_controls {
+ position : absolute;
+ top : 2px;
+ right : 2px;
+ white-space : nowrap;
+ cursor : default;
+ font-weight : '#{richSkin.headerWeightFont}';
+ color : '#{richSkin.headerTextColor}';
+ font-family : '#{richSkin.headerFamilyFont}';
+ font-size : '#{richSkin.headerSizeFont}';
+}
+
+.mp_content_scroller {
+ position : relative;
+ top : 0px;
+ left : 0px;
+ overflow : auto;
+}
+.mp_content {
+ position : relative;
+ padding : 10px;
+ color : '#{richSkin.generalTextColor}';
+ font-family : '#{richSkin.generalFamilyFont}';
+ font-size : '#{richSkin.generalSizeFont}';
+}
+.mp_handler {
+ background : red;
+ filter : 'alpha(opacity=0)';
+ opacity:0;
+ position : absolute;
+ margin : -4px;
+}
+.mp_handler_left {
+ width : 7px;
+ height : 100%;
+ top : 0px;
+ left : 0px;
+ cursor : w-resize;
+}
+
+.mp_handler_right {
+ width : 7px;
+ height : 100%;
+ top : 0px;
+ right : 0px;
+ cursor : w-resize;
+}
+
+.mp-iframe {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ background-color: white;
+ overflow-y: hidden;
+ z-index: -1;
+}
+
+.mp_handler_top {
+ width : 100%;
+ height : 7px;
+ top : 0px;
+ left : 0px;
+ cursor : n-resize;
+}
+.mp_handler_bottom {
+ width : 100%;
+ height : 7px;
+ bottom : 0px;
+ left : 0px;
+ cursor : n-resize;
+}
+
+.mp_handler_top_left {
+ width : 10px;
+ height : 10px;
+ top : 0px;
+ left : 0px;
+ cursor : nw-resize;
+}
+.mp_handler_top_right {
+ width : 10px;
+ height : 10px;
+ top : 0px;
+ right : 0px;
+ cursor : ne-resize;
+}
+.mp_handler_bottom_left {
+ width : 10px;
+ height : 10px;
+ bottom : 0px;
+ left : 0px;
+ cursor : ne-resize;
+}
+.mp_handler_bottom_right {
+ width : 10px;
+ height : 10px;
+ bottom : 0px;
+ right : 0px;
+ cursor : nw-resize;
+}
\ No newline at end of file
Copied:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js (from
rev 18558, trunk/ui/output/ui/src/main/resources/META-INF/resources/script/popupPanel.js)
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js
(rev 0)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js 2010-08-11
18:26:28 UTC (rev 18560)
@@ -0,0 +1,779 @@
+(function ($, richfaces) {
+
+ richfaces.ui = richfaces.ui || {};
+ var selectionEventHandler = function(event){
+ event.stopPropagation();
+ event.preventDefault();
+ };
+
+ var disableSelection = function (element)
+ {
+ if (typeof element.onselectstart!="undefined") //IE
+ {
+ jQuery(element).bind( 'selectstart', selectionEventHandler);
+ }
+ else //All other (ie: Opera)
+ {
+ jQuery(element).bind( 'mousedown', selectionEventHandler);
+ }
+ }
+
+ var enableSelection = function (element)
+ {
+ if (typeof element.onselectstart!="undefined") //IE
+ {
+ jQuery(element).unbind( 'selectstart', selectionEventHandler);
+ }
+ else //All other (ie: Opera)
+ {
+ jQuery(element).unbind( 'mousedown', selectionEventHandler);
+ }
+ }
+
+ richfaces.ui.PopupPanel = function(id, options) {
+
+ $super.constructor.call(this,id);
+ this.markerId = id;
+ this.attachToDom(id);
+ id = "#" + id;
+ this.options = options;
+
+ this.id = $(id);
+ this.minWidth = this.getMinimumSize(this.options.minWidth);
+ this.minHeight = this.getMinimumSize(this.options.minHeight);
+ this.maxWidth = this.options.maxWidth;
+ this.maxHeight = this.options.maxHeight;
+ this.options = options;
+
+ this.baseZIndex = this.options.zindex ? this.options.zindex : 100;
+
+ this.div = id;
+ this.cdiv = id + "_container";
+ this.contentDiv = id + "_content";
+ this.shadowDiv = id + "_shadow";
+ this.scrollerDiv = id + "_content_scroller"
+
+ this.borders = new Array();
+ this.firstHref = id + "FirstHref";
+ this.lastHref = id + "LastHref";
+ if (this.options.resizeable) {
+ this.borders.push(new richfaces.ui.PopupPanel.Border(id + "ResizerN", this,
"N-resize", richfaces.ui.PopupPanel.Sizer.N));
+ this.borders.push(new richfaces.ui.PopupPanel.Border(id + "ResizerE", this,
"E-resize", richfaces.ui.PopupPanel.Sizer.E));
+ this.borders.push(new richfaces.ui.PopupPanel.Border(id + "ResizerS", this,
"S-resize", richfaces.ui.PopupPanel.Sizer.S));
+ this.borders.push(new richfaces.ui.PopupPanel.Border(id + "ResizerW", this,
"W-resize", richfaces.ui.PopupPanel.Sizer.W));
+
+ this.borders.push(new richfaces.ui.PopupPanel.Border(id + "ResizerNW", this,
"NW-resize", richfaces.ui.PopupPanel.Sizer.NW));
+ this.borders.push(new richfaces.ui.PopupPanel.Border(id + "ResizerNE", this,
"NE-resize", richfaces.ui.PopupPanel.Sizer.NE));
+ this.borders.push(new richfaces.ui.PopupPanel.Border(id + "ResizerSE", this,
"SE-resize", richfaces.ui.PopupPanel.Sizer.SE));
+ this.borders.push(new richfaces.ui.PopupPanel.Border(id + "ResizerSW", this,
"SW-resize", richfaces.ui.PopupPanel.Sizer.SW));
+ }
+
+ if (this.options.moveable && $(id + "_header")) {
+ this.header = new richfaces.ui.PopupPanel.Border(id + "_header", this,
"move", richfaces.ui.PopupPanel.Sizer.Header);
+ } else{
+ $(id + "_header").css('cursor', 'default');
+ }
+
+ };
+
+ var $super = richfaces.BaseComponent.extend(richfaces.ui.PopupPanel);
+ var $p = richfaces.BaseComponent.extend(richfaces.ui.PopupPanel, {});
+ var $super = richfaces.ui.PopupPanel.$super;
+ $.extend(richfaces.ui.PopupPanel.prototype, (function (options) {
+
+ return {
+
+ name: "RichFaces.ui.PopupPanel",
+ saveInputValues: function(element) {
+ /* Fix for RF-3856 - Checkboxes in modal panel does not hold their states after modal
was closed and opened again */
+ if ($.browser.msie /* reproducible for checkbox/radio in IE6, radio in IE 7/8 beta 2
*/) {
+ $('input[type=checkbox], input[type=radio]', element).each(function(index)
{
+ $(this).defaultChecked = $(this).checked;
+ });
+ }
+ },
+
+ width: function() {
+ return this.getContentElement()[0].clientWidth;//TODO
+ },
+
+ height: function() {
+ return this.getContentElement()[0].clientHeight;//TODO
+ },
+
+ getLeft : function (){
+ return $(this.cdiv).css('left');
+ },
+
+ getTop : function (){
+ return $(this.cdiv).css('top');
+ },
+
+ getInitialSize : function(){
+ if(this.options.autosized){
+ return 15;
+ } else{
+ return $(this.div + "_header_content").height();
+ }
+ },
+
+ getContentElement: function() {
+ if (!this._contentElement) {
+ this._contentElement = $(this.cdiv);
+ }
+
+ return this._contentElement;
+ },
+ getSizeElement : function() {
+ return document.body;
+ },
+
+ getMinimumSize : function(size) {
+ return Math.max(size, 2*this.getInitialSize() + 2);
+ },
+ destroy: function() {
+
+ this._contentElement = null;
+ this.firstOutside = null;
+ this.lastOutside = null;
+ this.firstHref = null;
+ this.parent = null;
+ if (this.header) {
+ this.header.destroy();
+ this.header=null;
+ }
+
+ for (var k = 0; k < this.borders.length; k++ ) {
+ this.borders[k].destroy();
+ }
+ this.borders = null;
+
+ if (this.domReattached) {
+ var element = this.id;
+ var parent = $(element).parent();
+ if (parent) {
+ parent.remove(element);
+ }
+ }
+ this.markerId = null;
+ this.options = null;
+
+ this.id = null;
+
+ this.div = null;
+ this.cdiv = null;
+ this.contentDiv = null;
+ this.shadowDiv = null;
+ this.scrollerDiv = null;
+ this.userOptions = null;
+ this.eIframe= null;
+
+ },
+
+ initIframe : function() {
+ if (this.contentWindow) {
+ $(this.contentWindow.document.body).css("margin", "0px 0px 0px
0px");
+ } else {
+ //TODO opera etc.
+
+ }
+
+ if("transparent" == $(document.body).css("background-color")) {
+ $(this).css('filter', "alpha(opacity=0)");
+ $(this).css('opacity', "0");
+ }
+ },
+
+ setLeft: function(pos) {
+ if(!isNaN(pos)){
+ $(this.cdiv).css('left', pos + "px");
+ var depth = this.options.shadowDepth ? this.options.shadowDepth : 2;
+ $(this.shadowDiv).css('left', pos + depth + "px");
+ }
+ },
+
+ setTop: function(pos) {
+ if(!isNaN(pos)){
+ $(this.cdiv).css('top', pos + "px");
+ var depth = this.options.shadowDepth ? this.options.shadowDepth : 2;
+ $(this.shadowDiv).css('top', pos + depth +"px");
+ }
+ },
+
+ show: function(event, opts) {
+ if(!this.shown &&
this.invokeEvent("beforeshow",event,null,element)) {
+ this.preventFocus();
+ var element = this.id;
+
+ if (!this.domReattached) {
+ this.parent = $(element).parent();
+
+ var domElementAttachment;
+ if (opts) {
+ domElementAttachment = opts.domElementAttachment;
+ }
+
+ if (!domElementAttachment) {
+ domElementAttachment = this.options.domElementAttachment;
+ }
+
+ var newParent;
+ if ('parent' == domElementAttachment) {
+ newParent = this.parent;
+ } else if ('form' == domElementAttachment) {
+ newParent = this.findForm(element) || document.body;
+ } else {
+ //default - body
+ newParent = document.body;
+ }
+
+ if (newParent != this.parent) {
+ this.saveInputValues(element);
+ element.insertBefore(newParent.firstChild);
+ this.domReattached = true;
+ } else {
+ $(this.parent).show();
+ }
+ }
+
+ var forms = $("form", element);
+
+ if (this.options.keepVisualState && forms) {
+ for (var i = 0; i < forms.length; i++) {
+ var popup = this;
+ $(forms[i]).bind( "submit", {popup:popup}, this.setStateInput);
+ }
+ }
+
+
+
+ var options = {};
+ this.userOptions = {};
+ if (!element.mpSet) {
+ $.extend(options, this.options);
+ }
+
+ if (opts) {
+ $.extend(options, opts);
+ $.extend(this.userOptions, opts);
+ }
+
+ this.currentMinHeight = this.getMinimumSize((options.minHeight || options.minHeight
== 0) ? options.minHeight : this.minHeight);
+ this.currentMinWidth = this.getMinimumSize((options.minWidth || options.minWidth ==
0) ? options.minWidth : this.minWidth);
+
+ var eContentElt = this.getContentElement();
+
+ if (!this.options.autosized) {
+ if (options.width && options.width == -1)
+ options.width = 300;
+ if (options.height && options.height == -1)
+ options.height = 200;
+ } else{
+ //options.width = $(this.div+"_headerSpan").width() +20;
+ }
+
+ if (options.width && options.width != -1) {
+ if (this.currentMinWidth > options.width) {
+ options.width = this.currentMinWidth;
+ }
+ if (options.width > this.maxWidth) {
+ options.width = this.maxWidth;
+ }
+ $(eContentElt).css('width', options.width + (/px/.test(options.width) ?
'' : 'px'));
+ $(this.shadowDiv).css('width', options.width + 4 +
(/px/.test(options.width) ? '' : 'px'));
+ $(this.scrollerDiv).css('width', options.width + (/px/.test(options.width)
? '' : 'px'));
+
+
+ }
+
+ if (options.height && options.height != -1) {
+ if (this.currentMinHeight > options.height) {
+ options.height = this.currentMinHeight;
+ }
+ if (options.height > this.maxHeight) {
+ options.height = this.maxHeight;
+ }
+ $(eContentElt).css('height', options.height + (/px/.test(options.height) ?
'' : 'px'));
+ $(this.shadowDiv).css('height', options.height + 4 +
(/px/.test(options.height) ? '' : 'px'));
+ var headerHeight = $(this.div +"_header")[0] ? $(this.div
+"_header")[0].clientHeight : 0;
+ $(this.scrollerDiv).css('height', options.height - headerHeight +
(/px/.test(options.height) ? '' : 'px'));
+
+
+ }
+ var eIframe;
+ if (this.options.overlapEmbedObjects && !this.iframe) {
+ this.iframe = this.markerId + "IFrame";
+ $("<iframe src=\"javascript:''\"
frameborder=\"0\" scrolling=\"no\" id=\"" + this.iframe +
"\" " +
+ "class=\"mp-iframe\" style=\"width:" +this.options.width +
"px; height:" + this.options.height + "px;\">" +
+ "</iframe>").insertBefore($(':first-child',
$(this.cdiv))[0]);
+
+ eIframe = jQuery("#"+this.iframe);
+
+ $(eIframe).bind('load', this.initIframe);
+ this.eIframe = eIframe;
+ }
+ element.mpSet = true;
+
+ var eDiv = $(this.div);
+
+ if (options.left) {
+ var _left;
+ if (options.left != "auto") {
+ _left = parseInt(options.left, 10);
+ } else {
+ var cw = this.getSizeElement().clientWidth;
+ var _width = this.width();
+ if (cw >= _width) {
+ _left = (cw - _width) / 2;
+ } else {
+ _left = 0;
+ }
+ }
+
+ this.setLeft(Math.round(_left));
+ }
+
+ if (options.top) {
+ var _top;
+ if (options.top != "auto") {
+ _top = parseInt(options.top, 10);
+ } else {
+ var cw = this.getSizeElement().clientHeight;
+ var _height = this.height();
+ if (cw >= _height) {
+ _top = (cw - _height) / 2;
+ } else {
+ _top = 0;
+ }
+ }
+
+ this.setTop(Math.round(_top));
+ }
+
+ var opacity = options.shadowOpacity ? options.shadowOpacity : 0.1;
+ $(this.shadowDiv).css('opacity', opacity);
+ $(this.shadowDiv).css('filter ', 'alpha(opacity='+opacity*100
+');');
+ $(element).css('visibility', '');
+ $(element).css('display', 'block');
+ var event = {};
+ event.parameters = opts || {};
+ this.shown = true;
+ this.invokeEvent("show",event,null,element);
+ }
+ },
+
+ startDrag: function(border) {
+ //for (var k = 0; k < this.borders.length; k++ ) {
+ //this.borders[k].hide();
+ //}
+ disableSelection(document.body);
+ },
+ firstOnfocus: function(event) {
+ var e = $(event.data.popup.firstHref)
+ if (e) {
+ e.focus();
+ }
+ },
+
+
+ formElements: "|a|input|select|button|textarea|",
+
+ processAllFocusElements: function(root, callback) {
+ var idx = -1;
+ var tagName;
+
+ if (root.focus && root.nodeType == 1 && (tagName = root.tagName)
&&
+ // Many not visible elements have focus method, we is had to avoid processing them.
+ (idx = this.formElements.indexOf(tagName.toLowerCase())) != -1 &&
+ this.formElements.charAt(idx - 1) === '|' &&
+ this.formElements.charAt(idx + tagName.length) === '|' &&
+ !root.disabled && root.type!="hidden") {
+ callback.call(this, root);
+ } else {
+ if (root != this.id) {
+ var child = root.firstChild;
+ while (child) {
+ if (!child.style || child.style.display != 'none') {
+ this.processAllFocusElements(child, callback);
+ }
+ child = child.nextSibling;
+ }
+ }
+ }
+ },
+
+ processTabindexes: function(input) {
+ if (!this.firstOutside) {
+ this.firstOutside = input;
+ }
+ if (input.tabIndex && !input.prevTabIndex) {
+ input.prevTabIndex = input.tabIndex;
+ }
+ input.tabIndex = undefined;
+ if (input.accesskey && !input.prevAccesskey) {
+ input.prevAccesskey = input.accesskey;
+ }
+ input.accesskey = undefined;
+ },
+
+ restoreTabindexes: function(input) {
+ if (input.prevTabIndex) {
+ input.tabIndex = input.prevTabIndex;
+ input.prevTabIndex = undefined;
+ }
+ if (input.prevAccesskey) {
+ input.accesskey = input.prevAccesskey;
+ input.prevAccesskey = undefined;
+ }
+ },
+
+ preventFocus: function() {
+ if(this.options.modal){
+ this.processAllFocusElements(document, this.processTabindexes);
+ var popup = this;
+ if (this.firstOutside) {
+
+ jQuery(this.firstOutside).bind("focus", {popup: popup}, this.firstOnfocus);
+ }
+ }
+ },
+
+ restoreFocus: function() {
+ if(this.options.modal){
+ this.processAllFocusElements(document, this.restoreTabindexes);
+
+ if (this.firstOutside) {
+ jQuery(this.firstOutside).unbind("focus", this.firstOnfocus);
+ this.firstOutside = null;
+ }
+ }
+ },
+
+ endDrag: function(border) {
+ for (var k = 0; k < this.borders.length; k++ ) {
+ this.borders[k].show();
+ this.borders[k].doPosition();
+ }
+ enableSelection(document.body);
+ },
+
+ hide: function(event, opts) {
+ var element = this.id;
+ this.restoreFocus();
+ if (this.shown &&
this.invokeEvent("beforehide",event,null,element)) {
+
+ this.currentMinHeight = undefined;
+ this.currentMinWidth = undefined;
+
+ $(this.id).hide();
+
+ if (this.parent) {
+ if (this.domReattached) {
+ this.saveInputValues(element);
+
+ this.parent.append(element);
+
+ this.domReattached = false;
+ } else {
+ $(this.parent).hide();
+ }
+ }
+
+ var event = {};
+ event.parameters = opts || {};
+ if (this.options && this.options.onhide) {
+ this.options.onhide(event);
+ }
+
+ var forms = $("form", element);
+ if (this.options.keepVisualState && forms) {
+ for (var i = 0; i < forms.length; i++) {
+ $(forms[i]).unbind( "submit", this.setStateInput);
+ }
+ }
+
+ this.shown = false;
+
+ }
+ },
+
+ getStyle: function(elt, name) {
+ return parseInt($(elt).css(name).replace("px", ""), 10);
+ },
+
+ doResizeOrMove: function(diff) {
+ var vetoes = {};
+ var shadowHash = {};
+ var cssHash = {};
+ var cssHashWH = {};
+ var shadowHashWH = {};
+ var contentHashWH = {};
+ var scrollerHashWH = {};
+
+ var vetoeChange = false;
+ var newSize;
+ var shadowDepth = this.options.shadowDepth? this.options.shadowDepth: 4;
+ var scrollerHeight = 22;
+ var scrollerWidth = 0;
+ var eContentElt = this.getContentElement();
+
+ newSize = this.getStyle(eContentElt, "width");
+
+ var oldSize = newSize;
+ newSize += diff.deltaWidth || 0;
+
+
+
+ if (newSize >= this.currentMinWidth || this.options.autosized) {
+ if (diff.deltaWidth) {
+ cssHashWH.width = newSize + 'px';
+ shadowHashWH.width = newSize + shadowDepth + 'px';
+ contentHashWH.width = newSize - scrollerWidth + 'px';
+ scrollerHashWH.width = newSize - scrollerWidth + 'px';
+ }
+ } else {
+ if (diff.deltaWidth) {
+ cssHashWH.width = this.currentMinWidth + 'px';
+ shadowHashWH.width = this.currentMinWidth + shadowDepth + 'px';
+ contentHashWH.width = this.currentMinWidth - scrollerWidth + 'px';
+ scrollerHashWH.width = this.currentMinWidth - scrollerWidth + 'px';
+ vetoes.vx = oldSize - this.currentMinWidth;
+ }
+
+ vetoes.x = true;
+ }
+
+ if (newSize >= this.options.maxWidth) {
+ if (diff.deltaWidth) {
+ cssHashWH.width = this.currentMaxWidth + 'px';
+ shadowHashWH.width = this.currentMaxWidth + shadowDepth + 'px';
+ contentHashWH.width = this.currentMaxWidth - scrollerWidth + 'px';
+ scrollerHashWH.width = this.currentMaxWidth - scrollerWidth + 'px';
+ vetoes.vx = oldSize - this.currentMaxWidth;
+ }
+
+ vetoes.x = true;
+ }
+
+ if (vetoes.vx && diff.deltaX) {
+ diff.deltaX = -vetoes.vx;
+ }
+
+ var eCdiv = $(this.cdiv);
+
+ if (diff.deltaX && (vetoes.vx || !vetoes.x)) {
+ if (vetoes.vx) {
+ diff.deltaX = vetoes.vx;
+ }
+ var newPos;
+
+ newPos = this.getStyle(eCdiv, "left");
+ newPos += diff.deltaX;
+ cssHash.left = newPos + 'px';
+
+ shadowHash.left = newPos + shadowDepth + "px";
+ }
+
+ newSize = this.getStyle(eContentElt, "height")
+
+ var oldSize = newSize;
+ newSize += diff.deltaHeight || 0;
+
+ if (newSize >= this.currentMinHeight || this.options.autosized) {
+ if (diff.deltaHeight) {
+ cssHashWH.height = newSize + 'px';
+ shadowHashWH.height = newSize + shadowDepth + 'px';
+ scrollerHashWH.height = newSize - scrollerHeight + 'px';
+ }
+ } else {
+ if (diff.deltaHeight) {
+ cssHashWH.height = this.currentMinHeight + 'px';
+ shadowHashWH.height = this.currentMinHeight + shadowDepth + 'px';
+ scrollerHashWH.height = this.currentMinHeight - scrollerHeight + 'px';
+ vetoes.vy = oldSize - this.currentMinHeight;
+ }
+
+ vetoes.y = true;
+ }
+
+ if (newSize >= this.options.maxHeight) {
+ if (diff.deltaHeight) {
+ cssHashWH.height = this.currentMaxHeight + 'px';
+ shadowHashWH.height = this.currentMaxHeight + shadowDepth + 'px';
+ scrollerHashWH.height = this.currentMaxHeight - scrollerHeight + 'px';
+ vetoes.vy = oldSize - this.currentMaxHeight;
+ }
+
+ vetoes.y = true;
+ }
+
+ if (vetoes.vy && diff.deltaY) {
+ diff.deltaY = -vetoes.vy;
+ }
+
+ if (diff.deltaY && (vetoes.vy || !vetoes.y)) {
+ if (vetoes.vy) {
+ diff.deltaY = vetoes.vy;
+ }
+
+ }
+ if (diff.deltaY && (vetoes.vy || !vetoes.y)) {
+ if (vetoes.vy) {
+ diff.deltaY = vetoes.vy;
+ }
+ var newPos;
+
+ newPos = this.getStyle(eCdiv, "top");
+ newPos += diff.deltaY;
+ cssHash.top = newPos + 'px';
+ shadowHash.top = newPos + shadowDepth + "px";
+ }
+ $(eContentElt).css(cssHashWH);
+ $(this.scrollerDiv).css(scrollerHashWH);
+ if(this.eIframe)$(this.eIframe).css(scrollerHashWH);
+ $(this.shadowDiv).css(shadowHashWH);
+
+ $(eCdiv).css(cssHash);
+ $(this.shadowDiv).css(shadowHash);
+ //if(this.eIframe)$(this.eIframe).css(cssHash);
+ $.extend(this.userOptions, cssHash);
+ $.extend(this.userOptions, cssHashWH);
+ var w = this.width();
+ var h = this.height();
+
+ this.reductionData = null;
+
+ if (w <= 2*this.getInitialSize()) {
+ this.reductionData = {};
+ this.reductionData.w = w;
+ }
+
+ if (h <= 2*this.getInitialSize()) {
+ if (!this.reductionData) {
+ this.reductionData = {};
+ }
+
+ this.reductionData.h = h;
+ }
+
+ if (this.header) {
+ this.header.doPosition();
+ }
+
+ return vetoes;
+ },
+
+ setSize : function (width, height){
+ var w = width - this.width() ;
+ var h = height -this.height();
+ var diff = new richfaces.ui.PopupPanel.Sizer.Diff(0,0, w, h);
+ this.doResizeOrMove(diff);
+ },
+
+ moveTo : function (top, left){
+ var shadowDepth = this.options.shadowDepth? this.options.shadowDepth: 4;
+ $(this.cdiv).css('top', top);
+ $(this.cdiv).css('left', left);
+ $(this.shadowDiv).css('top', top + shadowDepth);
+ $(this.shadowDiv).css('left', left + shadowDepth);
+ },
+
+ move : function (dx, dy){
+ var diff = new richfaces.ui.PopupPanel.Sizer.Diff(dx,dy, 0, 0);
+ this.doResizeOrMove(diff);
+ },
+
+ resize : function (dx, dy){
+ var diff = new richfaces.ui.PopupPanel.Sizer.Diff(0,0, dx, dy);
+ this.doResizeOrMove(diff);
+ },
+
+ findForm: function(elt) {
+ var target = elt;
+ while (target) {
+ if (!target.tagName /* document node doesn't have tagName */
+ || target.tagName.toLowerCase() != "form") {
+
+ target = $(target).parent();
+ } else {
+ break;
+ }
+ }
+
+ return target;
+ },
+
+ setStateInput: function(event) {
+ // Concret input but not entire form is a target element for onsubmit in FF
+ var popup = event.data.popup;
+ target = $(popup.findForm(event.currentTarget));
+
+ var input = document.createElement("input");
+ input.type = "hidden";
+ input.id = popup.markerId + "OpenedState";
+ input.name = popup.markerId + "OpenedState";
+ input.value = popup.shown ? "true" : "false";
+ target.append(input);
+
+ $.each(popup.userOptions, function(key, value) {
+ input = document.createElement("input");
+ input.type = "hidden";
+ input.id = popup.markerId + "StateOption_" + key;
+ input.name = popup.markerId + "StateOption_" + key;
+ input.value = value;
+ target.append(input);
+ });
+
+ return true;
+ },
+
+ invokeEvent: function(eventName, event, value, element) {
+
+ var eventFunction = this.options['on'+eventName];
+ var result;
+
+ if (eventFunction) {
+ var eventObj;
+ if (event) {
+ eventObj = event;
+ }
+ else if(document.createEventObject) {
+ eventObj = document.createEventObject();
+ }
+ else if( document.createEvent ) {
+ eventObj = document.createEvent('Events');
+ eventObj.initEvent( eventName, true, false );
+ }
+
+ eventObj.rich = {component:this};
+ eventObj.rich.value = value;
+
+ try {
+ result = eventFunction.call(element, eventObj);
+ }
+ catch (e) { LOG.warn("Exception: "+e.Message + "\n[on"+eventName
+ "]"); }
+ }
+
+ if (result!=false) {
+ result = true;
+ }
+ return result;
+ }
+
+
+ }
+
+ })());
+ $.extend(richfaces.ui.PopupPanel, {
+
+ showPopupPanel : function (id, opts, event) {
+
+ $(document).ready(richfaces.$(id).show());
+ },
+
+ hidePopupPanel : function (id, opts, event) {
+ $(document).ready(richfaces.$(id).hide());
+ }
+ });
+
+})(jQuery, window.RichFaces);
Copied:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanelBorders.js
(from rev 18558,
trunk/ui/output/ui/src/main/resources/META-INF/resources/script/popupPanelBorders.js)
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanelBorders.js
(rev 0)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanelBorders.js 2010-08-11
18:26:28 UTC (rev 18560)
@@ -0,0 +1,174 @@
+(function ($, richfaces) {
+
+ richfaces.ui = richfaces.ui || {};
+
+ richfaces.ui.PopupPanel.Border = function(id, modalPanel, cursor, sizer) {
+
+ $super.constructor.call(this,id);
+
+ var element = jQuery(id);
+ jQuery(element).css('cursor',cursor);
+ var border = this;
+ jQuery(this.id).bind( 'mousedown', {border:border},this.startDrag);
+
+ this.modalPanel = modalPanel;
+ this.sizer = sizer;
+ };
+
+ var $super = richfaces.BaseComponent.extend(richfaces.ui.PopupPanel.Border);
+ var $super = richfaces.ui.PopupPanel.Border.$super;
+
+ $.extend(richfaces.ui.PopupPanel.Border.prototype, (function (options) {
+
+ return {
+
+ name: "RichFaces.ui.PopupPanel.Border",
+
+ destroy: function()
+ {
+ if (this.doingDrag)
+ {
+ jQuery(document).unbind( 'mousemove', this.doDrag);
+ jQuery(document).unbind( 'mouseup', this.endDrag);
+ }
+
+ jQuery(this.id).unbind( 'mousedown', this.startDrag);
+ this.modalPanel=null;
+ },
+
+ show: function() {
+ jQuery(this.id).show();
+ },
+
+ hide: function() {
+ jQuery(this.id).hide();
+ },
+
+ startDrag: function(event) {
+ var border = event.data.border;
+ border.doingDrag = true;
+
+ border.dragX = event.clientX;
+ border.dragY = event.clientY;
+ jQuery(document).bind( 'mousemove',{border:border}, border.doDrag);
+ jQuery(document).bind( 'mouseup',{border:border}, border.endDrag);
+
+ //var eCursorDiv = jQuery(border.modalPanel.cDiv);
+ //jQuery(eCursorDiv).css('cursor', jQuery(border.id).css('cursor'));
+ //jQuery(eCursorDiv).css('zIndex', 10);
+
+ border.modalPanel.startDrag(border);
+
+ border.onselectStartHandler = document.onselectstart;
+ document.onselectstart = function() { return false; }
+ },
+
+ getWindowSize : function() {
+ var myWidth = 0, myHeight = 0;
+ if( typeof( window.innerWidth ) == 'number' ) {
+ myWidth = window.innerWidth;
+ myHeight = window.innerHeight;
+ } else if( document.documentElement && (
document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
+ myWidth = document.documentElement.clientWidth;
+ myHeight = document.documentElement.clientHeight;
+ } else if( document.body && ( document.body.clientWidth ||
document.body.clientHeight ) ) {
+ myWidth = document.body.clientWidth;
+ myHeight = document.body.clientHeight;
+ }
+ return {"width":myWidth,"height":myHeight};
+ },
+
+ doDrag: function(event) {
+ var border = event.data.border;
+ if (!border.doingDrag) {
+ return ;
+ }
+
+ var evtX = event.clientX;
+ var evtY = event.clientY;
+
+ var winSize = border.getWindowSize();
+
+ if (evtX < 0) {
+ evtX = 0;
+ } else if (evtX >= winSize.width) {
+ evtX = winSize.width - 1;
+ }
+
+ if (evtY < 0) {
+ evtY = 0;
+ } else if (evtY >= winSize.height) {
+ evtY = winSize.height - 1;
+ }
+
+ var dx = evtX - border.dragX;
+ var dy = evtY - border.dragY;
+
+ if (dx != 0 || dy != 0) {
+
+ var id = border.id;
+
+ var diff = border.sizer.prototype.doDiff(dx, dy);//TODO
+ var doResize;
+
+ var element = jQuery(border.modalPanel.cdiv);
+
+ if (diff.deltaWidth || diff.deltaHeight) {
+ doResize = border.modalPanel.invokeEvent("resize",event,null,element);
+ } else if (diff.deltaX || diff.deltaY) {
+ doResize = border.modalPanel.invokeEvent("move",event,null,element);
+ }
+
+ var vetoes;
+
+ if (doResize) {
+ vetoes = border.modalPanel.doResizeOrMove(diff);
+ }
+
+ if(vetoes){
+ if (!vetoes.x) {
+ border.dragX = evtX;
+ } else {
+ if (!diff.deltaX) {
+ border.dragX -= vetoes.vx || 0;
+ } else {
+ border.dragX += vetoes.vx || 0;
+ }
+ }
+
+ if (!vetoes.y) {
+ border.dragY = evtY;
+ } else {
+ if (!diff.deltaY) {
+ border.dragY -= vetoes.vy || 0;
+ } else {
+ border.dragY += vetoes.vy || 0;
+ }
+ }
+ }
+ }
+ },
+
+ endDrag: function(event) {
+ var border = event.data.border;
+ border.doingDrag = undefined;
+
+ jQuery(document).unbind( 'mousemove', border.doDrag);
+ jQuery(document).unbind( 'mouseup', border.endDrag);
+
+ border.modalPanel.endDrag(border);
+
+ border.modalPanel.doResizeOrMove(richfaces.ui.PopupPanel.Sizer.Diff.EMPTY);
+
+ document.onselectstart = border.onselectStartHandler;
+ border.onselectStartHandler = null;
+ },
+
+ doPosition: function() {
+ this.sizer.prototype.doPosition(this.modalPanel, jQuery(this.id)); //TODO remove
prototype
+ }
+ }
+
+ })());
+
+})(jQuery, window.RichFaces);
\ No newline at end of file
Copied:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanelSizer.js
(from rev 18558,
trunk/ui/output/ui/src/main/resources/META-INF/resources/script/popupPanelSizer.js)
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanelSizer.js
(rev 0)
+++
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanelSizer.js 2010-08-11
18:26:28 UTC (rev 18560)
@@ -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.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.SE.prototype, {
+
+ 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