Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2520_PersistenceReintegration/HeuristicLab.Problems.GeneticProgramming.Views/3.3/Robocode/CodeSymbolView.cs @ 16713

Last change on this file since 16713 was 16453, checked in by jkarder, 6 years ago

#2520: updated year of copyrights

File size: 2.2 KB
RevLine 
[13210]1#region License Information
2/* HeuristicLab
[16453]3 * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[13210]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 HeuristicLab.Core.Views;
24using HeuristicLab.MainForm;
25using HeuristicLab.Problems.GeneticProgramming.Robocode;
26
27namespace HeuristicLab.Problems.GeneticProgramming.Views.Robocode {
28  [View("CodeSymbol View")]
29  [Content(typeof(CodeSymbol), IsDefaultView = true)]
30  public partial class CodeNodeView : ItemView {
31    public new CodeSymbol Content {
32      get { return (CodeSymbol)base.Content; }
33      set { base.Content = value; }
34    }
35
36    public CodeNodeView()
37      : base() {
38      InitializeComponent();
39    }
40
41    protected override void OnContentChanged() {
42      base.OnContentChanged();
43      if (Content == null) {
44        prefixCode.Text = string.Empty;
45        suffixCode.Text = string.Empty;
46      } else {
47        prefixCode.Text = Content.Prefix;
48        suffixCode.Text = Content.Suffix;
49      }
50    }
51
52    private void suffixCode_Validated(object sender, EventArgs e) {
53      Content.Suffix = suffixCode.Text;
54    }
55
56    private void prefixCode_Validated(object sender, EventArgs e) {
57      Content.Prefix = prefixCode.Text;
58    }
59
60    protected override void SetEnabledStateOfControls() {
61      base.SetEnabledStateOfControls();
62
63      prefixCode.Enabled = Content != null && !Locked && !ReadOnly;
64      suffixCode.Enabled = Content != null && !Locked && !ReadOnly;
65    }
66  }
67}
Note: See TracBrowser for help on using the repository browser.