Author: abelevich
Date: 2008-05-07 15:03:15 -0400 (Wed, 07 May 2008)
New Revision: 8483
Modified:
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js
Log:
code refactoring: remove unnecessary conditions
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-05-07
17:50:11 UTC (rev 8482)
+++
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combolist.js 2008-05-07
19:03:15 UTC (rev 8483)
@@ -81,8 +81,13 @@
// Richfaces.ComboBoxList.getElemXY(this.fieldElem);
this.fieldDimensions.height = this.fieldElem.parentNode.offsetHeight;
-
+
+ this.listParent.style.visibility = "hidden";
+ this.listParent.show();
this.setSize();
+ this.listParent.hide();
+ this.listParent.style.visibility = "visible";
+
this.setPosition(this.fieldDimensions.top, this.fieldDimensions.left,
this.fieldDimensions.height);
//attach list to the document body
this.injectListToBody(this.listParent);
@@ -95,23 +100,19 @@
var items = this.getItems();
if (items.length != 0) {
- this.listParent.show();
if (this.iframe) {
this.iframe.show();
}
- }
-
- if (this.selectFirstOnUpdate) {
- var curItems = this.getItems();
- if (curItems.length != 0) {
+ this.listParent.show();
+ if (this.selectFirstOnUpdate) {
if (this.selectedItem) {
this.doActiveItem(this.selectedItem);
} else {
- this.doActiveItem(curItems[0]);
+ this.doActiveItem(items[0]);
}
}
}
-
+
this.listParent.fire("rich:onlistcall", {});
},
@@ -170,17 +171,7 @@
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;
currentItemsHeight = itemHeight * rowsAmount;