Esempio n. 1
0
 private void AppendColumn(TableColumnModel theColumn)
 {
     // Column indexes start at 1
     theColumn.Index = this.columnCount + 1;
     foreach (var row in Rows)
     {
         row.AddCell(new TableCellModel());
     }
     Columns.Insert(this.columnCount, theColumn);
     this.columnCount++;
 }
Esempio n. 2
0
        private IEnumerable <TableCellModel> GetCellsByColumn(TableColumnModel theColumn)
        {
            var accumulator = new List <TableCellModel>();

            foreach (var row in Rows)
            {
                var x = row.GetCellAt(theColumn.Index);
                accumulator.Add(x);
            }

            return(accumulator);
        }
Esempio n. 3
0
        /// <summary>
        /// Add a new column to the table.
        /// </summary>
        /// <param name="theColumn">The new column.</param>
        public void AddColumn(TableColumnModel theColumn)
        {
            // Column indexes start at 1
            theColumn.Index = Columns.Count + 1;

            foreach (var row in Rows)
            {
                row.AddCell(new TableCellModel());
            }

            Columns.Add(theColumn);
            this.columnCount++;
        }
Esempio n. 4
0
        /// <summary>
        /// Add a column to the table.
        /// </summary>
        /// <param name="selectedColumnIndex">The currently selected column index.</param>
        /// <param name="theColumn">The new column.</param>
        public void AddColumnBefore(int selectedColumnIndex, TableColumnModel theColumn)
        {
            if (selectedColumnIndex < 0 || selectedColumnIndex >= Rows.Count)
            {
                throw new ArgumentOutOfRangeException(nameof(selectedColumnIndex));
            }

            // Column indexes start at 1
            theColumn.Index = selectedColumnIndex == 0? 1: selectedColumnIndex + 1;
            // Re-index the columns to the right of the inserted column
            for (var i = selectedColumnIndex; i < Columns.Count; i++)
            {
                Columns[i].Index++;
            }
            foreach (var row in Rows)
            {
                row.AddCell(new TableCellModel());
            }
            Columns.Insert(selectedColumnIndex, theColumn);
            this.columnCount++;
        }
 public TableColumnData(TableColumnModel theColumn, IEnumerable <TableCellModel> theColumnCells)
 {
     _column = theColumn;
     _cells  = new List <TableCellModel>(theColumnCells);
 }