X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.webapp%2Fsrc%2Fmain%2Fwebapp%2Fsource%2Fclass%2Forg%2Fargeo%2Fria%2Fcomponents%2FViewSelection.js;h=6c3e873abe37b1a0368e27fe4910ec036c012918;hb=403dbbf39a3690334ba5e09e00a210367059504c;hp=fd9058875d50c382a8406945d26cdafeee3dafc8;hpb=8f4e4722a346442a8ed1ca84efa24b60bfaf3d19;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/ViewSelection.js b/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/ViewSelection.js index fd9058875..6c3e873ab 100644 --- a/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/ViewSelection.js +++ b/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/ViewSelection.js @@ -1,7 +1,15 @@ +/** + * Generic selection model associated to an IView content opened in a given ViewPane. + * It contains in an array any row/data/node, and triggers changeSelection data events. + * @author Charles du Jeu + */ qx.Class.define("org.argeo.ria.components.ViewSelection", { extend : qx.core.Object, + /** + * @param viewId {String} The ViewPane unique id + */ construct : function(viewId){ this.base(arguments); this.nodes = []; @@ -9,13 +17,19 @@ qx.Class.define("org.argeo.ria.components.ViewSelection", }, properties : { + /** + * The viewPane unique id + */ viewId : { - check : String, + check : "String", nullable: false } }, events : { + /** + * Triggered each time the selection changes. + */ "changeSelection" : "qx.event.type.Data" }, @@ -27,24 +41,42 @@ qx.Class.define("org.argeo.ria.components.ViewSelection", members : { + /** + * Empty the selection + */ clear : function(){ this.nodes = []; this.triggerEvent(); }, + /** + * Add a row or xml node or whatever + * @param node {mixed} Data to add to the selection + */ addNode : function(node) { this.nodes.push(node); this.triggerEvent(); }, + /** + * The number of rows/nodes selected + * @return {Integer} + */ getCount : function() { return this.nodes.length; }, + /** + * Returns the content of the selection + * @return {Array} + */ getNodes : function(){ return this.nodes; }, + /** + * Creates and fire a data event changeSelection + */ triggerEvent : function(){ this.fireDataEvent("changeSelection", this); }