Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableHistoryView.cs @ 7229

Last change on this file since 7229 was 7216, checked in by abeham, 13 years ago

#1603

  • Made display name change transparent
  • Changed ok button

#1611

  • added warning and added label to show image size
  • fixed controls resizing
File size: 2.3 KB
RevLine 
[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]22using System.Linq;
[4703]23using System.Windows.Forms;
24using HeuristicLab.Core.Views;
25using HeuristicLab.MainForm;
[7216]26using System.Collections.Generic;
[4703]27
28namespace 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}
Note: See TracBrowser for help on using the repository browser.