Changeset 6573
- Timestamp:
- 07/18/11 16:24:20 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization.Views/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentTreeView.Designer.cs
r6550 r6573 171 171 this.treeView.AfterLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(treeView_AfterLabelEdit); 172 172 this.treeView.BeforeLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(treeView_BeforeLabelEdit); 173 this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(treeView_AfterSelect); 173 174 this.treeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.optimizerTreeView_ItemDrag); 174 175 this.treeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeview_NodeMouseClick); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentTreeView.cs
r6552 r6573 265 265 266 266 foreach (TreeNodeCollection parentNode in parentNodes) { 267 //get all effected child nodes 268 foreach (TreeNode childNode in parentNode.OfType<TreeNode>() 269 .Where(n => e.OldItems.Select(x => x.Value).Contains((IOptimizer)n.Tag)).ToList()) { 270 DisposeTreeNode(childNode); 271 childNode.Remove(); 272 } 273 274 foreach (var childOptimizer in e.Items) { 275 TreeNode childNode = CreateTreeNode(childOptimizer.Value); 276 UpdateChildTreeNodes(childNode.Nodes, childOptimizer.Value); 277 childNode.ExpandAll(); 278 parentNode.Insert(childOptimizer.Index, childNode); 279 } 280 } 281 RebuildImageList(); 282 UpdateDetailsViewHost(); 267 var backup = parentNode.OfType<TreeNode>().ToList(); 268 foreach (var indexedItem in e.Items) { 269 var node = backup.Where(n => n.Tag == indexedItem.Value).First(); 270 node.Remove(); 271 parentNode.Insert(indexedItem.Index, node); 272 } 273 } 283 274 } 284 275 private void Optimizers_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) { … … 640 631 } 641 632 633 634 private void treeView_AfterSelect(object sender, TreeViewEventArgs e) { 635 if (e.Action == TreeViewAction.ByKeyboard) { 636 UpdateDetailsViewHost(); 637 //NOTE: necessary because algorithm view steals the focus 638 treeView.Focus(); 639 } 640 } 641 642 642 private bool rightClickOccured = true; 643 643 private TreeNode toolStripMenuNode = null; … … 736 736 else experiment = (Experiment)treeView.SelectedNode.Parent.Tag; 737 737 738 var selectedNode = treeView.SelectedNode; 738 739 int index = treeView.SelectedNode.Index; 739 740 experiment.Optimizers.Reverse(index - 1, 2); 740 treeView.SelectedNode = treeNodeTagMapping[optimizer].First();741 treeView.SelectedNode = selectedNode; 741 742 SetEnabledStateOfControls(); 742 UpdateDetailsViewHost();743 RebuildImageList();744 743 } 745 744 private void moveDownButton_Click(object sender, EventArgs e) { … … 749 748 else experiment = (Experiment)treeView.SelectedNode.Parent.Tag; 750 749 750 var selectedNode = treeView.SelectedNode; 751 751 int index = treeView.SelectedNode.Index; 752 752 experiment.Optimizers.Reverse(index, 2); 753 treeView.SelectedNode = treeNodeTagMapping[optimizer].First();753 treeView.SelectedNode = selectedNode; 754 754 SetEnabledStateOfControls(); 755 UpdateDetailsViewHost();756 RebuildImageList();757 755 } 758 756 … … 885 883 var topLevelNodes = treeView.Nodes.OfType<TreeNode>().ToArray(); 886 884 var nodes = IterateTreeNodes().ToList(); 885 var selectedNode = treeView.SelectedNode; 887 886 treeView.Nodes.Clear(); 888 887 … … 894 893 } 895 894 treeView.Nodes.AddRange(topLevelNodes); 895 treeView.SelectedNode = selectedNode; 896 896 treeView.EndUpdate(); 897 897 }
Note: See TracChangeset
for help on using the changeset viewer.