[4703] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[5445] | 3 | * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[4703] | 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 |
|
---|
[7216] | 22 | using System.Linq;
|
---|
[4703] | 23 | using System.Windows.Forms;
|
---|
| 24 | using HeuristicLab.Core.Views;
|
---|
| 25 | using HeuristicLab.MainForm;
|
---|
[7216] | 26 | using System.Collections.Generic;
|
---|
[4703] | 27 |
|
---|
| 28 | namespace HeuristicLab.Analysis.Views {
|
---|
| 29 | [View("DataTableHistory View")]
|
---|
| 30 | [Content(typeof(DataTableHistory), true)]
|
---|
[6342] | 31 | public partial class DataTableHistoryView : MovieView<DataTable>, IConfigureableView {
|
---|
[4703] | 32 | public DataTableHistoryView() {
|
---|
| 33 | InitializeComponent();
|
---|
| 34 | itemsGroupBox.Text = "Data Table";
|
---|
| 35 | }
|
---|
[6342] | 36 |
|
---|
| 37 | public void ShowConfiguration() {
|
---|
| 38 | DataTable current = viewHost.Content as DataTable;
|
---|
| 39 | if (current == null) return;
|
---|
| 40 | using (DataTableVisualPropertiesDialog dialog = new DataTableVisualPropertiesDialog(current)) {
|
---|
| 41 | if (dialog.ShowDialog() != DialogResult.OK) return;
|
---|
[7216] | 42 | HashSet<string> modifiedDisplayNames = new HashSet<string>(dialog.RowsWithModifiedDisplayNames);
|
---|
[6342] | 43 | foreach (DataTable dt in Content) {
|
---|
[6628] | 44 | if (current == dt) continue;
|
---|
| 45 | dt.VisualProperties = (DataTableVisualProperties)current.VisualProperties.Clone();
|
---|
| 46 | foreach (DataRow row in current.Rows) {
|
---|
| 47 | if (!dt.Rows.ContainsKey(row.Name)) continue;
|
---|
| 48 | string oldDisplayName = dt.Rows[row.Name].VisualProperties.DisplayName;
|
---|
[7216] | 49 | dt.Rows[row.Name].VisualProperties = (DataRowVisualProperties)row.VisualProperties.Clone();
|
---|
| 50 | if (!modifiedDisplayNames.Contains(row.Name))
|
---|
| 51 | dt.Rows[row.Name].VisualProperties.DisplayName = oldDisplayName;
|
---|
[6342] | 52 | }
|
---|
| 53 | }
|
---|
| 54 | }
|
---|
| 55 | }
|
---|
| 56 |
|
---|
[4703] | 57 | }
|
---|
| 58 | }
|
---|