Changeset 10852
- Timestamp:
- 05/14/14 15:32:47 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataGridContentView.cs
r10844 r10852 88 88 if (Content != null) { 89 89 Content.DataGridLogic.SetSelection(GetSelectedCells()); 90 if (AreMultipleCellsSelected()) { 91 ResetHighlightedCellsBackground(); 92 HightlightedCellsBackground = GetSelectedCells(); 93 searchIterator = null; 94 } 90 95 } 91 96 } … … 120 125 } 121 126 } 127 searchIterator = null; 122 128 } 123 129 … … 164 170 findAndReplaceDialog = new SearchAndReplaceDialog(); 165 171 findAndReplaceDialog.Show(this); 166 HightlightedCellsBackground = GetSelectedCells(); 167 dataGridView.ClearSelection(); 172 if (AreMultipleCellsSelected()) { 173 HightlightedCellsBackground = GetSelectedCells(); 174 dataGridView.ClearSelection(); 175 } 168 176 findAndReplaceDialog.FindAllEvent += findAndReplaceDialog_FindAllEvent; 169 177 findAndReplaceDialog.FindNextEvent += findAndReplaceDialog_FindNextEvent; … … 171 179 findAndReplaceDialog.ReplaceNextEvent += findAndReplaceDialog_ReplaceEvent; 172 180 findAndReplaceDialog.FormClosing += findAndReplaceDialog_FormClosing; 181 searchIterator = null; 173 182 } 174 183 … … 176 185 ResetHighlightedCells(); 177 186 ResetHighlightedCellsBackground(); 187 searchIterator = null; 178 188 } 179 189 … … 193 203 currentSearchText = findAndReplaceDialog.GetSearchText(); 194 204 } 205 if (IsOneCellSelected()) { 206 var first = GetSelectedCells().First(); 207 searchIterator.SetStartCell(first.Key, first.Value[0]); 208 } 209 195 210 196 211 bool moreOccurences = false; … … 198 213 currentCell = searchIterator.GetCurrent(); 199 214 moreOccurences = searchIterator.MoveNext(); 215 if (IsOneCellSelected()) { 216 var first = GetSelectedCells().First(); 217 if (currentCell.Item1 == first.Key && currentCell.Item2 == first.Value[0]) { 218 if (!moreOccurences) { 219 searchIterator.Reset(); 220 } 221 currentCell = searchIterator.GetCurrent(); 222 moreOccurences = searchIterator.MoveNext(); 223 224 } 225 } 200 226 } while (moreOccurences && (currentCell == null || !Content.GetValue(currentCell.Item2, currentCell.Item1).Equals(currentSearchText))); 201 227 202 228 if (currentCell != null) { 203 HightlightedCells = TransformToDictionary(currentCell);204 dataGridView .FirstDisplayedCell = dataGridView[currentCell.Item1, currentCell.Item2];229 dataGridView.ClearSelection(); 230 dataGridView[currentCell.Item1, currentCell.Item2].Selected = true; 205 231 } else { 206 232 ResetHighlightedCells(); 207 233 } 208 234 209 if (!moreOccurences) { 210 searchIterator.Reset(); 211 } 235 //if (!moreOccurences) { 236 // searchIterator.Reset(); 237 // dataGridView.ClearSelection(); 238 // currentCell = searchIterator.GetCurrent(); 239 // dataGridView[currentCell.Item1, currentCell.Item2].Selected = true; 240 //} 241 } 242 243 private bool AreMultipleCellsSelected() { 244 return GetSelectedCellCount() > 1; 245 } 246 247 private bool IsOneCellSelected() { 248 return GetSelectedCellCount() == 1; 249 } 250 251 private int GetSelectedCellCount() { 252 int count = 0; 253 foreach (var column in GetSelectedCells()) { 254 count += column.Value.Count(); 255 } 256 return count; 212 257 } 213 258 -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/Utils/FindPreprocessingItemsIterator.cs
r10719 r10852 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using System.Text;26 25 27 26 namespace HeuristicLab.DataPreprocessing.Views { … … 33 32 this.items = items; 34 33 Reset(); 34 } 35 36 37 public void SetStartCell(int columnIndex, int rowIndex) { 38 Tuple<int, int> startCell = GetNextFoundCell(columnIndex, rowIndex); 39 int tmpColumnIndex = columnIndex + 1; 40 while (startCell == null && tmpColumnIndex != columnIndex) { 41 if (!items.ContainsKey(tmpColumnIndex)) { 42 tmpColumnIndex = 0; 43 } 44 startCell = GetNextFoundCell(tmpColumnIndex, 0); 45 ++tmpColumnIndex; 46 } 47 currentCell = startCell; 48 } 49 50 private Tuple<int, int> GetNextFoundCell(int columnIndex, int rowIndex) { 51 Tuple<int, int> next = null; 52 for (int i = 0; i < items[columnIndex].Count; ++i) { 53 if (items[columnIndex][i] >= rowIndex) { 54 next = new Tuple<int, int>(columnIndex, i); 55 break; 56 } 57 } 58 return next; 35 59 } 36 60 … … 54 78 55 79 public Tuple<int, int> GetCurrent() { 56 Tuple<int, int> resultCell s= null;80 Tuple<int, int> resultCell = null; 57 81 if (items != null && CurrentCellExists()) { 58 82 int cellRow = items[currentCell.Item1].ElementAt(currentCell.Item2); 59 resultCell s= new Tuple<int, int>(currentCell.Item1, cellRow);83 resultCell = new Tuple<int, int>(currentCell.Item1, cellRow); 60 84 } 61 return resultCell s;85 return resultCell; 62 86 } 63 87 -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/Utils/IFindPreprocessingItemsIterator.cs
r10698 r10852 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 25 24 namespace HeuristicLab.DataPreprocessing.Views { … … 28 27 bool MoveNext(); 29 28 void Reset(); 29 void SetStartCell(int columnIndex, int rowIndex); 30 30 } 31 31 }
Note: See TracChangeset
for help on using the changeset viewer.