* The only associated command is the "Close" command.
*/
/* *************************************************
-#asset(resource/org.argeo.ria.sample/window-close.png)
+#asset(resource/org.argeo.security.ria/*)
****************************************************/
qx.Class.define("org.argeo.security.ria.UsersApplet",
{
commands : {
init : {
"new_user" : {
- label : "Create User",
- icon : "ria/window-close.png",
+ label : "New User",
+ icon : "org.argeo.security.ria/list-add.png",
shortcut : "Control+n",
enabled : true,
menu : "Users",
- toolbar : "user",
+ toolbar : null,
callback : function(e){
// Call service to delete
var classObj = org.argeo.security.ria.UserEditorApplet;
iView.load();
},
command : null
- },
- "edit_user" : {
- label : "Edit User",
- icon : "ria/window-close.png",
- shortcut : "Control+u",
+ },
+ "delete_user" : {
+ label : "Delete User",
+ icon : "org.argeo.security.ria/list-remove.png",
+ shortcut : "Control+s",
enabled : true,
menu : "Users",
- toolbar : "user",
+ toolbar : null,
callback : function(e){
// Call service to delete
- var crtUser = this.getViewSelection().getNodes()[0];
- var classObj = org.argeo.security.ria.UserEditorApplet;
- var iView = org.argeo.ria.components.ViewsManager.getInstance().initIViewClass(classObj, "editor", crtUser);
- iView.load(crtUser);
+ var crtUsers = this.getViewSelection().getNodes();
+ for(var i=0;i<crtUsers.length;i++){
+ alert("Delete " + crtUsers[i]);
+ }
},
selectionChange : function(viewName, data){
if(viewName != "users") return;
- this.setEnabled(!(data == null || !data.length || data.length > 1));
+ this.setEnabled(!(data == null || !data.length));
},
command : null
- },
- "delete_user" : {
- label : "Delete User",
- icon : "ria/window-close.png",
- shortcut : "Control+s",
+ },
+ "edit_user" : {
+ label : "Edit User",
+ icon : "org.argeo.security.ria/document-properties.png",
+ shortcut : "Control+u",
enabled : true,
menu : "Users",
- toolbar : "user",
+ toolbar : null,
callback : function(e){
// Call service to delete
- var crtUsers = this.getViewSelection().getNodes();
- for(var i=0;i<crtUsers.length;i++){
- alert("Delete " + crtUsers[i]);
- }
+ var crtUser = this.getViewSelection().getNodes()[0];
+ var classObj = org.argeo.security.ria.UserEditorApplet;
+ var iView = org.argeo.ria.components.ViewsManager.getInstance().initIViewClass(classObj, "editor", crtUser);
+ iView.load(crtUser);
},
selectionChange : function(viewName, data){
if(viewName != "users") return;
- this.setEnabled(!(data == null || !data.length));
+ this.setEnabled(!(data == null || !data.length || data.length > 1));
},
command : null
- }
+ }
}
},
*/
init : function(viewPane){
this.setView(viewPane);
- this.setViewSelection(new org.argeo.ria.components.ViewSelection(viewPane.getViewId()));
+ this.setViewSelection(new org.argeo.ria.components.ViewSelection(viewPane.getViewId()));
+
+ this.toolBar = new qx.ui.toolbar.ToolBar();
+ this.toolBarPart = new qx.ui.toolbar.Part();
+ this.toolBar.add(this.toolBarPart);
+ viewPane.add(this.toolBar);
+
this.tableModel = new qx.ui.table.model.Filtered();
this.tableModel.setColumns(["username", "roles"]);
this.table = new qx.ui.table.Table(this.tableModel, {
this.table.getSelectionModel().addListener("changeSelection", function(){
this._selectionToValues(this.table.getSelectionModel(), this.getViewSelection());
}, this);
+ this.table.addListener("cellDblclick", function(cellEvent){
+ this.getCommands()["edit_user"].command.execute();
+ }, this);
this.setGuiMode("chooser");
},
load : function(){
var data = [["root", "ROLE_ADMIN"], ["mbaudier", "ROLE_ADMIN,ROLE_USER"], ["cdujeu","ROLE_USER"], ["anonymous", ""]];
this.tableModel.setData(data);
+ var commands = this.getCommands();
+ this.toolBarPart.add(commands["new_user"].command.getToolbarButton());
+ this.toolBarPart.add(commands["delete_user"].command.getToolbarButton());
+ this.toolBarPart.add(commands["edit_user"].command.getToolbarButton());
+ this.toolBar.setShow("icon");
+
},
applySelection : function(selectionValues, target){