Changeset 3562


Ignore:
Timestamp:
04/30/10 08:05:01 (12 years ago)
Author:
gkronber
Message:

Implemented changes as requested by swagner. #992 (CheckedItemList and CheckedItemCollection is necessary)

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/CheckedItemCollectionView.cs

    r3558 r3562  
    5656      Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<T>(Content_ItemsRemoved);
    5757      Content.CollectionReset -= new CollectionItemsChangedEventHandler<T>(Content_CollectionReset);
    58       Content.ItemsChecked -= new CollectionItemsChangedEventHandler<T>(Content_ItemsChecked);
     58      Content.CheckedItemsChanged -= new CollectionItemsChangedEventHandler<T>(Content_ItemsChecked);
    5959      base.DeregisterContentEvents();
    6060    }
     
    6464      Content.ItemsRemoved += new CollectionItemsChangedEventHandler<T>(Content_ItemsRemoved);
    6565      Content.CollectionReset += new CollectionItemsChangedEventHandler<T>(Content_CollectionReset);
    66       Content.ItemsChecked += new CollectionItemsChangedEventHandler<T>(Content_ItemsChecked);
     66      Content.CheckedItemsChanged += new CollectionItemsChangedEventHandler<T>(Content_ItemsChecked);
    6767    }
    6868
     
    299299        foreach (T item in e.Items) {
    300300          foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) {
    301             if (listViewItem.Checked != Content.IsItemChecked(item))
    302               listViewItem.Checked = Content.IsItemChecked(item);
     301            if (listViewItem.Checked != Content.ItemChecked(item))
     302              listViewItem.Checked = Content.ItemChecked(item);
    303303          }
    304304        }
  • trunk/sources/HeuristicLab.Core/3.3/Collections/CheckedItemCollection.cs

    r3560 r3562  
    6060    protected CheckedItemCollection(bool deserializing) : base(deserializing) { }
    6161
    62     public bool IsItemChecked(T item) {
     62    public bool ItemChecked(T item) {
    6363      return checkedState[item];
    6464    }
     
    7676        checkedState.Remove(oldItem);
    7777      foreach (var item in items)
    78         checkedState.Add(item, false);
     78        if (!checkedState.ContainsKey(item))
     79          checkedState.Add(item, false);
    7980      base.OnCollectionReset(items, oldItems);
    8081    }
     
    8283    protected override void OnItemsAdded(IEnumerable<T> items) {
    8384      foreach (var item in items)
    84         checkedState.Add(item, false);
     85        if (!checkedState.ContainsKey(item))
     86          checkedState.Add(item, false);
    8587      base.OnItemsAdded(items);
    8688    }
     
    9496
    9597    protected virtual void OnItemsChecked(IEnumerable<T> items) {
    96       RaiseItemsChecked(new CollectionItemsChangedEventArgs<T>(items));
     98      RaiseCheckedItemsChanged(new CollectionItemsChangedEventArgs<T>(items));
    9799    }
    98100
    99     public event CollectionItemsChangedEventHandler<T> ItemsChecked;
    100     private void RaiseItemsChecked(CollectionItemsChangedEventArgs<T> e) {
    101       var handler = ItemsChecked;
     101    public event CollectionItemsChangedEventHandler<T> CheckedItemsChanged;
     102    private void RaiseCheckedItemsChanged(CollectionItemsChangedEventArgs<T> e) {
     103      var handler = CheckedItemsChanged;
    102104      if (handler != null) handler(this, e);
    103105    }
  • trunk/sources/HeuristicLab.Core/3.3/Interfaces/ICheckedItemCollection.cs

    r3558 r3562  
    2424
    2525namespace HeuristicLab.Core {
    26   public interface ICheckedItemCollection<T> : IItemCollection<T>, IItem where T : class, IItem {
    27     event CollectionItemsChangedEventHandler<T> ItemsChecked;
     26  public interface ICheckedItemCollection<T> : IItemCollection<T> where T : class, IItem {
     27    event CollectionItemsChangedEventHandler<T> CheckedItemsChanged;
    2828    IEnumerable<T> CheckedItems { get; }
    29     bool IsItemChecked(T item);
     29    bool ItemChecked(T item);
    3030    void SetItemCheckedState(T item, bool checkedState);
    3131  }
Note: See TracChangeset for help on using the changeset viewer.