Changeset 16838


Ignore:
Timestamp:
04/19/19 10:07:53 (4 months ago)
Author:
gkronber
Message:

#2947: merged r16527 from trunk to stable (without useless mergeinfo properties)

Location:
stable
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Analysis.Views/3.3/DataTableHistoryView.cs

    r15584 r16838  
    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);
  • stable/HeuristicLab.Analysis.Views/3.3/DataTableView.cs

    r15584 r16838  
    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)
  • stable/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesDialog.Designer.cs

    r15584 r16838  
    2121
    2222namespace HeuristicLab.Analysis.Views {
    23   partial class DataTableVisualPropertiesDialog {
     23  partial class DataTableVisualPropertiesDialog<TDataRow> {
    2424    /// <summary>
    2525    /// Required designer variable.
  • stable/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesDialog.cs

    r15584 r16838  
    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++) {
  • stable/HeuristicLab.Analysis.Views/3.3/IndexedDataTableView.Designer.cs

    r15584 r16838  
    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}
  • stable/HeuristicLab.Analysis.Views/3.3/IndexedDataTableView.cs

    r15584 r16838  
    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
  • stable/HeuristicLab.Analysis.Views/3.3/ScatterPlotView.cs

    r15584 r16838  
    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
  • stable/HeuristicLab.Analysis/3.3/DataVisualization/DataRow.cs

    r15584 r16838  
    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 {
  • stable/HeuristicLab.Analysis/3.3/DataVisualization/DataTable.cs

    r15584 r16838  
    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; }
  • stable/HeuristicLab.Analysis/3.3/DataVisualization/IndexedDataRow.cs

    r16282 r16838  
    3232  [Item("IndexedDataRow", "A data row that contains a series of points.")]
    3333  [StorableClass]
    34   public class IndexedDataRow<T> : NamedItem {
     34  public class IndexedDataRow<T> : NamedItem, IDataRow {
    3535
    3636    private DataRowVisualProperties visualProperties;
  • stable/HeuristicLab.Analysis/3.3/DataVisualization/IndexedDataTable.cs

    r15584 r16838  
    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; }
     
    9090    public IndexedDataTable(string name)
    9191      : base(name) {
    92       VisualProperties = new DataTableVisualProperties();
     92      VisualProperties = new DataTableVisualProperties(name);
    9393      rows = new NamedItemCollection<IndexedDataRow<T>>();
    9494      this.RegisterRowsEvents();
     
    9696    public IndexedDataTable(string name, string description)
    9797      : base(name, description) {
    98       VisualProperties = new DataTableVisualProperties();
     98      VisualProperties = new DataTableVisualProperties(name);
    9999      rows = new NamedItemCollection<IndexedDataRow<T>>();
    100100      this.RegisterRowsEvents();
     
    103103    public override IDeepCloneable Clone(Cloner cloner) {
    104104      return new IndexedDataTable<T>(this, cloner);
     105    }
     106
     107    #region BackwardsCompatibility3.3
     108    // Using the name as title is the old style
     109    [Storable(DefaultValue = true)]
     110    private bool useNameAsTitle = false;
     111    #endregion
     112
     113    [StorableHook(HookType.AfterDeserialization)]
     114    private void AfterDeserialization() {
     115      // BackwardsCompatibility3.3
     116      #region Backwards compatible code, remove with 3.4
     117      // Previously, the Name of the IndexedDataTable was used as Title
     118      if (useNameAsTitle && string.IsNullOrEmpty(VisualProperties.Title)) {
     119        VisualProperties.Title = Name;
     120        useNameAsTitle = false;
     121      }
     122      #endregion
    105123    }
    106124
  • stable/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj

    r15220 r16838  
    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" />
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs

    r15584 r16838  
    457457            Content = scatterPlot,
    458458            Dock = DockStyle.Fill,
    459             ShowName = false
     459            ShowChartOnly = true
    460460            //ShowLegend = false,
    461461            //XAxisFormat = "G3"
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.Designer.cs

    r15584 r16838  
    8686      this.scatterPlotView.Name = "scatterPlotView";
    8787      this.scatterPlotView.ReadOnly = false;
    88       this.scatterPlotView.ShowName = false;
     88      this.scatterPlotView.ShowChartOnly = true;
    8989      this.scatterPlotView.Size = new System.Drawing.Size(618, 517);
    9090      this.scatterPlotView.TabIndex = 0;
  • stable/HeuristicLab.Problems.TestFunctions.Views/3.3/ParetoFrontScatterPlotView.Designer.cs

    r15584 r16838  
    6262      this.scatterPlotView.Name = "scatterPlotView";
    6363      this.scatterPlotView.ReadOnly = false;
    64       this.scatterPlotView.ShowName = false;
     64      this.scatterPlotView.ShowChartOnly = true;
    6565      this.scatterPlotView.Size = new System.Drawing.Size(615, 342);
    6666      this.scatterPlotView.TabIndex = 3;
Note: See TracChangeset for help on using the changeset viewer.