source: branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/DataGridContent.cs @ 10999

Last change on this file since 10999 was 10999, checked in by rstoll, 8 years ago
  • Reordered Code
File size: 3.9 KB
Line 
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
22using System;
23using System.Collections.Generic;
24using System.Drawing;
25using HeuristicLab.Common;
26using HeuristicLab.Core;
27
28namespace HeuristicLab.DataPreprocessing {
29
30  [Item("DataGrid", "Represents a data grid.")]
31  public class DataGridContent : Item, IViewShortcut, IDataGridContent {
32
33    public static new Image StaticItemImage {
34      get { return HeuristicLab.Common.Resources.VSImageLibrary.Table; }
35    }
36
37    public IManipulationLogic ManipulationLogic { get; private set; }
38    public IDataGridLogic DataGridLogic { get; private set; }
39    public IFilterLogic FilterLogic { get; private set; }
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 DataGridContent(IDataGridLogic theDataGridLogic, IManipulationLogic theManipulationLogic, IFilterLogic theFilterLogic) {
91      DataGridLogic = theDataGridLogic;
92      ManipulationLogic = theManipulationLogic;
93      FilterLogic = theFilterLogic;
94    }
95
96    public DataGridContent(DataGridContent dataGridContent, Cloner cloner)
97      : base(dataGridContent, cloner) {
98
99    }
100    public override IDeepCloneable Clone(Cloner cloner) {
101      return new DataGridContent(this, cloner);
102    }
103
104    public string GetValue(int rowIndex, int columnIndex) {
105      return DataGridLogic.GetValue(columnIndex, rowIndex);
106    }
107
108    public bool SetValue(string value, int rowIndex, int columnIndex) {
109      return DataGridLogic.SetValue(value, columnIndex, rowIndex);
110    }
111
112    public event DataPreprocessingChangedEventHandler Changed {
113      add { DataGridLogic.Changed += value; }
114      remove { DataGridLogic.Changed -= value; }
115    }
116
117
118    #region unused stuff/not implemented but necessary due to IStringConvertibleMatrix
119
120    // Is not used since DataGridContentView overrides dataGridView_CellValidating and uses
121    // DataGridLogic#Validate(string value, out string errorMessage, int columnIndex)
122    public bool Validate(string value, out string errorMessage) {
123      errorMessage = string.Empty;
124      return true;
125    }
126
127    public event EventHandler ColumnsChanged;
128
129    public event EventHandler RowsChanged;
130
131    public event EventHandler ColumnNamesChanged;
132
133    public event EventHandler RowNamesChanged;
134
135    public event EventHandler SortableViewChanged;
136
137    public event EventHandler<EventArgs<int, int>> ItemChanged;
138
139    public event EventHandler Reset;
140    #endregion
141
142  }
143}
Note: See TracBrowser for help on using the repository browser.