mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-27 02:56:01 +01:00
CA-272127: Aesthetic and usability improvements in the AD users list: fixed
cell alignment; removed grid; expand/collapse on row double click and on expander cell single click. Refactored class AdSubjectRow. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
18be622889
commit
3bd8a03699
65
XenAdmin/TabPages/AdPage.Designer.cs
generated
65
XenAdmin/TabPages/AdPage.Designer.cs
generated
@ -32,10 +32,11 @@ namespace XenAdmin.TabPages
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AdPage));
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.contextMenuStripADBox = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItemRemove = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@ -48,7 +49,6 @@ namespace XenAdmin.TabPages
|
||||
this.ColumnSubject = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ColumnRoles = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ColumnStatus = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ColumnDummy = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.LabelGridViewDisabled = new System.Windows.Forms.Label();
|
||||
this.ButtonRemove = new System.Windows.Forms.Button();
|
||||
this.tTipRemoveButton = new XenAdmin.Controls.ToolTipContainer();
|
||||
@ -131,10 +131,9 @@ namespace XenAdmin.TabPages
|
||||
this.GridViewSubjectList.AllowUserToResizeRows = false;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.GridViewSubjectList.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.GridViewSubjectList.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
this.GridViewSubjectList.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
|
||||
this.GridViewSubjectList.BackgroundColor = System.Drawing.SystemColors.Window;
|
||||
this.GridViewSubjectList.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleHorizontal;
|
||||
this.GridViewSubjectList.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
|
||||
resources.ApplyResources(this.GridViewSubjectList, "GridViewSubjectList");
|
||||
this.GridViewSubjectList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
||||
this.GridViewSubjectList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
@ -142,34 +141,32 @@ namespace XenAdmin.TabPages
|
||||
this.ColumnTypeImage,
|
||||
this.ColumnSubject,
|
||||
this.ColumnRoles,
|
||||
this.ColumnStatus,
|
||||
this.ColumnDummy});
|
||||
this.ColumnStatus});
|
||||
this.GridViewSubjectList.ContextMenuStrip = this.contextMenuStripADBox;
|
||||
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopLeft;
|
||||
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Window;
|
||||
dataGridViewCellStyle5.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
dataGridViewCellStyle5.Padding = new System.Windows.Forms.Padding(1);
|
||||
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.GridViewSubjectList.DefaultCellStyle = dataGridViewCellStyle5;
|
||||
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopLeft;
|
||||
dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window;
|
||||
dataGridViewCellStyle6.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
dataGridViewCellStyle6.Padding = new System.Windows.Forms.Padding(1);
|
||||
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.GridViewSubjectList.DefaultCellStyle = dataGridViewCellStyle6;
|
||||
this.GridViewSubjectList.Name = "GridViewSubjectList";
|
||||
this.GridViewSubjectList.RowHeadersVisible = false;
|
||||
this.GridViewSubjectList.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.GridViewSubjectList.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.GridViewSubjectList_CellMouseClick);
|
||||
this.GridViewSubjectList.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.GridViewSubjectList_CellClick);
|
||||
this.GridViewSubjectList.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.GridViewSubjectList_CellDoubleClick);
|
||||
this.GridViewSubjectList.SelectionChanged += new System.EventHandler(this.GridViewSubjectList_SelectionChanged);
|
||||
this.GridViewSubjectList.SortCompare += new System.Windows.Forms.DataGridViewSortCompareEventHandler(this.GridViewSubjectList_SortCompare);
|
||||
this.GridViewSubjectList.MouseUp += new System.Windows.Forms.MouseEventHandler(this.GridViewSubjectList_MouseClick);
|
||||
//
|
||||
// ColumnExpand
|
||||
//
|
||||
this.ColumnExpand.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
|
||||
this.ColumnExpand.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter;
|
||||
dataGridViewCellStyle2.NullValue = ((object)(resources.GetObject("dataGridViewCellStyle2.NullValue")));
|
||||
dataGridViewCellStyle2.Padding = new System.Windows.Forms.Padding(0, 5, 0, 0);
|
||||
this.ColumnExpand.DefaultCellStyle = dataGridViewCellStyle2;
|
||||
this.ColumnExpand.FillWeight = 49.51523F;
|
||||
resources.ApplyResources(this.ColumnExpand, "ColumnExpand");
|
||||
this.ColumnExpand.Name = "ColumnExpand";
|
||||
this.ColumnExpand.ReadOnly = true;
|
||||
@ -177,7 +174,10 @@ namespace XenAdmin.TabPages
|
||||
//
|
||||
// ColumnTypeImage
|
||||
//
|
||||
this.ColumnTypeImage.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
|
||||
this.ColumnTypeImage.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
||||
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter;
|
||||
dataGridViewCellStyle3.NullValue = ((object)(resources.GetObject("dataGridViewCellStyle3.NullValue")));
|
||||
this.ColumnTypeImage.DefaultCellStyle = dataGridViewCellStyle3;
|
||||
resources.ApplyResources(this.ColumnTypeImage, "ColumnTypeImage");
|
||||
this.ColumnTypeImage.Name = "ColumnTypeImage";
|
||||
this.ColumnTypeImage.ReadOnly = true;
|
||||
@ -186,8 +186,9 @@ namespace XenAdmin.TabPages
|
||||
//
|
||||
// ColumnSubject
|
||||
//
|
||||
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.ColumnSubject.DefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.ColumnSubject.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.ColumnSubject.DefaultCellStyle = dataGridViewCellStyle4;
|
||||
this.ColumnSubject.FillWeight = 200F;
|
||||
resources.ApplyResources(this.ColumnSubject, "ColumnSubject");
|
||||
this.ColumnSubject.Name = "ColumnSubject";
|
||||
@ -195,31 +196,22 @@ namespace XenAdmin.TabPages
|
||||
//
|
||||
// ColumnRoles
|
||||
//
|
||||
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.ColumnRoles.DefaultCellStyle = dataGridViewCellStyle4;
|
||||
this.ColumnRoles.FillWeight = 180.9098F;
|
||||
this.ColumnRoles.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells;
|
||||
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.ColumnRoles.DefaultCellStyle = dataGridViewCellStyle5;
|
||||
resources.ApplyResources(this.ColumnRoles, "ColumnRoles");
|
||||
this.ColumnRoles.Name = "ColumnRoles";
|
||||
this.ColumnRoles.ReadOnly = true;
|
||||
this.ColumnRoles.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.ColumnRoles.Resizable = System.Windows.Forms.DataGridViewTriState.False;
|
||||
//
|
||||
// ColumnStatus
|
||||
//
|
||||
this.ColumnStatus.FillWeight = 65.9477F;
|
||||
this.ColumnStatus.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells;
|
||||
resources.ApplyResources(this.ColumnStatus, "ColumnStatus");
|
||||
this.ColumnStatus.Name = "ColumnStatus";
|
||||
this.ColumnStatus.ReadOnly = true;
|
||||
this.ColumnStatus.Resizable = System.Windows.Forms.DataGridViewTriState.False;
|
||||
//
|
||||
// ColumnDummy
|
||||
//
|
||||
this.ColumnDummy.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
|
||||
resources.ApplyResources(this.ColumnDummy, "ColumnDummy");
|
||||
this.ColumnDummy.Name = "ColumnDummy";
|
||||
this.ColumnDummy.ReadOnly = true;
|
||||
this.ColumnDummy.Resizable = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.ColumnDummy.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// LabelGridViewDisabled
|
||||
//
|
||||
resources.ApplyResources(this.LabelGridViewDisabled, "LabelGridViewDisabled");
|
||||
@ -380,6 +372,5 @@ namespace XenAdmin.TabPages
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnSubject;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnRoles;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnStatus;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnDummy;
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using XenAPI;
|
||||
using XenAdmin.Dialogs;
|
||||
@ -261,7 +262,7 @@ namespace XenAdmin.TabPages
|
||||
{
|
||||
if (r.IsLocalRootRow)
|
||||
{
|
||||
r.toggleExpandedState();
|
||||
r.ToggleExpandedState();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -412,7 +413,7 @@ namespace XenAdmin.TabPages
|
||||
if (GridViewSubjectList.FirstDisplayedScrollingRowIndex > 0)
|
||||
{
|
||||
AdSubjectRow topRow = GridViewSubjectList.Rows[GridViewSubjectList.FirstDisplayedScrollingRowIndex] as AdSubjectRow;
|
||||
if (topRow.subject != null)
|
||||
if (topRow != null && topRow.subject != null)
|
||||
topSubject = topRow.subject.uuid;
|
||||
}
|
||||
|
||||
@ -439,33 +440,25 @@ namespace XenAdmin.TabPages
|
||||
// Populate list of authenticated users
|
||||
GridViewSubjectList.Rows.Clear();
|
||||
|
||||
// Add local root account, a null value for the subject shows this
|
||||
AdSubjectRow adminRow = new AdSubjectRow(null);
|
||||
GridViewSubjectList.Rows.Add(adminRow);
|
||||
var rows = new List<DataGridViewRow> {new AdSubjectRow(null)}; //local root account
|
||||
|
||||
List<DataGridViewRow> rows = new List<DataGridViewRow>();
|
||||
Session session = pool.Connection.Session;
|
||||
// Add all other Subjects in the server list
|
||||
foreach (Subject subject in pool.Connection.Cache.Subjects)
|
||||
foreach (Subject subject in pool.Connection.Cache.Subjects) //all other subjects in the pool
|
||||
{
|
||||
subject.PropertyChanged += new PropertyChangedEventHandler(subject_PropertyChanged);
|
||||
AdSubjectRow r = new AdSubjectRow(subject);
|
||||
// we show them as unknown logged in status until the background thread updates them
|
||||
r.showStatusLost();
|
||||
rows.Add(r);
|
||||
subject.PropertyChanged += subject_PropertyChanged;
|
||||
rows.Add(new AdSubjectRow(subject));
|
||||
}
|
||||
GridViewSubjectList.Rows.AddRange(rows.ToArray());
|
||||
GridViewSubjectList.Sort(GridViewSubjectList.SortedColumn ?? GridViewSubjectList.Columns[2],
|
||||
GridViewSubjectList.SortOrder == SortOrder.Ascending ? ListSortDirection.Ascending : ListSortDirection.Descending);
|
||||
|
||||
GridViewSubjectList.Sort(GridViewSubjectList.SortedColumn ?? ColumnSubject,
|
||||
GridViewSubjectList.SortOrder == SortOrder.Ascending ? ListSortDirection.Ascending : ListSortDirection.Descending);
|
||||
|
||||
// restore old selection, old expansion state and top row
|
||||
foreach (AdSubjectRow r in GridViewSubjectList.Rows)
|
||||
{
|
||||
r.Selected = r.subject != null && selectedSubjectUuids.ContainsKey(r.subject.uuid);
|
||||
r.Expanded = r.subject != null && expandedSubjectUuids.ContainsKey(r.subject.uuid);
|
||||
if (r.subject == null && rootExpanded)
|
||||
r.Expanded = true;
|
||||
if (r.subject != null && topSubject == r.subject.uuid)
|
||||
r.Selected = !r.IsLocalRootRow && selectedSubjectUuids.ContainsKey(r.subject.uuid);
|
||||
r.Expanded = r.IsLocalRootRow ? rootExpanded : expandedSubjectUuids.ContainsKey(r.subject.uuid);
|
||||
|
||||
if (!r.IsLocalRootRow && topSubject == r.subject.uuid)
|
||||
GridViewSubjectList.FirstDisplayedScrollingRowIndex = r.Index;
|
||||
}
|
||||
if (GridViewSubjectList.SelectedRows.Count == 0)
|
||||
@ -567,7 +560,7 @@ namespace XenAdmin.TabPages
|
||||
if (r.IsLocalRootRow)
|
||||
continue;
|
||||
|
||||
r.showStatusLost();
|
||||
r.SetStatusLost();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -578,12 +571,21 @@ namespace XenAdmin.TabPages
|
||||
/// Used in the DataGridView on the ConfigureAdDialog. Stores information about the subject and the different text to show if the
|
||||
/// row is expanded or not.
|
||||
/// </summary>
|
||||
internal class AdSubjectRow : DataGridViewRow
|
||||
private class AdSubjectRow : DataGridViewRow
|
||||
{
|
||||
internal Subject subject;
|
||||
private bool expanded = false;
|
||||
private bool loggedIn = false;
|
||||
private bool statusLost = false;
|
||||
private readonly DataGridViewImageCell _cellExpander = new DataGridViewImageCell();
|
||||
private readonly DataGridViewImageCell _cellGroupOrUser = new DataGridViewImageCell();
|
||||
private readonly KeyValuePairCell _cellSubjectInfo = new KeyValuePairCell();
|
||||
private readonly DataGridViewTextBoxCell _cellRoles = new DataGridViewTextBoxCell();
|
||||
private readonly DataGridViewTextBoxCell _cellLoggedIn = new DataGridViewTextBoxCell();
|
||||
|
||||
internal Subject subject { get; private set; }
|
||||
private bool expanded;
|
||||
private bool loggedIn;
|
||||
/// <summary>
|
||||
/// The row is created with unknown status until it's updated from outside the class
|
||||
/// </summary>
|
||||
private bool statusLost = true;
|
||||
|
||||
public bool LoggedIn
|
||||
{
|
||||
@ -595,8 +597,7 @@ namespace XenAdmin.TabPages
|
||||
{
|
||||
loggedIn = value;
|
||||
statusLost = false;
|
||||
Cells[4].Value = IsLocalRootRow || subject.IsGroup ? "-"
|
||||
: loggedIn ? Messages.YES : Messages.NO;
|
||||
RefreshCellContent();
|
||||
}
|
||||
}
|
||||
|
||||
@ -605,25 +606,32 @@ namespace XenAdmin.TabPages
|
||||
get { return subject == null; }
|
||||
}
|
||||
|
||||
// Each entry can show a summary of roles or a full list depending on whether it is expanded or contracted
|
||||
private string expandedRoles, contractedRoles;
|
||||
// Expanded subject info is the key pair mapping detailed in the subjects other config along with their display name
|
||||
// The contracted version is just their display name
|
||||
private List<KeyValuePair<string, string>> expandedSubjectInfo, contractedSubjectInfo;
|
||||
/// <summary>
|
||||
/// The full list of the subject's roles
|
||||
/// </summary>
|
||||
private readonly string expandedRoles = string.Empty;
|
||||
/// <summary>
|
||||
/// Topmost of the subject's roles
|
||||
/// </summary>
|
||||
private readonly string contractedRoles = string.Empty;
|
||||
/// <summary>
|
||||
/// The detailed info from the subject's other_config along with their display name
|
||||
/// </summary>
|
||||
private readonly List<KeyValuePair<string, string>> expandedSubjectInfo = new List<KeyValuePair<String, String>>();
|
||||
/// <summary>
|
||||
/// The subject's display name
|
||||
/// </summary>
|
||||
private readonly List<KeyValuePair<string, string>> contractedSubjectInfo = new List<KeyValuePair<String, String>>();
|
||||
|
||||
/// <summary>
|
||||
/// A DataGridViewRow that corresponds to a subject and shows their relevant information in expanded and collapsed states
|
||||
/// A DataGridViewRow that corresponds to a subject and shows their
|
||||
/// information in expanded and collapsed states
|
||||
/// </summary>
|
||||
/// <param name="subject">If set to null this is assumed to be a root account that does not have a subject</param>
|
||||
/// <param name="subject">If null, if it is a root account (no subject)</param>
|
||||
internal AdSubjectRow(Subject subject)
|
||||
: base()
|
||||
{
|
||||
this.subject = subject;
|
||||
if (IsLocalRootRow)
|
||||
if (subject == null) //root account
|
||||
{
|
||||
contractedRoles = expandedRoles = "";
|
||||
expandedSubjectInfo = new List<KeyValuePair<String, String>>();
|
||||
contractedSubjectInfo = new List<KeyValuePair<String, String>>();
|
||||
expandedSubjectInfo.Add(new KeyValuePair<string, string>(Messages.AD_LOCAL_ROOT_ACCOUNT, ""));
|
||||
expandedSubjectInfo.Add(new KeyValuePair<string, string>("", ""));
|
||||
expandedSubjectInfo.Add(new KeyValuePair<string, string>(Messages.AD_ALWAYS_GRANTED_ACCESS, ""));
|
||||
@ -631,49 +639,40 @@ namespace XenAdmin.TabPages
|
||||
}
|
||||
else
|
||||
{
|
||||
//Generate the role list
|
||||
string s = "";
|
||||
List<Role> roles = subject.Connection.ResolveAll<Role>(subject.roles);
|
||||
this.subject = subject;
|
||||
var roles = subject.Connection.ResolveAll(subject.roles);
|
||||
roles.Sort();
|
||||
roles.Reverse();
|
||||
foreach (Role r in roles)
|
||||
{
|
||||
s = String.Format("{0}\n{1}", s, r.FriendlyName());
|
||||
}
|
||||
expandedRoles = s;
|
||||
if (roles.Count > 0)
|
||||
expandedRoles = roles.Select(r => r.FriendlyName()).Aggregate((acc, s) => acc + "\n" + s);
|
||||
|
||||
contractedRoles = roles.Count > 0
|
||||
? roles.Count > 1 ? roles[0].FriendlyName().AddEllipsis() : roles[0].FriendlyName()
|
||||
: "";
|
||||
|
||||
contractedSubjectInfo = new List<KeyValuePair<String, String>>();
|
||||
contractedSubjectInfo.Add(new KeyValuePair<string, string>(subject.DisplayName ?? subject.SubjectName ?? "", ""));
|
||||
expandedSubjectInfo = Subject.ExtractKvpInfo(subject);
|
||||
}
|
||||
Cells.Add(new DataGridViewImageCell()); // Expander image cell
|
||||
Cells.Add(new DataGridViewImageCell()); // Group/user image cell
|
||||
Cells.Add(new KeyValuePairCell()); // Subject info cell
|
||||
Cells.Add(new DataGridViewTextBoxCell()); // Roles cell
|
||||
Cells.Add(new DataGridViewTextBoxCell()); // logged in cell
|
||||
|
||||
refreshCellContent();
|
||||
Cells.AddRange(_cellExpander, _cellGroupOrUser, _cellSubjectInfo, _cellRoles, _cellLoggedIn);
|
||||
RefreshCellContent();
|
||||
}
|
||||
|
||||
public void refreshCellContent()
|
||||
public void RefreshCellContent()
|
||||
{
|
||||
Cells[0].Value = expanded ? Resources.expanded_triangle : Resources.contracted_triangle;
|
||||
Cells[1].Value = IsLocalRootRow || !subject.IsGroup ?
|
||||
Resources._000_User_h32bit_16 : Resources._000_UserAndGroup_h32bit_32;
|
||||
Cells[2].Value = expanded ? expandedSubjectInfo : contractedSubjectInfo;
|
||||
Cells[3].Value = expanded ? expandedRoles : contractedRoles;
|
||||
Cells[4].Value = IsLocalRootRow || subject.IsGroup || statusLost ? "-"
|
||||
: loggedIn ? Messages.YES : Messages.NO;
|
||||
|
||||
_cellExpander.Value = expanded ? Resources.expanded_triangle : Resources.contracted_triangle;
|
||||
_cellGroupOrUser.Value = IsLocalRootRow || !subject.IsGroup ? Resources._000_User_h32bit_16 : Resources._000_UserAndGroup_h32bit_32;
|
||||
_cellSubjectInfo.Value = expanded ? expandedSubjectInfo : contractedSubjectInfo;
|
||||
_cellRoles.Value = expanded ? expandedRoles : contractedRoles;
|
||||
_cellLoggedIn.Value = IsLocalRootRow || subject.IsGroup || statusLost
|
||||
? "-"
|
||||
: loggedIn ? Messages.YES : Messages.NO;
|
||||
}
|
||||
|
||||
public void toggleExpandedState()
|
||||
public void ToggleExpandedState()
|
||||
{
|
||||
expanded = !expanded;
|
||||
refreshCellContent();
|
||||
RefreshCellContent();
|
||||
}
|
||||
|
||||
public bool Expanded
|
||||
@ -684,17 +683,24 @@ namespace XenAdmin.TabPages
|
||||
}
|
||||
set
|
||||
{
|
||||
expanded = value;
|
||||
refreshCellContent();
|
||||
if (expanded != value)
|
||||
{
|
||||
expanded = value;
|
||||
RefreshCellContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void showStatusLost()
|
||||
public void SetStatusLost()
|
||||
{
|
||||
if (statusLost)
|
||||
return;
|
||||
|
||||
statusLost = true;
|
||||
Cells[4].Value = "-";
|
||||
RefreshCellContent();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void buttonJoinLeave_Click(object sender, EventArgs e)
|
||||
@ -814,21 +820,6 @@ namespace XenAdmin.TabPages
|
||||
resolvingSubjectsDialog.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void GridViewSubjectList_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
|
||||
{
|
||||
Program.AssertOnEventThread();
|
||||
if (e.Button != MouseButtons.Left)
|
||||
return;
|
||||
|
||||
if (e.RowIndex < 0)
|
||||
// The click is on a column header
|
||||
return;
|
||||
AdSubjectRow row = GridViewSubjectList.Rows[e.RowIndex] as AdSubjectRow;
|
||||
row.toggleExpandedState();
|
||||
}
|
||||
|
||||
private void ButtonRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
Program.AssertOnEventThread();
|
||||
@ -930,6 +921,26 @@ namespace XenAdmin.TabPages
|
||||
toolStripMenuItemRemove.Enabled = ButtonRemove.Enabled;
|
||||
}
|
||||
|
||||
private void GridViewSubjectList_CellClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex < 0 || e.RowIndex < 0 || e.ColumnIndex != ColumnExpand.Index)
|
||||
return;
|
||||
|
||||
var row = GridViewSubjectList.Rows[e.RowIndex] as AdSubjectRow;
|
||||
if (row != null)
|
||||
row.ToggleExpandedState();
|
||||
}
|
||||
|
||||
private void GridViewSubjectList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||
return;
|
||||
|
||||
var row = GridViewSubjectList.Rows[e.RowIndex] as AdSubjectRow;
|
||||
if (row != null)
|
||||
row.ToggleExpandedState();
|
||||
}
|
||||
|
||||
private bool AllSelectedRowsLoggedIn()
|
||||
{
|
||||
foreach (AdSubjectRow r in GridViewSubjectList.SelectedRows)
|
||||
@ -1181,18 +1192,5 @@ namespace XenAdmin.TabPages
|
||||
Monitor.Pulse(statusUpdaterLock);
|
||||
}
|
||||
}
|
||||
|
||||
private void GridViewSubjectList_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button != MouseButtons.Right)
|
||||
return;
|
||||
|
||||
DataGridView.HitTestInfo i = GridViewSubjectList.HitTest(e.X, e.Y);
|
||||
if (i.RowIndex < 0 || GridViewSubjectList.Rows[i.RowIndex].Selected)
|
||||
return;
|
||||
|
||||
GridViewSubjectList.ClearSelection();
|
||||
GridViewSubjectList.Rows[i.RowIndex].Selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -145,23 +145,34 @@
|
||||
<data name="ColumnExpand.HeaderText" xml:space="preserve">
|
||||
<value />
|
||||
</data>
|
||||
<data name="ColumnExpand.MinimumWidth" type="System.Int32, mscorlib">
|
||||
<value>20</value>
|
||||
</data>
|
||||
<data name="ColumnExpand.Width" type="System.Int32, mscorlib">
|
||||
<value>20</value>
|
||||
<value>5</value>
|
||||
</data>
|
||||
<metadata name="ColumnTypeImage.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="dataGridViewCellStyle3.NullValue" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
Qk32AgAAAAAAADYAAAAoAAAADgAAABAAAAABABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACEgoTGw8bGw8bGw8bGw8bGw8bGw8bG
|
||||
w8bGw8bGw8bGw8bGw8bGw8YAAAAAAISChP///////////////////////////////////////////8bD
|
||||
xgAAAAAAhIKE////////////////////////////////////////////xsPGAAAAAACEgoT/////////
|
||||
///////////////////////////////////Gw8YAAAAAAISChP//////////////////////////////
|
||||
/////////////8bDxgAAAAAAhIKE////////////AAD/AAD/////////AAD/AAD/////////xsPGAAAA
|
||||
AACEgoT///////////////8AAP8AAP8AAP8AAP/////////////Gw8YAAAAAAISChP//////////////
|
||||
/////wAA/wAA/////////////////8bDxgAAAAAAhIKE////////////////AAD/AAD/AAD/AAD/////
|
||||
////////xsPGAAAAAACEgoT///////////8AAP8AAP////////8AAP8AAP/////////Gw8YAAAAAAISC
|
||||
hP///////////////////////////////////////////8bDxgAAAAAAhIKE////////////////////
|
||||
////////////////////////xsPGAAAAAACEgoT/////////////////////////////////////////
|
||||
///Gw8YAAAAAAISChP///////////////////////////////////////////8bDxgAAAAAAhIKEhIKE
|
||||
hIKEhIKEhIKEhIKEhIKEhIKEhIKEhIKEhIKEhIKEhIKEhIKEAAA=
|
||||
</value>
|
||||
</data>
|
||||
<data name="ColumnTypeImage.HeaderText" xml:space="preserve">
|
||||
<value />
|
||||
</data>
|
||||
<data name="ColumnTypeImage.MinimumWidth" type="System.Int32, mscorlib">
|
||||
<value>50</value>
|
||||
</data>
|
||||
<data name="ColumnTypeImage.Width" type="System.Int32, mscorlib">
|
||||
<value>50</value>
|
||||
<value>5</value>
|
||||
</data>
|
||||
<metadata name="ColumnSubject.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
@ -169,32 +180,26 @@
|
||||
<data name="ColumnSubject.HeaderText" xml:space="preserve">
|
||||
<value>Subject</value>
|
||||
</data>
|
||||
<data name="ColumnSubject.MinimumWidth" type="System.Int32, mscorlib">
|
||||
<value>20</value>
|
||||
</data>
|
||||
<metadata name="ColumnRoles.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="ColumnRoles.HeaderText" xml:space="preserve">
|
||||
<value>Roles</value>
|
||||
</data>
|
||||
<data name="ColumnRoles.Width" type="System.Int32, mscorlib">
|
||||
<value>62</value>
|
||||
</data>
|
||||
<metadata name="ColumnStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="ColumnStatus.HeaderText" xml:space="preserve">
|
||||
<value>Logged In</value>
|
||||
</data>
|
||||
<data name="ColumnStatus.MinimumWidth" type="System.Int32, mscorlib">
|
||||
<value>50</value>
|
||||
</data>
|
||||
<metadata name="ColumnDummy.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="ColumnDummy.HeaderText" xml:space="preserve">
|
||||
<value>Dummy</value>
|
||||
</data>
|
||||
<data name="ColumnDummy.Visible" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="ColumnDummy.Width" type="System.Int32, mscorlib">
|
||||
<value>5</value>
|
||||
<data name="ColumnStatus.Width" type="System.Int32, mscorlib">
|
||||
<value>87</value>
|
||||
</data>
|
||||
<metadata name="contextMenuStripADBox.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
@ -854,12 +859,6 @@
|
||||
<data name=">>ColumnStatus.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>ColumnDummy.Name" xml:space="preserve">
|
||||
<value>ColumnDummy</value>
|
||||
</data>
|
||||
<data name=">>ColumnDummy.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>AdPage</value>
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user