Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/03/11 19:52:35 (13 years ago)
Author:
abeham
Message:

#1465

  • Added new interface IConfigureableView to HeuristicLab.MainForm
  • Adapted ViewHost to show a configuration button when its ActiveView is of type IConfigureableView
  • Changed DataTableHistoryView to be an IConfigureableView
  • When changing the configuration of a history view the configuration will be applied to every frame
  • Fixed a bug in calculating the histogram (when all values were the same)
  • Added preceeding and trailing 0-bar in the histogram to prevent cutting the first and last column in the view
  • Added a method Replace(IEnumerable<T>) to the ObservableList to do Clear() and AddRange() with just a single event notification
    • Calling that method from the QualityDistributionAnalyzer (otherwise the result view is flickering)
  • Fixing a bug regarding axis labels in the QualityDistributionAnalyzer
  • Removed double AfterDeserializationHook in QAP
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/histogram/HeuristicLab.Collections/3.3/ObservableList.cs

    r5445 r6115  
    2424using System.Collections.Generic;
    2525using System.ComponentModel;
     26using System.Linq;
    2627using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2728
     
    211212    }
    212213
     214    /// <summary>
     215    /// Performs a Clear and an AddRange, but does not fire separate events for those operations
     216    /// </summary>
     217    /// <param name="collection"></param>
     218    public void Replace(IEnumerable<T> collection) {
     219      List<IndexedItem<T>> oldItems = null;
     220      if (list.Any()) oldItems = list.Select((x, i) => new IndexedItem<T>(i, x)).ToList();
     221      else oldItems = new List<IndexedItem<T>>();
     222
     223      int oldCapacity = list.Capacity;
     224      list.Clear();
     225      list.AddRange(collection);
     226
     227      List<IndexedItem<T>> items = null;
     228      if (list.Any()) items = list.Select((x, i) => new IndexedItem<T>(i, x)).ToList();
     229      else items = new List<IndexedItem<T>>();
     230
     231      if (oldCapacity != list.Capacity) OnPropertyChanged("Capacity");
     232      OnPropertyChanged("Item[]");
     233      if (oldItems.Count != items.Count) OnPropertyChanged("Count");
     234      OnItemsReplaced(items, oldItems);
     235    }
     236
    213237    public bool Remove(T item) {
    214238      int index = list.IndexOf(item);
Note: See TracChangeset for help on using the changeset viewer.