// This sets up a NSTableView for demonstration internal static NSView SetupTableView(CGRect frame) { // Create our NSTableView and set it's frame to a reasonable size. It will be autosized via the NSClipView NSTableView tableView = new NSTableView() { Frame = frame }; // Just like NSOutlineView, NSTableView expects at least one column tableView.AddColumn(new NSTableColumn("Values")); tableView.AddColumn(new NSTableColumn("Data")); // Setup the Delegate/DataSource instances to be interrogated for data and view information // In Unified, these take an interface instead of a base class and you can combine these into // one instance. tableView.DataSource = new TableDataSource(); tableView.Delegate = new TableDelegate(); // NSTableView expects to be hosted inside an NSClipView and won't draw correctly otherwise NSClipView clipView = new NSClipView(frame) { AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable }; clipView.DocumentView = tableView; return(clipView); }
private void InitialiseDefaultTableView() { MainTableView = splitViewController.propViewController.PropTableView; RemoveTableColumns(); //Populate appropriate columns NSTableColumn col = new NSTableColumn("Attribute"); col.HeaderCell.Title = "Attribute"; col.HeaderCell.Alignment = NSTextAlignment.Center; col.DataCell = new NSBrowserCell(); col.MinWidth = 250; col.ResizingMask = NSTableColumnResizing.UserResizingMask; MainTableView.AddColumn(col); NSTableColumn col1 = new NSTableColumn("Value"); col1.HeaderCell.Title = "Value"; col1.ResizingMask = NSTableColumnResizing.UserResizingMask; col1.HeaderCell.Alignment = NSTextAlignment.Center; col1.MinWidth = 250; MainTableView.AddColumn(col1); NSTableColumn col2 = new NSTableColumn("Syntax"); col2.HeaderCell.Title = "Syntax"; col2.ResizingMask = NSTableColumnResizing.UserResizingMask; col2.HeaderCell.Alignment = NSTextAlignment.Center; col2.MinWidth = 200; MainTableView.AddColumn(col2); }
private void InitializePreviewTable(NSTableView table) { var columns = table.TableColumns(); columns[0].SetIdentifier(FixCommonErrorsPreviewTableDelegate.CellIdentifiers[0]); columns[0].MinWidth = 50; columns[0].MaxWidth = 200; columns[0].Width = 60; var bc = new NSButtonCell(); bc.SetButtonType(NSButtonType.OnOff); columns[0].Title = Configuration.Settings.Language.General.Apply; columns[1].SetIdentifier(FixCommonErrorsPreviewTableDelegate.CellIdentifiers[1]); columns[1].MinWidth = 100; columns[1].MaxWidth = 600; columns[1].Width = 250; columns[1].Title = Configuration.Settings.Language.FixCommonErrors.Fixes; table.AddColumn(new NSTableColumn(FixCommonErrorsPreviewTableDelegate.CellIdentifiers[2]) { MinWidth = 100, MaxWidth = 2000, Width = 250, Title = Configuration.Settings.Language.General.Before, }); table.AddColumn(new NSTableColumn(FixCommonErrorsPreviewTableDelegate.CellIdentifiers[3]) { MinWidth = 100, MaxWidth = 2000, Width = 250, Title = Configuration.Settings.Language.General.After, }); }
private void InitializeTable(NSTableView table) { var columns = table.TableColumns(); columns[0].SetIdentifier(PreviewTableDelegate.CellIdentifiers[0]); columns[0].MinWidth = 50; columns[0].MaxWidth = 200; columns[0].Width = 60; var bc = new NSButtonCell(); bc.SetButtonType(NSButtonType.OnOff); // columns[0].DataCell = bc; columns[0].Title = Configuration.Settings.Language.General.Apply; columns[1].SetIdentifier(PreviewTableDelegate.CellIdentifiers[1]); columns[1].MinWidth = 50; columns[1].MaxWidth = 200; columns[1].Width = 60; columns[1].Title = Configuration.Settings.Language.General.LineNumber; table.AddColumn(new NSTableColumn(PreviewTableDelegate.CellIdentifiers[2]) { MinWidth = 100, MaxWidth = 2000, Width = 250, Title = Configuration.Settings.Language.General.Before, }); table.AddColumn(new NSTableColumn(PreviewTableDelegate.CellIdentifiers[3]) { MinWidth = 100, MaxWidth = 2000, Width = 250, Title = Configuration.Settings.Language.General.After, }); }
public void RefreshTableViewsBasedOnSelection(nint row) { UIErrorHelper.CheckedExec(delegate() { if (row >= (nint)0) { NSObject item = splitViewController.MainOutlineView.ItemAtRow((int)row); NSTableView table = splitViewController.MainTableView; RemoveTableColumns(); if (item is VecsPrivateKeysNode) { SearchToolBarItem.Active = true; DisplayRightPanePrivateKeysView(item); } else if (item is VecsSecretKeysNode) { SearchToolBarItem.Active = false; DisplayRightPaneSecretKeysView(item); } else if (item is VecsTrustedCertsNode) { SearchToolBarItem.Active = true; DisplayRightPaneTrustedCertsView(item); } else if (item is ChildScopeNode) { // Display generic childscope nodes with children SearchToolBarItem.Active = false; NSTableColumn col = new NSTableColumn("Name"); col.HeaderCell.Title = "Name"; col.DataCell = new NSBrowserCell(); col.Width = 160; table.AddColumn(col); ChildScopeNode node = item as ChildScopeNode; splitViewController.MainTableView.DataSource = new NodesListView(node.Children, Servernode.ServerDTO); } else if (item is ScopeNode) { //Display root node children SearchToolBarItem.Active = false; NSTableColumn col = new NSTableColumn("Name"); col.HeaderCell.Title = "Name"; col.DataCell = new NSBrowserCell(); col.Width = 160; table.AddColumn(col); ScopeNode node = item as ScopeNode; splitViewController.MainTableView.DataSource = new NodesListView(node.Children, null); } table.ReloadData(); } }); }
private void InitializeTable(NSTableView table) { var columns = table.TableColumns(); columns[0].SetIdentifier(AutoBackupTableDelegate.CellIdentifiers[0]); columns[0].MinWidth = 110; columns[0].MaxWidth = 200; columns[0].Width = 140; columns[0].Title = Configuration.Settings.Language.RestoreAutoBackup.DateAndTime; columns[1].SetIdentifier(AutoBackupTableDelegate.CellIdentifiers[1]); columns[1].MinWidth = 140; columns[1].MaxWidth = 10200; columns[1].Width = 260; columns[1].Title = Configuration.Settings.Language.RestoreAutoBackup.FileName; table.AddColumn(new NSTableColumn(AutoBackupTableDelegate.CellIdentifiers[2]) { MinWidth = 50, MaxWidth = 200, Width = 70, Title = Configuration.Settings.Language.RestoreAutoBackup.Extension, }); table.AddColumn(new NSTableColumn(AutoBackupTableDelegate.CellIdentifiers[3]) { MinWidth = 60, MaxWidth = 150, Width = 90, Title = Configuration.Settings.Language.General.Size, }); //2011-12-13_20-19-18_title if (Directory.Exists(Configuration.AutoBackupFolder)) { var autoBackupItems = new List <AutoBackupItem>(); var files = Directory.GetFiles(Configuration.AutoBackupFolder, "*.*"); foreach (string fileName in files) { if (fileNamePattern.IsMatch(Path.GetFileName(fileName))) { autoBackupItems.Add(new AutoBackupItem(fileName)); } } autoBackupItems = autoBackupItems.OrderBy(p => p.DisplayDate).ToList(); var ds = new AutoBackupTableDataSource(autoBackupItems); table.DataSource = ds; table.Delegate = new AutoBackupTableDelegate(ds); } }
public ServerTable(CGRect frame) { Table = new NSTableView() { Frame = frame }; foreach (var kvp in coldefs) { NSTableColumn c = new NSTableColumn(kvp.Value); c.HeaderCell.StringValue = kvp.Value; Table.AddColumn(c); } Table.DataSource = new TableDataSource(this); Table.Delegate = new TableDelegate(this); item = NSStatusBar.SystemStatusBar.CreateStatusItem(NSStatusItemLength.Square); item.Title = "S"; item.Menu = new NSMenu(); serverTitle = new NSMenuItem("Servers:"); serverTitle.Enabled = false; item.Menu.AddItem(serverTitle); UpdateBandwidth(null); }
public void RefreshTableViewsBasedOnSelection(nint row) { UIErrorHelper.CheckedExec(delegate() { if (row >= (nint)0) { NSObject item = splitViewController.MainOutlineView.ItemAtRow((int)row); NSTableView table = splitViewController.MainTableView; RemoveTableColumns(); if (item is VMDNSForwardZonesNode || item is VMDNSReverseZonesNode) { DisplayZoneDetails(item); } else if (item is VMDNSZoneEntryNode) { DisplayRecordDetails(item); } else { //Display root node children NSTableColumn col = new NSTableColumn(VMIdentityConstants.NAME_FIELD); col.HeaderCell.Title = VMIdentityConstants.NAME_FIELD; col.DataCell = new NSBrowserCell(); col.Width = 160; table.AddColumn(col); VMDNSRootScopeNode node = item as VMDNSRootScopeNode; splitViewController.MainTableView.DataSource = new NodesListView(node.Children, null); } table.ReloadData(); } }); }
public override void AwakeFromNib () { base.AwakeFromNib (); this.BtnClose.Activated += (object sender, EventArgs e) => { this.Close (); NSApplication.SharedApplication.StopModalWithCode (0); }; TableView = new NSTableView (); TableView.Delegate = new TableDelegate (); TableView.Frame = new CoreGraphics.CGRect (20, 20, 450, 450); this.MainTableView.AddSubview (TableView); IList<ComputerDto> computers = new List<ComputerDto> (); ActionHelper.Execute (delegate() { var auth = SnapInContext.Instance.AuthTokenManager.GetAuthToken (ServerDto.ServerName); computers = SnapInContext.Instance.ServiceGateway.Server.GetComputers (ServerDto, auth.Token); }); var listView = new ComputersDataSource { Entries = computers }; var columnNames = new List<ColumnOptions> { new ColumnOptions{ Id = "Name", DisplayName = "Computer Name", DisplayOrder = 1, Width = 300 }, new ColumnOptions{ Id = "DomainController", DisplayName = "Domain Controller", DisplayOrder = 2, Width = 130 } }; var columns = ListViewHelper.ToNSTableColumns (columnNames); foreach (var column in columns) { TableView.AddColumn (column); } TableView.DataSource = listView; TableView.ReloadData (); }
internal void AddTableColumns(NSTableView view) { _tableWidth = 0f; var properties = _classType.GetProperties(); foreach (var property in properties) { float width = 100; string columnTitle = property.Name; ColumnDetail[] columnDetail = property.GetCustomAttributes(typeof(ColumnDetail), false) as ColumnDetail[]; if (columnDetail?.Length == 1) { columnTitle = columnDetail[0].ColumnName; } var tableColumn = new NSTableColumn { Identifier = property.Name, Width = _columnWidths[property.Name], Editable = false, Hidden = _columnVisibility[property.Name], Title = columnTitle, ResizingMask = NSTableColumnResizing.Autoresizing | NSTableColumnResizing.UserResizingMask }; view.AddColumn(tableColumn); _tableWidth += width; } }
internal void AddTableColumns(NSTableView view) { var properties = GetGenericType().GetProperties(); foreach (var property in properties) { float width = 40; string columnTitle = property.Name; ColumnDetail[] columnDetail = property.GetCustomAttributes(typeof(ColumnDetail), false) as ColumnDetail[]; if (columnDetail?.Length == 1) { columnTitle = columnDetail[0].ColumnName; width = columnDetail[0].ColumnWidth; } var tableColumn = new NSTableColumn { Identifier = property.Name, MinWidth = width, Width = width, SortDescriptorPrototype = new NSSortDescriptor(property.Name, true), Editable = false, Hidden = false, Title = columnTitle, ResizingMask = NSTableColumnResizing.Autoresizing | NSTableColumnResizing.UserResizingMask, }; view.AddColumn(tableColumn); } }
public TesterView() : base() { GraphicsPlatform.Register(NativeGraphicsService.Instance); tableSource = new TesterTableViewSource(); tableSource.ScenarioSelected += (drawable) => { graphicsView.Drawable = drawable; graphicsView.InvalidateDrawable(); }; tableView = new NSTableView(); tableView.AddColumn(new NSTableColumn() { Width = 300, }); tableView.Source = tableSource; //tableView.BackgroundColor = NSColor.White; AddSubview(tableView); graphicsView = new NativeGraphicsView(); AddSubview(graphicsView); Layout(); tableView.SelectRow(0, false); }
private void InitializeRulesTable(NSTableView table) { var columns = table.TableColumns(); columns[0].SetIdentifier(FixCommonErrorsTableDelegate.CellIdentifiers[0]); columns[0].MinWidth = 50; columns[0].MaxWidth = 200; columns[0].Width = 60; var bc = new NSButtonCell(); bc.SetButtonType(NSButtonType.OnOff); columns[0].Title = Configuration.Settings.Language.MultipleReplace.Enabled; columns[1].SetIdentifier(FixCommonErrorsTableDelegate.CellIdentifiers[1]); columns[1].MinWidth = 100; columns[1].MaxWidth = 600; columns[1].Width = 250; columns[1].Title = Configuration.Settings.Language.MultipleReplace.FindWhat; table.AddColumn(new NSTableColumn(FixCommonErrorsTableDelegate.CellIdentifiers[2]) { MinWidth = 100, MaxWidth = 2000, Width = 250, Title = Configuration.Settings.Language.MultipleReplace.ReplaceWith, }); _fixActions = InitializeRules(); ShowFixRules(); }
void SetupTableColumns(NSTableView tableView) { /// Update titles column .width var titlesColumn = tableView.FindTableColumn(new NSString("ParameterTitlesTableColumn")); titlesColumn.Width = (nfloat)C.DefaultParameterTextFieldWidth; /// Remove unused `ParameterValuesTableColumn` column var unusedParameterValuesColumn = tableView.FindTableColumn(new NSString("ParameterValuesTableColumn")); if (unusedParameterValuesColumn != null) { tableView.RemoveColumn(unusedParameterValuesColumn); } /// Add columns for each variable (`x*` input process) for (int ind = 0; ind < DataSource.Matrix.Dimension.Rows; ind++) { var propertyTitle = ind < 10 ? $"x0{ind + 1}" : $"x{ind + 1}"; NSTableColumn column = new NSTableColumn(propertyTitle) { Title = propertyTitle, Width = (nfloat)C.DefaultColumnWidth }; tableView.AddColumn(column); } }
public void ReloadTableView(NSTableView tableView, List <HttpTransportViewData> datasource, HttpTransportCollection collection) { // tableView.Delegate = new TableDelegate (this); // var listView = new HttpTransportDataSource { Entries = datasource }; // tableView.DataSource = listView; // tableView.ReloadData (); foreach (NSTableColumn column in tableView.TableColumns()) { tableView.RemoveColumn(column); } tableView.Delegate = new TableDelegate(this); var listView = new HttpTransportDataSource { Entries = datasource, HttpTransportCollection = collection }; var columnNames = new List <ColumnOptions> { new ColumnOptions { Id = "Method", DisplayName = "", DisplayOrder = 1, Width = 60, Type = ColumnType.Text }, new ColumnOptions { Id = "Name", DisplayName = "Name", DisplayOrder = 2, Width = 400, Type = ColumnType.Text } }; var columns = ListViewHelper.ToNSTableColumns(columnNames); foreach (var column in columns) { tableView.AddColumn(column); } tableView.DataSource = listView; tableView.ReloadData(); }
private void ReloadTableView(NSTableView tableView, Dictionary <string, string> datasource) { foreach (NSTableColumn column in tableView.TableColumns()) { tableView.RemoveColumn(column); } tableView.Delegate = new TableDelegate(); var columnNames = new List <ColumnOptions> { new ColumnOptions { Id = "Name", DisplayName = "Name", DisplayOrder = 1, Width = 80 }, new ColumnOptions { Id = "Value", DisplayName = "Value", DisplayOrder = 1, Width = 200 } }; var columns = ListViewHelper.ToNSTableColumns(columnNames); foreach (var column in columns) { tableView.AddColumn(column); } var listView = new DictionaryDataSource { Entries = datasource.Keys.ToList(), Datasource = datasource }; tableView.DataSource = listView; tableView.ReloadData(); }
private void InitializeTable(NSTableView table) { var columns = table.TableColumns(); columns[0].SetIdentifier(AutoBackupTableDelegate.CellIdentifiers[0]); columns[0].MinWidth = 110; columns[0].MaxWidth = 200; columns[0].Width = 140; columns[0].Title = Configuration.Settings.Language.RestoreAutoBackup.DateAndTime; columns[1].SetIdentifier(AutoBackupTableDelegate.CellIdentifiers[1]); columns[1].MinWidth = 140; columns[1].MaxWidth = 10200; columns[1].Width = 260; columns[1].Title = Configuration.Settings.Language.RestoreAutoBackup.FileName; table.AddColumn(new NSTableColumn(AutoBackupTableDelegate.CellIdentifiers[2]) { MinWidth = 50, MaxWidth = 200, Width = 70, Title = Configuration.Settings.Language.RestoreAutoBackup.Extension, }); table.AddColumn(new NSTableColumn(AutoBackupTableDelegate.CellIdentifiers[3]) { MinWidth = 60, MaxWidth = 150, Width = 90, Title = Configuration.Settings.Language.General.Size, }); //2011-12-13_20-19-18_title if (Directory.Exists(Configuration.AutoBackupFolder)) { var autoBackupItems = new List<AutoBackupItem>(); var files = Directory.GetFiles(Configuration.AutoBackupFolder, "*.*"); foreach (string fileName in files) { if (fileNamePattern.IsMatch(Path.GetFileName(fileName))) { autoBackupItems.Add(new AutoBackupItem(fileName)); } } autoBackupItems = autoBackupItems.OrderBy(p => p.DisplayDate).ToList(); var ds = new AutoBackupTableDataSource(autoBackupItems); table.DataSource = ds; table.Delegate = new AutoBackupTableDelegate(ds); } }
public virtual NSTableColumn AddColumn(ListViewColumn col) { var tcol = new TableColumn(ApplicationContext, this, Table); cols.Add(tcol); tcol.UpdateColumn(col); Table.AddColumn(tcol); return(tcol); }
public static NSTableView ToNSTableView(List<ColumnOptions> options, NSTableViewDataSource nodeListView) { var view = new NSTableView (); var columns = ToNSTableColumns (options); foreach (var column in columns) view.AddColumn (column); view.DataSource = nodeListView; return view; }
/// <summary> /// Gets the NS table view from column options. /// </summary> /// <returns>The NS table view.</returns> /// <param name="options">Options.</param> /// <param name="nodeListView">Node list view.</param> public static NSTableView ToNSTableView(List <ColumnOptions> options, NSTableViewDataSource nodeListView) { var view = new NSTableView(); var columns = ToNSTableColumns(options); foreach (var column in columns) { view.AddColumn(column); } view.DataSource = nodeListView; return(view); }
public override void AwakeFromNib() { base.AwakeFromNib(); UserDto = UserDtoOriginal.DeepCopy(); Groups = new List <GroupDto> (GroupsOriginal); TxtUsername.StringValue = UserDto.Name == null ? string.Empty : UserDto.Name; TxtFirstName.StringValue = UserDto.PersonDetails.FirstName == null ? string.Empty : UserDto.PersonDetails.FirstName; TxtLastName.StringValue = UserDto.PersonDetails.LastName == null ? string.Empty : UserDto.PersonDetails.LastName; TxtEmail.StringValue = UserDto.PersonDetails.EmailAddress == null ? string.Empty : UserDto.PersonDetails.EmailAddress; TxtDescription.StringValue = UserDto.PersonDetails.Description == null ? string.Empty : UserDto.PersonDetails.Description; if (UserDto.PasswordDetails != null) { TxtPasswordLastChanged.StringValue = DateTimeHelper.UnixToWindows((long)UserDto.PasswordDetails.LastSet).ToString("dd-MMM-yyyy hh:mm:ss"); TxtPasswordDaysUntilExpiry.StringValue = SecondsToDaysAndHours(UserDto.PasswordDetails.Lifetime); } ChDisabled.StringValue = UserDto.Disabled ? "0" : "1"; //Window.Title = UserDto.Name + "@" + UserDto.Domain + " Properties"; ChActAsUser.StringValue = UserDto.ActAsUsers ? "1" : "0"; ChIdpAdmin.StringValue = UserDto.IsIdpAdmin ? "1" : "0"; RdoRoleGroup.SelectCell(new NSCell(UserDto.Role.ToString())); lstGroups = new NSTableView(); lstGroups.Delegate = new TableDelegate(); this.LstGroupMembershipView.AddSubview(lstGroups); var listView = new GroupsDataSource { Entries = Groups }; var columnNames = new List <ColumnOptions> { new ColumnOptions { Id = "Name", DisplayName = "Group Name", DisplayOrder = 1, Width = 300 } }; var columns = ListViewHelper.ToNSTableColumns(columnNames); foreach (var column in columns) { lstGroups.AddColumn(column); } lstGroups.DataSource = listView; lstGroups.ReloadData(); //Events this.BtnSave.Activated += OnClickSaveButton; this.BtnAddGroup.Activated += OnClickAddGroupButton; this.BtnRemoveGroup.Activated += OnClickRemoveGroupButton; // this.BtnClose.Activated += (object sender, EventArgs e) => { // this.Close (); // NSApplication.SharedApplication.StopModalWithCode (0); // }; }
public virtual NSTableColumn AddColumn (ListViewColumn col) { var tcol = new NSTableColumn (); tcol.Editable = true; cols.Add (tcol); var c = CellUtil.CreateCell (ApplicationContext, Table, this, col.Views, cols.Count - 1); tcol.DataCell = c; Table.AddColumn (tcol); var hc = new NSTableHeaderCell (); hc.Title = col.Title ?? ""; tcol.HeaderCell = hc; Widget.InvalidateIntrinsicContentSize (); return tcol; }
public static NSTableView AsListViewLook(this NSTableView self) { self.SelectionHighlightStyle = NSTableViewSelectionHighlightStyle.SourceList; self.AllowsColumnReordering = false; self.AllowsColumnResizing = false; self.AllowsColumnSelection = false; //this is needed .. can we go around it ? self.AddColumn(new NSTableColumn("1")); //this line hides the header by default self.HeaderView = new CustomNSTableHeaderView(); return(self); }
// This sets up a NSTableView for demonstration internal static NSView SetupTableView (CGRect frame) { // Create our NSTableView and set it's frame to a reasonable size. It will be autosized via the NSClipView NSTableView tableView = new NSTableView () { Frame = frame }; // Just like NSOutlineView, NSTableView expects at least one column tableView.AddColumn (new NSTableColumn ("Values")); tableView.AddColumn (new NSTableColumn ("Data")); // Setup the Delegate/DataSource instances to be interrogated for data and view information // In Unified, these take an interface instead of a base class and you can combine these into // one instance. tableView.DataSource = new TableDataSource (); tableView.Delegate = new TableDelegate (); NSScrollView scrollView = new NSScrollView (frame) { AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable }; scrollView.DocumentView = tableView; return scrollView; }
private void InitializeSubtitleTable(NSTableView table) { var columns = table.TableColumns(); columns[0].SetIdentifier(SubtitleTableDelegate.CellIdentifiers[0]); columns[0].MinWidth = 20; columns[0].MaxWidth = 100; columns[0].Width = 40; columns[0].Title = Configuration.Settings.Language.General.LineNumber; columns[1].SetIdentifier(SubtitleTableDelegate.CellIdentifiers[1]); columns[1].MinWidth = 50; columns[1].MaxWidth = 200; columns[1].Width = 90; columns[1].Title = Configuration.Settings.Language.General.StartTime; table.AddColumn(new NSTableColumn(SubtitleTableDelegate.CellIdentifiers[2]) { MinWidth = 50, MaxWidth = 200, Width = 90, Title = Configuration.Settings.Language.General.EndTime, }); table.AddColumn(new NSTableColumn(SubtitleTableDelegate.CellIdentifiers[3]) { MinWidth = 40, MaxWidth = 150, Width = 60, Title = Configuration.Settings.Language.General.Duration, }); table.AddColumn(new NSTableColumn(SubtitleTableDelegate.CellIdentifiers[4]) { MinWidth = 100, MaxWidth = 90000, Width = 1000, Title = Configuration.Settings.Language.General.Text, }); ShowSubtitle(); }
public virtual object AddColumn(ListViewColumn col) { var tcol = new NSTableColumn(); cols.Add(tcol); var c = CellUtil.CreateCell(this, col.Views); tcol.DataCell = c; Table.AddColumn(tcol); var hc = new NSTableHeaderCell(); hc.Title = col.Title; tcol.HeaderCell = hc; return(tcol); }
public HUITableView(CGRect rect) { _tableView = new NSTableView(rect); _tableView.AddColumn(new NSTableColumn("ListView")); _tableView.HeaderView = null; _tableView.SizeLastColumnToFit(); _delegate = new HUITableViewSource(_tableView); _tableView.WeakDataSource = _delegate; _tableView.WeakDelegate = _delegate; DocumentView = _tableView; HasVerticalScroller = true; }
/// <summary> /// Reloads the main table. /// </summary> /// <param name="tableView">Table view.</param> /// <param name="columnNames">Column names.</param> /// <param name="filteredHosts">Filtered hosts.</param> private void ReloadMainTable(NSTableView tableView, List <ColumnOptions> columnNames, List <NodeDto> filteredHosts) { var columns = NSTableColumnHelper.ToNSTableColumns(columnNames); while (tableView.ColumnCount > 0) { tableView.RemoveColumn(tableView.TableColumns() [0]); } foreach (var column in columns) { tableView.AddColumn(column); } tableView.DataSource = new NodeDataSource(filteredHosts); tableView.ReloadData(); }
public static void SetDataSourceEx(this NSTableView tableView, DataTable dataTable) { tableView.RemoveAllColumns(); //dataTable.Columns[0].ColumnMapping = MappingType.Hidden; dataTable.Columns.Cast <DataColumn>().ForEach(c => { var col = new NSTableColumn(); col.HeaderCell.Title = c.ColumnName; col.HeaderToolTip = c.ColumnName; col.Hidden = c.ColumnMapping == MappingType.Hidden; tableView.AddColumn(col); }); tableView.SizeLastColumnToFit(); tableView.DataSource = new ADOTableViewDataSource(dataTable); tableView.ReloadData(); }
public ListViewHandler() { TableView = new NSTableView(new CGRect(0, 0, 500, 500)); TableView.AddColumn(new NSTableColumn("ListView")); TableView.HeaderView = null; //TableView.UsesAutomaticRowHeights = true; TableView.RowHeight = 44; TableView.SizeLastColumnToFit(); TableView.WeakDataSource = this; TableView.WeakDelegate = this; AddSubview(tableViewContainer = new NSScrollView(new CGRect(0, 0, 500, 500))); tableViewContainer.DocumentView = TableView; tableViewContainer.HasVerticalScroller = true; }
public virtual object AddColumn(ListViewColumn col) { var tcol = new NSTableColumn(); cols.Add(tcol); var c = CellUtil.CreateCell(this, col.Views); tcol.DataCell = c; Table.AddColumn(tcol); var hc = new NSTableHeaderCell(); hc.Title = col.Title ?? ""; tcol.HeaderCell = hc; Widget.InvalidateIntrinsicContentSize(); return(tcol); }
private void InitTableColumns(string[] columnIdentifier, NSTableView tableView) { var columns = tableView.TableColumns().ToList(); foreach (var column in columns) { tableView.RemoveColumn(column); } for (int i = 0; i < columnIdentifier.Count(); i++) { var column = new NSTableColumn(); column.Identifier = columnIdentifier[i]; column.Title = column.Identifier; column.Width = 150; tableView.AddColumn(column); } }
public ServerTable(CGRect frame) { Table = new NSTableView() { Frame = frame }; foreach (var kvp in coldefs) { NSTableColumn c = new NSTableColumn(kvp.Value); c.HeaderCell.StringValue = kvp.Value; Table.AddColumn(c); } Table.DataSource = new TableDataSource(this); Table.Delegate = new TableDelegate(this); UpdateBandwidth(null); }
public virtual NSTableColumn AddColumn(ListViewColumn col) { var tcol = new NSTableColumn(); tcol.Editable = true; cols.Add(tcol); var c = CellUtil.CreateCell(ApplicationContext, Table, this, col.Views, cols.Count - 1); tcol.DataCell = c; Table.AddColumn(tcol); var hc = new NSTableHeaderCell(); hc.Title = col.Title ?? ""; tcol.HeaderCell = hc; tcol.HeaderCell.Alignment = col.Alignment.ToNSTextAlignment(); tcol.ResizingMask = col.CanResize ? NSTableColumnResizing.UserResizingMask : NSTableColumnResizing.Autoresizing; tcol.SizeToFit(); Widget.InvalidateIntrinsicContentSize(); return(tcol); }
public override void ViewDidLoad() { base.ViewDidLoad(); var column = new MvxTableColumn(); column.Identifier = "First"; column.BindingText = "Text Name"; column.HeaderCell = new NSCell("Example"); _tableView.AddColumn(column); var source = new MvxTableViewSource(_tableView); _tableView.Source = source; var set = this.CreateBindingSet <FirstViewController, FirstViewModel> (); set.Bind(source).For(v => v.ItemsSource).To(vm => vm.Tests); set.Bind(source).For(v => v.SelectionChangedCommand).To(vm => vm.GotoTestCommand); set.Apply(); }
public void ReloadTableView(NSTableView tableView, List<HttpTransportViewData> datasource, HttpTransportCollection collection) { // tableView.Delegate = new TableDelegate (this); // var listView = new HttpTransportDataSource { Entries = datasource }; // tableView.DataSource = listView; // tableView.ReloadData (); foreach(NSTableColumn column in tableView.TableColumns()) { tableView.RemoveColumn (column); } tableView.Delegate = new TableDelegate (this); var listView = new HttpTransportDataSource { Entries = datasource, HttpTransportCollection = collection }; var columnNames = new List<ColumnOptions> { new ColumnOptions{ Id = "Method", DisplayName = "", DisplayOrder = 1, Width = 60, Type = ColumnType.Text }, new ColumnOptions{ Id = "Name", DisplayName = "Name", DisplayOrder = 2, Width = 400, Type = ColumnType.Text } }; var columns = ListViewHelper.ToNSTableColumns (columnNames); foreach (var column in columns) { tableView.AddColumn (column); } tableView.DataSource = listView; tableView.ReloadData (); }
private void ReloadTableView(NSTableView tableView, Dictionary<string,string> datasource) { foreach(NSTableColumn column in tableView.TableColumns()) { tableView.RemoveColumn (column); } tableView.Delegate = new TableDelegate (); var columnNames = new List<ColumnOptions> { new ColumnOptions{ Id = "Name", DisplayName = "Name", DisplayOrder = 1, Width = 80 }, new ColumnOptions{ Id = "Value", DisplayName = "Value", DisplayOrder = 2, Width = 200 } }; var columns = ListViewHelper.ToNSTableColumns (columnNames); foreach (var column in columns) { tableView.AddColumn (column); } var listView = new DictionaryDataSource { Entries = datasource.Keys.ToList(), Datasource = datasource }; tableView.DataSource = listView; tableView.ReloadData (); }
private void InitialiseDefaultTableView () { MainTableView = splitViewController.MainTableView; RemoveTableColumns (); //Populate appropriate columns NSTableColumn col = new NSTableColumn ("Key"); col.HeaderCell.Title = "Attribute"; col.HeaderCell.Alignment = NSTextAlignment.Center; col.DataCell = new NSBrowserCell (); col.MinWidth = 200; col.ResizingMask = NSTableColumnResizing.UserResizingMask; MainTableView.AddColumn (col); NSTableColumn col1 = new NSTableColumn ("Value"); col1.HeaderCell.Title = "Value"; col1.ResizingMask = NSTableColumnResizing.UserResizingMask; col1.HeaderCell.Alignment = NSTextAlignment.Center; col1.MinWidth = 200; MainTableView.AddColumn (col1); MainTableView.Delegate = new GenericTableDelegate (); }
public SelectEncodingPanel () : base () { var size = new CGSize (600, 400); const float padding = 12; this.SetContentSize (size); var view = new NSView (new CGRect (0, 0, size.Width, size.Height)); var okButton = new NSButton { Title = GettextCatalog.GetString ("OK"), Bordered = true, BezelStyle = NSBezelStyle.Rounded, }; okButton.SetButtonType (NSButtonType.MomentaryPushIn); okButton.Activated += delegate { Dismiss (1); }; this.DefaultButtonCell = okButton.Cell; var cancelButton = new NSButton { Title = GettextCatalog.GetString ("Cancel"), Bordered = true, BezelStyle = NSBezelStyle.Rounded, }; cancelButton.Activated += delegate { Dismiss (0); }; var buttonBox = new MDBox (LayoutDirection.Horizontal, padding, 0) { new MDAlignment (cancelButton, true) { MinWidth = 96, MinHeight = 32 }, new MDAlignment (okButton, true) { MinWidth = 96, MinHeight = 32 }, }; buttonBox.Layout (); var buttonView = buttonBox.View; var buttonRect = buttonView.Frame; buttonRect.Y = 12; buttonRect.X = size.Width - buttonRect.Width - padding; buttonView.Frame = buttonRect; view.AddSubview (buttonView); var buttonAreaTop = buttonRect.Height + padding * 2; var label = CreateLabel (GettextCatalog.GetString ("Available encodings:")); var labelSize = label.Frame.Size; var labelBottom = size.Height - 12 - labelSize.Height; label.Frame = new CGRect (12, labelBottom, labelSize.Width, labelSize.Height); view.AddSubview (label); var moveButtonWidth = 32; var tableHeight = labelBottom - buttonAreaTop - padding; var tableWidth = size.Width / 2 - padding * 3 - moveButtonWidth + padding / 2; allTable = new NSTableView (new CGRect (padding, buttonAreaTop, tableWidth, tableHeight)); allTable.HeaderView = null; var allScroll = new NSScrollView (allTable.Frame) { BorderType = NSBorderType.BezelBorder, AutohidesScrollers = true, HasVerticalScroller = true, DocumentView = allTable, }; view.AddSubview (allScroll); nfloat center = (size.Width + padding) / 2; var selectedLabel = CreateLabel (GettextCatalog.GetString ("Encodings shown in menu:")); var selectedLabelSize = selectedLabel.Frame.Size; selectedLabel.Frame = new CGRect (center, labelBottom, selectedLabelSize.Width, selectedLabelSize.Height); view.AddSubview (selectedLabel); selectedTable = new NSTableView (new CGRect (center, buttonAreaTop, tableWidth, tableHeight)); selectedTable.HeaderView = null; var selectedScroll = new NSScrollView (selectedTable.Frame) { BorderType = NSBorderType.BezelBorder, AutohidesScrollers = true, HasVerticalScroller = true, DocumentView = selectedTable, }; view.AddSubview (selectedScroll); var buttonLevel = tableHeight / 2 + buttonAreaTop; var goRightImage = NSImage.ImageNamed ("NSGoRightTemplate"); addButton = new NSButton ( new CGRect (tableWidth + padding * 2, buttonLevel + padding / 2, moveButtonWidth, moveButtonWidth)) { //Title = "\u2192", BezelStyle = NSBezelStyle.SmallSquare, Image = goRightImage }; addButton.Activated += Add; view.AddSubview (addButton); removeButton = new NSButton ( new CGRect (tableWidth + padding * 2, buttonLevel - padding / 2 - moveButtonWidth, moveButtonWidth, moveButtonWidth)) { //Title = "\u2190", BezelStyle = NSBezelStyle.SmallSquare, Image = NSImage.ImageNamed ("NSGoLeftTemplate"), }; removeButton.Activated += Remove; view.AddSubview (removeButton); upButton = new NSButton ( new CGRect (center + tableWidth + padding, buttonLevel + padding / 2, moveButtonWidth, moveButtonWidth)) { //Title = "\u2191", BezelStyle = NSBezelStyle.SmallSquare, Image = MakeRotatedCopy (goRightImage, 90), }; upButton.Activated += MoveUp; view.AddSubview (upButton); downButton = new NSButton ( new CGRect (center + tableWidth + padding, buttonLevel - padding / 2 - moveButtonWidth, moveButtonWidth, moveButtonWidth)) { //Title = "\u2193", BezelStyle = NSBezelStyle.SmallSquare, Image = MakeRotatedCopy (goRightImage, -90), }; downButton.Activated += MoveDown; view.AddSubview (downButton); var allColumn = new NSTableColumn { DataCell = new NSTextFieldCell { Wraps = true }, Width = tableWidth }; allTable.AddColumn (allColumn); allTable.DataSource = allSource = new EncodingSource (TextEncoding.SupportedEncodings); allTable.Delegate = new EncodingAllDelegate (this); var selectedColumn = new NSTableColumn { DataCell = new NSTextFieldCell { Wraps = true }, Width = tableWidth }; selectedTable.AddColumn (selectedColumn); selectedTable.DataSource = selectedSource = new EncodingSource (TextEncoding.ConversionEncodings); selectedTable.Delegate = new EncodingSelectedDelegate (this); UpdateButtons (); this.ContentView = view; }
private void InitializeRulesTable(NSTableView table) { var columns = table.TableColumns(); columns[0].SetIdentifier(MultipleRulesTableDelegate.CellIdentifiers[0]); columns[0].MinWidth = 50; columns[0].MaxWidth = 200; columns[0].Width = 60; var bc = new NSButtonCell(); bc.SetButtonType(NSButtonType.OnOff); columns[0].Title = Configuration.Settings.Language.MultipleReplace.Enabled; columns[1].SetIdentifier(MultipleRulesTableDelegate.CellIdentifiers[1]); columns[1].MinWidth = 100; columns[1].MaxWidth = 600; columns[1].Width = 250; columns[1].Title = Configuration.Settings.Language.MultipleReplace.FindWhat; table.AddColumn(new NSTableColumn(MultipleRulesTableDelegate.CellIdentifiers[2]) { MinWidth = 100, MaxWidth = 2000, Width = 250, Title = Configuration.Settings.Language.MultipleReplace.ReplaceWith, }); table.AddColumn(new NSTableColumn(MultipleRulesTableDelegate.CellIdentifiers[3]) { MinWidth = 100, MaxWidth = 2000, Width = 250, Title = Configuration.Settings.Language.MultipleReplace.SearchType, }); _rulesContextMenuDelete.Activated += (object sender, EventArgs e) => { var index = (int)_rulesTable.SelectedRow; if (index >= 0 && index < MultipleSearchAndReplaceList.Count) { MultipleSearchAndReplaceList.RemoveAt(index); ShowRules(MultipleSearchAndReplaceList); if (index >= MultipleSearchAndReplaceList.Count) { index--; } if (index >= 0) { _rulesTable.SelectRow((nint)index, false); } } }; _rulesContextMenuMoveUp.Activated += (object sender, EventArgs e) => { var index = (int)_rulesTable.SelectedRow; if (index > 0 && index < MultipleSearchAndReplaceList.Count) { var item = MultipleSearchAndReplaceList[index]; MultipleSearchAndReplaceList.RemoveAt(index); MultipleSearchAndReplaceList.Insert(index - 1, item); ShowRules(MultipleSearchAndReplaceList); _rulesTable.SelectRow((nint)index - 1, false); } }; _rulesContextMenuMoveDown.Activated += (object sender, EventArgs e) => { var index = (int)_rulesTable.SelectedRow; if (index >= 0 && index < MultipleSearchAndReplaceList.Count - 1) { var item = MultipleSearchAndReplaceList[index]; MultipleSearchAndReplaceList.RemoveAt(index); MultipleSearchAndReplaceList.Insert(index + 1, item); ShowRules(MultipleSearchAndReplaceList); _rulesTable.SelectRow((nint)index + 1, false); } }; }
public override void AwakeFromNib () { base.AwakeFromNib (); UserDto = UserDtoOriginal.DeepCopy (); Groups = new List<GroupDto> (GroupsOriginal); TxtUsername.StringValue = UserDto.Name == null ? string.Empty : UserDto.Name; TxtFirstName.StringValue = UserDto.PersonDetails.FirstName == null ? string.Empty : UserDto.PersonDetails.FirstName; TxtLastName.StringValue = UserDto.PersonDetails.LastName == null ? string.Empty : UserDto.PersonDetails.LastName; TxtEmail.StringValue = UserDto.PersonDetails.EmailAddress == null ? string.Empty : UserDto.PersonDetails.EmailAddress; TxtDescription.StringValue = UserDto.PersonDetails.Description == null ? string.Empty : UserDto.PersonDetails.Description; if (UserDto.PasswordDetails != null) { TxtPasswordLastChanged.StringValue = DateTimeHelper.UnixToWindows ((long)UserDto.PasswordDetails.LastSet).ToString ("dd-MMM-yyyy hh:mm:ss"); TxtPasswordDaysUntilExpiry.StringValue = SecondsToDaysAndHours (UserDto.PasswordDetails.Lifetime); } ChDisabled.StringValue = UserDto.Disabled ? "0" : "1"; //Window.Title = UserDto.Name + "@" + UserDto.Domain + " Properties"; ChActAsUser.StringValue = UserDto.ActAsUsers ? "1" : "0"; ChIdpAdmin.StringValue = UserDto.IsIdpAdmin ? "1" : "0"; RdoRoleGroup.SelectCell (new NSCell (UserDto.Role.ToString ())); lstGroups = new NSTableView (); lstGroups.Delegate = new TableDelegate (); this.LstGroupMembershipView.AddSubview (lstGroups); var listView = new GroupsDataSource { Entries = Groups }; var columnNames = new List<ColumnOptions> { new ColumnOptions{ Id = "Name", DisplayName = "Group Name", DisplayOrder = 1, Width = 300 } }; var columns = ListViewHelper.ToNSTableColumns (columnNames); foreach (var column in columns) { lstGroups.AddColumn (column); } lstGroups.DataSource = listView; lstGroups.ReloadData (); //Events this.BtnSave.Activated += OnClickSaveButton; this.BtnAddGroup.Activated += OnClickAddGroupButton; this.BtnRemoveGroup.Activated += OnClickRemoveGroupButton; // this.BtnClose.Activated += (object sender, EventArgs e) => { // this.Close (); // NSApplication.SharedApplication.StopModalWithCode (0); // }; }