Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/RunCollectionItemDictionaryView.cs @ 5728

Last change on this file since 5728 was 5303, checked in by cneumuel, 14 years ago

#1215

  • manipulators for one and all parameters
  • SolutionCache to avoid multiple evaluations of equal solutions
  • RunsAnalyzer which stores all base level runs
  • ItemDictionaryView for runs
File size: 2.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Drawing;
5using System.Data;
6using System.Linq;
7using System.Text;
8using System.Windows.Forms;
9using HeuristicLab.MainForm;
10using HeuristicLab.Core;
11using HeuristicLab.Optimization;
12using HeuristicLab.Data;
13using HeuristicLab.Core.Views;
14
15namespace HeuristicLab.Problems.MetaOptimization.Views {
16
17  [View("RunCollectionItemDictionaryView")]
18  [Content(typeof(ItemDictionary<StringValue, RunCollection>), IsDefaultView = false)]
19  public sealed partial class RunCollectionItemDictionaryView : ItemView {
20    public new ItemDictionary<StringValue,RunCollection> Content {
21      get { return (ItemDictionary<StringValue,RunCollection>)base.Content; }
22      set { base.Content = value; }
23    }
24
25    public RunCollectionItemDictionaryView() {
26      InitializeComponent();
27    }
28
29    protected override void DeregisterContentEvents() {
30      // TODO: Deregister your event handlers here
31      base.DeregisterContentEvents();
32    }
33
34    protected override void RegisterContentEvents() {
35      base.RegisterContentEvents();
36      // TODO: Register your event handlers here
37    }
38
39    #region Event Handlers (Content)
40    // TODO: Put event handlers of the content here
41    #endregion
42
43    protected override void OnContentChanged() {
44      base.OnContentChanged();
45      if (Content == null) {
46        this.runCollectionDictionaryView.Content = null;
47        this.runCollectionView.Content = null;
48      } else {
49        this.runCollectionDictionaryView.Content = Content;
50        this.runCollectionView.Content = new RunCollection(GetAllRuns(Content));
51        // todo: register for runs added/removed and dictionary-entries added/removed
52      }
53    }
54
55    private IEnumerable<IRun> GetAllRuns(ItemDictionary<StringValue, RunCollection> runsDictionary) {
56      var runs = new List<IRun>();
57      foreach (var item in runsDictionary) {
58        runs.AddRange(item.Value);
59      }
60      return runs;
61    }
62
63
64    protected override void SetEnabledStateOfControls() {
65      base.SetEnabledStateOfControls();
66      // TODO: Enable or disable controls based on whether the content is null or the view is set readonly
67    }
68
69    #region Event Handlers (child controls)
70    // TODO: Put event handlers of child controls here.
71    #endregion
72  }
73}
Note: See TracBrowser for help on using the repository browser.