Changeset 6526 for trunk/sources/HeuristicLab.Optimization.Views/3.3
- Timestamp:
- 07/07/11 01:15:31 (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
r6524 r6526 49 49 this.ExpandToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 50 50 this.CollapseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 51 this.EditNodeLabelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 51 52 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 52 53 this.optimizersGroupBox.SuspendLayout(); … … 162 163 this.treeView.ImageIndex = 0; 163 164 this.treeView.ImageList = this.imageList; 165 this.treeView.LabelEdit = true; 164 166 this.treeView.Location = new System.Drawing.Point(4, 34); 165 167 this.treeView.Name = "optimizerTreeView"; … … 167 169 this.treeView.Size = new System.Drawing.Size(191, 402); 168 170 this.treeView.TabIndex = 10; 171 this.treeView.AfterLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(treeView_AfterLabelEdit); 172 this.treeView.BeforeLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(treeView_BeforeLabelEdit); 169 173 this.treeView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.optimizerTreeView_ItemDrag); 170 174 this.treeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.optimizerTreeview_NodeMouseClick); … … 215 219 // 216 220 this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 221 this.EditNodeLabelToolStripMenuItem, 217 222 this.ExpandToolStripMenuItem, 218 223 this.CollapseToolStripMenuItem}); … … 233 238 this.CollapseToolStripMenuItem.Text = "Collapse"; 234 239 this.CollapseToolStripMenuItem.Click += new System.EventHandler(this.CollapseToolStripMenuItem_Click); 240 // 241 // EditNodeLabelToolStripMenuItem 242 // 243 this.EditNodeLabelToolStripMenuItem.Name = "EditNodeLabelToolStripMenuItem"; 244 this.EditNodeLabelToolStripMenuItem.Size = new System.Drawing.Size(119, 22); 245 this.EditNodeLabelToolStripMenuItem.Text = "Edit Name"; 246 this.EditNodeLabelToolStripMenuItem.Click += new System.EventHandler(this.EditNodeLabelToolStripMenuItem_Click); 247 235 248 // 236 249 // ExperimentTreeView … … 268 281 private System.Windows.Forms.ToolStripMenuItem ExpandToolStripMenuItem; 269 282 private System.Windows.Forms.ToolStripMenuItem CollapseToolStripMenuItem; 283 private System.Windows.Forms.ToolStripMenuItem EditNodeLabelToolStripMenuItem; 270 284 271 285 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentTreeView.cs
r6524 r6526 454 454 else throw new NotSupportedException("Handling for specific type not implemented" + parentOptimizer.GetType()); 455 455 } 456 SetEnabledStateOfControls();457 UpdateDetailsViewHost();458 RebuildImageList();459 456 } 460 457 } … … 493 490 if (optimizer == null) return; 494 491 if (batchRun.Optimizer != null) return; 495 if (optimizer. GetObjectGraphObjects().OfType<IOptimizer>().Contains(batchRun)) return;492 if (optimizer.NestedOptimizers.Contains(batchRun)) return; 496 493 } 497 494 … … 503 500 if (enumerable != null) optimizers = enumerable.Cast<IOptimizer>(); 504 501 505 if (optimizer != null && optimizer. GetObjectGraphObjects().OfType<IOptimizer>().Contains(experiment)) return;506 if (optimizers != null && optimizers. GetObjectGraphObjects().OfType<IOptimizer>().Contains(experiment)) return;502 if (optimizer != null && optimizer.NestedOptimizers.Contains(experiment)) return; 503 if (optimizers != null && optimizers.Any(x => x.NestedOptimizers.Contains(experiment))) return; 507 504 } 508 505 … … 611 608 CollapseToolStripMenuItem.Enabled = toolStripMenuNode.IsExpanded; 612 609 CollapseToolStripMenuItem.Visible = toolStripMenuNode.IsExpanded; 610 EditNodeLabelToolStripMenuItem.Enabled = toolStripMenuNode.Tag != null && toolStripMenuNode.Tag is INamedItem; 611 EditNodeLabelToolStripMenuItem.Visible = toolStripMenuNode.Tag != null && toolStripMenuNode.Tag is INamedItem; 613 612 if (contextMenuStrip.Items.Cast<ToolStripMenuItem>().Any(item => item.Enabled)) 614 613 contextMenuStrip.Show(Cursor.Position); … … 621 620 private void CollapseToolStripMenuItem_Click(object sender, EventArgs e) { 622 621 if (toolStripMenuNode != null) toolStripMenuNode.Collapse(); 622 } 623 private void EditNodeLabelToolStripMenuItem_Click(object sender, EventArgs e) { 624 if (toolStripMenuNode != null) { 625 if (!toolStripMenuNode.IsEditing) toolStripMenuNode.BeginEdit(); 626 } 627 } 628 629 630 private void treeView_BeforeLabelEdit(object sender, NodeLabelEditEventArgs e) { 631 if (e.Node.Tag == null || !(e.Node.Tag is INamedItem)) { 632 e.CancelEdit = true; 633 return; 634 } 635 } 636 private void treeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) { 637 if (e.Label == null) return; 638 639 e.Node.EndEdit(false); 640 var namedItem = (INamedItem)e.Node.Tag; 641 namedItem.Name = e.Label; 623 642 } 624 643
Note: See TracChangeset
for help on using the changeset viewer.