Free cookie consent management tool by TermsFeed Policy Generator

source: branches/histogram/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesDialog.cs @ 6010

Last change on this file since 6010 was 6010, checked in by abeham, 14 years ago

#1465

  • worked on histogram integration
    • Added control to display DataRowVisualProperties
    • Added a dialog to select the DataRowVisualProperties of different series
    • Added a Properties menu item to the context menu and an option to show or hide this item (default is hide)
File size: 2.9 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2011 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.Collections.Generic;
23using System.Windows.Forms;
24using HeuristicLab.Common.Resources;
25
26namespace HeuristicLab.Analysis.Views {
27  public partial class DataTableVisualPropertiesDialog : Form {
28    protected DataTable Content { get; private set; }
29    private DataTableVisualProperties originalDataTableVPs;
30    private Dictionary<string, DataRowVisualProperties> originalDataRowVPs;
31
32    public DataTableVisualPropertiesDialog(DataTable dataTable) {
33      InitializeComponent();
34      Content = dataTable;
35      originalDataTableVPs = (DataTableVisualProperties)Content.VisualProperties.Clone();
36      originalDataRowVPs = new Dictionary<string, DataRowVisualProperties>();
37      foreach (DataRow row in Content.Rows)
38        originalDataRowVPs.Add(row.Name, (DataRowVisualProperties)row.VisualProperties.Clone());
39      seriesListView.Items.Clear();
40      seriesListView.SmallImageList = new ImageList();
41      seriesListView.SmallImageList.Images.Add(VSImageLibrary.Graph);
42      FillSeriesListView();
43    }
44
45    private void FillSeriesListView() {
46      seriesListView.SelectedIndices.Clear();
47      foreach (DataRow row in Content.Rows) {
48        seriesListView.Items.Add(new ListViewItem(row.Name, 0));
49      }
50      seriesListView.SelectedIndices.Add(0);
51    }
52
53    private void seriesListView_SelectedIndexChanged(object sender, System.EventArgs e) {
54      if (seriesListView.SelectedItems.Count == 0) return;
55      string rowName = seriesListView.SelectedItems[0].Text;
56      dataRowVisualPropertiesControl.Content = Content.Rows[rowName].VisualProperties;
57    }
58
59    private void okButton_Click(object sender, System.EventArgs e) {
60      DialogResult = DialogResult.OK;
61      Close();
62    }
63
64    private void cancelButton_Click(object sender, System.EventArgs e) {
65      DialogResult = DialogResult.Cancel;
66      Content.VisualProperties = originalDataTableVPs;
67      foreach (DataRow row in Content.Rows) {
68        row.VisualProperties = originalDataRowVPs[row.Name];
69      }
70      Close();
71    }
72  }
73}
Note: See TracBrowser for help on using the repository browser.