Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/10/19 15:40:44 (5 years ago)
Author:
gkronber
Message:

#2520: merged r16491:16528 from trunk to persistence branch

Location:
branches/2520_PersistenceReintegration
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/2520_PersistenceReintegration

  • branches/2520_PersistenceReintegration/HeuristicLab.Analysis.Views

  • branches/2520_PersistenceReintegration/HeuristicLab.Analysis.Views/3.3/DataTableHistoryView.cs

    r16453 r16529  
    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/2520_PersistenceReintegration/HeuristicLab.Analysis.Views/3.3/DataTableView.cs

    r16453 r16529  
    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        }
     
    337337    #region Event Handlers
    338338    #region Content Event Handlers
    339     protected override void Content_NameChanged(object sender, EventArgs e) {
    340       if (InvokeRequired)
    341         Invoke(new EventHandler(Content_NameChanged), sender, e);
    342       else {
    343         Content.VisualProperties.Title = Content.Name;
    344         base.Content_NameChanged(sender, e);
    345       }
    346     }
    347339    private void Content_VisualPropertiesChanged(object sender, EventArgs e) {
    348340      if (InvokeRequired)
  • branches/2520_PersistenceReintegration/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesDialog.Designer.cs

    r16453 r16529  
    2121
    2222namespace HeuristicLab.Analysis.Views {
    23   partial class DataTableVisualPropertiesDialog {
     23  partial class DataTableVisualPropertiesDialog<TDataRow> {
    2424    /// <summary>
    2525    /// Required designer variable.
  • branches/2520_PersistenceReintegration/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesDialog.cs

    r16453 r16529  
    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/2520_PersistenceReintegration/HeuristicLab.Analysis.Views/3.3/IndexedDataTableView.Designer.cs

    r16453 r16529  
    5050      System.Windows.Forms.DataVisualization.Charting.Title title1 = new System.Windows.Forms.DataVisualization.Charting.Title();
    5151      this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart();
     52      this.configureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    5253      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5354      ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
     
    100101      this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove);
    101102      //
     103      // configureToolStripMenuItem
     104      //
     105      this.configureToolStripMenuItem.Name = "configureToolStripMenuItem";
     106      this.configureToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
     107      this.configureToolStripMenuItem.Text = "Configure Chart...";
     108      this.configureToolStripMenuItem.Click += new System.EventHandler(this.configureToolStripMenuItem_Click);
     109      //
    102110      // DataTableView
    103111      //
     
    121129
    122130    protected HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart chart;
    123 
     131    private System.Windows.Forms.ToolStripMenuItem configureToolStripMenuItem;
    124132  }
    125133}
  • branches/2520_PersistenceReintegration/HeuristicLab.Analysis.Views/3.3/IndexedDataTableView.cs

    r16453 r16529  
    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;
     
    4949      chart.ChartAreas[0].CursorX.Interval = 1;
    5050      chart.SuppressExceptions = true;
     51      chart.ContextMenuStrip.Items.Add(configureToolStripMenuItem);
    5152    }
    5253
     
    131132      base.SetEnabledStateOfControls();
    132133      chart.Enabled = Content != null;
     134    }
     135
     136    public void ShowConfiguration() {
     137      if (Content != null) {
     138        using (var dialog = new DataTableVisualPropertiesDialog<IndexedDataRow<T>>(Content)) {
     139          dialog.ShowDialog(this);
     140        }
     141      } else MessageBox.Show("Nothing to configure.");
    133142    }
    134143
     
    211220      if (Content.VisualProperties.TitleFont != null) chart.Titles[0].Font = Content.VisualProperties.TitleFont;
    212221      if (!Content.VisualProperties.TitleColor.IsEmpty) chart.Titles[0].ForeColor = Content.VisualProperties.TitleColor;
     222      chart.Titles[0].Text = Content.VisualProperties.Title;
     223      chart.Titles[0].Visible = !string.IsNullOrEmpty(Content.VisualProperties.Title);
    213224
    214225      if (Content.VisualProperties.AxisTitleFont != null) area.AxisX.TitleFont = Content.VisualProperties.AxisTitleFont;
     
    313324    #region Event Handlers
    314325    #region Content Event Handlers
    315     protected override void Content_NameChanged(object sender, EventArgs e) {
    316       if (InvokeRequired)
    317         Invoke(new EventHandler(Content_NameChanged), sender, e);
    318       else {
    319         chart.Titles[0].Text = Content.Name;
    320         base.Content_NameChanged(sender, e);
    321       }
    322     }
    323326    private void Content_VisualPropertiesChanged(object sender, EventArgs e) {
    324327      if (InvokeRequired)
     
    508511    }
    509512    #endregion
     513    private void configureToolStripMenuItem_Click(object sender, EventArgs e) {
     514      ShowConfiguration();
     515    }
    510516    #endregion
    511517
  • branches/2520_PersistenceReintegration/HeuristicLab.Analysis.Views/3.3/ScatterPlotView.cs

    r16453 r16529  
    4040    protected Dictionary<Series, Series> seriesToRegressionSeriesTable;
    4141    private double xMin, xMax, yMin, yMax;
     42    protected bool showChartOnly = false;
    4243
    4344    public new ScatterPlot Content {
     
    4647    }
    4748
    48     public bool ShowName {
    49       get { return nameTextBox.Visible; }
     49    public bool ShowChartOnly {
     50      get { return showChartOnly; }
    5051      set {
    51         if (nameTextBox.Visible != value) {
    52           foreach (Control c in Controls) {
    53             if (c == chart) continue;
    54             c.Visible = value;
    55           }
    56           chart.Dock = value ? DockStyle.None : DockStyle.Fill;
     52        if (showChartOnly != value) {
     53          showChartOnly = value;
     54          UpdateControlsVisibility();
    5755        }
    5856      }
     
    137135        }
    138136      } else MessageBox.Show("Nothing to configure.");
     137    }
     138
     139    protected void UpdateControlsVisibility() {
     140      if (InvokeRequired)
     141        Invoke(new Action(UpdateControlsVisibility));
     142      else {
     143        foreach (Control c in Controls) {
     144          if (c == chart) continue;
     145          c.Visible = !showChartOnly;
     146        }
     147        chart.Dock = showChartOnly ? DockStyle.Fill : DockStyle.None;
     148      }
    139149    }
    140150
Note: See TracChangeset for help on using the changeset viewer.