First pass on perspectives
[lgpl/argeo-commons.git] / security / runtime / org.argeo.security.ria / src / argeo-ria-lib / security / class / org / argeo / security / ria / RolesApplet.js
diff --git a/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/RolesApplet.js b/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/RolesApplet.js
new file mode 100644 (file)
index 0000000..3d6ad86
--- /dev/null
@@ -0,0 +1,83 @@
+/**
+ * A simple Hello World applet for documentation purpose. 
+ * The only associated command is the "Close" command.
+ */
+/* *************************************************
+#asset(resource/org.argeo.ria.sample/window-close.png)
+****************************************************/
+qx.Class.define("org.argeo.security.ria.RolesApplet",
+{
+  extend : qx.ui.container.Composite,
+  implement : [org.argeo.ria.components.IView], 
+
+  construct : function(){
+       this.base(arguments);
+       this.setLayout(new qx.ui.layout.VBox());
+  },
+
+  properties : 
+  {
+       /**
+        * The viewPane inside which this applet is added. 
+        */
+       view : {
+               init : null
+       },
+       /**
+        * Commands definition, see {@link org.argeo.ria.event.CommandsManager#definitions} 
+        */
+       commands : {
+               init : {}
+       },
+       viewSelection : {
+               nullable:false, 
+               check:"org.argeo.ria.components.ViewSelection"
+       },
+       instanceId : {init:""},
+       instanceLabel : {init:""}
+  },
+
+  members :
+  {
+       /**
+        * Called at applet creation. Just registers viewPane.
+        * @param viewPane {org.argeo.ria.components.ViewPane} The viewPane.
+        */
+       init : function(viewPane){
+               this.setView(viewPane);
+               this.setViewSelection(new org.argeo.ria.components.ViewSelection(viewPane.getViewId()));                
+               this.tableModel = new qx.ui.table.model.Simple();
+               this.tableModel.setColumns(["Role Name"]);
+               this.table = new qx.ui.table.Table(this.tableModel, {
+                               tableColumnModel: function(obj){
+                                       return new qx.ui.table.columnmodel.Resize(obj)
+                               }
+                       });
+               this.table.setStatusBarVisible(false);                  
+               viewPane.add(this.table, {height:"100%"});
+               
+               var selectionModel = this.table.getSelectionModel(); 
+               selectionModel.addListener("changeSelection", function(){
+                       var ranges = selectionModel.getSelectedRanges();
+               });
+       },
+       
+       /**
+        * Load a given row : the data passed must be a simple data array.
+        * @param data {Element} The text xml description. 
+        */
+       load : function(){              
+               var data = [["ROLE_ADMIN"],["ROLE_USER"]];
+               this.tableModel.setData(data);
+       },
+                
+       addScroll : function(){
+               return false;
+       },
+       
+       close : function(){
+               return false;
+       }
+       
+  }
+});
\ No newline at end of file