+/**\r
+ * Generic selection model associated to an IView content opened in a given ViewPane.\r
+ * It contains in an array any row/data/node, and triggers changeSelection data events.\r
+ * @author Charles du Jeu\r
+ */\r
qx.Class.define("org.argeo.ria.components.ViewSelection",\r
{\r
extend : qx.core.Object,\r
\r
+ /**\r
+ * @param viewId {String} The ViewPane unique id\r
+ */\r
construct : function(viewId){\r
this.base(arguments);\r
this.nodes = [];\r
},\r
\r
properties : {\r
+ /**\r
+ * The viewPane unique id \r
+ */\r
viewId : {\r
check : "String",\r
nullable: false\r
},\r
\r
events : {\r
+ /**\r
+ * Triggered each time the selection changes.\r
+ */\r
"changeSelection" : "qx.event.type.Data"\r
},\r
\r
\r
members :\r
{\r
+ /**\r
+ * Empty the selection\r
+ */\r
clear : function(){\r
this.nodes = [];\r
this.triggerEvent();\r
},\r
\r
+ /**\r
+ * Add a row or xml node or whatever\r
+ * @param node {mixed} Data to add to the selection\r
+ */\r
addNode : function(node) {\r
this.nodes.push(node);\r
this.triggerEvent();\r
},\r
\r
+ /**\r
+ * The number of rows/nodes selected\r
+ * @return {Integer}\r
+ */\r
getCount : function() {\r
return this.nodes.length;\r
},\r
\r
+ /**\r
+ * Returns the content of the selection \r
+ * @return {Array}\r
+ */\r
getNodes : function(){\r
return this.nodes;\r
},\r
\r
+ /**\r
+ * Creates and fire a data event changeSelection\r
+ */\r
triggerEvent : function(){\r
this.fireDataEvent("changeSelection", this);\r
}\r