Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8120


Ignore:
Timestamp:
06/26/12 13:07:21 (12 years ago)
Author:
ascheibe
Message:

#1827 implemented review comments

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  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
    2423using System.Windows.Forms;
     
    4241    }
    4342
    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() {
    7544      IOptimizer optimizer = CreateItem<IOptimizer>();
    7645      if (optimizer != null) {
     
    8857    }
    8958
    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);
    10367        }
    10468      }
    10569    }
    106     #endregion
    10770
    10871    protected override ICollection<IItemTreeNodeAction<HiveTask>> GetTreeNodeItemActions(HiveTask selectedItem) {
  • trunk/sources/HeuristicLab.Clients.Hive.Views/3.3/TreeView/ItemTreeView.cs

    r8069 r8120  
    3636  [View("ItemTree View")]
    3737  [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> {
    3939    public new ItemCollection<T> Content {
    4040      get { return (ItemCollection<T>)base.Content; }
     
    360360
    361361    protected virtual void addButton_Click(object sender, EventArgs e) {
    362       T item = CreateItem<T>();
    363       if (item != null)
    364         Content.Add(item);
     362      AddItem();
    365363    }
    366364
    367365    protected virtual void removeButton_Click(object sender, EventArgs e) {
    368366      if (treeView.SelectedNode != null) {
     367        RemoveItem(treeView.SelectedNode.Tag as T);
    369368        detailsViewHost.Content = null;
    370369      }
    371370    }
     371
     372    protected abstract void AddItem();
     373
     374    protected abstract void RemoveItem(T item);
    372375
    373376    protected virtual void showDetailsCheckBox_CheckedChanged(object sender, EventArgs e) {
Note: See TracChangeset for help on using the changeset viewer.