Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelation/VariableVisibilityDialog.cs @ 8766

Last change on this file since 8766 was 8689, checked in by sforsten, 12 years ago

#1292:

  • NaN values are used, if the calculation is invalid (e.g. missing values, infinity etc.)
  • Variables can now be filtered. Initially allowed input variables and target variable are shown, but with a right click a dialog can be opened to select variables, which shall be shown
File size: 2.6 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 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;
23using System.Collections.Generic;
24using System.Linq;
25using System.Windows.Forms;
26
27namespace HeuristicLab.DataAnalysis.Views {
28  public partial class VariableVisibilityDialog : Form {
29    public VariableVisibilityDialog() {
30      InitializeComponent();
31    }
32
33    public VariableVisibilityDialog(IEnumerable<string> columns, IEnumerable<bool> visibility)
34      : this() {
35      if (columns.Count() != visibility.Count()) {
36        throw new ArgumentException("There have to be as many variables as values for visibility!");
37      }
38      this.columns = columns.ToList();
39      this.visibility = visibility.ToList();
40      UpdateCheckBoxes();
41    }
42
43    private List<string> columns;
44    public IList<string> Columns {
45      get { return this.columns; }
46    }
47    private List<bool> visibility;
48    public IList<bool> Visibility {
49      get { return this.visibility; }
50    }
51
52    private void UpdateCheckBoxes() {
53      for (int i = 0; i < columns.Count; i++) {
54        checkedListBox.Items.Add(columns[i], visibility[i]);
55      }
56    }
57
58    public event ItemCheckEventHandler VariableVisibilityChanged;
59
60    private void checkedListBox_ItemCheck(object sender, ItemCheckEventArgs e) {
61      this.visibility[e.Index] = e.NewValue == CheckState.Checked;
62      if (VariableVisibilityChanged != null) {
63        VariableVisibilityChanged(this, e);
64      }
65    }
66
67    private void btnShowAll_Click(object sender, System.EventArgs e) {
68      for (int i = 0; i < checkedListBox.Items.Count; i++)
69        checkedListBox.SetItemChecked(i, true);
70    }
71    private void btnHideAll_Click(object sender, System.EventArgs e) {
72      for (int i = 0; i < checkedListBox.Items.Count; i++)
73        checkedListBox.SetItemChecked(i, false);
74    }
75  }
76}
Note: See TracBrowser for help on using the repository browser.