Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/CodeNodeView.cs @ 13017

Last change on this file since 13017 was 13017, checked in by gkronber, 9 years ago

#2069 refactored grammar, symbols, and interpreter

File size: 2.2 KB
RevLine 
[9790]1#region License Information
2/* HeuristicLab
[13010]3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[9790]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;
[9779]23using HeuristicLab.Core.Views;
24using HeuristicLab.MainForm;
[13013]25using HeuristicLab.Problems.GeneticProgramming.Robocode;
[9779]26
[13013]27namespace HeuristicLab.Problems.GeneticProgramming.Views.Robocode {
[13017]28  [View("CodeSymbol View")]
29  [Content(typeof(CodeSymbol), IsDefaultView = true)]
[9890]30  public partial class CodeNodeView : ItemView {
[13017]31    public new CodeSymbol Content {
32      get { return (CodeSymbol)base.Content; }
[9779]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) {
[9890]44        prefixCode.Text = string.Empty;
45        suffixCode.Text = string.Empty;
[9779]46      } else {
[9890]47        prefixCode.Text = Content.Prefix;
48        suffixCode.Text = Content.Suffix;
[9779]49      }
50    }
51
52    private void suffixCode_Validated(object sender, EventArgs e) {
[9890]53      Content.Suffix = suffixCode.Text;
[9779]54    }
55
56    private void prefixCode_Validated(object sender, EventArgs e) {
[9890]57      Content.Prefix = prefixCode.Text;
[9779]58    }
[9890]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    }
[9779]66  }
67}
Note: See TracBrowser for help on using the repository browser.