source: branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/ManipulationView.cs @ 10709

Last change on this file since 10709 was 10709, checked in by rstoll, 6 years ago
  • Added ManipulationView with Content

presentation logic implemented
manipulation actions for delete xY missing

  • License added to LineChartView
  • ShuffleWithRanges without parameter added to ManipulationLogic (will use training and test partition)
File size: 3.4 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2013 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.Drawing;
24using System.Windows.Forms;
25using HeuristicLab.Core.Views;
26using HeuristicLab.MainForm;
27
28namespace HeuristicLab.DataPreprocessing.Views {
29
30  [View("Manipulation Chart View")]
31  [Content(typeof(ManipulationContent), false)]
32  public partial class ManipulationView : ItemView {
33
34    private Action[] validators;
35    private Action[] manipulations;
36
37    public ManipulationView() {
38      InitializeComponent();
39      tabsData.Appearance = TabAppearance.FlatButtons;
40      tabsData.ItemSize = new Size(0, 1);
41      tabsData.SizeMode = TabSizeMode.Fixed;
42      tabsPreview.Appearance = TabAppearance.FlatButtons;
43      tabsPreview.ItemSize = new Size(0, 1);
44      tabsPreview.SizeMode = TabSizeMode.Fixed;
45
46      validators = new Action[] {
47        ()=>validateDoubleTextBox(txtDeleteColumnsInfo.Text),
48        ()=>validateDoubleTextBox(txtDeleteColumnsVariance.Text),
49        ()=>validateDoubleTextBox(txtDeleteRowsInfo.Text),
50        ()=>{btnApply.Enabled = true;} //shuffle
51      };
52      manipulations = new Action[] {
53        ()=>{},
54        ()=>{},
55        ()=>{},
56        ()=>Content.ManipulationLogic.ShuffleWithRanges()
57      };
58    }
59
60    public new ManipulationContent Content {
61      get { return (ManipulationContent)base.Content; }
62      set { base.Content = value; }
63    }
64
65    private void lstMethods_SelectedIndexChanged(object sender, System.EventArgs e) {
66      int index = lstMethods.SelectedIndex;
67      tabsData.SelectedIndex = index + 1;
68      tabsPreview.SelectedIndex = index + 1;
69      btnApply.Enabled = false;
70
71      //in order that button will be enabled if text is already valid
72
73      validators[index]();
74    }
75
76    private void btnApply_Click(object sender, System.EventArgs e) {
77      manipulations[lstMethods.SelectedIndex]();
78    }
79
80    private void validateDoubleTextBox(String text) {
81      btnApply.Enabled = false;
82      if (!string.IsNullOrEmpty(text)) {
83        double percent;
84        if (Double.TryParse(text, out percent)) {
85          btnApply.Enabled = true;
86        }
87      }
88    }
89
90    private void txtDeleteColumnsInfo_TextChanged(object sender, EventArgs e) {
91      validateDoubleTextBox(txtDeleteColumnsInfo.Text);
92    }
93
94    private void txtDeleteColumnsVariance_TextChanged(object sender, EventArgs e) {
95      validateDoubleTextBox(txtDeleteColumnsVariance.Text);
96    }
97
98    private void txtDeleteRowsInfo_TextChanged(object sender, EventArgs e) {
99      validateDoubleTextBox(txtDeleteRowsInfo.Text);
100    }
101  }
102}
Note: See TracBrowser for help on using the repository browser.