Author: vmolotkov
Date: 2007-11-12 08:01:16 -0500 (Mon, 12 Nov 2007)
New Revision: 3912
Modified:
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
Log:
cosmetic changes
Modified:
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
===================================================================
---
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-12
12:53:58 UTC (rev 3911)
+++
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-12
13:01:16 UTC (rev 3912)
@@ -97,36 +97,24 @@
var control;
//FIXME
if ((this.shuttleItems.length <= 1) || (this.selectedItems.length == 0)) {
- for (var i = 0; i < this.controlList.length; i++) {
- control = this.controlList[i];
- control.doDisable();
- }
+ this.controlsProcessing(["first", "last", "down",
"up"]);
} else if (this.selectedItems[0].rowIndex == 0) {
- this.getControlByAction("first").doDisable();
- this.getControlByAction("up").doDisable();
- this.getControlByAction("down").doEnable();
- this.getControlByAction("last").doEnable();
+ this.controlsProcessing(["first", "up"]);
} else if (this.selectedItems[this.selectedItems.length - 1].rowIndex ==
(this.shuttleItems.length - 1)) {
- this.getControlByAction("down").doDisable();
- this.getControlByAction("last").doDisable();
- this.getControlByAction("first").doEnable();
- this.getControlByAction("up").doEnable();
+ this.controlsProcessing(["down", "last"]);
} else {
- for (var i = 0; i < this.controlList.length; i++) {
- control = this.controlList[i];
- control.doEnable();
- }
+ this.controlsProcessing();
}
}
-Shuttle.prototype.getControlByAction = function(action) {
+Shuttle.prototype.controlsProcessing = function(disabledControls) {
for (var i = 0; i < this.controlList.length; i++) {
- var control = this.controlList[i];
- if (control.action == action) {
- return control;
+ control = this.controlList[i];
+ if (control != null) {
+ if (disabledControls != null && disabledControls.indexOf(control.action) !=
-1) control.doDisable();
+ else control.doEnable();
}
- }
- return null;
+ }
}
Shuttle.prototype.retrieveShuttleItems = function(containerId) {
@@ -286,6 +274,7 @@
}
this.activeItem.className = Shuttle.ACTIVE_ITEM_CLASS;
this.saveState();
+ this.controlListManager();
Shuttle.setFocus(this.focusKeeper.id);
}
}
Show replies by date