Represents a collection of IComparer objects
Inheritance: System.Collections.CollectionBase
Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the SorterBase class with the specified
 /// TableModel, Column index, IComparer and SortOrder
 /// </summary>
 /// <param name="tableModel">The TableModel that contains the data to be sorted</param>
 /// <param name="column">The index of the Column to be sorted</param>
 /// <param name="comparer">The IComparer used to sort the Column's Cells</param>
 /// <param name="sortOrder">Specifies how the Column is to be sorted</param>
 public SorterBase(TableModel tableModel, int column, IComparer comparer, SortOrder sortOrder)
 {
     this.tableModel         = tableModel;
     this.column             = column;
     this.comparer           = comparer;
     this.sortOrder          = sortOrder;
     this.secondarySortOrder = new SortColumnCollection();
     this.secondaryComparers = new IComparerCollection();
 }
Esempio n. 2
0
        /// <summary>
        /// Gets a collection of comparers for the underlying sort order(s)
        /// </summary>
        /// <param name="secondarySortOrders"></param>
        /// <returns></returns>
        private IComparerCollection GetSecondaryComparers(SortColumnCollection secondarySortOrders)
        {
            IComparerCollection comparers = new IComparerCollection();

            foreach (SortColumn sort in secondarySortOrders)
            {
                ComparerBase comparer = null;
                Column column = this.ColumnModel.Columns[sort.SortColumnIndex];

                if (column.Comparer != null)
                {
                    comparer = (ComparerBase)Activator.CreateInstance(column.Comparer, new object[] { this.TableModel, sort.SortColumnIndex, sort.SortOrder });
                }
                else if (column.DefaultComparerType != null)
                {
                    comparer = (ComparerBase)Activator.CreateInstance(column.DefaultComparerType, new object[] { this.TableModel, sort.SortColumnIndex, sort.SortOrder });
                }
                if (comparer != null)
                    comparers.Add(comparer);
            }

            return comparers;
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the SorterBase class with the specified 
 /// TableModel, Column index, IComparer and SortOrder
 /// </summary>
 /// <param name="tableModel">The TableModel that contains the data to be sorted</param>
 /// <param name="column">The index of the Column to be sorted</param>
 /// <param name="comparer">The IComparer used to sort the Column's Cells</param>
 /// <param name="sortOrder">Specifies how the Column is to be sorted</param>
 public SorterBase(TableModel tableModel, int column, IComparer comparer, SortOrder sortOrder)
 {
     this.tableModel = tableModel;
     this.column = column;
     this.comparer = comparer;
     this.sortOrder = sortOrder;
     this.secondarySortOrder = new SortColumnCollection();
     this.secondaryComparers = new IComparerCollection();
 }