Use little toolbars
authorCharles du Jeu <charles.dujeu@gmail.com>
Thu, 17 Sep 2009 13:39:33 +0000 (13:39 +0000)
committerCharles du Jeu <charles.dujeu@gmail.com>
Thu, 17 Sep 2009 13:39:33 +0000 (13:39 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@2948 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/Perspective.js
security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/RolesApplet.js
security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/UserEditorApplet.js
security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/UsersApplet.js

index c3f167496896e349ed4ef2ba8a90e9b9fc1ba190..1380421951f9aabf955a762fe2366e8367232464 100644 (file)
@@ -40,8 +40,8 @@ qx.Class.define("org.argeo.security.ria.Perspective", {
                        this._firstSplit.add(rolesPane, 1);\r
                        this._firstSplit.add(this._secondSplit, 4);\r
                        \r
-                       this._secondSplit.add(usersPane, 4);\r
-                       this._secondSplit.add(editorPane, 3);\r
+                       this._secondSplit.add(usersPane, 3);\r
+                       this._secondSplit.add(editorPane, 4);\r
                        \r
                        viewsManager.getViewPanesContainer().add(this._firstSplit, {flex : 1});\r
                },\r
index f2f488d31a3220a38d4a93f35a773b2a2e992522..6cd0b43995d850f8105841880830d933e8001704 100644 (file)
@@ -34,7 +34,7 @@ qx.Class.define("org.argeo.security.ria.RolesApplet",
                                shortcut        : "Control+n",
                                enabled         : true,
                                menu            : "Roles",
-                               toolbar         : "role",
+                               toolbar         : null,
                                callback        : function(e){
                                        // Prompt for new name
                                },
@@ -46,7 +46,7 @@ qx.Class.define("org.argeo.security.ria.RolesApplet",
                                shortcut        : "Control+s",
                                enabled         : true,
                                menu            : "Roles",
-                               toolbar         : "role",
+                               toolbar         : null,
                                callback        : function(e){
                                        // Call service to delete
                                        var crtUsers = this.getViewSelection().getNodes();
@@ -55,7 +55,7 @@ qx.Class.define("org.argeo.security.ria.RolesApplet",
                                        }
                                },
                                selectionChange : function(viewName, data){
-                                       if(viewName != "role") return;
+                                       if(viewName != "roles") return;
                                        this.setEnabled(!(data == null || !data.length));                                       
                                },
                                command         : null
@@ -66,7 +66,7 @@ qx.Class.define("org.argeo.security.ria.RolesApplet",
                                shortcut        : "Control+r",
                                enabled         : true,
                                menu            : "Roles",
-                               toolbar         : "role",
+                               toolbar         : null,
                                callback        : function(e){
                                        // Call service to delete
                                        this.setGuiMode("edit");
@@ -103,7 +103,13 @@ qx.Class.define("org.argeo.security.ria.RolesApplet",
         */
        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.Simple();
                this.tableModel.setColumns(["Role Name"]);
                this.table = new qx.ui.table.Table(this.tableModel, {
@@ -120,21 +126,14 @@ qx.Class.define("org.argeo.security.ria.RolesApplet",
                        this._selectionToValues(this.table.getSelectionModel(), this.getViewSelection());
                }, this);
                
-               
                this.rolesUsersStub = {"ROLE_ADMIN":["root","mbaudier"],"ROLE_USER":["mbaudier","cdujeu"]};
-                               
-               var buttonPane = new qx.ui.container.Composite(new qx.ui.layout.HBox(2, "right"));
-               this.getView().header.setPadding(0);
-               if(this.getView().headerLabel) this.getView().headerLabel.setMargin(8);
-               this.getView().header.add(buttonPane, {edge:"east"});
-       
+                                       
                this.toggleButton = new qx.ui.form.ToggleButton("Filter", "org.argeo.security.ria/go-next.png");
                this.toggleButton.set({
                        show:"icon",
                        margin:2,
                        toolTip :new qx.ui.tooltip.ToolTip("Apply automatic filtering on Users list")                   
                });
-               buttonPane.add(this.toggleButton);
                                
                // TOGGLE THE GUI MODES                 
                this.toggleButton.addListener("changeChecked", function(event){
@@ -148,7 +147,6 @@ qx.Class.define("org.argeo.security.ria.RolesApplet",
                        toolTip :new qx.ui.tooltip.ToolTip("Save changes"),
                        visibility : "excluded"
                });
-               buttonPane.add(this.saveButton);                
                
                this.cancelButton = new qx.ui.form.Button("Cancel", "org.argeo.security.ria/window-close.png");
                this.cancelButton.set({
@@ -157,7 +155,6 @@ qx.Class.define("org.argeo.security.ria.RolesApplet",
                        toolTip :new qx.ui.tooltip.ToolTip("Cancel changes"),
                        visibility : "excluded"                         
                });
-               buttonPane.add(this.cancelButton);              
                
                this.saveButton.addListener("execute", function(){
                        alert("Saving changes...");
@@ -292,6 +289,17 @@ qx.Class.define("org.argeo.security.ria.RolesApplet",
        load : function(){              
                var data = [["ROLE_ADMIN"],["ROLE_USER"]];
                this.tableModel.setData(data);
+               
+               var commands = this.getCommands();
+               this.toolBarPart.add(commands["new_role"].command.getToolbarButton());
+               this.toolBarPart.add(commands["delete_role"].command.getToolbarButton());
+               this.toolBarPart.add(commands["edit_role"].command.getToolbarButton());                 
+               this.toolBar.addSpacer();
+               this.toolBar.add(this.toggleButton);
+               this.toolBar.add(this.saveButton);              
+               this.toolBar.add(this.cancelButton);                            
+               this.toolBar.setShow("icon");
+               
        },
                 
        addScroll : function(){
index 395d170c0a76ce08b810814a72eaf9aa4bf5c20e..29d8aa0fedf7deb08fdbaa262ae0d27abfc4c6bd 100644 (file)
@@ -12,8 +12,7 @@ qx.Class.define("org.argeo.security.ria.UserEditorApplet",
 
   construct : function(){
        this.base(arguments);
-       this.setLayout(new qx.ui.layout.VBox());
-       //this.setDecorator("tabview-pane");
+       this.setLayout(new qx.ui.layout.VBox(5));
   },
 
   properties : 
@@ -78,7 +77,8 @@ qx.Class.define("org.argeo.security.ria.UserEditorApplet",
                check:"org.argeo.ria.components.ViewSelection"
        },
        modified : {
-               init : false
+               init : false,
+               apply : "_applyModified"
        },
        rolesList : {
                
@@ -103,7 +103,11 @@ qx.Class.define("org.argeo.security.ria.UserEditorApplet",
                        this.setInstanceLabel("User " + data);
                }
                this.setView(viewPane);
-               this.setViewSelection(new org.argeo.ria.components.ViewSelection(viewPane.getViewId()));
+               this.setViewSelection(new org.argeo.ria.components.ViewSelection(viewPane.getViewId()));                
+               
+               // TOOLBAR
+               this.buttonGB = new qx.ui.container.Composite(new qx.ui.layout.HBox(5, "right"));
+               this.add(this.buttonGB);
                
                // GROUPBOXES
                this.basicGB = new qx.ui.groupbox.GroupBox("Base Informations");
@@ -170,6 +174,10 @@ qx.Class.define("org.argeo.security.ria.UserEditorApplet",
                groupBox.getChildrenContainer().setPadding(8);                  
        },
        
+       _applyModified : function(value){
+               if(value) this.getViewSelection().triggerEvent();
+       },
+       
        /**
         * Load a given row : the data passed must be a simple data array.
         * @param data {Element} The text xml description. 
@@ -180,6 +188,16 @@ qx.Class.define("org.argeo.security.ria.UserEditorApplet",
                }
                this.setRolesList(["ROLE_ADMIN", "ROLE_USER"]);
                this._attachListeners();
+               var title = new qx.ui.basic.Atom(this.getInstanceLabel(), "org.argeo.security.ria/preferences-user.png");
+               title.setFont(qx.bom.Font.fromString("16px sans-serif bold"));                  
+               this.buttonGB.add(title);
+               this.buttonGB.add(new qx.ui.core.Spacer(), {flex:1});
+               var commands = this.getCommands();
+               var button = new qx.ui.form.Button("Save", "org.argeo.security.ria/document-save.png", commands["save_user"].command);                  
+               var button2 = new qx.ui.form.Button("Close", "org.argeo.security.ria/window-close.png", commands["close"].command);             
+               this.buttonGB.add(button);
+               this.buttonGB.add(button2);
+               
        },
                 
        addScroll : function(){
index f4765628f9f7e6c573d92363713bf887443a7074..a44d3bb06bcc1edf50c28d3464bc074e24cf6c6f 100644 (file)
@@ -34,7 +34,7 @@ qx.Class.define("org.argeo.security.ria.UsersApplet",
                                shortcut        : "Control+n",
                                enabled         : true,
                                menu            : "Users",
-                               toolbar         : "userslist",
+                               toolbar         : null,
                                callback        : function(e){
                                        // Call service to delete
                                        var classObj = org.argeo.security.ria.UserEditorApplet;
@@ -49,7 +49,7 @@ qx.Class.define("org.argeo.security.ria.UsersApplet",
                                shortcut        : "Control+s",
                                enabled         : true,
                                menu            : "Users",
-                               toolbar         : "userslist",
+                               toolbar         : null,
                                callback        : function(e){
                                        // Call service to delete
                                        var crtUsers = this.getViewSelection().getNodes();
@@ -69,7 +69,7 @@ qx.Class.define("org.argeo.security.ria.UsersApplet",
                                shortcut        : "Control+u",
                                enabled         : true,
                                menu            : "Users",
-                               toolbar         : "userslist",
+                               toolbar         : null,
                                callback        : function(e){
                                        // Call service to delete
                                        var crtUser = this.getViewSelection().getNodes()[0];
@@ -107,7 +107,13 @@ qx.Class.define("org.argeo.security.ria.UsersApplet",
         */
        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, {
@@ -171,6 +177,12 @@ qx.Class.define("org.argeo.security.ria.UsersApplet",
        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){