1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Drawing;
|
---|
4 | using HeuristicLab.Common;
|
---|
5 | using HeuristicLab.Core;
|
---|
6 |
|
---|
7 | namespace HeuristicLab.DataPreprocessing {
|
---|
8 |
|
---|
9 | [Item("DataGrid", "Represents a data grid.")]
|
---|
10 | public class DataGridContent : Item, IDataGridContent, IContent {
|
---|
11 |
|
---|
12 | private readonly IDataGridLogic dataGridLogic;
|
---|
13 | private readonly IPreprocessingDataManipulation preprocessingDataManipulation;
|
---|
14 | public DataGridContent(IDataGridLogic theDataGridLogic, IPreprocessingDataManipulation thePreprocessingDataManipulation) {
|
---|
15 | dataGridLogic = theDataGridLogic;
|
---|
16 | preprocessingDataManipulation = thePreprocessingDataManipulation;
|
---|
17 | }
|
---|
18 |
|
---|
19 | public DataGridContent(DataGridContent dataGridContent, Cloner cloner)
|
---|
20 | : base(dataGridContent, cloner) {
|
---|
21 | }
|
---|
22 |
|
---|
23 | public IPreprocessingDataManipulation PreprocessingDataManipulation {
|
---|
24 | get { return preprocessingDataManipulation; }
|
---|
25 | }
|
---|
26 |
|
---|
27 | public IDataGridLogic DataGridLogic {
|
---|
28 | get {
|
---|
29 | return dataGridLogic;
|
---|
30 | }
|
---|
31 | }
|
---|
32 |
|
---|
33 | public static new Image StaticItemImage {
|
---|
34 | get { return HeuristicLab.Common.Resources.VSImageLibrary.Table; }
|
---|
35 | }
|
---|
36 |
|
---|
37 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
38 | return new DataGridContent(this, cloner);
|
---|
39 | }
|
---|
40 |
|
---|
41 | public int Rows {
|
---|
42 | get {
|
---|
43 | return dataGridLogic.Rows;
|
---|
44 | }
|
---|
45 | set {
|
---|
46 | //does nothing
|
---|
47 | }
|
---|
48 | }
|
---|
49 |
|
---|
50 | public int Columns {
|
---|
51 | get {
|
---|
52 | return dataGridLogic.Columns;
|
---|
53 | }
|
---|
54 | set {
|
---|
55 | //does nothing
|
---|
56 | }
|
---|
57 | }
|
---|
58 |
|
---|
59 | public IEnumerable<string> ColumnNames {
|
---|
60 | get {
|
---|
61 | return dataGridLogic.ColumnNames;
|
---|
62 | }
|
---|
63 | set {
|
---|
64 |
|
---|
65 | }
|
---|
66 | }
|
---|
67 |
|
---|
68 | public IEnumerable<string> RowNames {
|
---|
69 | get {
|
---|
70 | return dataGridLogic.RowNames;
|
---|
71 | }
|
---|
72 | set {
|
---|
73 | //not supported
|
---|
74 | }
|
---|
75 | }
|
---|
76 |
|
---|
77 | public bool SortableView {
|
---|
78 | get {
|
---|
79 | return true;
|
---|
80 | }
|
---|
81 | set {
|
---|
82 | //not supported
|
---|
83 | }
|
---|
84 | }
|
---|
85 |
|
---|
86 | public bool ReadOnly {
|
---|
87 | get { return false; }
|
---|
88 | }
|
---|
89 |
|
---|
90 | public bool Validate(string value, out string errorMessage) {
|
---|
91 | errorMessage = string.Empty;
|
---|
92 | return true;
|
---|
93 | }
|
---|
94 |
|
---|
95 | public bool Validate(string value, out string errorMessage, int columnIndex) {
|
---|
96 | return dataGridLogic.Validate(value, out errorMessage, columnIndex);
|
---|
97 | }
|
---|
98 |
|
---|
99 | public string GetValue(int rowIndex, int columnIndex) {
|
---|
100 | return dataGridLogic.GetValue(rowIndex, columnIndex);
|
---|
101 | }
|
---|
102 |
|
---|
103 | public bool SetValue(string value, int rowIndex, int columnIndex) {
|
---|
104 | return dataGridLogic.SetValue(value, rowIndex, columnIndex);
|
---|
105 | }
|
---|
106 |
|
---|
107 | public event EventHandler ColumnsChanged;
|
---|
108 |
|
---|
109 | public event EventHandler RowsChanged;
|
---|
110 |
|
---|
111 | public event EventHandler ColumnNamesChanged;
|
---|
112 |
|
---|
113 | public event EventHandler RowNamesChanged;
|
---|
114 |
|
---|
115 | public event EventHandler SortableViewChanged;
|
---|
116 |
|
---|
117 | public event EventHandler<EventArgs<int, int>> ItemChanged;
|
---|
118 |
|
---|
119 | public event EventHandler Reset;
|
---|
120 |
|
---|
121 | }
|
---|
122 | }
|
---|