Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9695 for trunk/sources


Ignore:
Timestamp:
07/04/13 14:03:58 (11 years ago)
Author:
mkommend
Message:

#2075: Removed default element names for ValueTypeArrays and added more efficient implementation for the row header update in the view.

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleArrayView.cs

    r9657 r9695  
    2323using System.ComponentModel;
    2424using System.Drawing;
    25 using System.Linq;
    2625using System.Text;
    2726using System.Windows.Forms;
     
    105104
    106105    protected virtual void UpdateRowHeaders() {
    107       for (int i = 0; i < dataGridView.RowCount; i++) {
    108         if (i < Content.ElementNames.Count())
    109           dataGridView.Rows[i].HeaderCell.Value = Content.ElementNames.ElementAt(i);
    110         else
    111           dataGridView.Rows[i].HeaderCell.Value = string.Empty;
     106      int i = 0;
     107      foreach (string elementName in Content.ElementNames) {
     108        dataGridView.Rows[i].HeaderCell.Value = elementName;
     109        i++;
     110      }
     111      for (; i < dataGridView.RowCount; i++) {
     112        dataGridView.Rows[i].HeaderCell.Value = string.Empty;
    112113      }
    113114    }
  • trunk/sources/HeuristicLab.Data/3.3/StringArray.cs

    r9692 r9695  
    5151        if (value == null || !value.Any())
    5252          elementNames = new List<string>();
    53         else if (value.Count() != Length)
    54           throw new ArgumentException("An element name must be specified for each element.");
     53        else if (value.Count() > Length)
     54          throw new ArgumentException("The number of element names must not exceed the array length.");
    5555        else
    5656          elementNames = new List<string>(value);
     
    6767          while (elementNames.Count > value)
    6868            elementNames.RemoveAt(elementNames.Count - 1);
    69           if (elementNames.Any()) {
    70             while (elementNames.Count < value)
    71               elementNames.Add("Element " + elementNames.Count);
    72           }
    7369          OnElementNamesChanged();
    7470          OnReset();
  • trunk/sources/HeuristicLab.Data/3.3/ValueTypeArray.cs

    r9692 r9695  
    5151        if (value == null || !value.Any())
    5252          elementNames = new List<string>();
    53         else if (value.Count() != Length)
    54           throw new ArgumentException("An element name must be specified for each element.");
     53        else if (value.Count() > Length)
     54          throw new ArgumentException("The number of element names must not exceed the array length.");
    5555        else
    5656          elementNames = new List<string>(value);
     
    6969          while (elementNames.Count > value)
    7070            elementNames.RemoveAt(elementNames.Count - 1);
    71           if (elementNames.Any()) {
    72             while (elementNames.Count < value)
    73               elementNames.Add("Element " + elementNames.Count);
    74           }
    7571          OnElementNamesChanged();
    7672          OnReset();
Note: See TracChangeset for help on using the changeset viewer.