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