public ReorderColumnState(TreeViewAdv tree, TreeColumn column, Point initialMouseLocation) : base(tree, column) { _location = new Point(initialMouseLocation.X + Tree.OffsetX, 0); _dragOffset = tree.GetColumnX(column) - initialMouseLocation.X; _ghostImage = column.CreateGhostImage(new Rectangle(0, 0, column.Width, tree.ColumnHeaderHeight), tree.Font); }
public override bool MouseMove(MouseEventArgs args) { _dropColumn = null; _location = new Point(args.X + Tree.OffsetX, 0); int x = 0; foreach (TreeColumn c in Tree.Columns) { if (c.IsVisible) { if (_location.X < x + c.Width / 2) { _dropColumn = c; break; } x += c.Width; } } Tree.UpdateHeaders(); return true; }
/// <summary> /// Saves the column settings of the specified TreeViewAdv to a string. /// </summary> /// <param name="lv"></param> /// <returns></returns> public static string SaveSettings(TreeViewAdv tv) { StringBuilder result = new StringBuilder(); try { for (int i = 0; i < tv.Columns.Count; i++) { TreeColumn c = tv.Columns[i]; result.Append(c.Header + "," + c.Width.ToString() + "," + c.SortOrder.ToString() + "," + c.IsVisible.ToString() + "|"); } } catch { } if (result.Length > 0) { result.Remove(result.Length - 1, 1); } return(result.ToString()); }
private void InitializeColumnHeaders() { // // tcProcessIcon // _tcProcessIcon = new TreeColumn { Header = "Process", SortOrder = SortOrder.None, TooltipText = null, Width = 250 }; // // tcProcessPid // _tcProcessPid = new TreeColumn { Header = "Pid", SortOrder = SortOrder.None, TooltipText = null }; }
protected void Sort(TreeColumn aColumn) { _sortedTreeModel.Comparer = new NodeSorter(aColumn, this); }
private void InvertSortOrderOf(TreeColumn aColun) { aColun.SortOrder = aColun.SortOrder == SortOrder.Ascending ? SortOrder.Descending : SortOrder.Ascending; }
/// <summary> /// /// </summary> public ManageRoutesForm() { InitializeComponent(); Program.NetClient.OnRouteListRecieved += RoutesRecieved; Program.NetClient.OnTagListRecieved += TagsRecieved; Model = new TreeModel(); MainTreeView.Model = Model; TreeColumn SourceColumn = new TreeColumn(); SourceColumn.Header = "Source"; SourceColumn.Width = 200; MainTreeView.Columns.Add(SourceColumn); ScaledNodeIcon IconControl = new ScaledNodeIcon(); IconControl.ParentColumn = SourceColumn; IconControl.DataPropertyName = "Icon"; IconControl.FixedSize = new Size((int)(MainTreeView.RowHeight * 1.25f), (int)(MainTreeView.RowHeight * 1.25f)); IconControl.Offset = new Size(0, 5); MainTreeView.NodeControls.Add(IconControl); TagListTreeNode TextControl = new TagListTreeNode(); TextControl.ParentColumn = SourceColumn; TextControl.ShowFullName = true; TextControl.DataPropertyName = "SourceTags"; MainTreeView.NodeControls.Add(TextControl); TreeColumn DestinationColumn = new TreeColumn(); DestinationColumn.Header = "Destination"; DestinationColumn.Width = 200; MainTreeView.Columns.Add(DestinationColumn); TagListTreeNode DestinationTextControl = new TagListTreeNode(); DestinationTextControl.ParentColumn = DestinationColumn; DestinationTextControl.DataPropertyName = "DestinationTags"; DestinationTextControl.ShowFullName = true; MainTreeView.NodeControls.Add(DestinationTextControl); TreeColumn BlacklistedColumn = new TreeColumn(); BlacklistedColumn.Header = "Blacklisted"; BlacklistedColumn.Width = 200; MainTreeView.Columns.Add(BlacklistedColumn); NodeTextBox BlacklistedTextControl = new NodeTextBox(); BlacklistedTextControl.ParentColumn = BlacklistedColumn; BlacklistedTextControl.DataPropertyName = "Blacklisted"; MainTreeView.NodeControls.Add(BlacklistedTextControl); TreeColumn BandwidthColumn = new TreeColumn(); BandwidthColumn.Header = "Bandwidth Limit"; BandwidthColumn.Width = 200; MainTreeView.Columns.Add(BandwidthColumn); NodeTextBox BandwidthTextControl = new NodeTextBox(); BandwidthTextControl.ParentColumn = BandwidthColumn; BandwidthTextControl.DataPropertyName = "BandwidthLimit"; MainTreeView.NodeControls.Add(BandwidthTextControl); }
protected ColumnState(TreeViewAdv tree, TreeColumn column) : base(tree) { this.Column = column; }
public NodeSorter(TreeColumn aColumn, TreeViewAdv aTreeView) { _aColumn = aColumn; _aTreeView = aTreeView; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ComplexConcMorphDlg)); this.m_btnHelp = new System.Windows.Forms.Button(); this.m_btnCancel = new System.Windows.Forms.Button(); this.m_btnOK = new System.Windows.Forms.Button(); this.m_helpProvider = new System.Windows.Forms.HelpProvider(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.m_glossWsComboBox = new System.Windows.Forms.ComboBox(); this.m_glossTextBox = new SIL.FieldWorks.Common.Widgets.FwTextBox(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.m_entryWsComboBox = new System.Windows.Forms.ComboBox(); this.m_entryTextBox = new SIL.FieldWorks.Common.Widgets.FwTextBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.m_formWsComboBox = new System.Windows.Forms.ComboBox(); this.m_formTextBox = new SIL.FieldWorks.Common.Widgets.FwTextBox(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.m_categoryNotCheckBox = new System.Windows.Forms.CheckBox(); this.m_categoryComboBox = new SIL.FieldWorks.Common.Widgets.TreeCombo(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.m_inflFeatsTreeView = new Aga.Controls.Tree.TreeViewAdv(); this.m_featureColumn = new Aga.Controls.Tree.TreeColumn(); this.m_notColumn = new Aga.Controls.Tree.TreeColumn(); this.m_valueColumn = new Aga.Controls.Tree.TreeColumn(); this.m_featureIcon = new Aga.Controls.Tree.NodeControls.NodeIcon(); this.m_featureTextBox = new Aga.Controls.Tree.NodeControls.NodeTextBox(); this.m_valueComboBox = new Aga.Controls.Tree.NodeControls.NodeComboBox(); this.m_inflNotCheckBox = new Aga.Controls.Tree.NodeControls.NodeCheckBox(); this.m_imageList = new System.Windows.Forms.ImageList(this.components); this.groupBox2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.m_glossTextBox)).BeginInit(); this.groupBox3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.m_entryTextBox)).BeginInit(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.m_formTextBox)).BeginInit(); this.groupBox4.SuspendLayout(); this.groupBox5.SuspendLayout(); this.SuspendLayout(); // // m_btnHelp // resources.ApplyResources(this.m_btnHelp, "m_btnHelp"); this.m_btnHelp.Name = "m_btnHelp"; this.m_btnHelp.UseVisualStyleBackColor = true; this.m_btnHelp.Click += new System.EventHandler(this.m_btnHelp_Click); // // m_btnCancel // resources.ApplyResources(this.m_btnCancel, "m_btnCancel"); this.m_btnCancel.Name = "m_btnCancel"; this.m_btnCancel.UseVisualStyleBackColor = true; this.m_btnCancel.Click += new System.EventHandler(this.m_btnCancel_Click); // // m_btnOK // resources.ApplyResources(this.m_btnOK, "m_btnOK"); this.m_btnOK.Name = "m_btnOK"; this.m_btnOK.UseVisualStyleBackColor = true; this.m_btnOK.Click += new System.EventHandler(this.m_btnOK_Click); // // groupBox2 // this.groupBox2.Controls.Add(this.m_glossWsComboBox); this.groupBox2.Controls.Add(this.m_glossTextBox); resources.ApplyResources(this.groupBox2, "groupBox2"); this.groupBox2.Name = "groupBox2"; this.m_helpProvider.SetShowHelp(this.groupBox2, ((bool)(resources.GetObject("groupBox2.ShowHelp")))); this.groupBox2.TabStop = false; // // m_glossWsComboBox // this.m_glossWsComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_glossWsComboBox.FormattingEnabled = true; resources.ApplyResources(this.m_glossWsComboBox, "m_glossWsComboBox"); this.m_glossWsComboBox.Name = "m_glossWsComboBox"; this.m_helpProvider.SetShowHelp(this.m_glossWsComboBox, ((bool)(resources.GetObject("m_glossWsComboBox.ShowHelp")))); this.m_glossWsComboBox.SelectedIndexChanged += new System.EventHandler(this.m_glossWsComboBox_SelectedIndexChanged); // // m_glossTextBox // this.m_glossTextBox.AcceptsReturn = false; this.m_glossTextBox.AdjustStringHeight = true; this.m_glossTextBox.BackColor = System.Drawing.SystemColors.Window; this.m_glossTextBox.controlID = null; resources.ApplyResources(this.m_glossTextBox, "m_glossTextBox"); this.m_glossTextBox.HasBorder = true; this.m_glossTextBox.Name = "m_glossTextBox"; this.m_helpProvider.SetShowHelp(this.m_glossTextBox, ((bool)(resources.GetObject("m_glossTextBox.ShowHelp")))); this.m_glossTextBox.SuppressEnter = true; this.m_glossTextBox.WordWrap = false; // // groupBox3 // this.groupBox3.Controls.Add(this.m_entryWsComboBox); this.groupBox3.Controls.Add(this.m_entryTextBox); resources.ApplyResources(this.groupBox3, "groupBox3"); this.groupBox3.Name = "groupBox3"; this.m_helpProvider.SetShowHelp(this.groupBox3, ((bool)(resources.GetObject("groupBox3.ShowHelp")))); this.groupBox3.TabStop = false; // // m_entryWsComboBox // this.m_entryWsComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_entryWsComboBox.FormattingEnabled = true; resources.ApplyResources(this.m_entryWsComboBox, "m_entryWsComboBox"); this.m_entryWsComboBox.Name = "m_entryWsComboBox"; this.m_helpProvider.SetShowHelp(this.m_entryWsComboBox, ((bool)(resources.GetObject("m_entryWsComboBox.ShowHelp")))); this.m_entryWsComboBox.SelectedIndexChanged += new System.EventHandler(this.m_entryWsComboBox_SelectedIndexChanged); // // m_entryTextBox // this.m_entryTextBox.AcceptsReturn = false; this.m_entryTextBox.AdjustStringHeight = true; this.m_entryTextBox.BackColor = System.Drawing.SystemColors.Window; this.m_entryTextBox.controlID = null; resources.ApplyResources(this.m_entryTextBox, "m_entryTextBox"); this.m_entryTextBox.HasBorder = true; this.m_entryTextBox.Name = "m_entryTextBox"; this.m_helpProvider.SetShowHelp(this.m_entryTextBox, ((bool)(resources.GetObject("m_entryTextBox.ShowHelp")))); this.m_entryTextBox.SuppressEnter = true; this.m_entryTextBox.WordWrap = false; // // groupBox1 // this.groupBox1.Controls.Add(this.m_formWsComboBox); this.groupBox1.Controls.Add(this.m_formTextBox); resources.ApplyResources(this.groupBox1, "groupBox1"); this.groupBox1.Name = "groupBox1"; this.groupBox1.TabStop = false; // // m_formWsComboBox // this.m_formWsComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_formWsComboBox.FormattingEnabled = true; resources.ApplyResources(this.m_formWsComboBox, "m_formWsComboBox"); this.m_formWsComboBox.Name = "m_formWsComboBox"; this.m_formWsComboBox.SelectedIndexChanged += new System.EventHandler(this.m_formWsComboBox_SelectedIndexChanged); // // m_formTextBox // this.m_formTextBox.AcceptsReturn = false; this.m_formTextBox.AdjustStringHeight = true; this.m_formTextBox.BackColor = System.Drawing.SystemColors.Window; this.m_formTextBox.controlID = null; resources.ApplyResources(this.m_formTextBox, "m_formTextBox"); this.m_formTextBox.HasBorder = true; this.m_formTextBox.Name = "m_formTextBox"; this.m_formTextBox.SuppressEnter = true; this.m_formTextBox.WordWrap = false; // // groupBox4 // this.groupBox4.Controls.Add(this.m_categoryNotCheckBox); this.groupBox4.Controls.Add(this.m_categoryComboBox); resources.ApplyResources(this.groupBox4, "groupBox4"); this.groupBox4.Name = "groupBox4"; this.groupBox4.TabStop = false; // // m_categoryNotCheckBox // resources.ApplyResources(this.m_categoryNotCheckBox, "m_categoryNotCheckBox"); this.m_categoryNotCheckBox.Name = "m_categoryNotCheckBox"; this.m_categoryNotCheckBox.UseVisualStyleBackColor = true; // // m_categoryComboBox // this.m_categoryComboBox.AdjustStringHeight = true; this.m_categoryComboBox.BackColor = System.Drawing.SystemColors.Window; this.m_categoryComboBox.DropDownWidth = 120; this.m_categoryComboBox.DroppedDown = false; this.m_categoryComboBox.HasBorder = true; resources.ApplyResources(this.m_categoryComboBox, "m_categoryComboBox"); this.m_categoryComboBox.Name = "m_categoryComboBox"; this.m_categoryComboBox.UseVisualStyleBackColor = true; // // groupBox5 // this.groupBox5.Controls.Add(this.m_inflFeatsTreeView); resources.ApplyResources(this.groupBox5, "groupBox5"); this.groupBox5.Name = "groupBox5"; this.groupBox5.TabStop = false; // // m_inflFeatsTreeView // this.m_inflFeatsTreeView.BackColor = System.Drawing.SystemColors.Window; this.m_inflFeatsTreeView.Columns.Add(this.m_featureColumn); this.m_inflFeatsTreeView.Columns.Add(this.m_notColumn); this.m_inflFeatsTreeView.Columns.Add(this.m_valueColumn); this.m_inflFeatsTreeView.DefaultToolTipProvider = null; this.m_inflFeatsTreeView.DragDropMarkColor = System.Drawing.Color.Black; this.m_inflFeatsTreeView.FullRowSelect = true; this.m_inflFeatsTreeView.LineColor = System.Drawing.SystemColors.ControlDark; resources.ApplyResources(this.m_inflFeatsTreeView, "m_inflFeatsTreeView"); this.m_inflFeatsTreeView.Model = null; this.m_inflFeatsTreeView.Name = "m_inflFeatsTreeView"; this.m_inflFeatsTreeView.NodeControls.Add(this.m_featureIcon); this.m_inflFeatsTreeView.NodeControls.Add(this.m_featureTextBox); this.m_inflFeatsTreeView.NodeControls.Add(this.m_valueComboBox); this.m_inflFeatsTreeView.NodeControls.Add(this.m_inflNotCheckBox); this.m_inflFeatsTreeView.SelectedNode = null; this.m_inflFeatsTreeView.UseColumns = true; // // m_featureColumn // resources.ApplyResources(this.m_featureColumn, "m_featureColumn"); this.m_featureColumn.SortOrder = System.Windows.Forms.SortOrder.None; // // m_notColumn // resources.ApplyResources(this.m_notColumn, "m_notColumn"); this.m_notColumn.SortOrder = System.Windows.Forms.SortOrder.None; // // m_valueColumn // resources.ApplyResources(this.m_valueColumn, "m_valueColumn"); this.m_valueColumn.SortOrder = System.Windows.Forms.SortOrder.None; // // m_featureIcon // this.m_featureIcon.DataPropertyName = "Image"; this.m_featureIcon.LeftMargin = 1; this.m_featureIcon.ParentColumn = this.m_featureColumn; this.m_featureIcon.ScaleMode = Aga.Controls.Tree.ImageScaleMode.Clip; // // m_featureTextBox // this.m_featureTextBox.DataPropertyName = "Text"; this.m_featureTextBox.IncrementalSearchEnabled = true; this.m_featureTextBox.LeftMargin = 1; this.m_featureTextBox.ParentColumn = this.m_featureColumn; // // m_valueComboBox // this.m_valueComboBox.DataPropertyName = "Value"; this.m_valueComboBox.EditEnabled = true; this.m_valueComboBox.EditOnClick = true; this.m_valueComboBox.IncrementalSearchEnabled = true; this.m_valueComboBox.LeftMargin = 1; this.m_valueComboBox.ParentColumn = this.m_valueColumn; this.m_valueComboBox.CreatingEditor += new System.EventHandler <Aga.Controls.Tree.NodeControls.EditEventArgs>(this.m_valueComboBox_CreatingEditor); this.m_valueComboBox.IsEditEnabledValueNeeded += new System.EventHandler <Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs>(this.m_valueComboBox_IsEditEnabledValueNeeded); // // m_inflNotCheckBox // this.m_inflNotCheckBox.DataPropertyName = "IsChecked"; this.m_inflNotCheckBox.EditEnabled = true; this.m_inflNotCheckBox.LeftMargin = 1; this.m_inflNotCheckBox.ParentColumn = this.m_notColumn; this.m_inflNotCheckBox.IsVisibleValueNeeded += new System.EventHandler <Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs>(this.m_inflNotCheckBox_IsVisibleValueNeeded); // // m_imageList // this.m_imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("m_imageList.ImageStream"))); this.m_imageList.TransparentColor = System.Drawing.Color.Transparent; this.m_imageList.Images.SetKeyName(0, ""); this.m_imageList.Images.SetKeyName(1, ""); // // ComplexConcMorphDlg // this.AcceptButton = this.m_btnOK; resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.m_btnCancel; this.Controls.Add(this.groupBox5); this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.m_btnHelp); this.Controls.Add(this.m_btnCancel); this.Controls.Add(this.m_btnOK); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ComplexConcMorphDlg"; this.m_helpProvider.SetShowHelp(this, ((bool)(resources.GetObject("$this.ShowHelp")))); this.ShowIcon = false; this.ShowInTaskbar = false; this.groupBox2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.m_glossTextBox)).EndInit(); this.groupBox3.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.m_entryTextBox)).EndInit(); this.groupBox1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.m_formTextBox)).EndInit(); this.groupBox4.ResumeLayout(false); this.groupBox4.PerformLayout(); this.groupBox5.ResumeLayout(false); this.ResumeLayout(false); }
protected override void OnLoad(EventArgs e) { if (this._nodeHelper == null) { _nodeHelper = new NodeHelper(Table); } TreeStore.Config config = new TreeStore.Config { NodeParam = "parentId" }; this._treeStore = new TreeStore(config); this._treeStore.ID = "_treeStore"; Model model = new Model { Fields = { new ModelField("Id", ModelFieldType.String), new ModelField("Name", ModelFieldType.String), new ModelField("ParentId", ModelFieldType.String) } }; model.Fields.AddRange(this._nodeHelper.CustomFields); this._treeStore.Model.Add(model); this._treeStore.Proxy.Add(new PageProxy()); this.Store.Add(this._treeStore); this._treeStore.ReadData += new TreeStoreBase.ReadDataEventHandler(this.treeStore_ReadData); base.RemoteRemove += new TreePanel.RemoteRemoveEventHandler(this.TreePanelEx_RemoteRemove); base.RemoteEdit += new TreePanel.RemoteEditEventHandler(this.TreePanelEx_RemoteEdit); base.RemoteMove += new TreePanel.RemoteMoveEventHandler(this.TreePanelEx_RemoteMove); Ext.Net.Button button = new Ext.Net.Button { Text = "刷新", Handler = "App." + this.ID + ".getStore().load();" }; Toolbar toolbar = new Toolbar(); toolbar.Items.Add(button); this.TopBar.Add(toolbar); if (!Ext.Net.X.IsAjaxRequest) { //base.Listeners.NodeDragOver.Handler = "var recs = dragData.records;var prev=-1;for(var i=0;i<recs.length;i++){var recData=recs[i].data;if(prev==-1){prev=recData.Level;}else{if(prev!=recData.Level){return false;}}}if(targetNode.data.Level>=" + this.Level + ")return false;return true;"; Parameter parameters = new Parameter { Name = "parentId", Value = "arguments[1].data.parentId", Mode = ParameterMode.Raw }; this.RemoteExtraParams.Add(parameters); this.On("beforeRemoteAction", new JFunction("Ext.net.Mask.show({ msg : '正在加载' });")); JFunction fn = new JFunction("Ext.net.Mask.hide();"); this.On("remoteActionRefusal", fn); this.On("remoteActionException", fn); this.On("remoteActionSuccess", fn); this.On("remoteEditRefusal", new JFunction("Ext.Msg.alert('失败了')")); this._treeStore.On("beforeload", new JFunction("Ext.net.Mask.show({ msg : '正在加载' });")); this._treeStore.On("load", new JFunction("Ext.net.Mask.hide();")); Ext.Net.Node node = new Ext.Net.Node(); node.CustomAttributes.Add(new ConfigItem("Id", "")); node.CustomAttributes.Add(new ConfigItem("Name", "根")); node.NodeID = "0"; node.Expanded = true; node.Text = "根"; this.Root.Add(node); Column column = new Column(); this.ColumnModel.Columns.Add(column); TreeColumn column2 = new TreeColumn(); this.ColumnModel.Columns.Add(column2); ActionColumn column3 = new ActionColumn(); if (this.EnableRemove) { ActionItem item2 = new ActionItem(); column3.Items.Add(item2); item2.Icon = Ext.Net.Icon.PageWhiteDelete; item2.Handler = "var record=arguments[5];var tree = App." + this.ID + ";var node = tree.getStore().getNodeById(record.data.Id) || tree.getStore().getNewRecords()[0];Ext.Msg.confirm(\"提示\", \"会删除相关的数据,无法恢复,确认删除?\", function (r) {if (r == \"yes\") {tree.removeNode(node);return;App.direct.RemoveNode(record.data.Id, {success: function (result) {if (result.Success) {node.remove();node.commit();} else {Ext.Msg.alert(\"错误\", result.Message);}},eventMask: {showMask: true,msg: \"正在删除\"}});}});"; item2.Tooltip = "删除"; } this.ColumnModel.Columns.Add(column3); column.ID = "col1"; column.DataIndex = "Id"; column.Width = 50; column.Text = "编号"; column2.ID = "col2"; column2.DataIndex = "Name"; column2.Width = 300; column2.Text = "名称"; column3.ID = "col3"; column3.Text = "操作"; column3.Width = 60; column3.Align = Alignment.Center; if (EnableEdit) { ActionItem item = new ActionItem(); column3.Items.Add(item); item.Icon = Ext.Net.Icon.PageWhiteAdd; item.Handler = "var record=arguments[5]; var tree = App." + this.ID + ";var ep = tree.editingPlugin;var node,store = tree.getStore();if (record.data.Id) {node = store.getNodeById(record.data.Id);}else{node = store.getRootNode();}node.expand(false, function () {node = node.appendChild({Name:'新节点'});setTimeout(function () {ep.startEdit(node, tree.columns[1]);}, 200);});"; item.Tooltip = "添加子节点"; CellEditing editing = new CellEditing(); editing.Listeners.CancelEdit.Handler = " if (e.record.data.Id) {e.record.reject();} else {e.record.remove(true);}"; this.Plugins.Add(editing); this.Editor.Add(new TextField()); TreeView view = new TreeView(); this.View.Add(view); TreeViewDragDrop drop = new TreeViewDragDrop { DragText = "移动到", AppendOnly = true }; view.Plugins.Add(drop); } this.Mode = TreePanelMode.Remote; } base.OnLoad(e); }
/// <summary> /// Adds an extra column to the end of the displayed columns. /// </summary> /// <param name="column">The column to add.</param> /// <param name="nodeControl">The node control used to display the values.</param> public void AddExtraColumn(TreeColumn column, NodeControl nodeControl) { AddExtraColumn(trvTree.Columns.Count, column, nodeControl); }
public void ReconfigureTreeColumns() { if (!DataLayer.IsConnected) { return; } tvWorkitems.HideEditor(); tvWorkitems.Columns.Clear(); tvWorkitems.NodeControls.Clear(); columnToAttributeMappings.Clear(); foreach (var column in configuration.GridSettings.Columns) { if (column.EffortTracking && !DataLayer.EffortTracking.TrackEffort) { continue; } var dataPropertyName = DataLayer.LocalizerResolve(column.Name); columnToAttributeMappings.Add(dataPropertyName, column.Attribute); var treeColumn = new TreeColumn(dataPropertyName, column.Width) { SortOrder = SortOrder.None, TooltipText = dataPropertyName }; switch (column.Type) { case "String": case "Effort": var textEditor = new CustomNodeTextBox(); ConfigureEditor(textEditor, dataPropertyName); textEditor.EditEnabled = !textEditor.IsReadOnly; textEditor.IsColumnReadOnly = column.ReadOnly; textEditor.ParentColumn = treeColumn; textEditor.IsEditEnabledValueNeeded += CheckCellEditability; tvWorkitems.NodeControls.Add(textEditor); break; case "List": var listEditor = new NodeComboBox(); ConfigureEditor(listEditor, dataPropertyName); listEditor.EditEnabled = !column.ReadOnly; listEditor.ParentColumn = treeColumn; listEditor.IsEditEnabledValueNeeded += CheckCellEditability; tvWorkitems.NodeControls.Add(listEditor); break; case "Multi": var listBoxEditor = new NodeListBox { ParentTree = tvWorkitems }; ConfigureEditor(listBoxEditor, dataPropertyName); listBoxEditor.EditEnabled = !column.ReadOnly; listBoxEditor.ParentColumn = treeColumn; listBoxEditor.IsEditEnabledValueNeeded += CheckCellEditability; tvWorkitems.NodeControls.Add(listBoxEditor); break; default: throw new NotSupportedException(); } tvWorkitems.Columns.Add(treeColumn); } AddStateIcon(); }
public ColumnState(TreeViewAdv tree, TreeColumn column) : base(tree) { _column = column; }
/// <summary> /// </summary> public DownloadFileSystemTree() { InitializeComponent(); HandleDestroyed += OnDestroyed; Model = new TreeModel(); MainTreeView.Model = Model; TreeColumn NameColumn = new TreeColumn(); NameColumn.Header = "Name"; NameColumn.Width = 180; MainTreeView.Columns.Add(NameColumn); ScaledNodeIcon IconControl = new ScaledNodeIcon(); IconControl.ParentColumn = NameColumn; IconControl.DataPropertyName = "Icon"; IconControl.FixedSize = new Size((int)(MainTreeView.RowHeight * 1.5f), (int)(MainTreeView.RowHeight * 1.5f)); IconControl.Offset = new Size(0, 5); MainTreeView.NodeControls.Add(IconControl); NodeTextBox TextControl = new NodeTextBox(); TextControl.ParentColumn = NameColumn; TextControl.DataPropertyName = "Name"; MainTreeView.NodeControls.Add(TextControl); TreeColumn SizeColumn = new TreeColumn(); SizeColumn.Header = "Size"; SizeColumn.Width = 65; MainTreeView.Columns.Add(SizeColumn); NodeTextBox SizeControl = new NodeTextBox(); SizeControl.ParentColumn = SizeColumn; SizeControl.DataPropertyName = "SizeFormatted"; MainTreeView.NodeControls.Add(SizeControl); TreeColumn CreatedColumn = new TreeColumn(); CreatedColumn.Header = "Created"; CreatedColumn.Width = 110; MainTreeView.Columns.Add(CreatedColumn); NodeTextBox CreatedControl = new NodeTextBox(); CreatedControl.ParentColumn = CreatedColumn; CreatedControl.DataPropertyName = "CreateTimeFormatted"; MainTreeView.NodeControls.Add(CreatedControl); TreeColumn AvailabilityColumn = new TreeColumn(); AvailabilityColumn.Header = "Availability"; AvailabilityColumn.Width = 210; MainTreeView.Columns.Add(AvailabilityColumn); ScaledNodeIcon AvailabilityIconControl = new ScaledNodeIcon(); AvailabilityIconControl.ParentColumn = AvailabilityColumn; AvailabilityIconControl.DataPropertyName = "AvailabilityIcon"; AvailabilityIconControl.FixedSize = new Size((int)(MainTreeView.RowHeight * 1.5f), (int)(MainTreeView.RowHeight * 1.5f)); AvailabilityIconControl.Offset = new Size(0, 5); MainTreeView.NodeControls.Add(AvailabilityIconControl); NodeTextBox AvailabilityControl = new NodeTextBox(); AvailabilityControl.ParentColumn = AvailabilityColumn; AvailabilityControl.DataPropertyName = "Availability"; MainTreeView.NodeControls.Add(AvailabilityControl); TreeColumn TagsColumn = new TreeColumn(); TagsColumn.Header = "Tags"; TagsColumn.Width = 200; MainTreeView.Columns.Add(TagsColumn); TagListTreeNode TagControl = new TagListTreeNode(); TagControl.ParentColumn = TagsColumn; TagControl.DataPropertyName = "Tags"; MainTreeView.NodeControls.Add(TagControl); }
/// <summary> /// 显式指明一个属性是否需要进行合计。 /// </summary> /// <param name="meta"></param> /// <param name="value">true: 合计; false: 不合计; null:根据类型来判断。</param> /// <returns></returns> public static WPFEntityPropertyViewMeta Summarize(this WPFEntityPropertyViewMeta meta, bool?value) { TreeColumn.SetNeedSummary(meta, value); return(meta); }
public ClickColumnState(TreeViewAdv tree, TreeColumn column, Point location) : base(tree, column) { _location = location; }
private void InitializeColumnStageProject() { #region Инициализация столбцов Этапов treeViewAdv1.UseColumns = true; TreeColumn columnName = new TreeColumn("Этап", 120); TreeColumn columnNameStage = new TreeColumn("Название", 150); TreeColumn columnUser = new TreeColumn("Ответственный", 160); TreeColumn columnDateBegin = new TreeColumn("Начало (план)", 60); TreeColumn columnDateEnd = new TreeColumn("Завершение (план)", 60); TreeColumn columnDateBeginUser = new TreeColumn("Начало (пользв.)", 60); TreeColumn columnDateEndUser = new TreeColumn("Завершение (пользв.)", 60); TreeColumn columnStatus = new TreeColumn("Статус", 60); TreeColumn columnDateBeginProg = new TreeColumn("Начало (прогноз)", 60); TreeColumn columnDateEndProg = new TreeColumn("Завершение (прогноз)", 60); TreeColumn columnComment = new TreeColumn("Комментарий", 200); //treeViewAdv1.Columns.Add(columnName); treeViewAdv1.Columns.Add(columnNameStage); treeViewAdv1.Columns.Add(columnUser); treeViewAdv1.Columns.Add(columnDateBegin); treeViewAdv1.Columns.Add(columnDateEnd); treeViewAdv1.Columns.Add(columnDateBeginUser); treeViewAdv1.Columns.Add(columnDateEndUser); treeViewAdv1.Columns.Add(columnStatus); treeViewAdv1.Columns.Add(columnDateBeginProg); treeViewAdv1.Columns.Add(columnDateEndProg); treeViewAdv1.Columns.Add(columnComment); NodeTextBox nodeTextName = new NodeTextBox(); nodeTextName.DataPropertyName = "NameStage"; nodeTextName.ParentColumn = columnNameStage; nodeTextName.IncrementalSearchEnabled = true; treeViewAdv1.NodeControls.Add(nodeTextName); NodeTextBox nodeTextUser = new NodeTextBox(); nodeTextUser.DataPropertyName = "User"; nodeTextUser.ParentColumn = columnUser; nodeTextUser.IncrementalSearchEnabled = true; treeViewAdv1.NodeControls.Add(nodeTextUser); NodeTextBox nodeTextDateBegin = new NodeTextBox(); nodeTextDateBegin.DataPropertyName = "DateBegin"; nodeTextDateBegin.ParentColumn = columnDateBegin; nodeTextDateBegin.IncrementalSearchEnabled = true; treeViewAdv1.NodeControls.Add(nodeTextDateBegin); NodeTextBox nodeTextDateEnd = new NodeTextBox(); nodeTextDateEnd.DataPropertyName = "DateEnd"; nodeTextDateEnd.ParentColumn = columnDateEnd; nodeTextDateEnd.IncrementalSearchEnabled = true; treeViewAdv1.NodeControls.Add(nodeTextDateEnd); NodeTextBox nodeTextDateBeginUser = new NodeTextBox(); nodeTextDateBeginUser.DataPropertyName = "DateBeginUser"; nodeTextDateBeginUser.ParentColumn = columnDateBeginUser; nodeTextDateBeginUser.IncrementalSearchEnabled = true; treeViewAdv1.NodeControls.Add(nodeTextDateBeginUser); NodeTextBox nodeTextDateEndUser = new NodeTextBox(); nodeTextDateEndUser.DataPropertyName = "DateEndUser"; nodeTextDateEndUser.ParentColumn = columnDateEndUser; nodeTextDateEndUser.IncrementalSearchEnabled = false; treeViewAdv1.NodeControls.Add(nodeTextDateEndUser); NodeTextBox nodeTextStatus = new NodeTextBox(); nodeTextStatus.DataPropertyName = "Status"; nodeTextStatus.ParentColumn = columnStatus; nodeTextStatus.IncrementalSearchEnabled = true; treeViewAdv1.NodeControls.Add(nodeTextStatus); NodeTextBox nodeTextDateBeginProg = new NodeTextBox(); nodeTextDateBeginProg.DataPropertyName = "DateBeginProg"; nodeTextDateBeginProg.ParentColumn = columnDateBeginProg; nodeTextDateBeginProg.IncrementalSearchEnabled = true; treeViewAdv1.NodeControls.Add(nodeTextDateBeginProg); NodeTextBox nodeTextDateEndProg = new NodeTextBox(); nodeTextDateEndProg.DataPropertyName = "DateEndProg"; nodeTextDateEndProg.ParentColumn = columnDateEndProg; nodeTextDateEndProg.IncrementalSearchEnabled = true; treeViewAdv1.NodeControls.Add(nodeTextDateEndProg); NodeTextBox nodeTextCommentUser = new NodeTextBox(); nodeTextCommentUser.DataPropertyName = "CommentUser"; nodeTextCommentUser.ParentColumn = columnComment; nodeTextCommentUser.IncrementalSearchEnabled = true; treeViewAdv1.NodeControls.Add(nodeTextCommentUser); #endregion }
public FunctionComparer(NProfStyleVisualizer parent, TreeColumn column, SortOrder order) { this.Parent = parent; this.Column = column; this.Order = order; }
public ResizeColumnState(TreeViewAdv tree, TreeColumn column, Point p) : base(tree, column) { _initLocation = p; _initWidth = column.Width; }
public virtual ColumnBase CreateColumn() { ColumnBase column; if (HasChildren) { column = new Column { Text = Header }; if (ConfigureColumnHandler != null) { ConfigureColumnHandler(column); } return(column); } var editor = CreateEditor(); if (CreateColumnHandler != null) { column = CreateColumnHandler(this); if (editor != null) { column.Editor.Add(editor); } if (ConfigureColumnHandler != null) { ConfigureColumnHandler(column); } return(column); } if (IsTreeColumn) { column = new TreeColumn { DataIndex = ColumnNameIndex, Text = Header, Width = new Unit(Width), Flex = string.IsNullOrEmpty(Width) ? Flex : 0, Sortable = !string.IsNullOrEmpty(Sort), }; } else { switch (ModelFieldType) { case ModelFieldType.Auto: column = new Column { DataIndex = ColumnNameIndex, Text = Header, Width = new Unit(Width), Flex = string.IsNullOrEmpty(Width) ? Flex : 0, Hidden = DefaultHidden, Sortable = !string.IsNullOrEmpty(Sort), }; break; case ModelFieldType.String: column = new Column { DataIndex = ColumnNameIndex, Text = Header, Width = new Unit(Width), Flex = string.IsNullOrEmpty(Width) ? Flex : 0, Hidden = DefaultHidden, Wrap = Wrap ?? true, Sortable = !string.IsNullOrEmpty(Sort), }; break; case ModelFieldType.Int: var intColumn = new NumberColumn { DataIndex = ColumnNameIndex, Text = Header, Width = new Unit(Width), Flex = string.IsNullOrEmpty(Width) ? Flex : 0, Hidden = DefaultHidden, Sortable = !string.IsNullOrEmpty(Sort), }; if (!string.IsNullOrEmpty(Format)) { intColumn.Format = GetIntFormat(); } intColumn.Align = Alignment.Right; //intColumn.Renderer.Handler = "debugger;return record.raw[metadata.column.dataIndex] == null && !value ? '' : value;"; column = intColumn; break; case ModelFieldType.Float: var floatColumn = new NumberColumn { DataIndex = ColumnNameIndex, Text = Header, Flex = string.IsNullOrEmpty(Width) ? Flex : 0, Hidden = DefaultHidden, Sortable = !string.IsNullOrEmpty(Sort), }; if (!string.IsNullOrEmpty(Format)) { floatColumn.Format = GetFloatFormat(); } floatColumn.Align = Alignment.Right; //floatColumn.Renderer.Handler = "debugger;return record.raw[metadata.column.dataIndex] == null && !value ? '' : value;"; column = floatColumn; break; case ModelFieldType.Boolean: if (EditModeForBool && CanEdit) { column = new CheckColumn { DataIndex = ColumnNameIndex, Text = Header, StopSelection = false, Editable = CanEdit, Width = new Unit(Width), Flex = string.IsNullOrEmpty(Width) ? Flex : 0, Hidden = DefaultHidden, Sortable = !string.IsNullOrEmpty(Sort), }; if (column.Renderer == null) { column.Renderer = new Renderer(); } column.Renderer.Handler = string.Format( "if (!record.data.CanEdit) return '<span style=\"font-size:11px\">' + (record.data.{0} ? {1} : {2}) + '</span>'; return (new Ext.ux.CheckColumn()).renderer(record.data.{0});", ColumnNameIndex, JSON.Serialize(TrueText), JSON.Serialize(FalseText)); } else { column = new BooleanColumn { DataIndex = ColumnNameIndex, Text = Header, TrueText = TrueText, FalseText = FalseText, Width = new Unit(Width), Flex = string.IsNullOrEmpty(Width) ? Flex : 0, Hidden = DefaultHidden, Sortable = !string.IsNullOrEmpty(Sort), }; } break; case ModelFieldType.Date: column = new DateColumn { DataIndex = ColumnNameIndex, Text = Header, Format = GetDateFormat(), Width = new Unit(Width), Flex = string.IsNullOrEmpty(Width) ? Flex : 0, Hidden = DefaultHidden, Sortable = !string.IsNullOrEmpty(Sort), }; break; default: throw new ArgumentOutOfRangeException(); } if (SummaryType != null) { column.SummaryType = SummaryType.Value; column.SummaryRenderer = new Renderer { Handler = SummaryRendererHandler }; column.CustomSummaryType = CustomSummaryType; } } if (editor != null) { column.Editor.Add(editor); } if (!string.IsNullOrEmpty(RendererFunction)) { var handler = RendererFunction.Contains(" ") ? $"function (value, metadata, record, rowIndex, colIndex, store, view) {{\n{RendererFunction}\n}}" : RendererFunction; column.Renderer = new Renderer { Handler = handler, }; } if (Locked) { column.Locked = true; } ConfigureColumnHandler?.Invoke(column); return(column); }