Free cookie consent management tool by TermsFeed Policy Generator

source: branches/histogram/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesControl.cs @ 6012

Last change on this file since 6012 was 6012, checked in by abeham, 12 years ago

#1465

  • fine tuned UI for setting data(table|row) visual properties
  • added control for the data table visual properties
  • added a few more visual properties
File size: 3.1 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2011 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
22using System.Windows.Forms;
23using HeuristicLab.MainForm;
24using HeuristicLab.MainForm.WindowsForms;
25
26namespace HeuristicLab.Analysis.Views {
27  [View("DataRow Visual Properties")]
28  public partial class DataTableVisualPropertiesControl : UserControl {
29    protected bool SuppressEvents { get; set; }
30
31    private DataTableVisualProperties content;
32    public DataTableVisualProperties Content {
33      get { return content; }
34      set {
35        bool changed = (value != content);
36        content = value;
37        if (changed) OnContentChanged();
38      }
39    }
40
41    public DataTableVisualPropertiesControl() {
42      InitializeComponent();
43    }
44
45    protected virtual void OnContentChanged() {
46      SuppressEvents = true;
47      try {
48        if (Content == null) {
49          yPrimaryTextBox.Text = string.Empty;
50          ySecondaryTextBox.Text = string.Empty;
51          xPrimaryTextBox.Text = string.Empty;
52          xSecondaryTextBox.Text = string.Empty;
53        } else {
54          yPrimaryTextBox.Text = Content.YAxisTitle;
55          ySecondaryTextBox.Text = Content.SecondYAxisTitle;
56          xPrimaryTextBox.Text = Content.XAxisTitle;
57          xSecondaryTextBox.Text = Content.SecondXAxisTitle;
58        }
59      } finally { SuppressEvents = false; }
60      SetEnabledStateOfControls();
61    }
62
63    protected virtual void SetEnabledStateOfControls() {
64      axisTitlesGroupBox.Enabled = Content != null;
65    }
66
67    #region Event Handlers
68    private void yPrimaryTextBox_Validated(object sender, System.EventArgs e) {
69      if (!SuppressEvents && Content != null) {
70        Content.YAxisTitle = yPrimaryTextBox.Text;
71      }
72    }
73
74    private void ySecondaryTextBox_Validated(object sender, System.EventArgs e) {
75      if (!SuppressEvents && Content != null) {
76        Content.SecondYAxisTitle = ySecondaryTextBox.Text;
77      }
78    }
79
80    private void xPrimaryTextBox_Validated(object sender, System.EventArgs e) {
81      if (!SuppressEvents && Content != null) {
82        Content.XAxisTitle = xPrimaryTextBox.Text;
83      }
84    }
85
86    private void xSecondaryTextBox_Validated(object sender, System.EventArgs e) {
87      if (!SuppressEvents && Content != null) {
88        Content.SecondXAxisTitle = xSecondaryTextBox.Text;
89      }
90    }
91    #endregion
92  }
93}
Note: See TracBrowser for help on using the repository browser.