Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/16/13 13:13:41 (12 years ago)
Author:
spimming
Message:

#1888:

  • Merged revisions from trunk
Location:
branches/OaaS
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS

  • branches/OaaS/HeuristicLab.Optimization.Views

    • Property svn:mergeinfo deleted
  • branches/OaaS/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBoxPlotView.cs

    r7469 r9363  
    7575      Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    7676      Content.UpdateOfRunsInProgressChanged += new EventHandler(Content_UpdateOfRunsInProgressChanged);
     77      Content.OptimizerNameChanged += new EventHandler(Content_AlgorithmNameChanged);
    7778      RegisterRunEvents(Content);
    7879    }
     
    8586      Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    8687      Content.UpdateOfRunsInProgressChanged -= new EventHandler(Content_UpdateOfRunsInProgressChanged);
     88      Content.OptimizerNameChanged -= new EventHandler(Content_AlgorithmNameChanged);
    8789      DeregisterRunEvents(Content);
    8890    }
     
    122124        this.categoricalMapping.Clear();
    123125        UpdateDataPoints();
     126        UpdateAxisLabels();
    124127      }
    125128    }
     
    135138        this.Invoke(new EventHandler(run_Changed), sender, e);
    136139      else if (!suppressUpdates) {
    137         IRun run = (IRun)sender;
    138140        UpdateDataPoints();
    139141      }
     142    }
     143
     144    private void Content_AlgorithmNameChanged(object sender, EventArgs e) {
     145      if (InvokeRequired)
     146        Invoke(new EventHandler(Content_AlgorithmNameChanged), sender, e);
     147      else UpdateCaption();
    140148    }
    141149    #endregion
     
    147155      UpdateComboBoxes();
    148156      UpdateDataPoints();
     157      UpdateCaption();
     158    }
     159
     160    private void UpdateCaption() {
     161      Caption = Content != null ? Content.OptimizerName + " Box Plots" : ViewAttribute.GetViewName(GetType());
    149162    }
    150163
     
    313326    }
    314327    private double GetCategoricalValue(int dimension, string value) {
    315       if (!this.categoricalMapping.ContainsKey(dimension))
     328      if (!this.categoricalMapping.ContainsKey(dimension)) {
    316329        this.categoricalMapping[dimension] = new Dictionary<object, double>();
    317       if (!this.categoricalMapping[dimension].ContainsKey(value)) {
    318         if (this.categoricalMapping[dimension].Values.Count == 0)
    319           this.categoricalMapping[dimension][value] = 1.0;
    320         else
    321           this.categoricalMapping[dimension][value] = this.categoricalMapping[dimension].Values.Max() + 1.0;
     330        var orderedCategories = Content.Where(r=> r.Visible).Select(r => Content.GetValue(r, dimension).ToString())
     331                                .Distinct()
     332                                .OrderBy(x => x, new NaturalStringComparer());
     333        int count = 1;
     334        foreach (var category in orderedCategories) {
     335          this.categoricalMapping[dimension].Add(category, count);
     336          count++;
     337        }
    322338      }
    323339      return this.categoricalMapping[dimension][value];
  • branches/OaaS/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.Designer.cs

    r7967 r9363  
    4646    private void InitializeComponent() {
    4747      this.components = new System.ComponentModel.Container();
    48       System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
    49       System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
     48      System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
     49      System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
    5050      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RunCollectionBubbleChartView));
    5151      this.yJitterLabel = new System.Windows.Forms.Label();
     
    6565      this.selectButton = new System.Windows.Forms.RadioButton();
    6666      this.radioButtonGroup = new System.Windows.Forms.GroupBox();
    67       this.colorButton = new System.Windows.Forms.Button();
     67      this.colorDialogButton = new System.Windows.Forms.Button();
    6868      this.colorDialog = new System.Windows.Forms.ColorDialog();
    6969      this.tooltip = new System.Windows.Forms.ToolTip(this.components);
     
    7272      this.noRunsLabel = new System.Windows.Forms.Label();
    7373      this.sizeTrackBar = new System.Windows.Forms.TrackBar();
     74      this.getDataAsMatrixToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     75      this.transparencyTrackBar = new System.Windows.Forms.TrackBar();
     76      this.transparencyLabel = new System.Windows.Forms.Label();
     77      this.colorRunsButton = new System.Windows.Forms.Button();
     78      this.hideRunsButton = new System.Windows.Forms.Button();
    7479      ((System.ComponentModel.ISupportInitialize)(this.xTrackBar)).BeginInit();
    7580      ((System.ComponentModel.ISupportInitialize)(this.yTrackBar)).BeginInit();
     
    7782      this.radioButtonGroup.SuspendLayout();
    7883      ((System.ComponentModel.ISupportInitialize)(this.sizeTrackBar)).BeginInit();
     84      ((System.ComponentModel.ISupportInitialize)(this.transparencyTrackBar)).BeginInit();
    7985      this.SuspendLayout();
    8086      //
     
    188194      //
    189195      this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    190                   | System.Windows.Forms.AnchorStyles.Left)
    191                   | System.Windows.Forms.AnchorStyles.Right)));
    192       chartArea2.Name = "ChartArea1";
    193       this.chart.ChartAreas.Add(chartArea2);
     196            | System.Windows.Forms.AnchorStyles.Left)
     197            | System.Windows.Forms.AnchorStyles.Right)));
     198      chartArea1.Name = "ChartArea1";
     199      this.chart.ChartAreas.Add(chartArea1);
    194200      this.chart.Location = new System.Drawing.Point(6, 30);
    195201      this.chart.Name = "chart";
    196       series2.ChartArea = "ChartArea1";
    197       series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
    198       series2.IsVisibleInLegend = false;
    199       series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;
    200       series2.Name = "Bubbles";
    201       series2.YValuesPerPoint = 2;
    202       this.chart.Series.Add(series2);
     202      series1.ChartArea = "ChartArea1";
     203      series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
     204      series1.IsVisibleInLegend = false;
     205      series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;
     206      series1.Name = "Bubbles";
     207      series1.YValuesPerPoint = 2;
     208      this.chart.Series.Add(series1);
    203209      this.chart.Size = new System.Drawing.Size(843, 425);
    204210      this.chart.TabIndex = 16;
     
    215221      this.openBoxPlotViewToolStripMenuItem.Text = "Open BoxPlot View";
    216222      this.openBoxPlotViewToolStripMenuItem.Click += new System.EventHandler(this.openBoxPlotViewToolStripMenuItem_Click);
    217       //
     223      // 
    218224      // hideRunToolStripMenuItem
    219       //
     225      // 
    220226      this.hideRunToolStripMenuItem.Name = "hideRunToolStripMenuItem";
    221227      this.hideRunToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
    222228      this.hideRunToolStripMenuItem.Text = "Hide Run";
    223       this.hideRunToolStripMenuItem.Click += new System.EventHandler(hideRunToolStripMenuItem_Click);
     229      this.hideRunToolStripMenuItem.Click += new System.EventHandler(this.hideRunToolStripMenuItem_Click);
    224230      //
    225231      // zoomButton
     
    253259      this.radioButtonGroup.Controls.Add(this.zoomButton);
    254260      this.radioButtonGroup.Controls.Add(this.selectButton);
    255       this.radioButtonGroup.Location = new System.Drawing.Point(3, 461);
     261      this.radioButtonGroup.Location = new System.Drawing.Point(2, 461);
    256262      this.radioButtonGroup.Name = "radioButtonGroup";
    257       this.radioButtonGroup.Size = new System.Drawing.Size(135, 32);
     263      this.radioButtonGroup.Size = new System.Drawing.Size(122, 32);
    258264      this.radioButtonGroup.TabIndex = 19;
    259265      this.radioButtonGroup.TabStop = false;
    260266      //
    261       // colorButton
    262       //
    263       this.colorButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    264       this.colorButton.Enabled = false;
    265       this.colorButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
    266       this.colorButton.Location = new System.Drawing.Point(144, 469);
    267       this.colorButton.Name = "colorButton";
    268       this.colorButton.Size = new System.Drawing.Size(64, 21);
    269       this.colorButton.TabIndex = 20;
    270       this.colorButton.Text = "Color";
    271       this.colorButton.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
    272       this.colorButton.UseVisualStyleBackColor = true;
    273       this.colorButton.Click += new System.EventHandler(this.colorButton_Click);
     267      // colorDialogButton
     268      //
     269      this.colorDialogButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     270      this.colorDialogButton.Enabled = false;
     271      this.colorDialogButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
     272      this.colorDialogButton.Location = new System.Drawing.Point(130, 469);
     273      this.colorDialogButton.Name = "colorDialogButton";
     274      this.colorDialogButton.Size = new System.Drawing.Size(21, 21);
     275      this.colorDialogButton.TabIndex = 20;
     276      this.colorDialogButton.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
     277      this.tooltip.SetToolTip(this.colorDialogButton, "Choose color");
     278      this.colorDialogButton.UseVisualStyleBackColor = true;
     279      this.colorDialogButton.Click += new System.EventHandler(this.colorDialogButton_Click);
    274280      //
    275281      // colorDialog
     
    317323      this.sizeTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    318324      this.sizeTrackBar.Location = new System.Drawing.Point(787, 3);
    319       this.sizeTrackBar.Maximum = 50;
    320       this.sizeTrackBar.Minimum = 5;
     325      this.sizeTrackBar.Maximum = 20;
     326      this.sizeTrackBar.Minimum = -20;
    321327      this.sizeTrackBar.Name = "sizeTrackBar";
    322328      this.sizeTrackBar.Size = new System.Drawing.Size(64, 45);
    323329      this.sizeTrackBar.TabIndex = 24;
    324       this.sizeTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
    325       this.sizeTrackBar.Value = 10;
     330      this.sizeTrackBar.TickFrequency = 20;
     331      this.sizeTrackBar.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
    326332      this.sizeTrackBar.ValueChanged += new System.EventHandler(this.sizeTrackBar_ValueChanged);
    327333      //
     334      // getDataAsMatrixToolStripMenuItem
     335      //
     336      this.getDataAsMatrixToolStripMenuItem.Name = "getDataAsMatrixToolStripMenuItem";
     337      this.getDataAsMatrixToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
     338      this.getDataAsMatrixToolStripMenuItem.Text = "Get Data as Matrix";
     339      this.getDataAsMatrixToolStripMenuItem.Click += new System.EventHandler(this.getDataAsMatrixToolStripMenuItem_Click);
     340      //
     341      // transparencyTrackBar
     342      //
     343      this.transparencyTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     344      this.transparencyTrackBar.LargeChange = 16;
     345      this.transparencyTrackBar.Location = new System.Drawing.Point(359, 470);
     346      this.transparencyTrackBar.Maximum = 254;
     347      this.transparencyTrackBar.Name = "transparencyTrackBar";
     348      this.transparencyTrackBar.Size = new System.Drawing.Size(64, 45);
     349      this.transparencyTrackBar.TabIndex = 24;
     350      this.transparencyTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
     351      this.tooltip.SetToolTip(this.transparencyTrackBar, "Sets the transparency of the colors");
     352      this.transparencyTrackBar.ValueChanged += new System.EventHandler(this.transparencyTrackBar_ValueChanged);
     353      //
     354      // transparencyLabel
     355      //
     356      this.transparencyLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     357      this.transparencyLabel.AutoSize = true;
     358      this.transparencyLabel.Location = new System.Drawing.Point(278, 475);
     359      this.transparencyLabel.Name = "transparencyLabel";
     360      this.transparencyLabel.Size = new System.Drawing.Size(75, 13);
     361      this.transparencyLabel.TabIndex = 12;
     362      this.transparencyLabel.Text = "Transparency:";
     363      //
     364      // colorRunsButton
     365      //
     366      this.colorRunsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     367      this.colorRunsButton.Enabled = false;
     368      this.colorRunsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
     369      this.colorRunsButton.Location = new System.Drawing.Point(151, 469);
     370      this.colorRunsButton.Name = "colorRunsButton";
     371      this.colorRunsButton.Size = new System.Drawing.Size(43, 21);
     372      this.colorRunsButton.TabIndex = 25;
     373      this.colorRunsButton.Text = "Color";
     374      this.colorRunsButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     375      this.tooltip.SetToolTip(this.colorRunsButton, "Color all selected runs");
     376      this.colorRunsButton.UseVisualStyleBackColor = true;
     377      this.colorRunsButton.Click += new System.EventHandler(this.colorRunsButton_Click);
     378      //
     379      // hideRunsButton
     380      //
     381      this.hideRunsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     382      this.hideRunsButton.Enabled = false;
     383      this.hideRunsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
     384      this.hideRunsButton.Location = new System.Drawing.Point(194, 469);
     385      this.hideRunsButton.Name = "hideRunsButton";
     386      this.hideRunsButton.Size = new System.Drawing.Size(43, 21);
     387      this.hideRunsButton.TabIndex = 26;
     388      this.hideRunsButton.Text = "Hide";
     389      this.hideRunsButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     390      this.tooltip.SetToolTip(this.hideRunsButton, "Hides all selected runs");
     391      this.hideRunsButton.UseVisualStyleBackColor = true;
     392      this.hideRunsButton.Click += new System.EventHandler(this.hideRunsButton_Click);
     393      //
    328394      // RunCollectionBubbleChartView
    329395      //
    330       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    331396      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    332397      this.BackColor = System.Drawing.SystemColors.Window;
    333398      this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     399      this.Controls.Add(this.hideRunsButton);
     400      this.Controls.Add(this.colorRunsButton);
     401      this.Controls.Add(this.transparencyTrackBar);
    334402      this.Controls.Add(this.sizeTrackBar);
    335403      this.Controls.Add(this.colorYAxisButton);
    336404      this.Controls.Add(this.colorXAxisButton);
    337405      this.Controls.Add(this.noRunsLabel);
    338       this.Controls.Add(this.colorButton);
     406      this.Controls.Add(this.colorDialogButton);
    339407      this.Controls.Add(this.radioButtonGroup);
    340408      this.Controls.Add(this.chart);
     
    342410      this.Controls.Add(this.sizeComboBox);
    343411      this.Controls.Add(this.yJitterLabel);
     412      this.Controls.Add(this.transparencyLabel);
    344413      this.Controls.Add(this.xJitterlabel);
    345414      this.Controls.Add(this.xTrackBar);
     
    357426      this.radioButtonGroup.PerformLayout();
    358427      ((System.ComponentModel.ISupportInitialize)(this.sizeTrackBar)).EndInit();
     428      ((System.ComponentModel.ISupportInitialize)(this.transparencyTrackBar)).EndInit();
    359429      this.ResumeLayout(false);
    360430      this.PerformLayout();
     
    377447    private System.Windows.Forms.RadioButton selectButton;
    378448    private System.Windows.Forms.GroupBox radioButtonGroup;
    379     private System.Windows.Forms.Button colorButton;
     449    private System.Windows.Forms.Button colorDialogButton;
    380450    private System.Windows.Forms.ColorDialog colorDialog;
    381451    private System.Windows.Forms.ToolTip tooltip;
     
    386456    private System.Windows.Forms.Button colorYAxisButton;
    387457    private System.Windows.Forms.TrackBar sizeTrackBar;
     458    private System.Windows.Forms.ToolStripMenuItem getDataAsMatrixToolStripMenuItem;
     459    private System.Windows.Forms.TrackBar transparencyTrackBar;
     460    private System.Windows.Forms.Label transparencyLabel;
     461    private System.Windows.Forms.Button colorRunsButton;
     462    private System.Windows.Forms.Button hideRunsButton;
    388463  }
    389464}
  • branches/OaaS/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs

    r7469 r9363  
    4343    private string sizeAxisValue;
    4444
    45     private Dictionary<IRun, List<DataPoint>> runToDataPointMapping;
    46     private Dictionary<int, Dictionary<object, double>> categoricalMapping;
    47     private Dictionary<IRun, double> xJitter;
    48     private Dictionary<IRun, double> yJitter;
     45    private readonly Dictionary<IRun, List<DataPoint>> runToDataPointMapping = new Dictionary<IRun, List<DataPoint>>();
     46    private readonly Dictionary<IRun, int> runToIndexMapping = new Dictionary<IRun, int>();
     47    private readonly Dictionary<int, Dictionary<object, double>> categoricalMapping = new Dictionary<int, Dictionary<object, double>>();
     48    private readonly Dictionary<IRun, double> xJitter = new Dictionary<IRun, double>();
     49    private readonly Dictionary<IRun, double> yJitter = new Dictionary<IRun, double>();
     50
     51    private readonly HashSet<IRun> selectedRuns = new HashSet<IRun>();
     52    private readonly Random random = new Random();
    4953    private double xJitterFactor = 0.0;
    5054    private double yJitterFactor = 0.0;
    51     private Random random;
    5255    private bool isSelecting = false;
    5356    private bool suppressUpdates = false;
    5457
     58
    5559    public RunCollectionBubbleChartView() {
    5660      InitializeComponent();
     
    5862      chart.ContextMenuStrip.Items.Insert(0, hideRunToolStripMenuItem);
    5963      chart.ContextMenuStrip.Items.Insert(1, openBoxPlotViewToolStripMenuItem);
     64      chart.ContextMenuStrip.Items.Add(getDataAsMatrixToolStripMenuItem);
    6065      chart.ContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(ContextMenuStrip_Opening);
    6166
    62       runToDataPointMapping = new Dictionary<IRun, List<DataPoint>>();
    63       categoricalMapping = new Dictionary<int, Dictionary<object, double>>();
    64       xJitter = new Dictionary<IRun, double>();
    65       yJitter = new Dictionary<IRun, double>();
    66       random = new Random();
    67 
    6867      colorDialog.Color = Color.Black;
    69       colorButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color);
     68      colorDialogButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color);
    7069      isSelecting = false;
    7170
     
    8382    public IStringConvertibleMatrix Matrix {
    8483      get { return this.Content; }
     84    }
     85    public IEnumerable<IRun> SelectedRuns {
     86      get { return selectedRuns; }
    8587    }
    8688
     
    9294      Content.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    9395      Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
     96      Content.OptimizerNameChanged += new EventHandler(Content_AlgorithmNameChanged);
    9497      Content.UpdateOfRunsInProgressChanged += new EventHandler(Content_UpdateOfRunsInProgressChanged);
    9598      RegisterRunEvents(Content);
     
    102105      Content.ItemsRemoved -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    103106      Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
     107      Content.OptimizerNameChanged -= new EventHandler(Content_AlgorithmNameChanged);
    104108      Content.UpdateOfRunsInProgressChanged -= new EventHandler(Content_UpdateOfRunsInProgressChanged);
    105109      DeregisterRunEvents(Content);
     
    125129    }
    126130    private void run_Changed(object sender, EventArgs e) {
     131      if (suppressUpdates) return;
    127132      if (InvokeRequired)
    128133        this.Invoke(new EventHandler(run_Changed), sender, e);
     
    130135        IRun run = (IRun)sender;
    131136        UpdateRun(run);
     137        UpdateCursorInterval();
     138        chart.ChartAreas[0].RecalculateAxesScale();
     139        UpdateAxisLabels();
     140      }
     141    }
     142
     143    private void Content_UpdateOfRunsInProgressChanged(object sender, EventArgs e) {
     144      if (InvokeRequired)
     145        this.Invoke(new EventHandler(Content_UpdateOfRunsInProgressChanged), sender, e);
     146      else {
     147        suppressUpdates = Content.UpdateOfRunsInProgress;
     148        if (suppressUpdates) return;
     149
     150        foreach (var run in Content) UpdateRun(run);
     151        UpdateMarkerSizes();
     152        UpdateCursorInterval();
     153        chart.ChartAreas[0].RecalculateAxesScale();
     154        UpdateAxisLabels();
    132155      }
    133156    }
    134157
    135158    private void UpdateRun(IRun run) {
    136       if (!suppressUpdates) {
    137         if (runToDataPointMapping.ContainsKey(run)) {
    138           foreach (DataPoint point in runToDataPointMapping[run]) {
    139             point.Color = run.Color;
    140             if (!run.Visible) {
    141               this.chart.Series[0].Points.Remove(point);
    142               UpdateCursorInterval();
    143               chart.ChartAreas[0].RecalculateAxesScale();
    144             }
     159      if (runToDataPointMapping.ContainsKey(run)) {
     160        foreach (DataPoint point in runToDataPointMapping[run]) {
     161          if (!run.Visible) {
     162            this.chart.Series[0].Points.Remove(point);
     163            continue;
    145164          }
    146           if (!run.Visible) runToDataPointMapping.Remove(run);
    147         } else {
    148           AddDataPoint(run);
    149           UpdateCursorInterval();
    150           chart.ChartAreas[0].RecalculateAxesScale();
    151         }
    152 
    153         if (this.chart.Series[0].Points.Count == 0)
    154           noRunsLabel.Visible = true;
    155         else
    156           noRunsLabel.Visible = false;
    157       }
     165          if (selectedRuns.Contains(run)) {
     166            point.Color = Color.Red;
     167            point.MarkerStyle = MarkerStyle.Cross;
     168          } else {
     169            point.Color = Color.FromArgb(255 - transparencyTrackBar.Value, ((IRun)point.Tag).Color);
     170            point.MarkerStyle = MarkerStyle.Circle;
     171          }
     172
     173        }
     174        if (!run.Visible) runToDataPointMapping.Remove(run);
     175      } else {
     176        AddDataPoint(run);
     177      }
     178
     179      if (this.chart.Series[0].Points.Count == 0)
     180        noRunsLabel.Visible = true;
     181      else
     182        noRunsLabel.Visible = false;
    158183    }
    159184
     
    163188      UpdateComboBoxes();
    164189      UpdateDataPoints();
    165     }
     190      UpdateCaption();
     191      RebuildInverseIndex();
     192    }
     193
     194    private void RebuildInverseIndex() {
     195      if (Content != null) {
     196        runToIndexMapping.Clear();
     197        int i = 0;
     198        foreach (var run in Content) {
     199          runToIndexMapping.Add(run, i);
     200          i++;
     201        }
     202      }
     203    }
     204
    166205    private void Content_ColumnNamesChanged(object sender, EventArgs e) {
    167206      if (InvokeRequired)
     
    169208      else
    170209        UpdateComboBoxes();
     210    }
     211
     212    private void UpdateCaption() {
     213      Caption = Content != null ? Content.OptimizerName + " Bubble Chart" : ViewAttribute.GetViewName(GetType());
    171214    }
    172215
     
    202245          changed = true;
    203246        }
    204         if (changed)
     247        if (changed) {
    205248          UpdateDataPoints();
    206       }
    207     }
    208 
    209 
    210     private void Content_UpdateOfRunsInProgressChanged(object sender, EventArgs e) {
     249          UpdateAxisLabels();
     250        }
     251      }
     252    }
     253
     254    private void Content_AlgorithmNameChanged(object sender, EventArgs e) {
    211255      if (InvokeRequired)
    212         Invoke(new EventHandler(Content_UpdateOfRunsInProgressChanged), sender, e);
    213       else {
    214         suppressUpdates = Content.UpdateOfRunsInProgress;
    215         if (!suppressUpdates) UpdateDataPoints();
    216       }
     256        Invoke(new EventHandler(Content_AlgorithmNameChanged), sender, e);
     257      else UpdateCaption();
    217258    }
    218259
     
    222263      else {
    223264        this.categoricalMapping.Clear();
     265        RebuildInverseIndex();
    224266        UpdateDataPoints();
     267        UpdateAxisLabels();
    225268      }
    226269    }
     
    230273      series.Points.Clear();
    231274      runToDataPointMapping.Clear();
     275      selectedRuns.Clear();
    232276
    233277      chart.ChartAreas[0].AxisX.IsMarginVisible = xAxisValue != AxisDimension.Index.ToString();
     
    246290        }
    247291      }
     292      xTrackBar.Value = 0;
     293      yTrackBar.Value = 0;
     294
     295      //needed to set axis back to automatic and refresh them, otherwise their values may remain NaN
    248296      var xAxis = chart.ChartAreas[0].AxisX;
    249297      var yAxis = chart.ChartAreas[0].AxisY;
    250       xTrackBar.Value = 0;
    251       yTrackBar.Value = 0;
    252298      SetAutomaticUpdateOfAxis(xAxis, true);
    253299      SetAutomaticUpdateOfAxis(yAxis, true);
     300      chart.Refresh();
    254301    }
    255302
    256303    private void UpdateMarkerSizes() {
    257       double[] sizeValues = this.chart.Series[0].Points.Select(p => p.YValues[1]).ToArray();
     304      var series = chart.Series[0];
     305      if (series.Points.Count <= 0) return;
     306
     307      var sizeValues = series.Points.Select(p => p.YValues[1]);
    258308      double minSizeValue = sizeValues.Min();
    259309      double maxSizeValue = sizeValues.Max();
    260 
    261       for (int i = 0; i < sizeValues.Length; i++) {
    262         DataPoint point = this.chart.Series[0].Points[i];
    263         double sizeRange = maxSizeValue - minSizeValue;
     310      double sizeRange = maxSizeValue - minSizeValue;
     311
     312      const int smallestBubbleSize = 5;
     313
     314      foreach (DataPoint point in series.Points) {
     315        //calculates the relative size of the data point  0 <= relativeSize <= 1
    264316        double relativeSize = (point.YValues[1] - minSizeValue);
    265 
    266         if (sizeRange > double.Epsilon) relativeSize /= sizeRange;
    267         else relativeSize = 1;
    268 
    269         point.MarkerSize = (int)Math.Round((sizeTrackBar.Value - sizeTrackBar.Minimum) * relativeSize + sizeTrackBar.Minimum);
     317        if (sizeRange > double.Epsilon) {
     318          relativeSize /= sizeRange;
     319
     320          //invert bubble sizes if the value of the trackbar is negative
     321          if (sizeTrackBar.Value < 0) relativeSize = Math.Abs(relativeSize - 1);
     322        } else relativeSize = 1;
     323
     324        double sizeChange = Math.Abs(sizeTrackBar.Value) * relativeSize;
     325        point.MarkerSize = (int)Math.Round(sizeChange + smallestBubbleSize);
    270326      }
    271327    }
     
    274330      var xAxis = this.chart.ChartAreas[0].AxisX;
    275331      var yAxis = this.chart.ChartAreas[0].AxisY;
     332
    276333      SetAutomaticUpdateOfAxis(xAxis, false);
    277334      SetAutomaticUpdateOfAxis(yAxis, false);
     335
     336      double xAxisRange = xAxis.Maximum - xAxis.Minimum;
     337      double yAxisRange = yAxis.Maximum - yAxis.Minimum;
    278338
    279339      foreach (DataPoint point in chart.Series[0].Points) {
     
    283343
    284344        if (!xJitterFactor.IsAlmost(0.0))
    285           xValue += 0.1 * GetXJitter(run) * xJitterFactor * (xAxis.Maximum - xAxis.Minimum);
     345          xValue += 0.1 * GetXJitter(run) * xJitterFactor * (xAxisRange);
    286346        if (!yJitterFactor.IsAlmost(0.0))
    287           yValue += 0.1 * GetYJitter(run) * yJitterFactor * (yAxis.Maximum - yAxis.Minimum);
     347          yValue += 0.1 * GetYJitter(run) * yJitterFactor * (yAxisRange);
    288348
    289349        point.XValue = xValue;
    290350        point.YValues[0] = yValue;
    291351      }
    292     }
    293 
     352
     353    }
     354
     355    // sets an axis to automatic or restrains it to its current values
     356    // this is used that none of the set values is changed when jitter is applied, so that the chart stays the same
    294357    private void SetAutomaticUpdateOfAxis(Axis axis, bool enabled) {
    295358      if (enabled) {
     
    306369        axis.LabelStyle.Interval = axis.LabelStyle.Interval;
    307370      }
    308 
    309371    }
    310372
     
    321383      if (xValue.HasValue && yValue.HasValue && sizeValue.HasValue) {
    322384        xValue = xValue.Value;
    323 
    324385        yValue = yValue.Value;
    325386
     
    327388          DataPoint point = new DataPoint(xValue.Value, new double[] { yValue.Value, sizeValue.Value });
    328389          point.Tag = run;
    329           point.Color = run.Color;
    330390          series.Points.Add(point);
    331391          if (!runToDataPointMapping.ContainsKey(run)) runToDataPointMapping.Add(run, new List<DataPoint>());
    332392          runToDataPointMapping[run].Add(point);
     393          UpdateRun(run);
    333394        }
    334395      }
     
    368429    }
    369430    private double GetCategoricalValue(int dimension, string value) {
    370       if (!this.categoricalMapping.ContainsKey(dimension))
     431      if (!this.categoricalMapping.ContainsKey(dimension)) {
    371432        this.categoricalMapping[dimension] = new Dictionary<object, double>();
    372       if (!this.categoricalMapping[dimension].ContainsKey(value)) {
    373         if (this.categoricalMapping[dimension].Values.Count == 0)
    374           this.categoricalMapping[dimension][value] = 1.0;
    375         else
    376           this.categoricalMapping[dimension][value] = this.categoricalMapping[dimension].Values.Max() + 1.0;
     433        var orderedCategories = Content.Where(r => r.Visible).Select(r => Content.GetValue(r, dimension).ToString())
     434                                    .Distinct()
     435                                    .OrderBy(x => x, new NaturalStringComparer());
     436        int count = 1;
     437        foreach (var category in orderedCategories) {
     438          this.categoricalMapping[dimension].Add(category, count);
     439          count++;
     440        }
    377441      }
    378442      return this.categoricalMapping[dimension][value];
    379443    }
     444
    380445    private double GetValue(IRun run, AxisDimension axisDimension) {
    381446      double value = double.NaN;
    382447      switch (axisDimension) {
    383448        case AxisDimension.Index: {
    384             value = Content.ToList().IndexOf(run);
     449            value = runToIndexMapping[run];
    385450            break;
    386451          }
     
    405470    }
    406471    private void UpdateCursorInterval() {
    407       Series series = chart.Series[0];
    408       double[] xValues = (from point in series.Points
    409                           where !point.IsEmpty
    410                           select point.XValue)
    411                     .DefaultIfEmpty(1.0)
    412                     .ToArray();
    413       double[] yValues = (from point in series.Points
    414                           where !point.IsEmpty
    415                           select point.YValues[0])
    416                     .DefaultIfEmpty(1.0)
    417                     .ToArray();
    418 
    419       double xRange = xValues.Max() - xValues.Min();
    420       double yRange = yValues.Max() - yValues.Min();
     472      double xMin = double.MaxValue;
     473      double xMax = double.MinValue;
     474      double yMin = double.MaxValue;
     475      double yMax = double.MinValue;
     476
     477      foreach (var point in chart.Series[0].Points) {
     478        if (point.IsEmpty) continue;
     479        if (point.XValue < xMin) xMin = point.XValue;
     480        if (point.XValue > xMax) xMax = point.XValue;
     481        if (point.YValues[0] < yMin) yMin = point.YValues[0];
     482        if (point.YValues[0] > yMax) yMax = point.YValues[0];
     483      }
     484
     485      double xRange = 0.0;
     486      double yRange = 0.0;
     487      if (xMin != double.MaxValue && xMax != double.MinValue) xRange = xMax - xMin;
     488      if (yMin != double.MaxValue && yMax != double.MinValue) yRange = yMax - yMin;
     489
    421490      if (xRange.IsAlmost(0.0)) xRange = 1.0;
    422491      if (yRange.IsAlmost(0.0)) yRange = 1.0;
     
    456525
    457526    private void chart_MouseUp(object sender, MouseEventArgs e) {
    458       if (isSelecting) {
    459         System.Windows.Forms.DataVisualization.Charting.Cursor xCursor = chart.ChartAreas[0].CursorX;
    460         System.Windows.Forms.DataVisualization.Charting.Cursor yCursor = chart.ChartAreas[0].CursorY;
    461 
    462         double minX = Math.Min(xCursor.SelectionStart, xCursor.SelectionEnd);
    463         double maxX = Math.Max(xCursor.SelectionStart, xCursor.SelectionEnd);
    464         double minY = Math.Min(yCursor.SelectionStart, yCursor.SelectionEnd);
    465         double maxY = Math.Max(yCursor.SelectionStart, yCursor.SelectionEnd);
    466 
    467         //check for click to select model
    468         if (minX == maxX && minY == maxY) {
    469           HitTestResult hitTest = chart.HitTest(e.X, e.Y);
    470           if (hitTest.ChartElementType == ChartElementType.DataPoint) {
    471             int pointIndex = hitTest.PointIndex;
    472             IRun run = (IRun)this.chart.Series[0].Points[pointIndex].Tag;
    473             run.Color = colorDialog.Color;
    474           }
    475         } else {
    476           List<DataPoint> selectedPoints = new List<DataPoint>();
    477           foreach (DataPoint p in this.chart.Series[0].Points) {
    478             if (p.XValue >= minX && p.XValue < maxX &&
    479               p.YValues[0] >= minY && p.YValues[0] < maxY) {
    480               selectedPoints.Add(p);
    481             }
    482           }
    483           foreach (DataPoint p in selectedPoints) {
    484             IRun run = (IRun)p.Tag;
    485             run.Color = colorDialog.Color;
    486           }
    487         }
    488         this.chart.ChartAreas[0].CursorX.SelectionStart = this.chart.ChartAreas[0].CursorX.SelectionEnd;
    489         this.chart.ChartAreas[0].CursorY.SelectionStart = this.chart.ChartAreas[0].CursorY.SelectionEnd;
    490       }
     527      if (!isSelecting) return;
     528
     529      System.Windows.Forms.DataVisualization.Charting.Cursor xCursor = chart.ChartAreas[0].CursorX;
     530      System.Windows.Forms.DataVisualization.Charting.Cursor yCursor = chart.ChartAreas[0].CursorY;
     531
     532      double minX = Math.Min(xCursor.SelectionStart, xCursor.SelectionEnd);
     533      double maxX = Math.Max(xCursor.SelectionStart, xCursor.SelectionEnd);
     534      double minY = Math.Min(yCursor.SelectionStart, yCursor.SelectionEnd);
     535      double maxY = Math.Max(yCursor.SelectionStart, yCursor.SelectionEnd);
     536
     537      //check for click to select a single model
     538      if (minX == maxX && minY == maxY) {
     539        HitTestResult hitTest = chart.HitTest(e.X, e.Y, ChartElementType.DataPoint);
     540        if (hitTest.ChartElementType == ChartElementType.DataPoint) {
     541          int pointIndex = hitTest.PointIndex;
     542          var point = chart.Series[0].Points[pointIndex];
     543          IRun run = (IRun)point.Tag;
     544          point.Color = Color.Red;
     545          point.MarkerStyle = MarkerStyle.Cross;
     546          selectedRuns.Add(run);
     547
     548        } else ClearSelectedRuns();
     549      } else {
     550        foreach (DataPoint point in this.chart.Series[0].Points) {
     551          if (point.XValue < minX || point.XValue >= maxX) continue;
     552          if (point.YValues[0] < minY || point.YValues[0] >= maxY) continue;
     553          point.MarkerStyle = MarkerStyle.Cross;
     554          point.Color = Color.Red;
     555          IRun run = (IRun)point.Tag;
     556          selectedRuns.Add(run);
     557        }
     558      }
     559
     560      this.chart.ChartAreas[0].CursorX.SelectionStart = this.chart.ChartAreas[0].CursorX.SelectionEnd;
     561      this.chart.ChartAreas[0].CursorY.SelectionStart = this.chart.ChartAreas[0].CursorY.SelectionEnd;
     562      this.OnChanged();
    491563    }
    492564
    493565    private void chart_MouseMove(object sender, MouseEventArgs e) {
     566      if (Control.MouseButtons != MouseButtons.None) return;
    494567      HitTestResult h = this.chart.HitTest(e.X, e.Y);
    495568      string newTooltipText = string.Empty;
     
    615688    private void zoomButton_CheckedChanged(object sender, EventArgs e) {
    616689      this.isSelecting = selectButton.Checked;
    617       this.colorButton.Enabled = this.isSelecting;
     690      this.colorDialogButton.Enabled = this.isSelecting;
     691      this.colorRunsButton.Enabled = this.isSelecting;
     692      this.hideRunsButton.Enabled = this.isSelecting;
    618693      this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = !isSelecting;
    619694      this.chart.ChartAreas[0].AxisY.ScaleView.Zoomable = !isSelecting;
    620     }
    621     private void colorButton_Click(object sender, EventArgs e) {
    622       if (colorDialog.ShowDialog(this) == DialogResult.OK) {
    623         this.colorButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color);
    624       }
    625     }
    626     private Image GenerateImage(int width, int height, Color fillColor) {
    627       Image colorImage = new Bitmap(width, height);
    628       using (Graphics gfx = Graphics.FromImage(colorImage)) {
    629         using (SolidBrush brush = new SolidBrush(fillColor)) {
    630           gfx.FillRectangle(brush, 0, 0, width, height);
    631         }
    632       }
    633       return colorImage;
     695      ClearSelectedRuns();
    634696    }
    635697
     
    650712    }
    651713    private void hideRunToolStripMenuItem_Click(object sender, EventArgs e) {
    652       var constraint = Content.Constraints.OfType<RunCollectionContentConstraint>().Where(c => c.Active).FirstOrDefault();
     714      var constraint = Content.Constraints.OfType<RunCollectionContentConstraint>().FirstOrDefault(c => c.Active);
    653715      if (constraint == null) {
    654716        constraint = new RunCollectionContentConstraint();
     
    657719      }
    658720      constraint.ConstraintData.Add(runToHide);
     721    }
     722    private void hideRunsButton_Click(object sender, EventArgs e) {
     723      if (!selectedRuns.Any()) return;
     724      var constraint = new RunCollectionContentConstraint();
     725      constraint.ConstraintData = new ItemSet<IRun>(selectedRuns);
     726      Content.Constraints.Add(constraint);
     727      ClearSelectedRuns();
     728      constraint.Active = true;
     729    }
     730
     731    private void ClearSelectedRuns() {
     732      foreach (var run in selectedRuns) {
     733        foreach (var point in runToDataPointMapping[run]) {
     734          point.MarkerStyle = MarkerStyle.Circle;
     735          point.Color = Color.FromArgb(255 - transparencyTrackBar.Value, run.Color);
     736        }
     737      }
     738      selectedRuns.Clear();
    659739    }
    660740
     
    666746      boxplotView.Show();
    667747    }
     748
     749    private void getDataAsMatrixToolStripMenuItem_Click(object sender, EventArgs e) {
     750      int xCol = Matrix.ColumnNames.ToList().IndexOf(xAxisValue);
     751      int yCol = Matrix.ColumnNames.ToList().IndexOf(yAxisValue);
     752
     753      var grouped = new Dictionary<string, List<string>>();
     754      Dictionary<double, string> reverseMapping = null;
     755      if (categoricalMapping.ContainsKey(xCol))
     756        reverseMapping = categoricalMapping[xCol].ToDictionary(x => x.Value, y => y.Key.ToString());
     757      foreach (var run in Content.Where(r => r.Visible)) {
     758        var x = GetValue(run, xAxisValue);
     759        object y;
     760        if (categoricalMapping.ContainsKey(yCol))
     761          y = Content.GetValue(run, yAxisValue);
     762        else y = GetValue(run, yAxisValue);
     763        if (!(x.HasValue && y != null)) continue;
     764
     765        var category = reverseMapping == null ? x.Value.ToString() : reverseMapping[x.Value];
     766        if (!grouped.ContainsKey(category)) grouped[category] = new List<string>();
     767        grouped[category].Add(y.ToString());
     768      }
     769
     770      if (!grouped.Any()) return;
     771      var matrix = new StringMatrix(grouped.Values.Max(x => x.Count), grouped.Count) {
     772        ColumnNames = grouped.Keys.ToArray()
     773      };
     774      int i = 0;
     775      foreach (var col in matrix.ColumnNames) {
     776        int j = 0;
     777        foreach (var y in grouped[col])
     778          matrix[j++, i] = y;
     779        i++;
     780      }
     781      matrix.SortableView = false;
     782      var view = MainFormManager.MainForm.ShowContent(matrix);
     783      view.ReadOnly = true;
     784    }
     785
     786    private void transparencyTrackBar_ValueChanged(object sender, EventArgs e) {
     787      foreach (var run in Content)
     788        UpdateRun(run);
     789    }
    668790    #endregion
    669791
    670     #region Automatic coloring
     792    #region coloring
     793    private void colorDialogButton_Click(object sender, EventArgs e) {
     794      if (colorDialog.ShowDialog(this) == DialogResult.OK) {
     795        this.colorDialogButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color);
     796      }
     797    }
     798    private Image GenerateImage(int width, int height, Color fillColor) {
     799      Image colorImage = new Bitmap(width, height);
     800      using (Graphics gfx = Graphics.FromImage(colorImage)) {
     801        using (SolidBrush brush = new SolidBrush(fillColor)) {
     802          gfx.FillRectangle(brush, 0, 0, width, height);
     803        }
     804      }
     805      return colorImage;
     806    }
     807
     808    private void colorRunsButton_Click(object sender, EventArgs e) {
     809      if (!selectedRuns.Any()) return;
     810      Content.UpdateOfRunsInProgress = true;
     811      foreach (var run in selectedRuns)
     812        run.Color = colorDialog.Color;
     813
     814      ClearSelectedRuns();
     815      Content.UpdateOfRunsInProgress = false;
     816    }
     817
    671818    private void colorXAxisButton_Click(object sender, EventArgs e) {
    672819      ColorRuns(xAxisValue);
    673820    }
    674 
    675821    private void colorYAxisButton_Click(object sender, EventArgs e) {
    676822      ColorRuns(yAxisValue);
    677823    }
    678 
    679824    private void ColorRuns(string axisValue) {
    680       var runs = Content.Where(r => r.Visible).Select(r => new { Run = r, Value = GetValue(r, axisValue) }).Where(r => r.Value.HasValue);
     825      var runs = Content.Where(r => r.Visible).Select(r => new { Run = r, Value = GetValue(r, axisValue) }).Where(r => r.Value.HasValue).ToList();
    681826      double minValue = runs.Min(r => r.Value.Value);
    682827      double maxValue = runs.Max(r => r.Value.Value);
    683828      double range = maxValue - minValue;
    684 
    685       foreach (var r in runs) {
    686         int colorIndex = 0;
    687         if (!range.IsAlmost(0)) colorIndex = (int)((ColorGradient.Colors.Count - 1) * (r.Value.Value - minValue) / (range));
    688         r.Run.Color = ColorGradient.Colors[colorIndex];
    689       }
     829      // UpdateOfRunsInProgress has to be set to true, otherwise run_Changed is called all the time (also in other views)
     830      Content.UpdateOfRunsInProgress = true;
     831      if (range.IsAlmost(0)) {
     832        Color c = ColorGradient.Colors[0];
     833        runs.ForEach(r => r.Run.Color = c);
     834      } else {
     835        int maxColorIndex = ColorGradient.Colors.Count - 1;
     836        foreach (var r in runs) {
     837          int colorIndex = (int)(maxColorIndex * (r.Value - minValue) / (range));
     838          r.Run.Color = ColorGradient.Colors[colorIndex];
     839        }
     840      }
     841      Content.UpdateOfRunsInProgress = false;
    690842    }
    691843    #endregion
  • branches/OaaS/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionDataTableView.cs

    r8108 r9363  
    6363      Content.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    6464      Content.UpdateOfRunsInProgressChanged += new EventHandler(Content_UpdateOfRunsInProgressChanged);
     65      Content.OptimizerNameChanged += new EventHandler(Content_AlgorithmNameChanged);
    6566    }
    6667    protected override void DeregisterContentEvents() {
     
    6970      Content.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    7071      Content.UpdateOfRunsInProgressChanged -= new EventHandler(Content_UpdateOfRunsInProgressChanged);
     72      Content.OptimizerNameChanged -= new EventHandler(Content_AlgorithmNameChanged);
    7173      base.DeregisterContentEvents();
    7274    }
     
    9395      RemoveRuns(e.OldItems);
    9496      AddRuns(e.Items);
     97    }
     98    private void Content_AlgorithmNameChanged(object sender, EventArgs e) {
     99      if (InvokeRequired)
     100        Invoke(new EventHandler(Content_AlgorithmNameChanged), sender, e);
     101      else UpdateCaption();
    95102    }
    96103    private void Content_UpdateOfRunsInProgressChanged(object sender, EventArgs e) {
     
    123130      runMapping.Clear();
    124131
     132      UpdateCaption();
    125133      if (Content != null) {
    126134        UpdateDataTableComboBox();
     
    195203    }
    196204
     205    private void UpdateCaption() {
     206      Caption = Content != null ? Content.OptimizerName + " Data Table" : ViewAttribute.GetViewName(GetType());
     207    }
     208
    197209    private void UpdateDataRowComboBox() {
    198210      dataRowComboBox.Items.Clear();
  • branches/OaaS/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionTabularView.cs

    r8139 r9363  
    5555        UpdateRowAttributes();
    5656      }
     57      UpdateCaption();
    5758    }
    5859
     
    6465      Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    6566      Content.UpdateOfRunsInProgressChanged += new EventHandler(Content_UpdateOfRunsInProgressChanged);
     67      Content.OptimizerNameChanged += new EventHandler(Content_AlgorithmNameChanged);
    6668      RegisterRunEvents(Content);
    6769    }
     
    7678      Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    7779      Content.UpdateOfRunsInProgressChanged -= new EventHandler(Content_UpdateOfRunsInProgressChanged);
     80      Content.OptimizerNameChanged -= new EventHandler(Content_AlgorithmNameChanged);
    7881      DeregisterRunEvents(Content);
    7982    }
     
    9194    private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
    9295      RegisterRunEvents(e.Items);
     96    }
     97    private void Content_AlgorithmNameChanged(object sender, EventArgs e) {
     98      if (InvokeRequired)
     99        Invoke(new EventHandler(Content_AlgorithmNameChanged), sender, e);
     100      else UpdateCaption();
    93101    }
    94102    private void run_Changed(object sender, EventArgs e) {
     
    101109    }
    102110    #endregion
     111
     112    private void UpdateCaption() {
     113      Caption = Content != null ? Content.OptimizerName + " Tabular View" : ViewAttribute.GetViewName(GetType());
     114    }
    103115
    104116    protected override void UpdateColumnHeaders() {
Note: See TracChangeset for help on using the changeset viewer.