- Timestamp:
- 04/14/10 14:19:46 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Data.Views/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Data.Views/3.3/ColumnsVisibilityDialog.Designer.cs
r3316 r3346 49 49 this.MinimizeBox = false; 50 50 this.Name = "ColumnsVisibilityDialog"; 51 this.ShowIcon = false; 51 52 this.ShowInTaskbar = false; 52 53 this.Text = "Show / Hide Columns"; -
trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.Designer.cs
r3333 r3346 84 84 this.dataGridView.AllowUserToAddRows = false; 85 85 this.dataGridView.AllowUserToDeleteRows = false; 86 this.dataGridView.AllowUserToOrderColumns = true; 86 87 this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 87 88 | System.Windows.Forms.AnchorStyles.Left) 88 89 | System.Windows.Forms.AnchorStyles.Right))); 89 this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.DisplayedCells;90 90 this.dataGridView.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableWithoutHeaderText; 91 91 this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; -
trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs
r3337 r3346 113 113 else 114 114 dataGridView.ColumnCount = Content.Columns; 115 115 116 UpdateRowHeaders(); 116 117 UpdateColumnHeaders(); 118 dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader); 119 dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders); 117 120 dataGridView.Enabled = true; 118 121 } … … 123 126 dataGridView.Columns[i].HeaderText = Content.ColumnNames.ElementAt(i); 124 127 else 125 dataGridView.Columns[i].HeaderText = "Column " + i;128 dataGridView.Columns[i].HeaderText = "Column " + (i + 1); 126 129 } 127 130 dataGridView.Invalidate(); … … 133 136 dataGridView.Rows[i].HeaderCell.Value = Content.RowNames.ElementAt(i); 134 137 else 135 dataGridView.Rows[i].HeaderCell.Value = i.ToString();138 dataGridView.Rows[i].HeaderCell.Value = "Row " + (i + 1); 136 139 } 137 140 dataGridView.Invalidate(); … … 291 294 int[] newSortedIndex = Enumerable.Range(0, Content.Rows).ToArray(); 292 295 if (sortedColumnIndizes.Count != 0) { 293 rowComparer. sortedIndizes = sortedColumnIndizes;294 rowComparer. matrix = Content;296 rowComparer.SortedIndizes = sortedColumnIndizes; 297 rowComparer.Matrix = Content; 295 298 Array.Sort(newSortedIndex, rowComparer); 296 299 } … … 308 311 #endregion 309 312 310 private class RowComparer : IComparer<int> { 311 public List<KeyValuePair<int, SortOrder>> sortedIndizes; 312 public IStringConvertibleMatrix matrix; 313 public class RowComparer : IComparer<int> { 313 314 public RowComparer() { 315 } 316 317 private List<KeyValuePair<int, SortOrder>> sortedIndizes; 318 public IEnumerable<KeyValuePair<int, SortOrder>> SortedIndizes { 319 get { return this.sortedIndizes; } 320 set { sortedIndizes = new List<KeyValuePair<int, SortOrder>>(value); } 321 } 322 private IStringConvertibleMatrix matrix; 323 public IStringConvertibleMatrix Matrix { 324 get { return this.matrix; } 325 set { this.matrix = value; } 314 326 } 315 327 … … 320 332 string string1, string2; 321 333 322 foreach (KeyValuePair<int, SortOrder> pair in sortedIndizes) { 323 string1 = matrix.GetValue(x, pair.Key); 324 string2 = matrix.GetValue(y, pair.Key); 325 if (double.TryParse(string1, out double1) && double.TryParse(string2, out double2)) 326 result = double1.CompareTo(double2); 327 else if (DateTime.TryParse(string1, out dateTime1) && DateTime.TryParse(string2, out dateTime2)) 328 result = dateTime1.CompareTo(dateTime2); 329 else { 330 if (string1 != null) 331 result = string1.CompareTo(string2); 332 else if (string2 != null) 333 result = string2.CompareTo(string1) * -1; 334 } 335 if (pair.Value == SortOrder.Descending) 336 result *= -1; 337 if (result != 0) 338 return result; 334 if (matrix == null) 335 throw new InvalidOperationException("Could not sort IStringConvertibleMatrix if the matrix member is null."); 336 if (sortedIndizes == null) 337 return 0; 338 339 foreach (KeyValuePair<int, SortOrder> pair in sortedIndizes.Where(p => p.Value != SortOrder.None)) { 340 string1 = matrix.GetValue(x, pair.Key); 341 string2 = matrix.GetValue(y, pair.Key); 342 if (double.TryParse(string1, out double1) && double.TryParse(string2, out double2)) 343 result = double1.CompareTo(double2); 344 else if (DateTime.TryParse(string1, out dateTime1) && DateTime.TryParse(string2, out dateTime2)) 345 result = dateTime1.CompareTo(dateTime2); 346 else { 347 if (string1 != null) 348 result = string1.CompareTo(string2); 349 else if (string2 != null) 350 result = string2.CompareTo(string1) * -1; 351 } 352 if (pair.Value == SortOrder.Descending) 353 result *= -1; 354 if (result != 0) 355 return result; 339 356 } 340 357 return result;
Note: See TracChangeset
for help on using the changeset viewer.