Author: nbelaevski
Date: 2007-12-09 17:52:44 -0500 (Sun, 09 Dec 2007)
New Revision: 4642
Modified:
branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java
branches/3.1.x/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js
branches/3.1.x/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
Log:
http://jira.jboss.com/jira/browse/RF-1558
Modified:
branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java
===================================================================
---
branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java 2007-12-08
16:47:40 UTC (rev 4641)
+++
branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleRendererBase.java 2007-12-09
22:52:44 UTC (rev 4642)
@@ -131,15 +131,15 @@
ItemState itemState = getItemState(context, table, variables);
boolean active = itemState.isActive();
- if (active) {
- if (source) {
- rowClassName.append(" rich-shuttle-source-row-active");
- cellClassName.append(" rich-shuttle-source-cell-active");
- } else {
- rowClassName.append(" rich-shuttle-target-row-active");
- cellClassName.append(" rich-shuttle-target-cell-active");
- }
- }
+// if (active) {
+// if (source) {
+// rowClassName.append(" rich-shuttle-source-row-active");
+// cellClassName.append(" rich-shuttle-source-cell-active");
+// } else {
+// rowClassName.append(" rich-shuttle-target-row-active");
+// cellClassName.append(" rich-shuttle-target-cell-active");
+// }
+// }
boolean selected = itemState.isSelected();
selectionState.addState(selected);
@@ -181,8 +181,6 @@
writer.writeAttribute(HTML.NAME_ATTRIBUTE, table.getBaseClientId(context), null);
StringBuffer value = new StringBuffer();
- value.append(table.getRowKey());
-
if (selected) {
value.append('s');
}
@@ -191,6 +189,7 @@
value.append('a');
}
+ value.append(table.getRowKey());
value.append(':');
value.append(shuttleRendererTableHolder.getConverter().getAsString(context, table,
table.getRowData()));
@@ -311,27 +310,27 @@
Object value = converter.getAsObject(context, listShuttle, string.substring(idx +
1));
String substring = string.substring(0, idx);
+ idx = 0;
boolean target = false;
- if (substring.charAt(0) == 't') {
- target = true;
- }
boolean selected = false;
- idx = substring.length() - 1;
-
+ if (substring.charAt(idx) == 's') {
+ (facadeSource ? sourceSelection : targetSelection).add(value);
+ idx++;
+ }
+
if (substring.charAt(idx) == 'a') {
activeItem = value;
- idx--;
+ idx++;
}
- if (substring.charAt(idx) == 's') {
- (facadeSource ? sourceSelection : targetSelection).add(value);
- idx--;
+ if (substring.charAt(idx) == 't') {
+ target = true;
+ idx++;
}
-
- substring = substring.substring(target ? 1 : 0, idx + 1);
+ substring = substring.substring(idx);
Object key = new ListShuttleRowKey(new Integer(substring), target, facadeSource);
map.put(key, value);
Modified:
branches/3.1.x/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js
===================================================================
---
branches/3.1.x/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js 2007-12-08
16:47:40 UTC (rev 4641)
+++
branches/3.1.x/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js 2007-12-09
22:52:44 UTC (rev 4642)
@@ -3,8 +3,10 @@
Richfaces.ListShuttle = Class.create();
Richfaces.ListShuttle.Source = Class.create(Richfaces.ListBase);
+Richfaces.ListShuttle.Target = Class.create(Richfaces.OrderingList);
-Richfaces.ListShuttle.Source.prototype.CLASSES = {
+Richfaces.ListShuttle.Source.SelectItem = Class.create(Richfaces.SelectItem);
+Richfaces.ListShuttle.Source.SelectItem.prototype.CLASSES = {
ROW : {
ACTIVE : "rich-shuttle-source-row-active",
SELECTED : "rich-shuttle-source-row-selected",
@@ -21,11 +23,10 @@
BEGIN: " rich-shuttle-source-cell-begin",
END: " rich-shuttle-source-cell-end"
}
-};
+}
-Richfaces.ListShuttle.Target = Class.create(Richfaces.OrderingList);
-
-Richfaces.ListShuttle.Target.prototype.CLASSES = {
+Richfaces.ListShuttle.Target.SelectItem = Class.create(Richfaces.SelectItem);
+Richfaces.ListShuttle.Target.SelectItem.prototype.CLASSES = {
ROW : {
ACTIVE : "rich-shuttle-target-row-active",
SELECTED : "rich-shuttle-target-row-selected",
@@ -42,7 +43,7 @@
BEGIN: " rich-shuttle-target-cell-begin",
END: " rich-shuttle-target-cell-end"
}
-};
+}
Richfaces.ListShuttle.prototype = {
initialize: function(targetList, sourceList, clientId, controlIds, switchByClick,
sourceLayoutManager, targetLayoutManager) {
@@ -152,7 +153,7 @@
addItem : function(component, item) {
//var newItem = Object.clone(item);
- Richfaces.SelectItems.doNormal(item._node, component.CLASSES);
+ item.doNormal();
component.shuttleTbody.insertBefore(item._node, null);
component.shuttleItems.push(item);
},
Modified:
branches/3.1.x/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
===================================================================
---
branches/3.1.x/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2007-12-08
16:47:40 UTC (rev 4641)
+++
branches/3.1.x/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2007-12-09
22:52:44 UTC (rev 4642)
@@ -183,8 +183,8 @@
var sourceLayoutManager = new
LayoutManager('#{clientId}internal_header_tab',
'#{clientId}internal_tab');
var targetLayoutManager = new
LayoutManager('#{clientId}tlInternal_header_tab',
'#{clientId}tlInternal_tab');
- var listShuttle = new Richfaces.ListShuttle(new
Richfaces.ListShuttle.Target('#{clientId}', '#{clientId}tlInternal_tab',
'#{clientId}tlInternal_header_tab', '#{clientId}tlFocusKeeper',
cotrolsIdPrefix, '#{clientId}sortLabel', #{this:getAsEventHandler(context,
component, "onorderchanged")}),
- new Richfaces.ListShuttle.Source('#{clientId}',
'#{clientId}internal_tab', '#{clientId}internal_header_tab',
'#{clientId}focusKeeper'),
+ var listShuttle = new Richfaces.ListShuttle(new
Richfaces.ListShuttle.Target('#{clientId}', '#{clientId}tlInternal_tab',
'#{clientId}tlInternal_header_tab', '#{clientId}tlFocusKeeper',
cotrolsIdPrefix, '#{clientId}sortLabel', #{this:getAsEventHandler(context,
component, "onorderchanged")}, Richfaces.ListShuttle.Target.SelectItem),
+ new Richfaces.ListShuttle.Source('#{clientId}',
'#{clientId}internal_tab', '#{clientId}internal_header_tab',
'#{clientId}focusKeeper', undefined, Richfaces.ListShuttle.Source.SelectItem),
"#{clientId}", listShuttleCotrolsIdPrefix,
"#{switchByClick}", sourceLayoutManager, targetLayoutManager);
var sourceLayoutManager = new
LayoutManager('#{clientId}internal_header_tab',
'#{clientId}internal_tab');
var targetLayoutManager = new
LayoutManager('#{clientId}tlInternal_header_tab',
'#{clientId}tlInternal_tab');