private void ExtractAttributeColumns(object[] aColumnAttributes, CIElement aElement) { bool foundColumnAttributes = false; SortedDictionary <int, CIDBColumn> columns = new SortedDictionary <int, CIDBColumn>(); foreach (object obj in aColumnAttributes) { if (obj is CIDBAttributeColumn) { CIDBAttributeColumn attribute = (CIDBAttributeColumn)obj; // Make a column CIDBColumn col = new CIDBColumn(attribute.Caption); col.Width = attribute.Width; col.WidthSet = attribute.WidthSet; col.TakesUpSlack = attribute.TakesUpSlack; if (columns.ContainsKey(attribute.Order)) { throw new Exception(string.Format("Column: [{0}] in element: [{1}] specifies order: {2} which is already in use", attribute.Caption, aElement, attribute.Order)); } columns.Add(attribute.Order, col); foundColumnAttributes = true; } } // Since the list is already sorted for us, just add the items in order foreach (KeyValuePair <int, CIDBColumn> kvp in columns) { this.Add(kvp.Value); } // We'll override the auto populate feature if we find a valid // column attribute iAutoPopulate = foundColumnAttributes; }
public void Add(CIDBColumn aColumn) { aColumn.Model = this; iColumns.Add(aColumn); }