Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2906_Transformations/HeuristicLab.DataPreprocessing.Views/3.4/TransformationView.cs @ 15856

Last change on this file since 15856 was 15856, checked in by pfleck, 6 years ago

#2906 Implemented transformation re-apply of an already reverse-transformed model.

File size: 3.0 KB
RevLine 
[10539]1#region License Information
2/* HeuristicLab
[15583]3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[10539]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
[10786]22using System;
[15846]23using System.Collections.Generic;
[10814]24using System.Windows.Forms;
[10303]25using HeuristicLab.MainForm;
[10712]26using HeuristicLab.MainForm.WindowsForms;
[10303]27
28namespace HeuristicLab.DataPreprocessing.Views {
29  [View("Transformation View")]
[10712]30  [Content(typeof(TransformationContent), true)]
31  public partial class TransformationView : AsynchronousContentView {
[11068]32    public new TransformationContent Content {
[10998]33      get { return (TransformationContent)base.Content; }
34      set { base.Content = value; }
35    }
36
[10303]37    public TransformationView() {
38      InitializeComponent();
39    }
40
[10772]41    protected override void OnContentChanged() {
42      base.OnContentChanged();
43      if (Content == null) {
[10902]44        transformationListView.Content = null;
[10772]45      } else {
[10902]46        transformationListView.Content = Content.CheckedTransformationList;
[15846]47        transformationListView.PreprocessingData = Content.PreprocessingData;
[10977]48        CheckFilters();
[10772]49      }
50    }
[10786]51
[10977]52    protected override void RegisterContentEvents() {
[15518]53      Content.PreprocessingData.FilterChanged += FilterLogic_FilterChanged;
[10977]54    }
55
56    protected override void DeregisterContentEvents() {
[15518]57      Content.PreprocessingData.FilterChanged -= FilterLogic_FilterChanged;
[10977]58    }
59
60    void FilterLogic_FilterChanged(object sender, EventArgs e) {
61      if (Content != null) {
62        CheckFilters();
63      }
64    }
65
66    private void CheckFilters() {
[15518]67      if (Content.PreprocessingData.IsFiltered) {
[10977]68        applyButton.Enabled = false;
69        lblFilterNotice.Visible = true;
70      } else {
71        applyButton.Enabled = true;
72        lblFilterNotice.Visible = false;
73      }
74    }
75
[10786]76    private void applyButton_Click(object sender, EventArgs e) {
[15846]77      bool success = Content.ApplyTransformations(out IEnumerable<string> errorMessages);
[10786]78
79      if (success) {
[15856]80        //Content.CheckedTransformationList.Clear();
[10814]81        MessageBox.Show(this, "Transformations applied.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
[10819]82      } else {
[15846]83        MessageBox.Show(this, string.Join(Environment.NewLine, errorMessages), "Transformation failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
[10786]84      }
85    }
[10303]86  }
87}
Note: See TracBrowser for help on using the repository browser.