1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.ComponentModel;
|
---|
4 | using System.Drawing;
|
---|
5 | using System.Data;
|
---|
6 | using System.Linq;
|
---|
7 | using System.Text;
|
---|
8 | using System.Windows.Forms;
|
---|
9 | using HeuristicLab.Core.Views;
|
---|
10 | using HeuristicLab.MainForm;
|
---|
11 | using HeuristicLab.MainForm.WindowsForms;
|
---|
12 | using HeuristicLab.Problems.DataAnalysis;
|
---|
13 | using HeuristicLab.Data.Views;
|
---|
14 |
|
---|
15 | namespace HeuristicLab.DataPreprocessing.Views {
|
---|
16 |
|
---|
17 | [View("Histogram View")]
|
---|
18 | [Content(typeof(HistogramContent), false)]
|
---|
19 | public partial class HistogramView : ItemView {
|
---|
20 | public HistogramView() {
|
---|
21 | InitializeComponent();
|
---|
22 | }
|
---|
23 |
|
---|
24 | public new HistogramContent Content {
|
---|
25 | get { return (HistogramContent)base.Content; }
|
---|
26 | set { base.Content = value; }
|
---|
27 | }
|
---|
28 |
|
---|
29 | protected override void OnContentChanged() {
|
---|
30 | base.OnContentChanged();
|
---|
31 | if (Content != null) {
|
---|
32 | InitDataTable();
|
---|
33 | InitVariablesListBox();
|
---|
34 | }
|
---|
35 | }
|
---|
36 |
|
---|
37 | private void InitVariablesListBox() {
|
---|
38 | IHistogramLogic logic = Content.HistogramLogic;
|
---|
39 |
|
---|
40 | foreach (var variableName in logic.GetVariableNames()) {
|
---|
41 | variablesListBox.Items.Add(variableName, true);
|
---|
42 | }
|
---|
43 | }
|
---|
44 |
|
---|
45 | private void InitDataTable() {
|
---|
46 | IHistogramLogic logic = Content.HistogramLogic;
|
---|
47 | viewHost.Content = logic.GetDataTable();
|
---|
48 | }
|
---|
49 |
|
---|
50 | private void variablesListBox_ItemCheck(object sender, ItemCheckEventArgs e) {
|
---|
51 | string item = variablesListBox.Items[e.Index] as string;
|
---|
52 |
|
---|
53 | if (e.NewValue == CheckState.Checked && !Content.HistogramLogic.VariableIsDisplayed(item))
|
---|
54 | Content.HistogramLogic.AddVariable(item);
|
---|
55 | else if (e.NewValue == CheckState.Unchecked && Content.HistogramLogic.VariableIsDisplayed(item))
|
---|
56 | Content.HistogramLogic.RemoveVariable(item);
|
---|
57 | }
|
---|
58 | }
|
---|
59 | }
|
---|
60 |
|
---|
61 |
|
---|
62 |
|
---|
63 |
|
---|
64 |
|
---|