Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14270


Ignore:
Timestamp:
08/31/16 16:15:35 (8 years ago)
Author:
pfleck
Message:

#2663

  • Fixed reordering issue by enabling/disabling series rather than removing the DataRow.
  • Reduced flickering by suspending layouting during variable un/rechecking.
Location:
trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4

    • Property svn:ignore
      •  

        old new  
        11ComparisonFilterView.resx
        22FilterView.resx
         3*.user
  • trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs

    r14185 r14270  
    5959    //Add or remove data row
    6060    private void CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> checkedItems) {
    61 
     61      tableLayoutPanel.SuspendLayout();
    6262      foreach (IndexedItem<StringValue> item in checkedItems.Items) {
    6363        string variableName = item.Value.Value;
    6464
    65         //variable is displayed -> remove
    66         if (VariableIsDisplayed(variableName)) {
    67           dataTable.Rows.Remove(variableName);
     65        // not checked -> remove
     66        if (!VariableIsChecked(variableName)) {
     67          dataTableView.SetRowEnabled(variableName, false);
    6868          dataTable.SelectedRows.Remove(variableName);
    6969          dataTablePerVariable.Remove(dataTablePerVariable.Find(x => (x.Name == variableName)));
    70           //variable isnt't displayed -> add
    7170        } else {
    7271          DataRow row = GetDataRow(variableName);
    7372          DataRow selectedRow = GetSelectedDataRow(variableName);
    74           dataTable.Rows.Add(row);
     73          dataTableView.SetRowEnabled(variableName, true);
    7574
    7675          PreprocessingDataTable pdt = new PreprocessingDataTable(variableName);
    7776          pdt.Rows.Add(row);
    78           dataTablePerVariable.Add(pdt);
     77          // dataTablePerVariable does not contain unchecked variables => reduce insert position by number of uncheckt variables to correct the index
     78          int uncheckedUntilVariable = checkedItemList.Content.TakeWhile(x => x.Value != variableName).Count(x => !checkedItemList.Content.ItemChecked(x));
     79          dataTablePerVariable.Insert(item.Index - uncheckedUntilVariable, pdt);
    7980
    8081          //update selection
     
    8990      if (Content != null && !Content.AllInOneMode)
    9091        GenerateChart();
    91 
    92     }
    93 
    94     private bool VariableIsDisplayed(string name) {
    95 
    96       foreach (var item in dataTable.Rows) {
    97         if (item.Name == name)
    98           return true;
    99       }
    100       return false;
     92      tableLayoutPanel.ResumeLayout(true);
     93    }
     94
     95    private bool VariableIsChecked(string name) {
     96      return Content.VariableItemList.CheckedItems.Any(x => x.Value.Value == name);
    10197    }
    10298
     
    158154      dataTable.SelectedRows.Clear();
    159155      foreach (var selectedRow in selectedDataRows) {
    160         if (VariableIsDisplayed(selectedRow.Name))
     156        if (VariableIsChecked(selectedRow.Name))
    161157          dataTable.SelectedRows.Add(selectedRow);
    162158      }
  • trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingDataTableView.cs

    r14185 r14270  
    139139        }
    140140      } else MessageBox.Show("Nothing to configure.");
     141    }
     142
     143    public bool IsRowEnabled(string name) {
     144      return chart.Series.FindByName(name) != null && chart.Series[name].Enabled;
     145    }
     146    public void SetRowEnabled(string name, bool enabled) {
     147      if (chart.Series.FindByName(name) != null)
     148        chart.Series[name].Enabled = enabled;
    141149    }
    142150
Note: See TracChangeset for help on using the changeset viewer.