Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12499


Ignore:
Timestamp:
06/23/15 16:02:53 (9 years ago)
Author:
pfleck
Message:

#2379

  • Quick-fixed a critical performance bug when changing the checked status of many items in the tree (e.g. via level change)
  • Added a new sample with alps runs.
Location:
branches/BubbleChart
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/BubbleChart/HeuristicLab.Optimization.BubbleChart/3.3/BubbleChartView.cs

    r12498 r12499  
    2222using System;
    2323using System.Collections.Generic;
    24 using System.Drawing;
    2524using System.Linq;
    2625using System.Windows.Forms;
     
    3130using HeuristicLab.Data;
    3231using HeuristicLab.MainForm;
    33 using HeuristicLab.MainForm.WindowsForms;
    3432
    3533namespace HeuristicLab.Optimization.BubbleChart {
     
    4644    private string YAxisValue { get { return (string)yAxisComboBox.SelectedItem; } }
    4745    private string SizeAxisValue { get { return (string)sizeComboBox.SelectedItem; } }
     46
     47    private bool updating = false;
    4848
    4949    public new RecursiveDataItem Content {
     
    304304      }
    305305    }
    306 
    307     private void UpdateNodeColors() {
    308       var selectedDepth = treeView.SelectedNode != null ? treeView.SelectedNode.Level : (int?)null;
    309       var selectedIndex = treeView.SelectedNode != null ? treeView.SelectedNode.Index : (int?)null;
    310       foreach (TreeNode node in treeView.Nodes) {
    311         UpdateNodeColor(node, selectedDepth, selectedIndex);
    312       }
    313     }
    314     private void UpdateNodeColor(TreeNode node, int? depth, int? index) {
    315       if (depth.HasValue && index.HasValue && node.Level == depth /*&& node.Index == index*/)
    316         node.BackColor = Color.Yellow;
    317       else
    318         node.BackColor = Color.White;
    319       foreach (TreeNode child in node.Nodes)
    320         UpdateNodeColor(child, depth, index);
    321     }
    322306    #endregion
    323307
    324308    #region Event Handlers
    325309    private void treeView_AfterCheck(object sender, TreeViewEventArgs e) {
     310      if (updating) return;
     311      updating = true;
    326312      UpdateComboBoxes();
    327313      UpdateDataPoints();
     314      updating = false;
    328315    }
    329316    private void treeView_AfterSelect(object sender, TreeViewEventArgs e) {
     
    334321
    335322    private void axisComboBox_SelectedValueChanged(object sender, EventArgs e) {
     323      if (updating) return;
     324      updating = true;
    336325      UpdateDataPoints();
    337326      UpdateAxisLabels();
     327      updating = false;
    338328    }
    339329
    340330    private void includeChildrenCheckBox_CheckedChanged(object sender, EventArgs e) {
     331      if (updating) return;
     332      updating = true;
    341333      UpdateTreeViewCheckBoxes();
    342334      UpdateComboBoxes();
     335      updating = false;
    343336    }
    344337
    345338    private void levelNumericUpDown_ValueChanged(object sender, EventArgs e) {
     339      if (updating) return;
     340      updating = true;
    346341      UpdateTreeViewCheckBoxes();
    347342      UpdateComboBoxes();
     343      updating = false;
    348344    }
    349345    #endregion
     
    363359      }
    364360    }
    365 
    366     private void BeginUpdateComboBoxes() {
    367       xAxisComboBox.BeginUpdate();
    368       yAxisComboBox.BeginUpdate();
    369       sizeComboBox.BeginUpdate();
    370     }
    371     private void EndUpdateComboBoxes() {
    372       xAxisComboBox.EndUpdate();
    373       yAxisComboBox.EndUpdate();
    374       sizeComboBox.EndUpdate();
    375     }
    376361    #endregion
    377362  }
Note: See TracChangeset for help on using the changeset viewer.