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