Lot of changes in the user editor
[lgpl/argeo-commons.git] / security / runtime / org.argeo.security.ria / src / argeo-ria-lib / security / class / org / argeo / security / ria / components / SimpleUserNatureImpl.js
index 4b5e4c84b3f1687f8e71c1f92a401c3214f26782..342cee246bf91cae6891673a037d89ee42e48674 100644 (file)
@@ -4,27 +4,32 @@ qx.Class.define("org.argeo.security.ria.components.SimpleUserNatureImpl", {
        events : {\r
                "modified" : "qx.event.type.Event"              \r
        },\r
+       statics : {\r
+               NATURE_TYPE : "org.argeo.security.nature.SimpleUserNature",\r
+               NATURE_LABEL : "Simple User",\r
+               NATURE_ICON : ""\r
+       },\r
        properties : {\r
                valid : {\r
                        init : false\r
                },\r
-               natureUuid : {\r
-                       init : ""\r
-               },\r
-               natureType : {\r
-                       init : "SimpleUser"\r
-               },\r
                dataMap : {\r
                        \r
-               }\r
+               },\r
+               editMode : {\r
+                       init : true,\r
+                       apply : "_applyEditMode",\r
+                       event : "changeEditMode"\r
+               }               \r
        },\r
        \r
        construct : function(){\r
                this.base(arguments);   \r
                this._createGui();\r
+               this.setEditMode(false);                \r
        },\r
                \r
-       members : {\r
+       members : {             \r
                \r
                _createGui : function(){\r
                        var grid = new qx.ui.layout.Grid(5,5);\r
@@ -52,17 +57,19 @@ qx.Class.define("org.argeo.security.ria.components.SimpleUserNatureImpl", {
                                this.fields[key].addListener("changeValue", function(e){this.fireEvent("modified");}, this);\r
                                this.add(this.fields[key], {row:j,column:1});\r
                                j++;\r
-                       }                       \r
+                       }       \r
+               },\r
+               \r
+               _applyEditMode : function(value){\r
+                       for(var key in this.fields){\r
+                               this.fields[key].setEnabled(value);\r
+                       }\r
                },\r
+               \r
                getContainer  : function(){\r
                        return this;\r
                },\r
-               getNatureLabel : function(){\r
-                       return "Simple User";\r
-               },\r
                setData    : function(dataMap, format){\r
-                       this.setNatureUuid(dataMap["uuid"]);\r
-                       this.setNatureType(dataMap["type"]);\r
                        for(var key in this.fields){\r
                                if(dataMap[key]){\r
                                        this.fields[key].setValue(dataMap[key]);\r