#region License Information /* HeuristicLab * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using System.Collections.Generic; using System.Drawing; using HeuristicLab.Common; using HeuristicLab.Core; namespace HeuristicLab.DataPreprocessing { [Item("DataGrid", "Represents a data grid.")] public class DataGridContent : Item, IViewShortcut, IDataGridContent { private readonly IDataGridLogic dataGridLogic; private readonly IManipulationLogic preprocessingDataManipulation; public DataGridContent(IDataGridLogic theDataGridLogic, IManipulationLogic thePreprocessingDataManipulation) { dataGridLogic = theDataGridLogic; preprocessingDataManipulation = thePreprocessingDataManipulation; } public DataGridContent(DataGridContent dataGridContent, Cloner cloner) : base(dataGridContent, cloner) { } public IManipulationLogic PreprocessingDataManipulation { get { return preprocessingDataManipulation; } } public IDataGridLogic DataGridLogic { get { return dataGridLogic; } } public static new Image StaticItemImage { get { return HeuristicLab.Common.Resources.VSImageLibrary.Table; } } public override IDeepCloneable Clone(Cloner cloner) { return new DataGridContent(this, cloner); } public int Rows { get { return dataGridLogic.Rows; } set { //does nothing } } public int Columns { get { return dataGridLogic.Columns; } set { //does nothing } } public IEnumerable ColumnNames { get { return dataGridLogic.ColumnNames; } set { } } public IEnumerable RowNames { get { return dataGridLogic.RowNames; } set { //not supported } } public bool SortableView { get { return true; } set { //not supported } } public bool ReadOnly { get { return false; } } public bool Validate(string value, out string errorMessage) { errorMessage = string.Empty; return true; } public bool Validate(string value, out string errorMessage, int columnIndex) { return dataGridLogic.Validate(value, out errorMessage, columnIndex); } public string GetValue(int rowIndex, int columnIndex) { return dataGridLogic.GetValue(rowIndex, columnIndex); } public bool SetValue(string value, int rowIndex, int columnIndex) { return dataGridLogic.SetValue(value, rowIndex, columnIndex); } public event EventHandler ColumnsChanged; public event EventHandler RowsChanged; public event EventHandler ColumnNamesChanged; public event EventHandler RowNamesChanged; public event EventHandler SortableViewChanged; public event EventHandler> ItemChanged; public event EventHandler Reset; public event DataPreprocessingChangedEventHandler Changed { add { dataGridLogic.Changed += value; } remove { dataGridLogic.Changed -= value; } } } }