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