Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Operator Architecture Refactoring/HeuristicLab.Core/3.2/ParameterView.cs @ 2045

Last change on this file since 2045 was 2030, checked in by swagner, 15 years ago

Refactoring of the Operator Architecture (#95)

File size: 3.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 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 System.Collections.Generic;
24using System.ComponentModel;
25using System.Drawing;
26using System.Data;
27using System.Text;
28using System.Windows.Forms;
29
30namespace HeuristicLab.Core {
31  /// <summary>
32  /// The visual representation of <see cref="IParameter"/>.
33  /// </summary>
34  public partial class ParameterView : ViewBase {
35    /// <summary>
36    /// Gets or sets the variable information to represent visually.
37    /// </summary>
38    /// <remarks>Uses property <see cref="ViewBase.Item"/> of base class <see cref="ViewBase"/>.
39    /// No own data storage present.</remarks>
40    public IParameter Parameter {
41      get { return (IParameter)Item; }
42      set { base.Item = value; }
43    }
44
45    /// <summary>
46    /// Initializes a new instance of <see cref="VariableInfoView"/> with caption "Variable Info".
47    /// </summary>
48    public ParameterView() {
49      InitializeComponent();
50      Caption = "Parameter";
51    }
52    /// <summary>
53    /// Initializes a new instance of <see cref="VariableInfoView"/>
54    /// with the given <paramref name="variableInfo"/>.
55    /// </summary>
56    /// <remarks>Calls <see cref="VariableInfoView()"/>.</remarks>
57    /// <param name="variableInfo">The variable info to represent visually.</param>
58    public ParameterView(IParameter parameter)
59      : this() {
60      Parameter = parameter;
61    }
62
63    /// <summary>
64    /// Updates all controls with the latest data of the model.
65    /// </summary>
66    /// <remarks>Calls <see cref="ViewBase.UpdateControls"/> of base class <see cref="ViewBase"/>.</remarks>
67    protected override void UpdateControls() {
68      base.UpdateControls();
69      Caption = "Parameter";
70      if (Parameter == null) {
71        nameTextBox.Enabled = false;
72        dataTypeTextBox.Enabled = false;
73        typeTextBox.Enabled = false;
74        descriptionTextBox.Enabled = false;
75      } else {
76        Caption = Parameter.Name + " (" + Parameter.GetType().Name + ")";
77        nameTextBox.Text = Parameter.Name;
78        nameTextBox.Enabled = true;
79        dataTypeTextBox.Text = Parameter.DataType.FullName;
80        dataTypeTextBox.Enabled = true;
81        typeTextBox.Text = Parameter.Type.ToString();
82        typeTextBox.Enabled = true;
83        descriptionTextBox.Text = Parameter.Description;
84        descriptionTextBox.Enabled = true;
85      }
86    }
87  }
88}
Note: See TracBrowser for help on using the repository browser.