Author: vmolotkov
Date: 2008-01-31 13:53:21 -0500 (Thu, 31 Jan 2008)
New Revision: 5756
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
Log:
horizontal scrolling is added
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss
===================================================================
---
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss 2008-01-31
18:30:36 UTC (rev 5755)
+++
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss 2008-01-31
18:53:21 UTC (rev 5756)
@@ -68,7 +68,6 @@
.rich-combobox-list-scroll {
overflow : auto;
/*overflow-x : hidden;*/
- height : 100px;
}
.rich-combobox-list-cord {
@@ -86,7 +85,6 @@
padding : 1px;
border : 1px solid #4a75b5;
background-color: #4a75b5;
- width : 100%;
cursor:pointer;
}
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-31
18:30:36 UTC (rev 5755)
+++
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-01-31
18:53:21 UTC (rev 5756)
@@ -48,7 +48,7 @@
this.doDisable();
}
- if (Prototype.Browser.IE) {
+ if (Richfaces.browser.isIE6) {
this.comboList.createIframe(this.combobox, listWidth, this.combobox.id,
"rich-combobox-list-width rich-combobox-list-scroll
rich-combobox-list-position");
}
@@ -383,6 +383,7 @@
this.width = width;
this.height = height;
+
this.initDimensions();
},
@@ -391,10 +392,12 @@
this.listParent.style.visibility = "hidden";
this.listParent.show();
- Richfaces.ComboBoxList.LAYOUT_BORDER_V = Richfaces.getBorderWidth(this.listParent,
"tb");
- Richfaces.ComboBoxList.LAYOUT_BORDER_H = Richfaces.getBorderWidth(this.listParent,
"lr");
- Richfaces.ComboBoxList.LAYOUT_PADDING_V = Richfaces.getPaddingWidth(this.listParent,
"tb");
- Richfaces.ComboBoxList.LAYOUT_PADDING_H = Richfaces.getPaddingWidth(this.listParent,
"lr");
+ this.LAYOUT_WIDTH = this.list.parentNode.scrollWidth;
+ var el = this.listParent.childNodes[1].firstChild;
+ this.LAYOUT_BORDER_V = Richfaces.getBorderWidth(el, "tb");
+ this.LAYOUT_BORDER_H = Richfaces.getBorderWidth(el, "lr");
+ this.LAYOUT_PADDING_V = Richfaces.getPaddingWidth(el, "tb");
+ this.LAYOUT_PADDING_H = Richfaces.getPaddingWidth(el, "lr");
this.listParent.hide();
this.listParent.style.visibility = "visible";
@@ -423,10 +426,10 @@
this.fieldDimensions = Richfaces.ComboBoxList.getElemXY(this.fieldElem);
this.fieldDimensions.height = this.fieldElem.parentNode.offsetHeight;
+ this.setPosition(this.fieldDimensions.top, this.fieldDimensions.left,
this.fieldDimensions.height);
+
this.setSize();
- this.setPosition(this.fieldDimensions.top, this.fieldDimensions.left,
this.fieldDimensions.height);
-
if (this.selectedItem) {
//was created new item list, so necessary to recreate selectedItem
this.doSelectItem(this.findItemBySubstr(this.selectedItem.innerHTML));
@@ -475,13 +478,13 @@
var currentItemsHeight;
var rowsAmount;
var item = this.getItems()[0];
+ var actItPars = 0;
if (item) {
//FIXME
this.listParent.style.visibility = "hidden";
this.listParent.show();
var itemHeight = item.offsetHeight;
-
this.listParent.hide();
this.listParent.style.visibility = "visible";
rowsAmount = this.getItems().length;
@@ -498,7 +501,10 @@
height = itemHeight * this.defaultRowsAmount;
}
}
- this.list.style.height = height;
+ if (Prototype.Browser.IE) {
+ height = parseInt(height) + this.LAYOUT_BORDER_V + this.LAYOUT_PADDING_V;
+ }
+ this.list.parentNode.style.height = height;
if (this.iframe) {
this.iframe.style.height = height;
}
@@ -519,15 +525,28 @@
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;
- var correction = parseInt(width) - Richfaces.getBorderWidth(positionElem.firstChild,
"lr") - Richfaces.getPaddingWidth(positionElem.firstChild, "lr") +
"px";
- this.list.style.width = correction;
- combobox.style.width = correction;
+ 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";
- if (this.iframe) {
- this.iframe.style.width = correction;
- }
},
@@ -559,7 +578,7 @@
scrolling : function(event) {
var increment;
- var scrollElem = this.list;
+ var scrollElem = this.list.parentNode;
var listTop = Richfaces.ComboBoxList.getElemXY(scrollElem).top;
var scrollTop = scrollElem.scrollTop;
var itemTop = Richfaces.ComboBoxList.getElemXY(this.activeItem).top;
@@ -580,7 +599,7 @@
},
scrollingUpToItem : function(item) {
- var scrollElem = this.list;
+ var scrollElem = this.list.parentNode;
var increment = (Richfaces.ComboBoxList.getElemXY(item).top - scrollElem.scrollTop) -
Richfaces.ComboBoxList.getElemXY(scrollElem).top;
scrollElem.scrollTop += increment;
},
@@ -592,6 +611,8 @@
}
this.activeItem = item;
+
+ //this.activeItem.style.width = this.LAYOUT_WIDTH + "px"; //FIXME
this.changeItem(item, this.classes.ITEM.SELECTED);
},
@@ -689,7 +710,7 @@
},
createItem : function(text, className) {
- return "<span class=\"" + className+ "\">" + text +
"</span>";
+ return "<span class=\"" + className+ "\"
style=\"width:" + this.LAYOUT_WIDTH + "px;\">" + text +
"</span>";
},
createIframe : function(parentElem, width, comboboxId, classes) {
Modified: trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-31 18:30:36 UTC
(rev 5755)
+++ trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-31 18:53:21 UTC
(rev 5756)
@@ -195,7 +195,6 @@
]]>
</jsp:scriptlet>
<style>
-
</style>
<jsp:scriptlet>
<![CDATA[
@@ -203,8 +202,7 @@
]]>
</jsp:scriptlet>
<f:resource var="spacer" name="images/spacer.gif"/>
- <f:resource name="org.richfaces.renderkit.images.ComboBoxListShadow"/>
-
+<f:resource name="org.richfaces.renderkit.images.ComboBoxListShadow"/>
<div id="control#{clientId}" class="rich-combobox-font rich-combobox
#{styleClass}" style="width:#{listWidth};#{style}"
x:passThruWithExclusions="value,name,type,id,styleClass,class,style,size,autocomplete,disabled,onchange">
<input id="comboboxValue#{clientId}"
name="comboboxValue#{clientId}" type="hidden"/>
@@ -249,8 +247,8 @@
</table>
</div>
<div id="listPosition#{clientId}"
class="rich-combobox-list-position">
- <div id="listDecoration#{clientId}"
class="rich-combobox-list-decoration">
- <div id="list#{clientId}"
class="rich-combobox-list-scroll">
+ <div id="listDecoration#{clientId}"
class="rich-combobox-list-decoration rich-combobox-list-scroll">
+ <div id="list#{clientId}">
<f:call name="encodeItems"/>
</div>
</div>