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