[106] | 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 |
|
---|
| 22 | using System;
|
---|
| 23 | using System.Collections.Generic;
|
---|
| 24 | using System.ComponentModel;
|
---|
| 25 | using System.Drawing;
|
---|
| 26 | using System.Data;
|
---|
| 27 | using System.Text;
|
---|
| 28 | using System.Windows.Forms;
|
---|
| 29 |
|
---|
| 30 | using HeuristicLab.Core;
|
---|
| 31 | using HeuristicLab.Data;
|
---|
| 32 |
|
---|
| 33 | namespace HeuristicLab.TestFunctions {
|
---|
[1188] | 34 | /// <summary>
|
---|
| 35 | /// Visual representation of a <see cref="TestFunctionInjector"/>.
|
---|
| 36 | /// </summary>
|
---|
[106] | 37 | public partial class TestFunctionInjectorView : ViewBase {
|
---|
[1188] | 38 | /// <summary>
|
---|
| 39 | /// Gets or sets the TestFunctionInjector to represent visually.
|
---|
| 40 | /// </summary>
|
---|
| 41 | /// <remarks>Uses property <see cref="ViewBase.Item"/> of base class <see cref="ViewBase"/>.
|
---|
| 42 | /// No own data storage present.</remarks>
|
---|
[106] | 43 | public TestFunctionInjector TestFunctionInjector {
|
---|
| 44 | get { return (TestFunctionInjector)base.Item; }
|
---|
| 45 | set { base.Item = value; }
|
---|
| 46 | }
|
---|
| 47 |
|
---|
[1188] | 48 | /// <summary>
|
---|
| 49 | /// Initializes a new instance of <see cref="TestFunctionInjectorView"/>.
|
---|
| 50 | /// </summary>
|
---|
[106] | 51 | public TestFunctionInjectorView() {
|
---|
| 52 | InitializeComponent();
|
---|
| 53 | }
|
---|
| 54 |
|
---|
[1188] | 55 | /// <summary>
|
---|
| 56 | /// Initializes a new instance of <see cref="TestFunctionInjectorView"/> with the given
|
---|
| 57 | /// <paramref name="testFunctionInjector"/> to display.
|
---|
| 58 | /// </summary>
|
---|
| 59 | /// <param name="testFunctionInjector">The injector to represent visually.</param>
|
---|
[106] | 60 | public TestFunctionInjectorView(TestFunctionInjector testFunctionInjector)
|
---|
| 61 | : this() {
|
---|
| 62 | TestFunctionInjector = testFunctionInjector;
|
---|
| 63 | }
|
---|
| 64 |
|
---|
[1188] | 65 | /// <summary>
|
---|
| 66 | /// Removes the eventhandler from the underlying controls.
|
---|
| 67 | /// </summary>
|
---|
| 68 | /// <remarks>Calls <see cref="ViewBase.RemoveItemEvents"/> of base class <see cref="ViewBase"/>.
|
---|
| 69 | /// </remarks>
|
---|
[106] | 70 | protected override void RemoveItemEvents() {
|
---|
| 71 | maximizationCheckBox.DataBindings.Clear();
|
---|
| 72 | dimensionTextBox.DataBindings.Clear();
|
---|
[109] | 73 | lowerBoundTextBox.DataBindings.Clear();
|
---|
| 74 | upperBoundTextBox.DataBindings.Clear();
|
---|
[106] | 75 | base.RemoveItemEvents();
|
---|
| 76 | }
|
---|
| 77 |
|
---|
[1188] | 78 | /// <summary>
|
---|
| 79 | /// Adds eventhandlers to the underlying controls.
|
---|
| 80 | /// </summary>
|
---|
| 81 | /// <remarks>Calls <see cref="ViewBase.AddItemEvents"/> of base class <see cref="ViewBase"/>.
|
---|
| 82 | /// </remarks>
|
---|
[106] | 83 | protected override void AddItemEvents() {
|
---|
| 84 | base.AddItemEvents();
|
---|
| 85 | maximizationCheckBox.DataBindings.Add("Checked", TestFunctionInjector, "Maximization");
|
---|
[109] | 86 | dimensionTextBox.DataBindings.Add("Text", TestFunctionInjector, "Dimension");
|
---|
| 87 | lowerBoundTextBox.DataBindings.Add("Text", TestFunctionInjector, "LowerBound");
|
---|
| 88 | upperBoundTextBox.DataBindings.Add("Text", TestFunctionInjector, "UpperBound");
|
---|
[106] | 89 | }
|
---|
| 90 |
|
---|
[1188] | 91 | /// <summary>
|
---|
| 92 | /// Updates all controls with the latest values.
|
---|
| 93 | /// </summary>
|
---|
| 94 | /// <remarks>Calls <see cref="ViewBase.UpdateControls"/> of base class <see cref="ViewBase"/>.</remarks>
|
---|
[106] | 95 | protected override void UpdateControls() {
|
---|
| 96 | base.UpdateControls();
|
---|
| 97 | if (TestFunctionInjector == null) {
|
---|
| 98 | maximizationCheckBox.Enabled = false;
|
---|
| 99 | maximizationCheckBox.Checked = false;
|
---|
| 100 | dimensionTextBox.Enabled = false;
|
---|
| 101 | dimensionTextBox.Text = "-";
|
---|
[109] | 102 | lowerBoundTextBox.Enabled = false;
|
---|
| 103 | lowerBoundTextBox.Text = "-";
|
---|
| 104 | upperBoundTextBox.Enabled = false;
|
---|
| 105 | upperBoundTextBox.Text = "-";
|
---|
[106] | 106 | } else {
|
---|
| 107 | maximizationCheckBox.Enabled = true;
|
---|
| 108 | dimensionTextBox.Enabled = true;
|
---|
[109] | 109 | lowerBoundTextBox.Enabled = true;
|
---|
| 110 | upperBoundTextBox.Enabled = true;
|
---|
[106] | 111 | }
|
---|
| 112 | }
|
---|
| 113 | }
|
---|
| 114 | }
|
---|