1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

r22487: Add a separate widget class for listing users and reposition

things on NetManager's screen. Qooxdoo layout positioning can
be tricky sometimes...

rafal
(This used to be commit 3face29cc2)
This commit is contained in:
Rafal Szczesniak 2007-04-23 13:37:33 +00:00 committed by Gerald (Jerry) Carter
parent f66bd1ae54
commit 9e752901b2
2 changed files with 83 additions and 35 deletions

View File

@ -2,6 +2,7 @@
* Copyright (C) Rafal Szczesniak 2007
*/
/**
* Swat Net Manager class graphical user interface
*/
@ -14,7 +15,6 @@ function()
//qx.OO.addProperty({ name : "_tree", type : "object" });
//qx.OO.addProperty({ name : "_panel", type : "object" });
//qx.OO.addProperty({ name : "_view", type : "object" });
//qx.OO.addProperty({ name : "_txtDomain", type : "object" });
//qx.OO.addProperty({ name : "_txtUsername", type : "object" });
@ -30,9 +30,9 @@ qx.Proto.buildGui = function(module)
// Main layout composing the whole form
var vlayout = new qx.ui.layout.VerticalBoxLayout();
vlayout.set({
top: 20,
left: 20,
width: "100%",
top: 10,
left: 10,
right: 10,
bottom: 20
});
@ -70,37 +70,17 @@ qx.Proto.buildGui = function(module)
// "Panel" for list view
this._panel = new qx.ui.layout.VerticalBoxLayout();
var panel = this._panel;
// TODO: Find out what's causing this bug - specifying 'width' works fine,
// but setting 'right' instead does not which makes impossible to position
// the panel against right boundary of a box
panel.set({
top: 0,
left: 10,
width: "80%",
width:"80%",
height: "100%"
});
// Setup some initial columns and (empty) item list - to be replaced soon
// with default view loading
var columns = { name : { label: "Name", width: 120, type: "text" }};
var items = [];
// Setup the list view
this._view = new qx.ui.listview.ListView(items, columns);
var view = this._view;
view.setBorder(qx.renderer.border.BorderPresets.getInstance().shadow);
view.setBackgroundColor("white");
view.set({
top: 0,
left: 0,
width: "80%",
height: "100%"
});
// Give a list view name to handle
fsm.addObject("view", view);
// and the list view to the panel
panel.add(view);
// Add the tree view and panel for list view to the layout
hlayout.add(tree);
hlayout.add(panel);
@ -110,8 +90,8 @@ qx.Proto.buildGui = function(module)
statusLayout.set({
top: 10,
left: 0,
right: 0,
height: "100%"
width: "100%",
height: "20%"
});
// First "column" of status fields
@ -119,13 +99,13 @@ qx.Proto.buildGui = function(module)
colALayout.set({
top: 0,
left: 0,
width: 150,
width: "25%",
height: "100%"
});
// Domain name (credentials) - label and text box
var statusDomain = new qx.ui.layout.HorizontalBoxLayout();
statusDomain.set({ top: 0, left: 0, width: "100%", height: 20,
statusDomain.set({ top: 0, left: 0, width: "100%", height: "auto",
verticalChildrenAlign: "middle" });
var lblDomain = new qx.ui.basic.Atom();
@ -141,7 +121,7 @@ qx.Proto.buildGui = function(module)
// Username (credentials) - label and text box
var statusUsername = new qx.ui.layout.HorizontalBoxLayout();
statusUsername.set({ top: 0, left: 0, width: "100%", height: 20,
statusUsername.set({ top: 0, left: 0, width: "100%", height: "auto",
verticalChildrenAlign: "middle" });
var lblUsername = new qx.ui.basic.Atom();
@ -281,7 +261,13 @@ qx.Proto._updateNetContextCreds = function(module, rpcRequest)
qx.Proto._initUserManager = function(module, rpcRequest)
{
// Get obtained UsrCtx handle
var result = rpcRequest.getUserData("result").data;
var usrCtx = rpcRequest.getUserData("result").data;
// Create user view and pass the context
var view = new swat.module.netmgr.UsersView(module.fsm);
view.setUsrCtx(usrCtx);
this._panel.add(view);
};

View File

@ -0,0 +1,62 @@
/*
* Copyright (C) Rafal Szczesniak 2007
*/
//qx.OO.addProperty({ name: "_fsm", type: "object"});
//qx.OO.addProperty({ name: "_columns", type: "object"});
//qx.OO.addProperty({ name: "_items", type: "object"});
//qx.OO.addProperty({ name: "_view", type: "object" });
/**
* Users View
*/
qx.OO.defineClass("swat.module.netmgr.UsersView", qx.ui.layout.HorizontalBoxLayout,
function(fsm)
{
qx.ui.layout.HorizontalBoxLayout.call(this);
this._fsm = fsm;
// Set the whole view panel size and spacing between boxes
this.set({ top: 0, left: 0, width: "100%", height: "100%" });
this.setSpacing(5);
// Provide vertical positioning of combo box and list view
var innerBox = new qx.ui.layout.VerticalBoxLayout();
innerBox.set({ top: 0, left: 0, width: "100%", height: "100%"});
// horizontal box for domain selection label and combo box
var selectDomainBox = new qx.ui.layout.HorizontalBoxLayout();
selectDomainBox.set({ top: 0, left: 0, width: "auto", height: "10%" });
selectDomainBox.setVerticalChildrenAlign("middle");
selectDomainBox.setSpacing(5);
// Setup domain selection combo box
var lblDomain = new qx.ui.basic.Atom("Domain:");
lblDomain.setHorizontalChildrenAlign("right");
var cmbDomain = new qx.ui.form.ComboBox();
cmbDomain.setEditable(false);
// Create an empty list view with sample column
this._columns = { username : { label: "Username", width: 150, type: "text" }};
this._items = [];
this._view = new qx.ui.listview.ListView(this._items, this._columns);
var view = this._view;
view.set({ top: 0, left: 0, width: "90%", height: "90%" });
view.setBorder(qx.renderer.border.BorderPresets.getInstance().shadow);
// Arrange widgets and boxes
selectDomainBox.add(lblDomain);
selectDomainBox.add(cmbDomain);
innerBox.add(selectDomainBox);
innerBox.add(view);
// place the inner box in the UsersView box
this.add(innerBox);
});
// UsrMgr context is required for any operation on user accounts
qx.OO.addProperty({ name : "usrCtx", type : "number" });