]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/components/ViewSelection.js
A dynamic folder that will take a loader function as argument and then can be reloaded.
[gpl/argeo-slc.git] / org.argeo.slc.webapp / src / main / webapp / argeo-ria-src / class / org / argeo / ria / components / ViewSelection.js
1 /**
2 * Generic selection model associated to an IView content opened in a given ViewPane.
3 * It contains in an array any row/data/node, and triggers changeSelection data events.
4 * @author Charles du Jeu
5 */
6 qx.Class.define("org.argeo.ria.components.ViewSelection",
7 {
8 extend : qx.core.Object,
9
10 /**
11 * @param viewId {String} The ViewPane unique id
12 */
13 construct : function(viewId){
14 this.base(arguments);
15 this.nodes = [];
16 this.setViewId(viewId);
17 },
18
19 properties : {
20 /**
21 * The viewPane unique id
22 */
23 viewId : {
24 check : "String",
25 nullable: false
26 }
27 },
28
29 events : {
30 /**
31 * Triggered each time the selection changes.
32 */
33 "changeSelection" : "qx.event.type.Data"
34 },
35
36 /*
37 *****************************************************************************
38 MEMBERS
39 *****************************************************************************
40 */
41
42 members :
43 {
44 /**
45 * Empty the selection
46 */
47 clear : function(){
48 this.nodes = [];
49 this.triggerEvent();
50 },
51
52 /**
53 * Add a row or xml node or whatever
54 * @param node {mixed} Data to add to the selection
55 */
56 addNode : function(node) {
57 this.nodes.push(node);
58 this.triggerEvent();
59 },
60
61 /**
62 * The number of rows/nodes selected
63 * @return {Integer}
64 */
65 getCount : function() {
66 return this.nodes.length;
67 },
68
69 /**
70 * Returns the content of the selection
71 * @return {Array}
72 */
73 getNodes : function(){
74 return this.nodes;
75 },
76
77 /**
78 * Creates and fire a data event changeSelection
79 */
80 triggerEvent : function(){
81 this.fireDataEvent("changeSelection", this);
82 }
83
84 }
85 });