Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10930


Ignore:
Timestamp:
06/04/14 10:51:34 (10 years ago)
Author:
rstoll
Message:
  • Disabled Replace tab in SearchAndReplaceDialog if a filter is active
  • Disabled Replace button in DataGridview if filter is active
  • Refactored/Changed IFilterLogic#IsFiltered from method to property
Location:
branches/DataPreprocessing
Files:
5 edited

Legend:

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

    r10916 r10930  
    102102    }
    103103
    104     void FilterLogic_FilterChanged(object sender, EventArgs e) {
    105       OnContentChanged();
    106       searchIterator = null;
    107     }
    108 
    109104    protected override void DeregisterContentEvents() {
    110105      base.DeregisterContentEvents();
    111106      Content.Changed -= Content_Changed;
    112107      Content.FilterLogic.FilterChanged -= FilterLogic_FilterChanged;
     108    }
     109
     110    void FilterLogic_FilterChanged(object sender, EventArgs e) {
     111      OnContentChanged();
     112      searchIterator = null;
     113      if (findAndReplaceDialog != null && !findAndReplaceDialog.IsDisposed) {
     114        if (Content.FilterLogic.IsFiltered) {
     115          findAndReplaceDialog.DisableReplace();
     116        } else {
     117          findAndReplaceDialog.EnableReplace();
     118        }
     119      }
     120      btnReplace.Enabled = !Content.FilterLogic.IsFiltered;
    113121    }
    114122
     
    132140        string errorMessage;
    133141        if (Content != null) {
    134           if (dataGridView.IsCurrentCellInEditMode && Content.FilterLogic.IsFiltered()) {
     142          if (dataGridView.IsCurrentCellInEditMode && Content.FilterLogic.IsFiltered) {
    135143            errorMessage = "A filter is active, you cannot modify data. Press ESC to exit edit mode.";
    136144          } else {
     
    191199        searchIterator = null;
    192200        DataGridView.SelectionChanged += DataGridView_SelectionChanged_FindAndReplace;
     201        if (Content.FilterLogic.IsFiltered) {
     202          findAndReplaceDialog.DisableReplace();
     203        }
    193204      }
    194205    }
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/SearchAndReplaceDialog.Designer.cs

    r10870 r10930  
    2727      this.tabSearch = new System.Windows.Forms.TabPage();
    2828      this.tabReplace = new System.Windows.Forms.TabPage();
     29      this.cmbComparisonOperator = new System.Windows.Forms.ComboBox();
    2930      this.txtSearchString = new System.Windows.Forms.TextBox();
    3031      this.lblSearch = new System.Windows.Forms.Label();
     
    3738      this.txtValue = new System.Windows.Forms.TextBox();
    3839      this.label1 = new System.Windows.Forms.Label();
    39       this.cmbComparisonOperator = new System.Windows.Forms.ComboBox();
    4040      this.tabSearchReplace.SuspendLayout();
    4141      this.tabReplace.SuspendLayout();
     
    8787      this.tabReplace.UseVisualStyleBackColor = true;
    8888      //
     89      // cmbComparisonOperator
     90      //
     91      this.cmbComparisonOperator.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     92      this.cmbComparisonOperator.FormattingEnabled = true;
     93      this.cmbComparisonOperator.Location = new System.Drawing.Point(103, 19);
     94      this.cmbComparisonOperator.Name = "cmbComparisonOperator";
     95      this.cmbComparisonOperator.Size = new System.Drawing.Size(45, 21);
     96      this.cmbComparisonOperator.TabIndex = 24;
     97      //
    8998      // txtSearchString
    9099      //
     
    173182      this.label1.TabIndex = 14;
    174183      this.label1.Text = "Replace with";
    175       //
    176       // cmbComparisonOperator
    177       //
    178       this.cmbComparisonOperator.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    179       this.cmbComparisonOperator.FormattingEnabled = true;
    180       this.cmbComparisonOperator.Location = new System.Drawing.Point(103, 19);
    181       this.cmbComparisonOperator.Name = "cmbComparisonOperator";
    182       this.cmbComparisonOperator.Size = new System.Drawing.Size(45, 21);
    183       this.cmbComparisonOperator.TabIndex = 24;
    184184      //
    185185      // SearchAndReplaceDialog
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/SearchAndReplaceDialog.cs

    r10870 r10930  
    11using System;
    2 using System.Collections.Generic;
    32using System.Windows.Forms;
    43
     
    2221  }
    2322
     23
     24
    2425  public partial class SearchAndReplaceDialog : Form {
    2526    private string[] cmbItemsText = { "Value", "Average", "Median", "Random", "Most Common", "Interpolation" };
     
    4243      tabSearchReplace.SelectTab(tabReplace);
    4344      AddControlsToCurrentTab();
     45    }
     46
     47    public void DisableReplace() {
     48      tabSearchReplace.SelectTab(tabSearch);
     49      tabReplace.Enabled = false;
     50    }
     51
     52    public void EnableReplace() {
     53      tabReplace.Enabled = true;
    4454    }
    4555
     
    97107      remove { btnReplace.Click -= value; }
    98108    }
    99      
    100109  }
    101110}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/FilterLogic.cs

    r10908 r10930  
    8282    }
    8383
    84     public bool IsFiltered() {
    85       return preprocessingData.IsFiltered;
     84    public bool IsFiltered {
     85      get {
     86        return preprocessingData.IsFiltered;
     87      }
    8688    }
    8789
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Interfaces/IFilterLogic.cs

    r10900 r10930  
    3636    IPreprocessingData PreprocessingData { get; }
    3737    void Reset();
    38     bool IsFiltered();
     38    bool IsFiltered { get; }
    3939
    4040    event EventHandler FilterChanged;
Note: See TracChangeset for help on using the changeset viewer.