Author: vmolotkov
Date: 2008-03-28 14:30:44 -0400 (Fri, 28 Mar 2008)
New Revision: 7377
Modified:
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js
Log:
http://jira.jboss.com/jira/browse/RF-2789
Modified:
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
===================================================================
---
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-03-28
18:17:04 UTC (rev 7376)
+++
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-03-28
18:30:44 UTC (rev 7377)
@@ -300,9 +300,6 @@
this.comboValue.value = value;
this.comboList.doSelectItem(this.comboList.activeItem);
this.combobox.fire("rich:onselect", {});
- /*if (oV != value) {
- this.combobox.fire("rich:onchange", {});
- }*/
} else {
if (this.directInputSuggestions) {
var startInd = this.field.value.length;
Modified:
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js
===================================================================
---
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js 2008-03-28
18:17:04 UTC (rev 7376)
+++
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js 2008-03-28
18:30:44 UTC (rev 7377)
@@ -1,16 +1,36 @@
if (!window.Richfaces) window.Richfaces = {};
+Richfaces.defined = function(o) {
+ return (typeof(o)!="undefined");
+};
+
+Richfaces.getBody = function() {
+ if (document.body) {
+ return document.body;
+ }
+ if (document.getElementsByTagName) {
+ var bodies = document.getElementsByTagName("BODY");
+ if (bodies!=null && bodies.length>0) {
+ return bodies[0];
+ }
+ }
+ return null;
+};
+
+Richfaces.zero = function(n) {
+ return (!Richfaces.defined(n) || isNaN(n))?0:n;
+};
+
+
Richfaces.getDocumentHeight = function() {
- if (self.innerHeight) { // all except Explorer
- return self.innerHeight;
- }
- else if (document.documentElement && document.documentElement.clientHeight) {
- // Explorer 6 Strict Mode
- return document.documentElement.clientHeight;
- }
- else if (document.body) { // other Explorers
- return document.body.clientHeight;
- }
+ var body = Richfaces.getBody();
+ var innerHeight =
(Richfaces.defined(self.innerHeight)&&!isNaN(self.innerHeight))?self.innerHeight:0;
+ if (document.documentElement && (!document.compatMode ||
document.compatMode=="CSS1Compat")) {
+ var topMargin = Richfaces.getMarginWidth(body, 't');
+ var bottomMargin = Richfaces.getMarginWidth(body, 'b');
+ return Math.max(body.offsetHeight + topMargin + bottomMargin,
document.documentElement.clientHeight, document.documentElement.scrollHeight,
Richfaces.zero(self.innerHeight));
+ }
+ return Math.max(body.scrollHeight, body.clientHeight,
Richfaces.zero(self.innerHeight));
}
Richfaces.getScrollWidth = function(elem) {
Modified:
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js
===================================================================
---
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js 2008-03-28
18:17:04 UTC (rev 7376)
+++
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js 2008-03-28
18:30:44 UTC (rev 7377)
@@ -138,7 +138,6 @@
if (item) {
//FIXME
this.listParent.style.visibility = "hidden";
- //this.shadowElem.style.visibility = "hidden";
this.listParent.show();
@@ -183,34 +182,6 @@
}
},
- /*setWidth : function(width) {
- var positionElem = this.listParent.childNodes[1];
- var combobox = this.listParent.parentNode;
- combobox.style.width = width;
- if (this.iframe) {
- this.iframe.style.width = width;
- }
- if (Prototype.Browser.Gecko) {
- width = parseInt(width) - Richfaces.getBorderWidth(positionElem.firstChild,
"lr") - Richfaces.getPaddingWidth(positionElem.firstChild, "lr") +
"px";
- }
- positionElem.firstChild.style.width = width;
- //positionElem.style.width = width;
- this.listParent.style.visibility = "hidden";
- this.listParent.show();
-
- var scrollWidth = Richfaces.getScrollWidth(positionElem.firstChild);
-
- this.listParent.hide();
- this.listParent.style.visibility = "visible";
- var correction = parseInt(width) - scrollWidth;
- if (Prototype.Browser.Gecko) {
- correction -= Richfaces.getBorderWidth(positionElem.firstChild, "lr") +
Richfaces.getPaddingWidth(positionElem.firstChild, "lr");
- }
- this.list.style.width = correction + "px";
-
-
- },*/
-
setWidth : function(width) {
var positionElem = this.listParent.childNodes[1];
var combobox = this.listParent.parentNode;