]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/UserEditorApplet.js
7f18caaed2e49245245013ef2315273c636feb2e
2 * A simple Hello World applet for documentation purpose.
3 * The only associated command is the "Close" command.
5 /* *************************************************
6 #asset(resource/org.argeo.ria.sample/window-close.png)
7 ****************************************************/
8 qx
.Class
.define("org.argeo.security.ria.UserEditorApplet",
10 extend
: qx
.ui
.container
.Composite
,
11 implement
: [org
.argeo
.ria
.components
.IView
],
13 construct : function(){
15 this.setLayout(new qx
.ui
.layout
.VBox());
16 //this.setDecorator("tabview-pane");
22 * The viewPane inside which this applet is added.
28 * Commands definition, see {@link org.argeo.ria.event.CommandsManager#definitions}
34 icon
: "ria/window-close.png",
35 shortcut
: "Control+s",
39 callback : function(e
){
42 selectionChange : function(viewName
, data
){
43 if(viewName
!= "editor") return;
44 var iApplet
= org
.argeo
.ria
.components
.ViewsManager
.getInstance().getViewPaneById("editor").getContent();
45 if(iApplet
== null) this.setEnabled(true);
46 this.setEnabled(iApplet
.getModified());
47 //this.setEnabled(!(data == null || !data.length || data.length > 1));
53 icon
: "org.argeo.ria.sample/window-close.png",
54 shortcut
: "Control+w",
58 callback : function(e
){
59 // Call service to delete
60 this.getView().closeCurrent();
68 check
:"org.argeo.ria.components.ViewSelection"
76 instanceId
: {init
:""},
77 instanceLabel
: {init
:"Editor"}
83 * Called at applet creation. Just registers viewPane.
84 * @param viewPane {org.argeo.ria.components.ViewPane} The viewPane.
86 init : function(viewPane
, data
){
89 this.setInstanceId(now
.getTime());
90 this.setInstanceLabel("New User");
92 this.setInstanceId(data
);
93 this.setInstanceLabel("User " + data
);
95 this.setView(viewPane
);
96 this.setViewSelection(new org
.argeo
.ria
.components
.ViewSelection(viewPane
.getViewId()));
99 this.basicGB
= new qx
.ui
.groupbox
.GroupBox("Base Informations");
100 var grid
= new qx
.ui
.layout
.Grid(5,5);
101 this.basicGB
.setLayout(grid
);
102 grid
.setColumnFlex(0,1);
103 grid
.setColumnAlign(0,"right", "middle");
104 grid
.setColumnFlex(1,2);
105 this._initializeGroupBox(this.basicGB
);
107 this.passGB
= new qx
.ui
.groupbox
.GroupBox("Set/Modify Password");
108 this.passGB
.setLayout(new qx
.ui
.layout
.VBox());
109 this._initializeGroupBox(this.passGB
);
111 this.naturesGB
= new qx
.ui
.groupbox
.GroupBox("User Natures");
112 this.naturesGB
.setLayout(new qx
.ui
.layout
.Dock());
113 this._initializeGroupBox(this.naturesGB
);
115 this.add(this.basicGB
);
116 this.add(this.passGB
);
117 this.add(this.naturesGB
, {flex
:1});
120 this.usernameField
= new qx
.ui
.form
.TextField();
121 this.usernameField
.addListener("changeValue", function(){
122 this.setModified(true);
123 this.getViewSelection().triggerEvent();
125 this.basicGB
.add(new qx
.ui
.basic
.Label("Username"), {row
:0,column
:0});
126 this.basicGB
.add(this.usernameField
, {row
:0,column
:1});
128 this.rolesField
= new org
.argeo
.ria
.components
.ui
.MultipleComboBox();
129 this.rolesField
.setChoiceValues(["ROLE_ADMIN", "ROLE_USER", "ROLE_USER1"]);
130 this.basicGB
.add(new qx
.ui
.basic
.Label("Roles"), {row
:1,column
:0});
131 this.basicGB
.add(this.rolesField
, {row
:1,column
:1});
133 this.passPane
= new org
.argeo
.security
.ria
.components
.PasswordCredentialImpl();
134 this.passGB
.add(this.passPane
.getContainer());
136 this.naturesTab
= new qx
.ui
.tabview
.TabView("top");
137 this.simpleNature
= new org
.argeo
.security
.ria
.components
.SimpleUserNatureImpl();
138 var page1
= new qx
.ui
.tabview
.Page(this.simpleNature
.getNatureLabel());
139 page1
.setLayout(new qx
.ui
.layout
.Dock());
140 page1
.add(this.simpleNature
.getContainer(), {edge
:"center"});
141 this.naturesTab
.add(page1
);
142 this.naturesGB
.add(this.naturesTab
, {edge
:"center"});
146 _initializeGroupBox: function(groupBox
){
147 groupBox
.setPadding(0);
148 groupBox
.getChildrenContainer().setPadding(8);
152 * Load a given row : the data passed must be a simple data array.
153 * @param data {Element} The text xml description.
155 load : function(userData
){
157 this.usernameField
.setValue(userData
);
159 this.setRolesList(["ROLE_ADMIN", "ROLE_USER"]);
162 addScroll : function(){