[2] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[2790] | 3 | * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[2] | 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 |
|
---|
[3376] | 22 | using HeuristicLab.Common;
|
---|
[2805] | 23 | using HeuristicLab.Core;
|
---|
| 24 | using HeuristicLab.Core.Views;
|
---|
[2520] | 25 | using HeuristicLab.MainForm;
|
---|
[2845] | 26 | using System;
|
---|
[2] | 27 |
|
---|
[2805] | 28 | namespace HeuristicLab.Operators.Views {
|
---|
[776] | 29 | /// <summary>
|
---|
[2655] | 30 | /// The base class for visual representations of items.
|
---|
[776] | 31 | /// </summary>
|
---|
[2917] | 32 | [View("Operator View (Default)")]
|
---|
[2664] | 33 | [Content(typeof(Operator), true)]
|
---|
[2727] | 34 | [Content(typeof(IOperator), false)]
|
---|
[2845] | 35 | public partial class OperatorView : ParameterizedNamedItemView {
|
---|
[2727] | 36 | public new IOperator Content {
|
---|
| 37 | get { return (IOperator)base.Content; }
|
---|
[2713] | 38 | set { base.Content = value; }
|
---|
[2] | 39 | }
|
---|
| 40 |
|
---|
[776] | 41 | /// <summary>
|
---|
[2655] | 42 | /// Initializes a new instance of <see cref="ItemBaseView"/>.
|
---|
[776] | 43 | /// </summary>
|
---|
[2664] | 44 | public OperatorView() {
|
---|
[2] | 45 | InitializeComponent();
|
---|
| 46 | }
|
---|
| 47 |
|
---|
[2845] | 48 | /// <summary>
|
---|
| 49 | /// Removes the eventhandlers from the underlying <see cref="IOperatorGraph"/>.
|
---|
| 50 | /// </summary>
|
---|
| 51 | /// <remarks>Calls <see cref="ViewBase.RemoveItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>
|
---|
| 52 | protected override void DeregisterContentEvents() {
|
---|
| 53 | Content.BreakpointChanged -= new EventHandler(Content_BreakpointChanged);
|
---|
| 54 | base.DeregisterContentEvents();
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | /// <summary>
|
---|
| 58 | /// Adds eventhandlers to the underlying <see cref="IOperatorGraph"/>.
|
---|
| 59 | /// </summary>
|
---|
| 60 | /// <remarks>Calls <see cref="ViewBase.AddItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>
|
---|
| 61 | protected override void RegisterContentEvents() {
|
---|
| 62 | base.RegisterContentEvents();
|
---|
| 63 | Content.BreakpointChanged += new EventHandler(Content_BreakpointChanged);
|
---|
| 64 | }
|
---|
| 65 |
|
---|
[2713] | 66 | protected override void OnContentChanged() {
|
---|
| 67 | base.OnContentChanged();
|
---|
| 68 | if (Content == null) {
|
---|
[2845] | 69 | breakpointCheckBox.Checked = false;
|
---|
[2] | 70 | } else {
|
---|
[2845] | 71 | breakpointCheckBox.Checked = Content.Breakpoint;
|
---|
[2] | 72 | }
|
---|
| 73 | }
|
---|
[2845] | 74 |
|
---|
[3904] | 75 | protected override void SetEnabledStateOfControls() {
|
---|
| 76 | base.SetEnabledStateOfControls();
|
---|
[3696] | 77 | breakpointCheckBox.Enabled = Content != null && !Locked;
|
---|
[3454] | 78 | }
|
---|
| 79 |
|
---|
[2917] | 80 | protected void Content_BreakpointChanged(object sender, EventArgs e) {
|
---|
[2845] | 81 | if (InvokeRequired)
|
---|
| 82 | Invoke(new EventHandler(Content_DescriptionChanged), sender, e);
|
---|
| 83 | else
|
---|
| 84 | breakpointCheckBox.Checked = Content.Breakpoint;
|
---|
| 85 | }
|
---|
| 86 |
|
---|
[2917] | 87 | protected void breakpointCheckBox_CheckedChanged(object sender, System.EventArgs e) {
|
---|
[2845] | 88 | if (Content != null) Content.Breakpoint = breakpointCheckBox.Checked;
|
---|
| 89 | }
|
---|
[2] | 90 | }
|
---|
| 91 | }
|
---|