Author: vmolotkov
Date: 2007-11-29 06:21:10 -0500 (Thu, 29 Nov 2007)
New Revision: 4343
Modified:
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/SelectItem.js
Log:
bug:RF-1429
Modified:
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js
===================================================================
---
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2007-11-29
10:40:41 UTC (rev 4342)
+++
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2007-11-29
11:21:10 UTC (rev 4343)
@@ -170,22 +170,10 @@
Richfaces.SelectItems.doActive(this.activeItem);
this.saveSate();
break;
- case 32 : this.invertSelection(event); break; //blank
+ //case 32 : this.invertSelection(event); break; //blank
}
},
- invertSelection : function(event) {
- var eventItem = this.activeItem;
- var eventShuttleItem = this.getSelectItemByNode(eventItem);
- if (eventShuttleItem._selected) {
- eventShuttleItem._selected = false;
- this.selectedItems.remove(eventShuttleItem);
- } else {
- eventShuttleItem._selected = true;
- this.selectedItems.push(eventShuttleItem);
- }
- },
-
moveActiveItem : function(action, event) {
var item = this.activeItem;
var rows = this.shuttleTbody.rows;
@@ -202,13 +190,10 @@
},
changeActiveItems : function(newItem, item) {
- var shuttleItem = this.getSelectItemByNode(item);
- var newShuttleItem = this.getSelectItemByNode(newItem);
-
this.resetMarked();
+ Richfaces.SelectItems.doSelect(newItem);
Richfaces.SelectItems.doActive(newItem);
- newItem._selected = true;
this.activeItem = newItem;
this.selectedItems.push(newItem);
},
@@ -223,41 +208,61 @@
* Click handler
*/
selectionItem : function(activeItem) {
- var markedItem = this.getSelectItemByNode(activeItem);
+ //var markedItem = this.getSelectItemByNode(activeItem);
var markedShuttleItem = activeItem;
- if (markedItem != null) {
+ //if (markedItem != null) {
this.resetMarked();
- if (markedItem._selected) {
+ /*if (markedItem._selected) {
markedItem._selected = false;
} else {
markedItem._selected = true;
this.selectedItems[0] = markedShuttleItem;
+ }*/
+ if (Richfaces.SelectItems.isSelected(activeItem)) {
+ Richfaces.SelectItems.doNormal(activeItem);
+ } else {
+ Richfaces.SelectItems.doSelect(activeItem);
+ this.selectedItems[0] = markedShuttleItem; //TODO: delete
}
- }
+ //}
},
/**
* CTRL+Click handler
*/
addSelectedItem : function(activeItem) {
- var markedItem = this.getSelectItemByNode(activeItem);
+ //var markedItem = this.getSelectItemByNode(activeItem);
var markedShuttleItem = activeItem;
- if (markedItem._selected) {
+ /*if (markedItem._selected) {
this.selectedItems.remove(markedShuttleItem);
markedItem._selected = false;
} else {
markedItem._selected = true;
this.selectedItems.push(markedShuttleItem);
+ }*/
+
+ if (Richfaces.SelectItems.isSelected(activeItem)) {
+ this.selectedItems.remove(markedShuttleItem); //TODO :delete
+ Richfaces.SelectItems.doNormal(activeItem);
+ } else {
+ Richfaces.SelectItems.doSelect(activeItem);
+ this.selectedItems.push(markedShuttleItem); //TODO :delete
}
- Richfaces.SelectItems.doSelect(this.activeItem);
+ if (this.activeItem.rowIndex != activeItem.rowIndex) {
+ //reset activity of an element
+ if (Richfaces.SelectItems.isSelected(this.activeItem)) {
+ Richfaces.SelectItems.doSelect(this.activeItem);
+ } else {
+ Richfaces.SelectItems.doNormal(this.activeItem);
+ }
+ }
- if (this.activeItem && !this.getSelectItemByNode(this.activeItem)._selected) {
+ /*if (this.activeItem && !this.getSelectItemByNode(this.activeItem)._selected)
{
Richfaces.SelectItems.doNormal(this.activeItem);
- }
-
+ }*/
this.saveState();
},
@@ -288,7 +293,7 @@
for (var i = startIndex; i <= endIndex; i++) {
Richfaces.SelectItems.doSelect(rows[i]);
this.selectedItems.push(rows[i]);
- this.getSelectItemByNode(rows[i])._selected = true;
+ //this.getSelectItemByNode(rows[i])._selected = true;
}
this.saveState();
@@ -299,7 +304,7 @@
for (var i = 0; i < rows.length; i++) {
var shuttleItem = rows[i];
Richfaces.SelectItems.doNormal(shuttleItem);
- this.getSelectItemByNode(shuttleItem)._selected = false; //FIXME
+ //this.getSelectItemByNode(shuttleItem)._selected = false; //FIXME
}
this.selectedItems.length = 0;
},
Modified:
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
===================================================================
---
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-29
10:40:41 UTC (rev 4342)
+++
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-29
11:21:10 UTC (rev 4343)
@@ -33,9 +33,9 @@
var control;
//FIXME
this.controlsProcessing(["first", "last", "down",
"up"], "enable");
- if ((this.shuttleItems.length <= 1) || (this.selectedItems.length == 0))
+ if ((this.shuttleItems.length == 0) || (this.selectedItems.length == 0)) {
this.controlsProcessing(["first", "last", "down",
"up"], "disable");
- else {
+ } else {
if (this.selectedItems[0].rowIndex == 0)
this.controlsProcessing(["first", "up"], "disable");
if (this.selectedItems[this.selectedItems.length - 1].rowIndex ==
(this.shuttleItems.length - 1))
Modified:
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/SelectItem.js
===================================================================
---
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/SelectItem.js 2007-11-29
10:40:41 UTC (rev 4342)
+++
branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/SelectItem.js 2007-11-29
11:21:10 UTC (rev 4343)
@@ -6,22 +6,27 @@
ROW : {
ACTIVE : "rich-ordering-list-row-active",
SELECTED : "rich-ordering-list-row-selected",
+ ACTIVE_SELECTED : "rich-ordering-list-row-selected
rich-ordering-list-row-active",
DISABLED : "rich-ordering-list-row-disabled",
NORMAL : "rich-ordering-list-row"
},
CELL : {
ACTIVE : "rich-ordering-list-cell-active",
SELECTED : "rich-ordering-list-cell-selected",
+ ACTIVE_SELECTED : "rich-ordering-list-cell-selected
rich-ordering-list-cell-active",
DISABLED : "rich-ordering-list-cell-disabled",
NORMAL : "rich-ordering-list-cell"
}
},
doActive : function(row) {
- Richfaces.SelectItems
- .doChange(row,
- Richfaces.SelectItems.CLASSES.ROW.ACTIVE,
- Richfaces.SelectItems.CLASSES.CELL.ACTIVE);
+ var newRowStyle = Richfaces.SelectItems.CLASSES.ROW.ACTIVE;
+ var newCellStyle = Richfaces.SelectItems.CLASSES.CELL.ACTIVE;
+ if (Element.hasClassName(row, Richfaces.SelectItems.CLASSES.ROW.SELECTED)) {
+ newRowStyle = Richfaces.SelectItems.CLASSES.ROW.ACTIVE_SELECTED;
+ newCellStyle = Richfaces.SelectItems.CLASSES.CELL.ACTIVE_SELECTED;
+ }
+ Richfaces.SelectItems.doChange(row, newRowStyle, newCellStyle);
},
doSelect : function(row) {