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 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using System.Drawing;
|
---|
25 | using HeuristicLab.Common;
|
---|
26 | using HeuristicLab.Core;
|
---|
27 |
|
---|
28 | namespace HeuristicLab.DataPreprocessing {
|
---|
29 |
|
---|
30 | [Item("DataGrid", "Represents a data grid.")]
|
---|
31 | public class DataGridContent : Item, IDataGridContent {
|
---|
32 |
|
---|
33 | private readonly IDataGridLogic dataGridLogic;
|
---|
34 | private readonly IManipulationLogic preprocessingDataManipulation;
|
---|
35 | public DataGridContent(IDataGridLogic theDataGridLogic, IManipulationLogic thePreprocessingDataManipulation) {
|
---|
36 | dataGridLogic = theDataGridLogic;
|
---|
37 | preprocessingDataManipulation = thePreprocessingDataManipulation;
|
---|
38 | }
|
---|
39 |
|
---|
40 | public DataGridContent(DataGridContent dataGridContent, Cloner cloner)
|
---|
41 | : base(dataGridContent, cloner) {
|
---|
42 | }
|
---|
43 |
|
---|
44 | public IManipulationLogic PreprocessingDataManipulation {
|
---|
45 | get { return preprocessingDataManipulation; }
|
---|
46 | }
|
---|
47 |
|
---|
48 | public IDataGridLogic DataGridLogic {
|
---|
49 | get {
|
---|
50 | return dataGridLogic;
|
---|
51 | }
|
---|
52 | }
|
---|
53 |
|
---|
54 | public static new Image StaticItemImage {
|
---|
55 | get { return HeuristicLab.Common.Resources.VSImageLibrary.Table; }
|
---|
56 | }
|
---|
57 |
|
---|
58 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
59 | return new DataGridContent(this, cloner);
|
---|
60 | }
|
---|
61 |
|
---|
62 | public int Rows {
|
---|
63 | get {
|
---|
64 | return dataGridLogic.Rows;
|
---|
65 | }
|
---|
66 | set {
|
---|
67 | //does nothing
|
---|
68 | }
|
---|
69 | }
|
---|
70 |
|
---|
71 | public int Columns {
|
---|
72 | get {
|
---|
73 | return dataGridLogic.Columns;
|
---|
74 | }
|
---|
75 | set {
|
---|
76 | //does nothing
|
---|
77 | }
|
---|
78 | }
|
---|
79 |
|
---|
80 | public IEnumerable<string> ColumnNames {
|
---|
81 | get {
|
---|
82 | return dataGridLogic.ColumnNames;
|
---|
83 | }
|
---|
84 | set {
|
---|
85 |
|
---|
86 | }
|
---|
87 | }
|
---|
88 |
|
---|
89 | public IEnumerable<string> RowNames {
|
---|
90 | get {
|
---|
91 | return dataGridLogic.RowNames;
|
---|
92 | }
|
---|
93 | set {
|
---|
94 | //not supported
|
---|
95 | }
|
---|
96 | }
|
---|
97 |
|
---|
98 | public bool SortableView {
|
---|
99 | get {
|
---|
100 | return true;
|
---|
101 | }
|
---|
102 | set {
|
---|
103 | //not supported
|
---|
104 | }
|
---|
105 | }
|
---|
106 |
|
---|
107 | public bool ReadOnly {
|
---|
108 | get { return false; }
|
---|
109 | }
|
---|
110 |
|
---|
111 | public bool Validate(string value, out string errorMessage) {
|
---|
112 | errorMessage = string.Empty;
|
---|
113 | return true;
|
---|
114 | }
|
---|
115 |
|
---|
116 | public bool Validate(string value, out string errorMessage, int columnIndex) {
|
---|
117 | return dataGridLogic.Validate(value, out errorMessage, columnIndex);
|
---|
118 | }
|
---|
119 |
|
---|
120 | public string GetValue(int rowIndex, int columnIndex) {
|
---|
121 | return dataGridLogic.GetValue(rowIndex, columnIndex);
|
---|
122 | }
|
---|
123 |
|
---|
124 | public bool SetValue(string value, int rowIndex, int columnIndex) {
|
---|
125 | return dataGridLogic.SetValue(value, rowIndex, columnIndex);
|
---|
126 | }
|
---|
127 |
|
---|
128 | public event EventHandler ColumnsChanged;
|
---|
129 |
|
---|
130 | public event EventHandler RowsChanged;
|
---|
131 |
|
---|
132 | public event EventHandler ColumnNamesChanged;
|
---|
133 |
|
---|
134 | public event EventHandler RowNamesChanged;
|
---|
135 |
|
---|
136 | public event EventHandler SortableViewChanged;
|
---|
137 |
|
---|
138 | public event EventHandler<EventArgs<int, int>> ItemChanged;
|
---|
139 |
|
---|
140 | public event EventHandler Reset;
|
---|
141 |
|
---|
142 | public event DataPreprocessingChangedEventHandler Changed {
|
---|
143 | add { dataGridLogic.Changed += value; }
|
---|
144 | remove { dataGridLogic.Changed -= value; }
|
---|
145 | }
|
---|
146 | }
|
---|
147 | }
|
---|