[richfaces-svn-commits] JBoss Rich Faces SVN: r4508 - in branches/3.1.x/ui: orderingList/src/main/resources/org/richfaces/renderkit/html/scripts and 1 other directory.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Wed Dec 5 12:19:27 EST 2007
Author: sergeyhalipov
Date: 2007-12-05 12:19:27 -0500 (Wed, 05 Dec 2007)
New Revision: 4508
Modified:
branches/3.1.x/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js
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:
List shuttle skinning. Not finished.
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-05 16:40:19 UTC (rev 4507)
+++ branches/3.1.x/ui/listShuttle/src/main/resources/org/richfaces/renderkit/html/scripts/ListShuttle.js 2007-12-05 17:19:27 UTC (rev 4508)
@@ -22,6 +22,40 @@
this.controlList = new Array();
this.initControlList(clientId, controlIds);
+
+ this.sourceList.CLASSES = {
+ ROW : {
+ ACTIVE : "rich-shuttle-source-row-active",
+ SELECTED : "rich-shuttle-source-row-selected",
+ ACTIVE_SELECTED : "rich-shuttle-source-row-selected rich-shuttle-source-row-active",
+ DISABLED : "rich-shuttle-source-row-disabled",
+ NORMAL : "rich-shuttle-source-row"
+ },
+ CELL : {
+ ACTIVE : "rich-shuttle-source-cell-active",
+ SELECTED : "rich-shuttle-source-cell-selected",
+ ACTIVE_SELECTED : "rich-shuttle-source-cell-selected rich-shuttle-source-cell-active",
+ DISABLED : "rich-shuttle-source-cell-disabled",
+ NORMAL : "rich-shuttle-source-cell"
+ }
+ };
+
+ this.targetList.CLASSES = {
+ ROW : {
+ ACTIVE : "rich-shuttle-target-row-active",
+ SELECTED : "rich-shuttle-target-row-selected",
+ ACTIVE_SELECTED : "rich-shuttle-target-row-selected rich-shuttle-target-row-active",
+ DISABLED : "rich-shuttle-target-row-disabled",
+ NORMAL : "rich-shuttle-target-row"
+ },
+ CELL : {
+ ACTIVE : "rich-shuttle-target-cell-active",
+ SELECTED : "rich-shuttle-target-cell-selected",
+ ACTIVE_SELECTED : "rich-shuttle-target-cell-selected rich-shuttle-target-cell-active",
+ DISABLED : "rich-shuttle-target-cell-disabled",
+ NORMAL : "rich-shuttle-target-cell"
+ }
+ };
},
initControlList : function(clientId, ids) {
@@ -71,25 +105,7 @@
}
}
},
-
- /*addItems : function(component, items) {
- var componentItems = list.shuttleItems;
-
- for (var item in items) {
- var newItem = Object.clone(item);
- collection.push(newItem);
- }
- },
- removeItems : function(component, items) {
- var componentItems = component.shuttleItems;
- var componentSelectedItems = component.selectedItems;
-
- for (var item in items) {
- targetCollection.remove(item);
- }
- }*/
-
moveItems : function(sourceComponent, targetComponent, items) {
if (items.length > 0) {
var length = items.length;
@@ -122,7 +138,7 @@
addItem : function(component, item) {
//var newItem = Object.clone(item);
- Richfaces.SelectItems.doNormal(item._node);
+ Richfaces.SelectItems.doNormal(item._node, component.CLASSES);
component.shuttleTbody.insertBefore(item._node, null);
component.shuttleItems.push(item);
},
@@ -145,20 +161,3 @@
remove: function (e) { this.moveItems(this.targetList, this.sourceList, this.targetList.selectedItems); return false; },
removeAll: function (e) { this.moveItems(this.targetList, this.sourceList, this.targetList.shuttleItems); return false; }
};
-
-Richfaces.SelectItems.CLASSES = {
- ROW : {
- ACTIVE : "rich-shuttle-source-row-active",
- SELECTED : "rich-shuttle-source-row-selected",
- ACTIVE_SELECTED : "rich-shuttle-source-row-selected rich-shuttle-source-row-active",
- DISABLED : "rich-shuttle-source-row-disabled",
- NORMAL : "rich-shuttle-source-row"
- },
- CELL : {
- ACTIVE : "rich-shuttle-source-cell-active",
- SELECTED : "rich-shuttle-source-cell-selected",
- ACTIVE_SELECTED : "rich-shuttle-source-cell-selected rich-shuttle-source-cell-active",
- DISABLED : "rich-shuttle-source-cell-disabled",
- NORMAL : "rich-shuttle-source-cell"
- }
-};
\ No newline at end of file
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-12-05 16:40:19 UTC (rev 4507)
+++ branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/ListBase.js 2007-12-05 17:19:27 UTC (rev 4508)
@@ -32,6 +32,23 @@
Richfaces.ListBase.CONTROL_SET = ["A", "INPUT", "TEXTAREA", "SELECT", "OPTION", "BUTTON"];
Richfaces.ListBase.prototype = {
+ CLASSES : {
+ 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"
+ }
+ },
+
initialize : function(containerId, contentTableId, headerTableId, focusKeeperId,
onclickControlId) {
this.selectedItems = new Array();
@@ -69,11 +86,11 @@
id = row.id.split(containerId + ":")[1];
this.shuttleItems[i]
= new Richfaces.SelectItem(null, (id || i),
- ((Richfaces.SelectItems.isSelected(row)) ? true : false), row);
- if (Richfaces.SelectItems.isSelected(row)) {
+ ((Richfaces.SelectItems.isSelected(row, this.CLASSES)) ? true : false), row);
+ if (Richfaces.SelectItems.isSelected(row, this.CLASSES)) {
this.selectedItems.push(row);
}
- if (Richfaces.SelectItems.isActive(row)) {
+ if (Richfaces.SelectItems.isActive(row, this.CLASSES)) {
this.activeItem = row;
}
}
@@ -143,7 +160,7 @@
}
- Richfaces.SelectItems.doActive(this.activeItem);
+ Richfaces.SelectItems.doActive(this.activeItem, this.CLASSES);
this.setFocus();
this.saveState();
@@ -169,7 +186,7 @@
this.selectAll();
Event.stop(event);
}
- Richfaces.SelectItems.doActive(this.activeItem);
+ Richfaces.SelectItems.doActive(this.activeItem, this.CLASSES);
this.saveState();
break;
}
@@ -193,8 +210,8 @@
changeActiveItems : function(newItem, item) {
this.resetMarked();
- Richfaces.SelectItems.doSelect(newItem);
- Richfaces.SelectItems.doActive(newItem);
+ Richfaces.SelectItems.doSelect(newItem, this.CLASSES);
+ Richfaces.SelectItems.doActive(newItem, this.CLASSES);
this.activeItem = newItem;
this.selectedItems.push(newItem);
},
@@ -220,10 +237,10 @@
markedItem._selected = true;
this.selectedItems[0] = markedShuttleItem;
}*/
- if (Richfaces.SelectItems.isSelected(activeItem)) {
+ if (Richfaces.SelectItems.isSelected(activeItem, this.CLASSES)) {
Richfaces.SelectItems.doNormal(activeItem);
} else {
- Richfaces.SelectItems.doSelect(activeItem);
+ Richfaces.SelectItems.doSelect(activeItem, this.CLASSES);
this.selectedItems[0] = markedShuttleItem; //TODO: delete
}
//}
@@ -244,20 +261,20 @@
this.selectedItems.push(markedShuttleItem);
}*/
- if (Richfaces.SelectItems.isSelected(activeItem)) {
+ if (Richfaces.SelectItems.isSelected(activeItem, this.CLASSES)) {
this.selectedItems.remove(markedShuttleItem); //TODO :delete
- Richfaces.SelectItems.doNormal(activeItem);
+ Richfaces.SelectItems.doNormal(activeItem, this.CLASSES);
} else {
- Richfaces.SelectItems.doSelect(activeItem);
+ Richfaces.SelectItems.doSelect(activeItem, this.CLASSES);
this.selectedItems.push(markedShuttleItem); //TODO :delete
}
if ((this.activeItem != null) && (this.activeItem.rowIndex != activeItem.rowIndex)) {
//reset activity of an element
- if (Richfaces.SelectItems.isSelected(this.activeItem)) {
- Richfaces.SelectItems.doSelect(this.activeItem);
+ if (Richfaces.SelectItems.isSelected(this.activeItem, this.CLASSES)) {
+ Richfaces.SelectItems.doSelect(this.activeItem, this.CLASSES);
} else {
- Richfaces.SelectItems.doNormal(this.activeItem);
+ Richfaces.SelectItems.doNormal(this.activeItem, this.CLASSES);
}
}
@@ -292,7 +309,7 @@
selectItemRange : function(startIndex, endIndex) {
var rows = this.shuttleTbody.rows;
for (var i = startIndex; i <= endIndex; i++) {
- Richfaces.SelectItems.doSelect(rows[i]);
+ Richfaces.SelectItems.doSelect(rows[i], this.CLASSES);
this.selectedItems.push(rows[i]);
//this.getSelectItemByNode(rows[i])._selected = true;
}
@@ -304,7 +321,7 @@
var rows = this.shuttleTbody.rows;
for (var i = 0; i < rows.length; i++) {
var shuttleItem = rows[i];
- Richfaces.SelectItems.doNormal(shuttleItem);
+ Richfaces.SelectItems.doNormal(shuttleItem, this.CLASSES);
//this.getSelectItemByNode(shuttleItem)._selected = false; //FIXME
}
this.selectedItems.length = 0;
@@ -359,10 +376,10 @@
this.focusKeeper.focused = false;
//this.shuttleTable.className = Richfaces.ListBase.ORDERING_LIST_CLASSES.normal;
- if (Richfaces.SelectItems.isSelected(this.activeItem)) {
- Richfaces.SelectItems.doSelect(this.activeItem);
+ if (Richfaces.SelectItems.isSelected(this.activeItem, this.CLASSES)) {
+ Richfaces.SelectItems.doSelect(this.activeItem, this.CLASSES);
} else {
- Richfaces.SelectItems.doNormal(this.activeItem);
+ Richfaces.SelectItems.doNormal(this.activeItem, this.CLASSES);
}
},
@@ -395,7 +412,7 @@
state = state.replace(/[as]/g, "");
//TODO optimization
- if (Richfaces.SelectItems.isSelected(item._node)) {
+ if (Richfaces.SelectItems.isSelected(item._node, this.CLASSES)) {
state = state + "s";
}
if (this.activeItem && (this.activeItem.rowIndex == item._node.rowIndex)) {
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-12-05 16:40:19 UTC (rev 4507)
+++ branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-12-05 17:19:27 UTC (rev 4508)
@@ -5,7 +5,7 @@
name: 'Richfaces.OrderingList',
parent: Richfaces.ListBase
},
-
+
initialize: function(containerId, contentTableId, headerTableId, focusKeeperId,
ids, onclickControlId, onorderchanged) {
Richfaces.OrderingList.parentClass.constructor().call(this, containerId, contentTableId, headerTableId, focusKeeperId, onclickControlId);
@@ -144,7 +144,7 @@
this.selectAll();
Event.stop(event);
}
- Richfaces.SelectItems.doActive(this.activeItem);
+ Richfaces.SelectItems.doActive(this.activeItem, this.CLASSES);
this.saveState();
this.controlListManager();
break;
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-12-05 16:40:19 UTC (rev 4507)
+++ branches/3.1.x/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/SelectItem.js 2007-12-05 17:19:27 UTC (rev 4508)
@@ -2,53 +2,37 @@
Richfaces.SelectItems = {
- CLASSES : {
- 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, classes) {
+ var newRowStyle = classes.ROW.ACTIVE;
+ var newCellStyle = classes.CELL.ACTIVE;
+ if (Element.hasClassName(row, classes.ROW.SELECTED)) {
+ newRowStyle = classes.ROW.ACTIVE_SELECTED;
+ newCellStyle = classes.CELL.ACTIVE_SELECTED;
}
- },
-
- doActive : function(row) {
- 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) {
+ doSelect : function(row, classes) {
Richfaces.SelectItems
.doChange(row,
- Richfaces.SelectItems.CLASSES.ROW.SELECTED,
- Richfaces.SelectItems.CLASSES.CELL.SELECTED);
+ classes.ROW.SELECTED,
+ classes.CELL.SELECTED);
},
- doNormal : function(row) {
+ doNormal : function(row, classes) {
Richfaces.SelectItems
.doChange(row,
- Richfaces.SelectItems.CLASSES.ROW.NORMAL,
- Richfaces.SelectItems.CLASSES.CELL.NORMAL);
+ classes.ROW.NORMAL,
+ classes.CELL.NORMAL);
},
- isSelected : function(row) {
- return Richfaces.SelectItems.compareStates(row, Richfaces.SelectItems.CLASSES.ROW.SELECTED);
+ isSelected : function(row, classes) {
+ return Richfaces.SelectItems.compareStates(row, classes.ROW.SELECTED);
},
- isActive : function(row) {
- return Richfaces.SelectItems.compareStates(row, Richfaces.SelectItems.CLASSES.ROW.ACTIVE);
+ isActive : function(row, classes) {
+ return Richfaces.SelectItems.compareStates(row, classes.ROW.ACTIVE);
},
doChange : function(row, classNameRow, classNameCell) {
More information about the richfaces-svn-commits
mailing list