Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/DataGridContent.cs @ 10614

Last change on this file since 10614 was 10614, checked in by pfleck, 10 years ago
  • replaced main menu list with ItemCollectionList
  • added ViewShortcut interface for menu items
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    private readonly IDataGridLogic dataGridLogic;
34    private readonly IManipulationLogic preprocessingDataManipulation;
35
36    public DataGridContent(IDataGridLogic theDataGridLogic, IManipulationLogic thePreprocessingDataManipulation) {
37      dataGridLogic = theDataGridLogic;
38      preprocessingDataManipulation = thePreprocessingDataManipulation;
39    }
40
41    public DataGridContent(DataGridContent dataGridContent, Cloner cloner)
42      : base(dataGridContent, cloner) {
43    }
44
45    public IManipulationLogic PreprocessingDataManipulation {
46      get { return preprocessingDataManipulation; }
47    }
48
49    public IDataGridLogic DataGridLogic {
50      get {
51        return dataGridLogic;
52      }
53    }
54
55    public static new Image StaticItemImage {
56      get { return HeuristicLab.Common.Resources.VSImageLibrary.Table; }
57    }
58
59    public override IDeepCloneable Clone(Cloner cloner) {
60      return new DataGridContent(this, cloner);
61    }
62
63    public int Rows {
64      get {
65        return dataGridLogic.Rows;
66      }
67      set {
68        //does nothing
69      }
70    }
71
72    public int Columns {
73      get {
74        return dataGridLogic.Columns;
75      }
76      set {
77        //does nothing
78      }
79    }
80
81    public IEnumerable<string> ColumnNames {
82      get {
83        return dataGridLogic.ColumnNames;
84      }
85      set {
86
87      }
88    }
89
90    public IEnumerable<string> RowNames {
91      get {
92        return dataGridLogic.RowNames;
93      }
94      set {
95        //not supported
96      }
97    }
98
99    public bool SortableView {
100      get {
101        return true;
102      }
103      set {
104        //not supported
105      }
106    }
107
108    public bool ReadOnly {
109      get { return false; }
110    }
111
112    public bool Validate(string value, out string errorMessage) {
113      errorMessage = string.Empty;
114      return true;
115    }
116
117    public bool Validate(string value, out string errorMessage, int columnIndex) {
118      return dataGridLogic.Validate(value, out errorMessage, columnIndex);
119    }
120
121    public string GetValue(int rowIndex, int columnIndex) {
122      return dataGridLogic.GetValue(rowIndex, columnIndex);
123    }
124
125    public bool SetValue(string value, int rowIndex, int columnIndex) {
126      return dataGridLogic.SetValue(value, rowIndex, columnIndex);
127    }
128
129    public event EventHandler ColumnsChanged;
130
131    public event EventHandler RowsChanged;
132
133    public event EventHandler ColumnNamesChanged;
134
135    public event EventHandler RowNamesChanged;
136
137    public event EventHandler SortableViewChanged;
138
139    public event EventHandler<EventArgs<int, int>> ItemChanged;
140
141    public event EventHandler Reset;
142
143    public event DataPreprocessingChangedEventHandler Changed {
144      add { dataGridLogic.Changed += value; }
145      remove { dataGridLogic.Changed -= value; }
146    }
147  }
148}
Note: See TracBrowser for help on using the repository browser.