Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/15/18 11:47:03 (6 years ago)
Author:
pfleck
Message:

#2947

  • Added interfaces for DataRow and DataTable (IDataTable is generic because the NamedItemCollection is invariant)
  • Adapted DataTableVisualPropertiesDialog to use the new interfaces
  • Added IConfigurableView to IndexedDataTableView
  • Fixed VisualProperty.Title change in IndexedDataTableView
Location:
branches/2947_ConfigurableIndexedDataTable
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • branches/2947_ConfigurableIndexedDataTable/HeuristicLab.Analysis.Views/3.3/DataTableHistoryView.cs

    r15583 r16149  
    3737      DataTable current = viewHost.Content as DataTable;
    3838      if (current == null) return;
    39       using (DataTableVisualPropertiesDialog dialog = new DataTableVisualPropertiesDialog(current)) {
     39      using (var dialog = new DataTableVisualPropertiesDialog<DataRow>(current)) {
    4040        if (dialog.ShowDialog(this) != DialogResult.OK) return;
    4141        HashSet<string> modifiedDisplayNames = new HashSet<string>(dialog.RowsWithModifiedDisplayNames);
  • branches/2947_ConfigurableIndexedDataTable/HeuristicLab.Analysis.Views/3.3/DataTableView.cs

    r15619 r16149  
    128128    public void ShowConfiguration() {
    129129      if (Content != null) {
    130         using (var dialog = new DataTableVisualPropertiesDialog(Content)) {
     130        using (var dialog = new DataTableVisualPropertiesDialog<DataRow>(Content)) {
    131131          dialog.ShowDialog(this);
    132132        }
  • branches/2947_ConfigurableIndexedDataTable/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesDialog.Designer.cs

    r15583 r16149  
    2121
    2222namespace HeuristicLab.Analysis.Views {
    23   partial class DataTableVisualPropertiesDialog {
     23  partial class DataTableVisualPropertiesDialog<TDataRow> {
    2424    /// <summary>
    2525    /// Required designer variable.
  • branches/2947_ConfigurableIndexedDataTable/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesDialog.cs

    r15583 r16149  
    2727
    2828namespace HeuristicLab.Analysis.Views {
    29   public partial class DataTableVisualPropertiesDialog : Form {
     29  public partial class DataTableVisualPropertiesDialog<TDataRow> : Form where TDataRow : class, IDataRow {
    3030    protected bool SuppressEvents { get; set; }
    31     protected DataTable Content { get; private set; }
     31    protected IDataTable<TDataRow> Content { get; private set; }
    3232    private DataTableVisualProperties originalDataTableVPs;
    3333    private Dictionary<string, DataRowVisualProperties> originalDataRowVPs;
     
    3636    public IEnumerable<string> RowsWithModifiedDisplayNames { get { return modifiedDisplayNames.AsEnumerable(); } }
    3737
    38     public DataTableVisualPropertiesDialog(DataTable dataTable) {
     38    public DataTableVisualPropertiesDialog(IDataTable<TDataRow> dataTable) {
    3939      InitializeComponent();
    4040      #region Prepare controls
     
    5151      originalDataTableVPs = (DataTableVisualProperties)Content.VisualProperties.Clone();
    5252      originalDataRowVPs = new Dictionary<string, DataRowVisualProperties>();
    53       foreach (DataRow row in Content.Rows)
     53      foreach (var row in Content.Rows)
    5454        originalDataRowVPs.Add(row.Name, (DataRowVisualProperties)row.VisualProperties.Clone());
    5555
     
    6262
    6363    private void RegisterContentEvents() {
    64       foreach (DataRow row in Content.Rows) {
     64      foreach (var row in Content.Rows) {
    6565        row.VisualProperties.PropertyChanged += new PropertyChangedEventHandler(Row_VisualProperties_PropertyChanged);
    6666      }
     
    6868
    6969    private void DeregisterContentEvents() {
    70       foreach (DataRow row in Content.Rows) {
     70      foreach (var row in Content.Rows) {
    7171        row.VisualProperties.PropertyChanged -= new PropertyChangedEventHandler(Row_VisualProperties_PropertyChanged);
    7272      }
     
    8080
    8181    private void Row_VisualProperties_PropertyChanged(object sender, PropertyChangedEventArgs e) {
    82       foreach (DataRow row in Content.Rows) {
     82      foreach (var row in Content.Rows) {
    8383        if (e.PropertyName == "DisplayName" && row.VisualProperties == sender) {
    8484          modifiedDisplayNames.Add(row.Name);
     
    109109    private void cancelButton_Click(object sender, System.EventArgs e) {
    110110      DialogResult = DialogResult.Cancel;
    111       foreach (DataRow row in Content.Rows) {
     111      foreach (var row in Content.Rows) {
    112112        row.VisualProperties = originalDataRowVPs[row.Name];
    113113      }
     
    160160    private void FillSeriesListView() {
    161161      seriesListView.SelectedIndices.Clear();
    162       foreach (DataRow row in Content.Rows) {
     162      foreach (var row in Content.Rows) {
    163163        seriesListView.Items.Add(new ListViewItem(row.Name, 0));
    164164      }
     
    168168
    169169    private void UpdateAllSeriesPositions() {
    170       Dictionary<string, DataRow> rows = Content.Rows.ToDictionary(x => x.Name);
     170      var rows = Content.Rows.ToDictionary(x => x.Name);
    171171      Content.Rows.Clear();
    172172      for (int i = 0; i < seriesListView.Items.Count; i++) {
  • branches/2947_ConfigurableIndexedDataTable/HeuristicLab.Analysis.Views/3.3/IndexedDataTableView.cs

    r15583 r16149  
    2020#endregion
    2121
    22 using HeuristicLab.Collections;
    23 using HeuristicLab.Core.Views;
    24 using HeuristicLab.MainForm;
    2522using System;
    2623using System.Collections.Generic;
     
    2926using System.Windows.Forms;
    3027using System.Windows.Forms.DataVisualization.Charting;
     28using HeuristicLab.Collections;
     29using HeuristicLab.Core.Views;
     30using HeuristicLab.MainForm;
    3131
    3232namespace HeuristicLab.Analysis.Views {
    3333  [View("IndexedDataTable View")]
    3434  [Content(typeof(IndexedDataTable<>), true)]
    35   public partial class IndexedDataTableView<T> : NamedItemView {
     35  public partial class IndexedDataTableView<T> : NamedItemView, IConfigureableView {
    3636    protected List<Series> invisibleSeries;
    3737    protected Dictionary<IObservableList<Tuple<T, double>>, IndexedDataRow<T>> valuesRowsTable;
     
    131131      base.SetEnabledStateOfControls();
    132132      chart.Enabled = Content != null;
     133    }
     134
     135    public void ShowConfiguration() {
     136      if (Content != null) {
     137        using (var dialog = new DataTableVisualPropertiesDialog<IndexedDataRow<T>>(Content)) {
     138          dialog.ShowDialog(this);
     139        }
     140      } else MessageBox.Show("Nothing to configure.");
    133141    }
    134142
     
    211219      if (Content.VisualProperties.TitleFont != null) chart.Titles[0].Font = Content.VisualProperties.TitleFont;
    212220      if (!Content.VisualProperties.TitleColor.IsEmpty) chart.Titles[0].ForeColor = Content.VisualProperties.TitleColor;
     221      chart.Titles[0].Text = Content.VisualProperties.Title;
     222      chart.Titles[0].Visible = !string.IsNullOrEmpty(Content.VisualProperties.Title);
    213223
    214224      if (Content.VisualProperties.AxisTitleFont != null) area.AxisX.TitleFont = Content.VisualProperties.AxisTitleFont;
  • branches/2947_ConfigurableIndexedDataTable/HeuristicLab.Analysis/3.3/DataVisualization/DataRow.cs

    r15583 r16149  
    3434  [Item("DataRow", "A row of data values.")]
    3535  [StorableClass]
    36   public class DataRow : NamedItem {
     36  public class DataRow : NamedItem , IDataRow {
    3737    private DataRowVisualProperties visualProperties;
    3838    public DataRowVisualProperties VisualProperties {
  • branches/2947_ConfigurableIndexedDataTable/HeuristicLab.Analysis/3.3/DataVisualization/DataTable.cs

    r15583 r16149  
    3737  [Item("DataTable", "A table of data values.")]
    3838  [StorableClass]
    39   public class DataTable : NamedItem, IStringConvertibleMatrix {
     39  public class DataTable : NamedItem, IStringConvertibleMatrix, IDataTable<DataRow> {
    4040    public static new Image StaticItemImage {
    4141      get { return HeuristicLab.Common.Resources.VSImageLibrary.Performance; }
  • branches/2947_ConfigurableIndexedDataTable/HeuristicLab.Analysis/3.3/DataVisualization/IndexedDataTable.cs

    r15583 r16149  
    3434  [Item("IndexedDataTable", "A data table where the points are also given with a certain index.")]
    3535  [StorableClass]
    36   public class IndexedDataTable<T> : NamedItem, IStringConvertibleMatrix {
     36  public class IndexedDataTable<T> : NamedItem, IStringConvertibleMatrix, IDataTable<IndexedDataRow<T>> {
    3737    public static new Image StaticItemImage {
    3838      get { return HeuristicLab.Common.Resources.VSImageLibrary.Performance; }
  • branches/2947_ConfigurableIndexedDataTable/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj

    r14734 r16149  
    134134    <Compile Include="DataVisualization\IndexedDataRow.cs" />
    135135    <Compile Include="DataVisualization\IndexedDataTable.cs" />
     136    <Compile Include="DataVisualization\Interfaces\IDataRow.cs" />
     137    <Compile Include="DataVisualization\Interfaces\IDataTable.cs" />
    136138    <Compile Include="DataVisualization\ScatterPlotDataRowVisualProperties.cs" />
    137139    <Compile Include="DataVisualization\ScatterPlotDataRow.cs" />
Note: See TracChangeset for help on using the changeset viewer.