Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/ResultParameterView.cs @ 12764

Last change on this file since 12764 was 12764, checked in by abeham, 9 years ago

#2431:

  • branched relevant plugins
  • added analyzer to calculate quality vs evaluation first-hit graph
  • (also added results parameter)
File size: 2.6 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using HeuristicLab.Core;
24using HeuristicLab.MainForm;
25using HeuristicLab.Parameters.Views;
26
27namespace HeuristicLab.Optimization.Views {
28  [View("ResultParameter View")]
29  [Content(typeof(ResultParameter<>), true)]
30  [Content(typeof(IResultParameter<>), false)]
31  public partial class ResultParameterView<T> : LookupParameterView<ResultCollection> where T : class, IItem, new() {
32
33    public new IResultParameter<T> Content {
34      get { return (IResultParameter<T>)base.Content; }
35      set { base.Content = value; }
36    }
37
38    public ResultParameterView() {
39      InitializeComponent();
40    }
41
42    protected override void DeregisterContentEvents() {
43      Content.ResultNameChanged -= new EventHandler(Content_ResultNameChanged);
44      base.DeregisterContentEvents();
45    }
46
47    protected override void RegisterContentEvents() {
48      base.RegisterContentEvents();
49      Content.ResultNameChanged += new EventHandler(Content_ResultNameChanged);
50    }
51
52    protected override void OnContentChanged() {
53      base.OnContentChanged();
54      if (Content == null)
55        resultNameTextBox.Text = "-";
56      else
57        resultNameTextBox.Text = Content.ResultName;
58    }
59
60    protected override void SetEnabledStateOfControls() {
61      base.SetEnabledStateOfControls();
62      resultNameTextBox.Enabled = Content != null;
63      resultNameTextBox.ReadOnly = ReadOnly;
64    }
65
66    private void Content_ResultNameChanged(object sender, EventArgs e) {
67      if (InvokeRequired)
68        Invoke(new EventHandler(Content_ResultNameChanged), sender, e);
69      else
70        resultNameTextBox.Text = Content.ResultName;
71    }
72
73    private void resultNameTextBox_Validated(object sender, EventArgs e) {
74      Content.ResultName = resultNameTextBox.Text;
75    }
76  }
77}
Note: See TracBrowser for help on using the repository browser.