Author: vmolotkov
Date: 2007-11-12 09:43:36 -0500 (Mon, 12 Nov 2007)
New Revision: 3917
Modified:
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
Log:
FuncSpec-RF-OL-CF-060.1.7 List Active State was implemented
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
14:33:36 UTC (rev 3916)
+++
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-12
14:43:36 UTC (rev 3917)
@@ -34,6 +34,8 @@
this.activeItem = null;
this.focusKeeper = document.getElementById(focusKeeperId);
+ this.focusKeeper.focused = false;
+
this.valueKeeper = document.getElementById(valueKeeperId);
this.shuttleTop = null;
@@ -45,7 +47,7 @@
this.focusKeeper.onkeydown = function(e) {
obj.onkeydownHandler(window.event || e);
}
- this.init(containerId, contentTableId, headerTableId, controlsId, onclickControlId,
focusKeeperId);
+ this.init(containerId, contentTableId, headerTableId, controlsId, onclickControlId);
}
Shuttle.ASC = "acs";
@@ -63,6 +65,11 @@
Shuttle.CONTROL_SET = ["A", "INPUT", "TEXTAREA",
"SELECT", "BUTTON"];
+Shuttle.ORDERING_LIST_CLASSES = {
+ normal : "ol_internal_tab rich-ordering-list-items",
+ disabled : "ol_internal_tab rich-ordering-list-disabled",
+ active : "ol_internal_tab rich-ordering-list-active"
+}
Shuttle.ACTIVITY_MARKER = "a";
Shuttle.SELECTION_MARKER = "s";
@@ -75,9 +82,10 @@
down: function (e) { this.moveSelectedItems("down", e);return false; }
};
-Shuttle.prototype.init = function(containerId, contentTableId, headerTableId, ids,
onclickControlId, focusKeeperId) {
+Shuttle.prototype.init = function(containerId, contentTableId, headerTableId, ids,
onclickControlId) {
var obj = this;
- Shuttle.setFocus(focusKeeperId);
+ this.setFocus();
+ Shuttle.addEventListener(this.focusKeeper, "blur", function (e)
{obj.focusListener(e);});
for (var i = 0; i < ids.length; i++) {
var id = ids[i];
var node = document.getElementById(containerId + id[0]);
@@ -92,6 +100,13 @@
this.shuttleTop = LayoutManager.getElemXY(this.shuttleTable).top;
}
+Shuttle.prototype.isListActive = function() {
+ if ((this.activeItem != null || this.selectedItems.length != 0) &&
this.focusKeeper.focused) {
+ return true;
+ }
+ return false;
+}
+
Shuttle.prototype.controlListManager = function() {
this.selectedItems.sort(this.compareByRowIndex);
var control;
@@ -275,7 +290,7 @@
this.activeItem.className = Shuttle.ACTIVE_ITEM_CLASS;
this.saveState();
this.controlListManager();
- Shuttle.setFocus(this.focusKeeper.id);
+ this.setFocus();
}
}
@@ -566,10 +581,20 @@
return ((obj1 == obj2) ? 0 : ((obj1 < obj2) ? -1 : 1));
}
-Shuttle.setFocus = function(targetObjectId) {
- document.getElementById(targetObjectId).focus();
+Shuttle.prototype.setFocus = function() {
+ this.focusKeeper.focus();
+ this.focusKeeper.focused = true;
+ if (this.isListActive()) {
+ this.shuttleTable.className = Shuttle.ORDERING_LIST_CLASSES.active;
+ }
}
+Shuttle.prototype.focusListener = function(e) {
+ e = e || window.event;
+ this.focusKeeper.focusused = false;
+ this.shuttleTable.className = Shuttle.ORDERING_LIST_CLASSES.normal;
+}
+
Shuttle.addEventListener = function(elem, event, func) {
if (window.attachEvent) {
elem.attachEvent("on" + event, func);
Modified:
trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
===================================================================
---
trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2007-11-12
14:33:36 UTC (rev 3916)
+++
trunk/sandbox/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2007-11-12
14:43:36 UTC (rev 3917)
@@ -36,7 +36,7 @@
<td>
<div id="#{clientId}headerBox" class="ol_list">
<div class="ol_list_header" style="width:
#{component.attributes['listHeight']}px;">
- <table id="#{clientId}internal_header_tab"
class="ol_internal_header_tab" cellpadding="0"
cellspacing="0">
+ <table id="#{clientId}internal_header_tab"
class="ol_internal_header_tab rich-ordering-list-items"
cellpadding="0" cellspacing="0">
<f:call name="encodeHeader"/>
</table>
</div>