Changeset 8120
- Timestamp:
- 06/26/12 13:07:21 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Clients.Hive.Views/3.3/TreeView
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.Hive.Views/3.3/TreeView/HiveTaskItemTreeView.cs
r8069 r8120 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 23 using System.Windows.Forms; … … 42 41 } 43 42 44 #region Register Content Events 45 protected override void DeregisterContentEvents() { 46 // TODO: Deregister your event handlers on the Content here 47 base.DeregisterContentEvents(); 48 } 49 protected override void RegisterContentEvents() { 50 base.RegisterContentEvents(); 51 // TODO: Register your event handlers on the Content here 52 } 53 #endregion 54 55 protected override void OnContentChanged() { 56 base.OnContentChanged(); 57 if (Content == null) { 58 // TODO: Put code here when content is null 59 } else { 60 // TODO: Put code here when content has been changed and is not null 61 } 62 } 63 64 protected override void SetEnabledStateOfControls() { 65 base.SetEnabledStateOfControls(); 66 // TODO: Put code here to enable or disable controls based on whether the Content is/not null or the view is ReadOnly 67 } 68 69 #region Event Handlers 70 // TODO: Put event handlers here 71 #endregion 72 73 #region Child Control Events 74 protected override void addButton_Click(object sender, EventArgs e) { 43 protected override void AddItem() { 75 44 IOptimizer optimizer = CreateItem<IOptimizer>(); 76 45 if (optimizer != null) { … … 88 57 } 89 58 90 protected override void removeButton_Click(object sender, EventArgs e) { 91 base.removeButton_Click(sender, e); 92 93 if (treeView.SelectedNode != null) { 94 var selectedItem = (HiveTask)treeView.SelectedNode.Tag; 95 var parentItem = GetParentItem(selectedItem); 96 if (parentItem == null) { 97 Content.Remove((HiveTask)treeView.SelectedNode.Tag); 98 } else { 99 var experiment = parentItem.ItemTask.Item as Experiment; 100 if (experiment != null) { 101 experiment.Optimizers.Remove(((OptimizerTask)selectedItem.ItemTask).Item); 102 } 59 protected override void RemoveItem(HiveTask item) { 60 var parentItem = GetParentItem(item); 61 if (parentItem == null) { 62 Content.Remove(item); 63 } else { 64 var experiment = parentItem.ItemTask.Item as Experiment; 65 if (experiment != null) { 66 experiment.Optimizers.Remove(((OptimizerTask)item.ItemTask).Item); 103 67 } 104 68 } 105 69 } 106 #endregion107 70 108 71 protected override ICollection<IItemTreeNodeAction<HiveTask>> GetTreeNodeItemActions(HiveTask selectedItem) { -
trunk/sources/HeuristicLab.Clients.Hive.Views/3.3/TreeView/ItemTreeView.cs
r8069 r8120 36 36 [View("ItemTree View")] 37 37 [Content(typeof(ItemCollection<>), IsDefaultView = false)] 38 public partial class ItemTreeView<T> : ItemView where T : class, IItemTree<T> {38 public abstract partial class ItemTreeView<T> : ItemView where T : class, IItemTree<T> { 39 39 public new ItemCollection<T> Content { 40 40 get { return (ItemCollection<T>)base.Content; } … … 360 360 361 361 protected virtual void addButton_Click(object sender, EventArgs e) { 362 T item = CreateItem<T>(); 363 if (item != null) 364 Content.Add(item); 362 AddItem(); 365 363 } 366 364 367 365 protected virtual void removeButton_Click(object sender, EventArgs e) { 368 366 if (treeView.SelectedNode != null) { 367 RemoveItem(treeView.SelectedNode.Tag as T); 369 368 detailsViewHost.Content = null; 370 369 } 371 370 } 371 372 protected abstract void AddItem(); 373 374 protected abstract void RemoveItem(T item); 372 375 373 376 protected virtual void showDetailsCheckBox_CheckedChanged(object sender, EventArgs e) {
Note: See TracChangeset
for help on using the changeset viewer.