Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3448


Ignore:
Timestamp:
04/20/10 18:00:29 (15 years ago)
Author:
mkommend
Message:

added reaction of color & visibility of IRuns in RunCollectionTabularView (ticket #970)

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs

    r3444 r3448  
    3434  [Content(typeof(IStringConvertibleMatrix), true)]
    3535  public partial class StringConvertibleMatrixView : AsynchronousContentView {
    36     private int[] virtualRowIndizes;
     36    protected int[] virtualRowIndizes;
    3737    private List<KeyValuePair<int, SortOrder>> sortedColumnIndizes;
    3838    private RowComparer rowComparer;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs

    r3447 r3448  
    9494      Content.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    9595      Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    96       foreach (IRun run in Content)
     96      RegisterRunEvents(Content);
     97    }
     98    protected virtual void RegisterRunEvents(IEnumerable<IRun> runs) {
     99      foreach (IRun run in runs)
    97100        run.Changed += new EventHandler(run_Changed);
    98101    }
    99 
    100102    protected override void DeregisterContentEvents() {
    101103      base.DeregisterContentEvents();
     
    105107      Content.ItemsRemoved -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    106108      Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    107       foreach (IRun run in Content)
     109      DeregisterRunEvents(Content);
     110    }
     111    protected virtual void DeregisterRunEvents(IEnumerable<IRun> runs) {
     112      foreach (IRun run in runs)
    108113        run.Changed -= new EventHandler(run_Changed);
    109114    }
    110115
    111116    private void Content_CollectionReset(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
    112       foreach (IRun run in e.OldItems)
    113         run.Changed -= new EventHandler(run_Changed);
    114       foreach (IRun run in e.Items)
    115         run.Changed += new EventHandler(run_Changed);
    116     }
    117 
     117      DeregisterRunEvents(e.OldItems);
     118      RegisterRunEvents(e.Items);
     119    }
    118120    private void Content_ItemsRemoved(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
    119       foreach (IRun run in e.OldItems)
    120         run.Changed -= new EventHandler(run_Changed);
     121      DeregisterRunEvents(e.OldItems);
    121122    }
    122123    private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
    123       foreach (IRun run in e.Items)
    124         run.Changed += new EventHandler(run_Changed);
     124      RegisterRunEvents(e.Items);
    125125    }
    126126    private void run_Changed(object sender, EventArgs e) {
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionTabularView.cs

    r3447 r3448  
    5757      get { return (RunCollection)base.Content; }
    5858      set { base.Content = value; }
     59    }
     60
     61    protected override void RegisterContentEvents() {
     62      base.RegisterContentEvents();
     63      Content.ItemsAdded += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded);
     64      Content.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
     65      Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
     66      RegisterRunEvents(Content);
     67    }
     68    protected virtual void RegisterRunEvents(IEnumerable<IRun> runs) {
     69      foreach (IRun run in runs)
     70        run.Changed += new EventHandler(run_Changed);
     71    }
     72    protected override void DeregisterContentEvents() {
     73      base.DeregisterContentEvents();
     74      Content.ItemsAdded -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded);
     75      Content.ItemsRemoved -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
     76      Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
     77      DeregisterRunEvents(Content);
     78    }
     79    protected virtual void DeregisterRunEvents(IEnumerable<IRun> runs) {
     80      foreach (IRun run in runs)
     81        run.Changed -= new EventHandler(run_Changed);
     82    }
     83    private void Content_CollectionReset(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
     84      DeregisterRunEvents(e.OldItems);
     85      RegisterRunEvents(e.Items);
     86    }
     87    private void Content_ItemsRemoved(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
     88      DeregisterRunEvents(e.OldItems);
     89    }
     90    private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
     91      RegisterRunEvents(e.Items);
     92    }
     93    private void run_Changed(object sender, EventArgs e) {
     94      IRun run = (IRun)sender;
     95      int rowIndex = Content.ToList().IndexOf(run);
     96      rowIndex = virtualRowIndizes[rowIndex];
     97      this.dataGridView.Rows[rowIndex].Visible = run.Visible;
     98      this.dataGridView.Rows[rowIndex].DefaultCellStyle.ForeColor = run.Color;
    5999    }
    60100
Note: See TracChangeset for help on using the changeset viewer.