Changeset 10705


Ignore:
Timestamp:
04/02/14 13:47:19 (5 years ago)
Author:
sbreuer
Message:
  • enhanced usability
Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3
Files:
4 edited

Legend:

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

    r10698 r10705  
    150150      findAndReplaceDialog.ReplaceAllEvent += findAndReplaceDialog_ReplaceAllEvent;
    151151      findAndReplaceDialog.ReplaceNextEvent += findAndReplaceDialog_ReplaceEvent;
     152      findAndReplaceDialog.FormClosing += findAndReplaceDialog_FormClosing;
     153    }
     154
     155    void findAndReplaceDialog_FormClosing(object sender, FormClosingEventArgs e) {
     156      ResetHighlightedCells();
    152157    }
    153158
     
    161166    void findAndReplaceDialog_ReplaceAllEvent(object sender, EventArgs e) {
    162167      Replace(FindAll(findAndReplaceDialog.GetSearchText()));
     168      findAndReplaceDialog.SetEndReached(false);
    163169    }
    164170
     
    167173        searchIterator = new FindPreprocessingItemsIterator(FindAll(findAndReplaceDialog.GetSearchText()));
    168174        currentSearchText = findAndReplaceDialog.GetSearchText();
    169       }
    170 
    171       while (searchIterator.MoveNext() && (searchIterator.GetCurrent() == null || !Content.GetValue(searchIterator.GetCurrent().Item1, searchIterator.GetCurrent().Item2).Equals(currentSearchText))) {
    172        
    173       }
    174 
    175       if (searchIterator.GetCurrent() != null) {
    176         HightlightedCells = TransformToDictionary(searchIterator.GetCurrent());
     175        findAndReplaceDialog.SetEndReached(false);
     176      }
     177     
     178      Tuple<int, int> currentCell = null;
     179      bool moreOccurences = false;
     180      do {
     181        currentCell = searchIterator.GetCurrent();
     182        moreOccurences = searchIterator.MoveNext();
     183      } while (moreOccurences && (currentCell == null || !Content.GetValue(currentCell.Item2, currentCell.Item1).Equals(currentSearchText)));
     184
     185      if (!moreOccurences) {
     186        findAndReplaceDialog.SetEndReached(true);
     187      }
     188
     189      if (currentCell != null) {
     190        HightlightedCells = TransformToDictionary(currentCell);
    177191      } else {
    178         HightlightedCells.Clear();
     192        ResetHighlightedCells();
    179193      }
    180194    }
     
    182196    void findAndReplaceDialog_FindAllEvent(object sender, EventArgs e) {
    183197      HightlightedCells = FindAll(findAndReplaceDialog.GetSearchText());
     198      findAndReplaceDialog.SetEndReached(false);
    184199    }
    185200
     
    228243      highlightCells.Add(tuple.Item1, new List<int>() { tuple.Item2 });
    229244      return highlightCells;
     245    }
     246
     247    private void ResetHighlightedCells() {
     248      HightlightedCells = new Dictionary<int, IList<int>>();
    230249    }
    231250
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/FindAndReplaceDialog.Designer.cs

    r10672 r10705  
    3737      this.txtValue = new System.Windows.Forms.TextBox();
    3838      this.label1 = new System.Windows.Forms.Label();
     39      this.lblEndReached = new System.Windows.Forms.Label();
    3940      this.tabSearchReplace.SuspendLayout();
    4041      this.tabReplace.SuspendLayout();
     
    5152      this.tabSearchReplace.Name = "tabSearchReplace";
    5253      this.tabSearchReplace.SelectedIndex = 0;
    53       this.tabSearchReplace.Size = new System.Drawing.Size(564, 135);
     54      this.tabSearchReplace.Size = new System.Drawing.Size(564, 143);
    5455      this.tabSearchReplace.TabIndex = 0;
    5556      this.tabSearchReplace.SelectedIndexChanged += new System.EventHandler(this.tabSearchReplace_SelectedIndexChanged);
     
    6768      // tabReplace
    6869      //
     70      this.tabReplace.Controls.Add(this.lblEndReached);
    6971      this.tabReplace.Controls.Add(this.txtSearchString);
    7072      this.tabReplace.Controls.Add(this.lblSearch);
     
    8082      this.tabReplace.Name = "tabReplace";
    8183      this.tabReplace.Padding = new System.Windows.Forms.Padding(3);
    82       this.tabReplace.Size = new System.Drawing.Size(556, 109);
     84      this.tabReplace.Size = new System.Drawing.Size(556, 117);
    8385      this.tabReplace.TabIndex = 1;
    8486      this.tabReplace.Text = "Replace";
     
    172174      this.label1.Text = "Replace with";
    173175      //
     176      // lblEndReached
     177      //
     178      this.lblEndReached.AutoSize = true;
     179      this.lblEndReached.Location = new System.Drawing.Point(218, 100);
     180      this.lblEndReached.Name = "lblEndReached";
     181      this.lblEndReached.Size = new System.Drawing.Size(139, 13);
     182      this.lblEndReached.TabIndex = 24;
     183      this.lblEndReached.Text = "No more occurences found.";
     184      //
    174185      // FindAndReplaceDialog
    175186      //
    176187      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    177188      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    178       this.ClientSize = new System.Drawing.Size(588, 159);
     189      this.ClientSize = new System.Drawing.Size(588, 167);
    179190      this.Controls.Add(this.tabSearchReplace);
    180191      this.Name = "FindAndReplaceDialog";
     
    202213    private System.Windows.Forms.TextBox txtValue;
    203214    private System.Windows.Forms.Label label1;
     215    private System.Windows.Forms.Label lblEndReached;
    204216  }
    205217}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/FindAndReplaceDialog.cs

    r10672 r10705  
    2020      cmbReplaceWith.Items.AddRange(cmbItemsText);
    2121      cmbReplaceWith.SelectedIndex = (int)ReplaceAction.Value;
     22      SetEndReached(false);
    2223    }
    2324
     
    3031      tabReplace.Focus();
    3132      AddControlsToCurrentTab();
     33    }
     34
     35    public void SetEndReached(bool endReached) {
     36      lblEndReached.Visible = endReached;
    3237    }
    3338
     
    4550      tabSearchReplace.SelectedTab.Controls.Add(lblSearch);
    4651      tabSearchReplace.SelectedTab.Controls.Add(txtSearchString);
     52      tabSearchReplace.SelectedTab.Controls.Add(lblEndReached);
    4753    }
    4854
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/Utils/FindPreprocessingItemsIterator.cs

    r10698 r10705  
    3737    public bool MoveNext() {
    3838      bool result = false;
     39      bool endReached = false;
    3940      if (items != null) {
    4041        do {
     
    4344          } else if (currentCell.Item1 < items.Count - 1) {
    4445            currentCell = new Tuple<int, int>(currentCell.Item1 + 1, 0);
     46          } else {
     47            endReached = true;
    4548          }
    46         } while (!EndReached() && !CurrentCellExists());
    47         result = EndReached();
     49        } while (!endReached && !CurrentCellExists());
     50        result = !endReached;
    4851      }
    4952      return result;
     
    6164    public void Reset() {
    6265      currentCell = new Tuple<int, int>(0, 0);
     66      if (!CurrentCellExists()) {
     67        MoveNext();
     68      }
    6369    }
    6470
     
    7177    }
    7278
    73     private bool EndReached() {
    74       bool result = true;
    75       if (items != null && CurrentCellExists()) {
    76         result = currentCell.Item1 >= items.Count - 1 && currentCell.Item2 >= items[currentCell.Item1].Count - 1;
    77       }
    78       return result;
    79     }
     79    //private bool EndReached() {
     80    //  bool result = true;
     81    //  if (items != null && CurrentCellExists()) {
     82    //    result = currentCell.Item1 >= items.Count - 1 && currentCell.Item2 >= items[currentCell.Item1].Count - 1;
     83    //  }
     84    //  return result;
     85    //}
    8086  }
    8187}
Note: See TracChangeset for help on using the changeset viewer.