Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Operators.Views/3.3/CheckedMultiOperatorView.cs @ 7034

Last change on this file since 7034 was 5445, checked in by swagner, 14 years ago

Updated year of copyrights (#1406)

File size: 3.5 KB
RevLine 
[2756]1#region License Information
2/* HeuristicLab
[5445]3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[2756]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
[2917]22using System;
[2756]23using HeuristicLab.Core;
24using HeuristicLab.Core.Views;
25using HeuristicLab.MainForm;
26
[4068]27namespace HeuristicLab.Operators.Views {
[3591]28  [View("CheckedMultiOperator View")]
29  [Content(typeof(CheckedMultiOperator<>), true)]
30  public partial class CheckedMultiOperatorView<T> : NamedItemView where T : class, IOperator {
31    public new CheckedMultiOperator<T> Content {
32      get { return (CheckedMultiOperator<T>)base.Content; }
[2756]33      set { base.Content = value; }
34    }
35
36    /// <summary>
[3591]37    /// Initializes a new instance of <see cref="CheckedMultiOperatorView"/>.
[2756]38    /// </summary>
[3591]39    public CheckedMultiOperatorView() {
[2756]40      InitializeComponent();
41    }
42
[2917]43    /// <summary>
[3591]44    /// Removes the eventhandlers from the underlying <see cref="CheckedMultiOperator"/>.
[2917]45    /// </summary>
[3591]46    /// <remarks>Calls <see cref="NamedItemView.DeregisterContentEvents"/> of base class <see cref="NamedItemView"/>.</remarks>
[2917]47    protected override void DeregisterContentEvents() {
48      Content.BreakpointChanged -= new EventHandler(Content_BreakpointChanged);
49      base.DeregisterContentEvents();
50    }
51
52    /// <summary>
[3591]53    /// Adds eventhandlers to the underlying <see cref="CheckedMultiOperator"/>.
[2917]54    /// </summary>
[3591]55    /// <remarks>Calls <see cref="NamedItemView.RegisterContentEvents"/> of base class <see cref="NamedItemView"/>.</remarks>
[2917]56    protected override void RegisterContentEvents() {
57      base.RegisterContentEvents();
58      Content.BreakpointChanged += new EventHandler(Content_BreakpointChanged);
59    }
60
[2756]61    protected override void OnContentChanged() {
62      base.OnContentChanged();
63      if (Content == null) {
[2917]64        breakpointCheckBox.Checked = false;
[2773]65        operatorListView.Content = null;
[2756]66        parameterCollectionView.Content = null;
67      } else {
[2917]68        breakpointCheckBox.Checked = Content.Breakpoint;
[2773]69        operatorListView.Content = Content.Operators;
[2756]70        parameterCollectionView.Content = ((IOperator)Content).Parameters;
71      }
72    }
[2917]73
[3904]74    protected override void SetEnabledStateOfControls() {
75      base.SetEnabledStateOfControls();
[3696]76      breakpointCheckBox.Enabled = Content != null && !Locked;
[3454]77      parameterCollectionView.Enabled = Content != null;
78    }
79
[2917]80    protected void Content_BreakpointChanged(object sender, EventArgs e) {
81      if (InvokeRequired)
82        Invoke(new EventHandler(Content_DescriptionChanged), sender, e);
83      else
84        breakpointCheckBox.Checked = Content.Breakpoint;
85    }
86
87    protected void breakpointCheckBox_CheckedChanged(object sender, System.EventArgs e) {
88      if (Content != null) Content.Breakpoint = breakpointCheckBox.Checked;
89    }
[2756]90  }
91}
Note: See TracBrowser for help on using the repository browser.