Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/15/18 11:47:03 (6 years ago)
Author:
pfleck
Message:

#2947

  • Added interfaces for DataRow and DataTable (IDataTable is generic because the NamedItemCollection is invariant)
  • Adapted DataTableVisualPropertiesDialog to use the new interfaces
  • Added IConfigurableView to IndexedDataTableView
  • Fixed VisualProperty.Title change in IndexedDataTableView
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2947_ConfigurableIndexedDataTable/HeuristicLab.Analysis.Views/3.3/DataTableVisualPropertiesDialog.cs

    r15583 r16149  
    2727
    2828namespace HeuristicLab.Analysis.Views {
    29   public partial class DataTableVisualPropertiesDialog : Form {
     29  public partial class DataTableVisualPropertiesDialog<TDataRow> : Form where TDataRow : class, IDataRow {
    3030    protected bool SuppressEvents { get; set; }
    31     protected DataTable Content { get; private set; }
     31    protected IDataTable<TDataRow> Content { get; private set; }
    3232    private DataTableVisualProperties originalDataTableVPs;
    3333    private Dictionary<string, DataRowVisualProperties> originalDataRowVPs;
     
    3636    public IEnumerable<string> RowsWithModifiedDisplayNames { get { return modifiedDisplayNames.AsEnumerable(); } }
    3737
    38     public DataTableVisualPropertiesDialog(DataTable dataTable) {
     38    public DataTableVisualPropertiesDialog(IDataTable<TDataRow> dataTable) {
    3939      InitializeComponent();
    4040      #region Prepare controls
     
    5151      originalDataTableVPs = (DataTableVisualProperties)Content.VisualProperties.Clone();
    5252      originalDataRowVPs = new Dictionary<string, DataRowVisualProperties>();
    53       foreach (DataRow row in Content.Rows)
     53      foreach (var row in Content.Rows)
    5454        originalDataRowVPs.Add(row.Name, (DataRowVisualProperties)row.VisualProperties.Clone());
    5555
     
    6262
    6363    private void RegisterContentEvents() {
    64       foreach (DataRow row in Content.Rows) {
     64      foreach (var row in Content.Rows) {
    6565        row.VisualProperties.PropertyChanged += new PropertyChangedEventHandler(Row_VisualProperties_PropertyChanged);
    6666      }
     
    6868
    6969    private void DeregisterContentEvents() {
    70       foreach (DataRow row in Content.Rows) {
     70      foreach (var row in Content.Rows) {
    7171        row.VisualProperties.PropertyChanged -= new PropertyChangedEventHandler(Row_VisualProperties_PropertyChanged);
    7272      }
     
    8080
    8181    private void Row_VisualProperties_PropertyChanged(object sender, PropertyChangedEventArgs e) {
    82       foreach (DataRow row in Content.Rows) {
     82      foreach (var row in Content.Rows) {
    8383        if (e.PropertyName == "DisplayName" && row.VisualProperties == sender) {
    8484          modifiedDisplayNames.Add(row.Name);
     
    109109    private void cancelButton_Click(object sender, System.EventArgs e) {
    110110      DialogResult = DialogResult.Cancel;
    111       foreach (DataRow row in Content.Rows) {
     111      foreach (var row in Content.Rows) {
    112112        row.VisualProperties = originalDataRowVPs[row.Name];
    113113      }
     
    160160    private void FillSeriesListView() {
    161161      seriesListView.SelectedIndices.Clear();
    162       foreach (DataRow row in Content.Rows) {
     162      foreach (var row in Content.Rows) {
    163163        seriesListView.Items.Add(new ListViewItem(row.Name, 0));
    164164      }
     
    168168
    169169    private void UpdateAllSeriesPositions() {
    170       Dictionary<string, DataRow> rows = Content.Rows.ToDictionary(x => x.Name);
     170      var rows = Content.Rows.ToDictionary(x => x.Name);
    171171      Content.Rows.Clear();
    172172      for (int i = 0; i < seriesListView.Items.Count; i++) {
Note: See TracChangeset for help on using the changeset viewer.