Author: vmolotkov
Date: 2008-01-09 09:46:42 -0500 (Wed, 09 Jan 2008)
New Revision: 5221
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js
trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
Log:
component corrected
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
===================================================================
---
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-01-09
14:12:13 UTC (rev 5220)
+++
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-01-09
14:46:42 UTC (rev 5221)
@@ -10,7 +10,6 @@
this.combobox = $(combobox);
this.field = $(fieldId);
this.button = $(buttonId);
- //listWidth = (listWidth.length == 0) ? this.combobox.offsetWidth : listWidth;
var fieldDem = Richfaces.ComboBoxList.getElemXY(this.field);
fieldDem.height = this.field.offsetHeight;
this.comboList = new Richfaces.ComboBoxList(listId, parentListId, classes, listWidth,
listHeight, itemsText, onlistcall, fieldDem);
@@ -202,12 +201,18 @@
this.width = width;
this.height = height;
this.fieldDimensions = fieldXY;
- //this.initList(width, height, fieldXY);
+ this.initDimensions();
},
- initList : function(width, height, fieldXY) {
- this.setSize(width, height);
- this.setPosition(fieldXY.top, fieldXY.left, fieldXY.height);
+ initDimensions : function() {
+ this.listParent.style.visibility = "hidden";
+ this.listParent.show();
+
+ Richfaces.ComboBoxList.LAYOUT_BORDER = Richfaces.getBorderWidth(this.listParent,
"tb");
+ Richfaces.ComboBoxList.LAYOUT_PADDING = Richfaces.getPaddingWidth(this.listParent,
"tb");
+
+ this.listParent.hide();
+ this.listParent.style.visibility = "visible";
},
createDefaultList : function() {
@@ -245,8 +250,6 @@
},
setSize : function() {
- this.listParent.style.width = this.width;
-
var height = this.height;
var currentItemsHeight;
@@ -276,7 +279,15 @@
height = itemHeight * this.defaultRowsAmount;
}
}
+
+ if (Prototype.Browser.IE) {
+ height += Richfaces.ComboBoxList.LAYOUT_BORDER -
Richfaces.ComboBoxList.LAYOUT_PADDING;
+ }
this.listParent.style.height = height;
+
+ if (this.width) {
+ this.listParent.style.width = this.width
+ }
},
setPosition : function(fieldTop, fieldLeft, fieldHeight) {
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js
===================================================================
---
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js 2008-01-09
14:12:13 UTC (rev 5220)
+++
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js 2008-01-09
14:46:42 UTC (rev 5221)
@@ -11,4 +11,38 @@
else if (document.body) { // other Explorers
return document.body.clientHeight;
}
-}
\ No newline at end of file
+}
+
+Richfaces.getScrollWidth = function(elem) {
+ if (elem.clientWidth != 0) {
+ return elem.offsetWidth - elem.clientWidth;
+ }
+ return 0;
+}
+
+Richfaces.getBorderWidth = function(el, side) {
+ return Richfaces.getStyles(el, side, Richfaces.borders);
+}
+
+Richfaces.getPaddingWidth = function(el, side) {
+ return Richfaces.getStyles(el, side, Richfaces.paddings);
+}
+
+Richfaces.getMarginWidth = function(el, side) {
+ return Richfaces.getStyles(el, side, Richfaces.margins);
+}
+
+Richfaces.getStyles = function(el, sides, styles) {
+ var val = 0;
+ for(var i = 0, len = sides.length; i < len; i++){
+ //if (el.getStyle) {
+ var w = parseInt(Element.getStyle(el, styles[sides.charAt(i)]), 10);
+ if(!isNaN(w)) val += w;
+ //}
+ }
+ return val;
+}
+
+Richfaces.borders = {l: 'border-left-width', r: 'border-right-width', t:
'border-top-width', b: 'border-bottom-width'},
+Richfaces.paddings = {l: 'padding-left', r: 'padding-right', t:
'padding-top', b: 'padding-bottom'},
+Richfaces.margins = {l: 'margin-left', r: 'margin-right', t:
'margin-top', b: 'margin-bottom'}
\ No newline at end of file
Modified: trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-09 14:12:13 UTC
(rev 5220)
+++ trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-09 14:46:42 UTC
(rev 5221)
@@ -51,8 +51,8 @@
]]>
</jsp:scriptlet>
- <div id="#{clientId}" class="rich-cb-width rich-cb-font
rich-cb-shell">
- <input id="comboboxField#{clientId}" class="rich-cb-width
rich-cb-font rich-cb-field" type="text" size="#{inputSize}"
autocomplete="off">
+ <div id="#{clientId}" class="rich-cb-width rich-cb-font
rich-cb-shell" style="width:#{listWidth}">
+ <input id="comboboxField#{clientId}" class="rich-cb-width
rich-cb-font rich-cb-field" type="text" size="#{inputSize}"
autocomplete="off" style="width:#{listWidth}">
</input>
<input readonly="true" type="text" value=""
class="rich-cb-button rich-cb-font rich-cb-button-bg">
</input>