Author: vmolotkov
Date: 2008-04-14 13:17:27 -0400 (Mon, 14 Apr 2008)
New Revision: 7824
Modified:
trunk/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js
trunk/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
Log:
http://jira.jboss.com/jira/browse/RF-1540
Modified:
trunk/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js
===================================================================
---
trunk/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js 2008-04-14
17:17:22 UTC (rev 7823)
+++
trunk/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js 2008-04-14
17:17:27 UTC (rev 7824)
@@ -42,7 +42,7 @@
}
Richfaces.ListShuttle.prototype = {
- initialize: function(targetList, sourceList, clientId, controlIds, switchByClick,
onlistchanged) {
+ initialize: function(targetList, sourceList, clientId, controlIds, switchByClick,
events) {
this.containerId = clientId;
this["rich:destructor"] = "destroy";
@@ -78,9 +78,10 @@
this.controlList = new Array();
this.initControlList(clientId, controlIds);
- if (onlistchanged) {
- this.targetList.container.observe("rich:onorderchanged", onlistchanged);
- this.container.observe("rich:onlistchanged", onlistchanged);
+ for (var e in this.events) {
+ if (e) {
+ this.container.observe("rich:" + e.toString(), this.events[e]);
+ }
}
},
@@ -154,12 +155,11 @@
if (this.targetList.controlListManager) {
this.targetList.controlListManager();
}
- //this.saveState();
this.targetLayoutManager.widthSynchronization();
this.sourceLayoutManager.widthSynchronization();
- this.container.fire("rich:onlistchanged", {});
+ this.container.fire("rich:onlistchanged", {sourceItems:
sourceComponent.shuttleItems, targetItems: targetComponent.shuttleItems});
}
},
@@ -198,7 +198,6 @@
},
addItem : function(component, item) {
- //var newItem = Object.clone(item);
item.doNormal(Richfaces.getExternalClass(item.rowIndex), component.columnsClasses);
component.shuttleTbody.insertBefore(item._node, null);
@@ -214,11 +213,6 @@
component.shuttleTbody = table.tBodies[0];
},
- /*saveState : function() {
- this.targetList.saveState();
- this.sourceList.saveState();
- },*/
-
moveItemByClick : function(event, sourceComponent, targetComponent, layoutManager) {
var item = this.sourceList.getEventTargetRow(event);
this.moveItem(sourceComponent, targetComponent, item);
@@ -227,28 +221,31 @@
if (this.targetList.controlListManager) {
this.targetList.controlListManager();
}
- //this.saveState();
this.targetLayoutManager.widthSynchronization();
this.sourceLayoutManager.widthSynchronization();
- this.container.fire("rich:onlistchanged", {});
+ this.container.fire("rich:onlistchanged", {sourceItems:
sourceComponent.shuttleItems, targetItems: targetComponent.shuttleItems});
},
copyAll : function() {
+ this.container.fire("rich:oncopyallclick", {sourceItems:
this.sourceList.shuttleItems, targetItems: this.targetList.shuttleItems, selection:
this.sourceList.getSelection()});
this.moveItems(this.sourceList, this.targetList, this.sourceList.shuttleItems);
},
copy : function() {
+ this.container.fire("rich:oncopyclick", {sourceItems:
this.sourceList.shuttleItems, targetItems: this.targetList.shuttleItems, selection:
this.sourceList.getSelection()});
this.moveItems(this.sourceList, this.targetList, this.sourceList.selectedItems);
},
removeAll : function() {
+ this.container.fire("rich:onremoveallclick", {sourceItems:
this.sourceList.shuttleItems, targetItems: this.targetList.shuttleItems, selection:
this.targetList.getSelection()});
this.moveItems(this.targetList, this.sourceList, this.targetList.shuttleItems);
},
remove : function() {
- this.moveItems(this.targetList, this.sourceList, this.targetList.selectedItems);
+ this.container.fire("rich:onremoveclick", {sourceItems:
this.sourceList.shuttleItems, targetItems: this.targetList.shuttleItems, selection:
this.targetList.getSelection()});
+ this.moveItems(this.targetList, this.sourceList, this.targetList.selectedItems);
}
};
Modified: trunk/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
===================================================================
--- trunk/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2008-04-14
17:17:22 UTC (rev 7823)
+++ trunk/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2008-04-14
17:17:27 UTC (rev 7824)
@@ -193,7 +193,13 @@
new Richfaces.ListShuttle.Source('#{clientId}',
'#{clientId}internal_tab', '#{clientId}internal_header_tab',
'#{clientId}focusKeeper', undefined, Richfaces.ListShuttle.Source.SelectItem,
#{this:getColumnClassesAsJSArray(context, component)},
#{this:getRowClassesAsJSArray(context, component)}),
"#{clientId}",
[['copy', 'discopy'], ['copyAll',
'discopyAll'], ['remove', 'disremove'],
['removeAll','disremoveAll']],
- "#{switchByClick}", #{this:getAsEventHandler(context, component,
"onlistchanged")});
+ "#{switchByClick}", {
+ onlistchanged:#{this:getAsEventHandler(context, component,
"onlistchanged")},
+ oncopyallclick:#{this:getAsEventHandler(context, component,
"oncopyallclick")},
+ oncopyclick:#{this:getAsEventHandler(context, component,
"oncopyclick")},
+ onremoveallclick:#{this:getAsEventHandler(context, component,
"onremoveallclick")},
+ onremoveclick:#{this:getAsEventHandler(context, component,
"onremoveclick")}
+ });
},
RichShuttleUtils.Condition.ElementPresent("#{clientId}"), 100
);