Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/03/12 16:46:35 (12 years ago)
Author:
gkronber
Message:

#1847: merged r8084:8205 from trunk into GP move operators branch

Location:
branches/GP-MoveOperators
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/GP-MoveOperators

  • branches/GP-MoveOperators/HeuristicLab.Clients.Hive.Views/3.3/TreeView/HiveTaskItemTreeView.cs

    r8085 r8206  
    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) {
  • branches/GP-MoveOperators/HeuristicLab.Clients.Hive.Views/3.3/TreeView/ItemTreeView.cs

    r8085 r8206  
    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.