Author: vmolotkov
Date: 2008-04-14 13:17:22 -0400 (Mon, 14 Apr 2008)
New Revision: 7823
Modified:
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
trunk/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
Log:
http://jira.jboss.com/jira/browse/RF-1540
Modified:
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java
===================================================================
---
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2008-04-14
16:42:21 UTC (rev 7822)
+++
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentRendererBase.java 2008-04-14
17:17:22 UTC (rev 7823)
@@ -358,9 +358,9 @@
}
- if (customEvent != null) {
+ /*if (customEvent != null) {
writer.writeAttribute(HTML.onclick_ATTRIBUTE, customEvent, null);
- }
+ }*/
if (useFacet) {
renderChild(context, facet);
Modified:
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
===================================================================
---
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2008-04-14
16:42:21 UTC (rev 7822)
+++
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2008-04-14
17:17:22 UTC (rev 7823)
@@ -65,7 +65,6 @@
this.clckHandler = function(e) {this.onclickHandler(window.event ||
e)}.bindAsEventListener(this);
this.shuttleTable.observe("click", this.clckHandler);
- //
this.layoutManager = new LayoutManager(headerTableId, contentTableId);
this.layoutManager.widthSynchronization();
},
@@ -421,5 +420,13 @@
getExtRowClass : function(index) {
return Richfaces.getExternalClass(this.rowClasses, index);
+ },
+
+ getSelection : function() {
+ var result = [];
+ for (var i = 0; i < this.selectedItems.length; i++) {
+ result[i] = this.selectedItems[i].item;
+ }
+ return result;
}
}
\ No newline at end of file
Modified:
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
===================================================================
---
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2008-04-14
16:42:21 UTC (rev 7822)
+++
trunk/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2008-04-14
17:17:22 UTC (rev 7823)
@@ -20,16 +20,20 @@
Richfaces.OrderingList = Class.create(Richfaces.ListBase, {
- initialize: function($super, containerId, contentTableId, headerTableId, focusKeeperId,
ids, onclickControlId, onorderchanged, controlClass, columnsClasses, rowClasses) {
+ initialize: function($super, containerId, contentTableId, headerTableId, focusKeeperId,
ids, onclickControlId, events, controlClass, columnsClasses, rowClasses) {
$super(containerId, contentTableId, headerTableId, focusKeeperId, onclickControlId,
controlClass, columnsClasses, rowClasses);
this.container.component = this;
- if (onorderchanged) {
- this.container.observe("rich:onorderchanged", onorderchanged);
- }
+ this.events = events;
this.controlList = new Array();
this.initControlList(containerId, ids);
+
+ for (var e in this.events) {
+ if (e) {
+ this.container.observe("rich:" + e.toString(), this.events[e]);
+ }
+ }
},
destroy: function($super) {
@@ -48,7 +52,6 @@
this.controlList[i] = new Richfaces.Control(node, disNode, false, false, id[0]);
}
}
- //this.controlListManager();
},
controlListManager : function() {
@@ -88,7 +91,6 @@
moveActiveItem : function($super, action, event) {
$super(action, event);
- //this.saveState();
this.controlListManager();
},
@@ -135,9 +137,8 @@
if (action != null)
this.autoScrolling(action, event);
- this.container.fire("rich:onorderchanged", {});
+ this.container.fire("rich:onorderchanged", {items: this.shuttleItems});
this.controlListManager();
- //this.saveState();
}
},
@@ -175,7 +176,6 @@
this.selectAll();
}
this.activeItem.item.doActive(this.getExtRowClass(this.activeItem.rowIndex),
this.columnsClasses);
- //this.saveState();
this.controlListManager();
Event.stop(event);
break;
@@ -183,18 +183,22 @@
},
top : function(e) {
+ this.container.fire("rich:ontopclick", {items: this.shuttleItems, selection:
this.getSelection()});
this.moveSelectedItems("first", e);
},
bottom : function(e) {
+ this.container.fire("rich:onbottomclick", {items: this.shuttleItems,
selection: this.getSelection()});
this.moveSelectedItems("last", e);
},
up : function(e) {
+ this.container.fire("rich:onupclick", {items: this.shuttleItems, selection:
this.getSelection()});
this.moveSelectedItems("up", e);
},
down : function(e) {
+ this.container.fire("rich:ondownclick", {items: this.shuttleItems, selection:
this.getSelection()});
this.moveSelectedItems("down", e);
}
Modified: trunk/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
===================================================================
---
trunk/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2008-04-14
16:42:21 UTC (rev 7822)
+++
trunk/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2008-04-14
17:17:22 UTC (rev 7823)
@@ -122,7 +122,11 @@
'#{cId}internal_header_tab', '#{cId}focusKeeper',
[['up', 'disup'], ['down', 'disdown'],
['last', 'dislast'], ['first','disfirst']],
'#{cId}sortLabel',
- #{this:getAsEventHandler(context, component, "onorderchanged")},
+ {onorderchanged:#{this:getAsEventHandler(context, component,
"onorderchanged")},
+ ontopclick:#{this:getAsEventHandler(context, component,
"ontopclick")},
+ onbottomclick:#{this:getAsEventHandler(context, component,
"onbottomclick")},
+ onupclick:#{this:getAsEventHandler(context, component,
"onupclick")},
+ ondownclick:#{this:getAsEventHandler(context, component,
"ondownclick")}},
Richfaces.OrderingListSelectItem,
#{this:getColumnClassesAsJSArray(context, component)},
#{this:getRowClassesAsJSArray(context, component)});