Changeset 12501


Ignore:
Timestamp:
06/23/15 17:12:33 (7 years ago)
Author:
ehopf
Message:

#2335: Adjusted the code of the Histogram-View to prevent an outdated CheckedItemList after the deletion of a column (Defect 4).

Location:
branches/DataPreprocessingImprovements
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessingImprovements/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs

    r12169 r12501  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Linq;
    2425using System.Windows.Forms;
    2526using HeuristicLab.Analysis;
     
    6061    //Add or remove data row
    6162    private void CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> checkedItems) {
     63
    6264      foreach (IndexedItem<StringValue> item in checkedItems.Items) {
    6365        string variableName = item.Value.Value;
     
    122124      if (Content.VariableItemList == null) {
    123125        Content.VariableItemList = Content.CreateVariableItemList();
     126      } else {
     127        var checkedNames = Content.VariableItemList.CheckedItems.Select(x => x.Value.Value);
     128        Content.VariableItemList = Content.CreateVariableItemList(checkedNames);
    124129      }
    125130      checkedItemList.Content = Content.VariableItemList;
     
    136141        DataRow row = GetDataRow(variableName);
    137142
    138         //add row to data table
    139         dataTable.Rows.Add(row);
    140 
    141         //add row to data table per variable
    142         d.Rows.Add(row);
    143         dataTablePerVariable.Add(d);
     143        if (row != null) {
     144          //add row to data table
     145          dataTable.Rows.Add(row);
     146
     147          //add row to data table per variable
     148          d.Rows.Add(row);
     149          dataTablePerVariable.Add(d);
     150        }
    144151      }
    145152
     
    153160      dataTable.SelectedRows.Clear();
    154161      foreach (var selectedRow in selectedDataRows) {
    155         if(VariableIsDisplayed(selectedRow.Name))
     162        if (VariableIsDisplayed(selectedRow.Name))
    156163          dataTable.SelectedRows.Add(selectedRow);
    157164      }
  • branches/DataPreprocessingImprovements/HeuristicLab.DataPreprocessing/3.4/Implementations/PreprocessingChartContent.cs

    r12012 r12501  
    2323using System.Collections.Generic;
    2424using System.Drawing;
     25using System.Linq;
    2526using HeuristicLab.Analysis;
    2627using HeuristicLab.Common;
     
    126127
    127128
    128     public ICheckedItemList<StringValue> CreateVariableItemList() {
     129    public ICheckedItemList<StringValue> CreateVariableItemList(IEnumerable<string> checkedItems = null) {
    129130      ICheckedItemList<StringValue> itemList = new CheckedItemList<StringValue>();
    130131      foreach (string name in PreprocessingData.GetDoubleVariableNames()) {
    131         itemList.Add(new StringValue(name), true);
     132        var n = new StringValue(name);
     133        itemList.Add(n, (checkedItems == null) ? true : checkedItems.Contains(name));
    132134      }
    133135      return new ReadOnlyCheckedItemList<StringValue>(itemList);
Note: See TracChangeset for help on using the changeset viewer.