Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16634


Ignore:
Timestamp:
02/28/19 17:20:10 (6 years ago)
Author:
gkronber
Message:

#2971: disabled validation check in NamedIntervalsView because it is problematic when NamedIntervals are updated (e.g. while the algorithm is running)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/NamedIntervalsView.cs

    r16627 r16634  
    3737
    3838    public new NamedIntervals Content {
    39       get => (NamedIntervals)base.Content; 
    40       set => base.Content = value; 
     39      get => (NamedIntervals)base.Content;
     40      set => base.Content = value;
    4141    }
    4242
     
    8282      dataGridView.Rows.AddRange(rows);
    8383
    84       setRowsHeader();
     84      SetRowsHeader();
    8585      FillRows();
    8686
     
    9999    }
    100100
    101     protected void setRowsHeader() {   
     101    protected void SetRowsHeader() {
    102102      for (var i = 0; i < Content.VariableIntervals.Count; ++i) {
    103103        var item = Content.VariableIntervals.ElementAt(i);
     
    119119      var upperBound = e.ColumnIndex == 1 ? double.Parse(dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) : Content.VariableIntervals[key].UpperBound;
    120120
    121       Content.VariableIntervals[key] = new Interval(lowerBound, upperBound);
     121      // update if there was a change
     122      if (lowerBound != Content.VariableIntervals[key].LowerBound ||
     123        upperBound != Content.VariableIntervals[key].UpperBound)
     124        Content.VariableIntervals[key] = new Interval(lowerBound, upperBound);
    122125    }
    123126
    124127    private void dataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) {
    125       if (dataGridView.Rows[e.RowIndex].IsNewRow) {
    126         return;
    127       }
     128      // DISABLED VALIDATION OF ENTRIES
     129      // because it leads to problems when updating the table
     130      // we can assume it's the users fault if he or she enters incorrect values
    128131
    129       if (!double.TryParse(e.FormattedValue.ToString(), out var value)) {
    130         e.Cancel = true;
    131         dataGridView.Rows[e.RowIndex].ErrorText = "Value must be a double value.";
    132       } else {
    133         if (e.ColumnIndex == 0 && value > double.Parse(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString()) ||
    134             e.ColumnIndex == 1 && value < double.Parse(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString())) {
    135           e.Cancel = true;
    136           dataGridView.Rows[e.RowIndex].ErrorText = "Lower Bound of Interval must be smaller than Upper Bound.";
    137         }
    138       }
     132      // if (dataGridView.Rows[e.RowIndex].IsNewRow) {
     133      //   return;
     134      // }
     135      //
     136      // if (!double.TryParse(e.FormattedValue.ToString(), out var value)) {
     137      //   e.Cancel = true;
     138      //   dataGridView.Rows[e.RowIndex].ErrorText = "Value must be a double value.";
     139      // } else if (string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString()) ||
     140      //   string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString())) {
     141      //   // accept any value if one of the cells is still empty
     142      // } else {
     143      //   var left = double.Parse(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString());
     144      //   var right = double.Parse(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString());
     145      //   if (e.ColumnIndex == 1 && value < left || e.ColumnIndex == 0 && value > right) {
     146      //     e.Cancel = true;
     147      //     dataGridView.Rows[e.RowIndex].ErrorText = "Lower bound of interval must be smaller than upper bound.";
     148      //   }
     149      // }
    139150    }
    140151
Note: See TracChangeset for help on using the changeset viewer.