]> git.argeo.org Git - lgpl/argeo-commons.git/blob - ria/components/SimpleUserNatureImpl.js
Prepare next development cycle
[lgpl/argeo-commons.git] / ria / components / SimpleUserNatureImpl.js
1 qx.Class.define("org.argeo.security.ria.components.SimpleUserNatureImpl", {
2 extend : qx.ui.container.Composite,
3 implement : [org.argeo.security.ria.components.INaturePane],
4 events : {
5 "modified" : "qx.event.type.Event"
6 },
7 properties : {
8 valid : {
9 init : false
10 },
11 natureUuid : {
12 init : ""
13 },
14 natureType : {
15 init : "SimpleUser"
16 },
17 dataMap : {
18
19 }
20 },
21
22 construct : function(){
23 this.base(arguments);
24 var grid = new qx.ui.layout.Grid(5,5);
25 this.setLayout(grid);
26 grid.setColumnFlex(0,1);
27 grid.setColumnAlign(0,"right", "middle");
28 grid.setColumnFlex(1,3);
29
30 this.mailField = new qx.ui.form.TextField();
31 this.fNameField = new qx.ui.form.TextField();
32 this.nameField = new qx.ui.form.TextField();
33
34 var labels = ["Email", "First Name", "Last Name"];
35 this.fields = {
36 "email" : this.mailField,
37 "firstName": this.fNameField,
38 "lastName" : this.nameField
39 };
40
41 for(var i=0;i<labels.length;i++){
42 this.add(new qx.ui.basic.Label(labels[i]), {row:i,column:0});
43 }
44 var j=0;
45 for(var key in this.fields){
46 this.fields[key].addListener("changeValue", function(e){this.fireEvent("modified");}, this);
47 this.add(this.fields[key], {row:j,column:1});
48 j++;
49 }
50
51 },
52
53 members : {
54 getContainer : function(){
55 return this;
56 },
57 getNatureLabel : function(){
58 return "Simple User";
59 },
60 setData : function(dataMap, format){
61 this.setNatureUuid(dataMap["uuid"]);
62 this.setNatureType(dataMap["type"]);
63 for(var key in this.fields){
64 if(dataMap[key]){
65 this.fields[key].setValue(dataMap[key]);
66 }
67 }
68 this.setDataMap(dataMap);
69 },
70 getData : function(format){
71 var dataMap = this.getDataMap();
72 for(var key in dataMap){
73 if(this.fields[key]){
74 dataMap[key] = this.fields[key].getValue();
75 }
76 }
77 this.setDataMap(dataMap);
78 return dataMap;
79 },
80 validate : function(){return true;}
81 }
82 });