Position the newly appended cells and update array of column heights.
966137
function(cells, reflow) {
    var columnIndex;
    var columnHeight;
    for(var j = 0, k = cells.length; j < k; j++) {
      // Place the cell to column with the minimal height.
      columnIndex = getMinKey(columnHeights);
      columnHeight = columnHeights[columnIndex];
      cells[j].style.height = (cells[j].offsetHeight - CELL_PADDING) + 'px';
      cells[j].style.left = columnIndex * (COLUMN_WIDTH + GAP_WIDTH) + 'px';
      cells[j].style.top = columnHeight + 'px';
      columnHeights[columnIndex] = columnHeight + GAP_HEIGHT + cells[j].offsetHeight;
      if(!reflow) {
        cells[j].className = 'cell ready';
      }
    }
    cellsContainer.style.height = getMaxVal(columnHeights) + 'px';
    manageCells();
  }
73392
def _execute_cell_code(self, row, col, grid):
        """"""

        key = row, col, grid.current_table
        grid.code_array[key]

        grid.ForceRefresh()
1325884
def _index_resized(self, col, old_width, new_width):
        """"""
        self.table_index.setColumnWidth(col, new_width)
        self._update_layout()
881706
public void newColumns()
    {
        column = new Table(0);
        columns = 1;
        table.newRow();
        table.addCell(column);
        table.cell().top();
    }
86019
public void addColumns(ArrayList<String> columns, String defaultValue) {
		CompactCharSequence dv = new CompactCharSequence(defaultValue);
		for (int i = 0; i < data.length; i++) {
			CompactCharSequence[] row = data[i];
			int oldrowlength = data[i].length;
			data[i] = (CompactCharSequence[]) resizeArray(row, oldrowlength + columns.size());
			for (int c = 0; c < columns.size(); c++) {
				data[i][oldrowlength + c] = dv;
			}
			if (i == 0) {
				for (int c = 0; c < columns.size(); c++) {
					String column = columns.get(c);
					data[0][oldrowlength + c] = new CompactCharSequence(column);
					columnLookup.put(column, new HeaderInfo(oldrowlength + c));
				}
			}
		}
		//   columnLookup.get("ZNF30");

		//     int startIndex = columnLookup.size() + 1;
		//     for (String column : columns) {
		//        if(column.equals("ttr")){
		//            int dummy = 1;
		//        }
		//        columnLookup.put(column, new HeaderInfo(startIndex));
		//        startIndex++;
		//    }


	}
830238
def _shift_rowcol(self, insertion_point, no_to_insert):
        """"""

        # Shift row heights

        new_row_heights = {}
        del_row_heights = []

        for row, tab in self.row_heights:
            if tab > insertion_point:
                new_row_heights[(row, tab + no_to_insert)] = \
                    self.row_heights[(row, tab)]
                del_row_heights.append((row, tab))

        for row, tab in new_row_heights:
            self.set_row_height(row, tab, new_row_heights[(row, tab)])

        for row, tab in del_row_heights:
            if (row, tab) not in new_row_heights:
                self.set_row_height(row, tab, None)

        # Shift column widths

        new_col_widths = {}
        del_col_widths = []

        for col, tab in self.col_widths:
            if tab > insertion_point:
                new_col_widths[(col, tab + no_to_insert)] = \
                    self.col_widths[(col, tab)]
                del_col_widths.append((col, tab))

        for col, tab in new_col_widths:
            self.set_col_width(col, tab, new_col_widths[(col, tab)])

        for col, tab in del_col_widths:
            if (col, tab) not in new_col_widths:
                self.set_col_width(col, tab, None)
188290
private void fillEmptyMatrixCells() {
        try {
            for (int i=0; i < rows.size(); i++) {
                for (int j=0; j < columns; j++) {
                    if (!((Row) rows.get(i)).isReserved(j)) {
                        addCell(defaultCell, new Point(i, j));
                    }
                }
            }
        }
        catch(BadElementException bee) {
            throw new ExceptionConverter(bee);
        }
    }
736136
function updatePosition(subvalue) {
      var lastIndex = -1
      var index = subvalue.indexOf('\n')

      while (index !== -1) {
        line++
        lastIndex = index
        index = subvalue.indexOf('\n', index + 1)
      }

      if (lastIndex === -1) {
        column += subvalue.length
      } else {
        column = subvalue.length - lastIndex
      }

      if (line in offset) {
        if (lastIndex !== -1) {
          column += offset[line]
        } else if (column <= offset[line]) {
          column = offset[line] + 1
        }
      }
    }
605025
public static void appendTable(ParagraphAlignment alignment, int rows, int cols, String[][] values, int
            rowHeight, int colWidth, Map<String, Integer> cellMargins, Map<String, Object> styles) {
        appendTable(new ParagraphAlignment[]{alignment}, rows, cols, values, new int[]{rowHeight}, new
                int[]{colWidth}, cellMargins, styles);
    }
360197
public void addColumns(int aColumns) {
        ArrayList<Row> newRows = new ArrayList<Row>(rows.size());
        
        int newColumns = columns + aColumns;
        Row row;
        for (int i = 0; i < rows.size(); i++) {
            row = new Row(newColumns);
            for (int j = 0; j < columns; j++) {
                row.setElement(((Row) rows.get(i)).getCell(j) ,j);
            }
            for (int j = columns; j < newColumns && i < curPosition.x; j++) {
                row.setElement(null, j);
            }
            newRows.add(row);
        }
        // applied 1 column-fix; last column needs to have a width of 0
        float [] newWidths = new float[newColumns];
        System.arraycopy(widths, 0, newWidths, 0, columns);
        for (int j = columns; j < newColumns ; j++) {
            newWidths[j] = 0;
        }
        columns = newColumns;
        widths = newWidths;
        rows = newRows;
    }
1283176
function recalculateCellHeights(tableGrid, heights) {
        var allCells = tableGrid.getAllCells();
        return Tools.map(allCells, function (cell) {
          var height = total(cell.rowIndex, cell.rowIndex + cell.rowspan, heights);
          return {
            element: cell.element,
            height: height,
            rowspan: cell.rowspan
          };
        });
      }
229945
protected function adaptRows()
    {
        // Go through all headers and rows, wrapping their cells until each
        // column meets the max column width.
        $maxColumnWidths = $this->getMaxColumnWidths();
        $this->setRows($this->adaptCells($this->rowsCopy, $maxColumnWidths));
    }
1175068
def _adjust_rowcol(self, insertion_point, no_to_insert, axis, tab=None):
        """"""

        if axis == 2:
            self._shift_rowcol(insertion_point, no_to_insert)
            return

        assert axis in (0, 1)

        cell_sizes = self.col_widths if axis else self.row_heights
        set_cell_size = self.set_col_width if axis else self.set_row_height

        new_sizes = {}
        del_sizes = []

        for pos, table in cell_sizes:
            if pos > insertion_point and (tab is None or tab == table):
                if 0 <= pos + no_to_insert < self.shape[axis]:
                    new_sizes[(pos + no_to_insert, table)] = \
                        cell_sizes[(pos, table)]
                del_sizes.append((pos, table))

        for pos, table in new_sizes:
            set_cell_size(pos, table, new_sizes[(pos, table)])

        for pos, table in del_sizes:
            if (pos, table) not in new_sizes:
                set_cell_size(pos, table, None)
1240688
public void maybeAppendColumn(Cell cell, DeletionInfo.InOrderTester tester, int gcBefore)
    {
        if (cell.getLocalDeletionTime() >= gcBefore && !tester.isDeleted(cell))
        {
            internalAdd(cell);
            sortedSize++;
        }
    }
437652
def insert_cells(cells, pos_dict, ft_name, append=False):
    ""
    idx = get_insert_idx(pos_dict, ft_name)
    if append or idx == -1: cells += [get_doc_cell(ft_name), get_empty_cell()]
    else:
        cells.insert(idx, get_doc_cell(ft_name))
        cells.insert(idx+1, get_empty_cell())
        pos_dict = update_pos(pos_dict, ft_name, 2)
    return cells, pos_dict
893226
def resizeColumnsToContents(self):
        """"""
        self._autosized_cols = set()
        self._resizeColumnsToContents(self.table_level,
                                      self.table_index, self._max_autosize_ms)
        self._update_layout()
88944
protected void moveAllLeftToRight() {
        int sz = dataModel.getSize();
        int[] selected = new int[sz];
        for (int i = 0; i < sz; i++) {
            selected[i] = i;
        }
        helperList.setSelectedIndices(selected);
        update();
    }