check if we need to individually color columns or we can do the entire
 row in one shot
489094
def check_colors
        each_column {|c,i|
          if c.color || c.bgcolor || c.attrib
            @_check_coloring = true
            return
          end
          @_check_coloring = false
        }
      end
1356815
public void setColorForTotal(int row, int column, Color color){
		int mapC = (colors.length-1) - column;
		int mapR = (colors[0].length-1) - row;
		colors[mapC][mapR]=color;		
	}
1130985
function column_style_all($property, $value) {
        foreach (array_keys($this->columns) as $column) {
            $this->column_style[$column][$property] = $value;
        }
    }
221799
public synchronized void paintRow(Graphics2D g2d, AbstractGraphRow row, Color color, double zoomFactor, int limitPointFactor) {

        Iterator<Entry<Long, AbstractGraphPanelChartElement>> it = row.iterator();
        Entry<Long, AbstractGraphPanelChartElement> element;

        Stroke olStroke;

        prevX = -1;
        prevY = chartRect.y + chartRect.height;

        mustDrawFirstZeroingLine = chartSettings.isDrawFinalZeroingLines();

        olStroke = g2d.getStroke();

        if (row.isDrawThickLines()) {
            g2d.setStroke(chartSettings.getThickStroke());
        } else {
            g2d.setStroke(getLineStroke());
        }

        g2d.setColor(color);

        while (it.hasNext()) {
            if (!row.isDrawOnChart()) {
                continue;
            }
            if (limitPointFactor == 1) {

                element = it.next();
                AbstractGraphPanelChartElement elt = (AbstractGraphPanelChartElement) element.getValue();

                //not compatible with factor != 1, ie cannot be used if limit nb of point is selected.
                if (chartSettings.getHideNonRepValLimit() > 0) {
                    while (!elt.isPointRepresentative(chartSettings.getHideNonRepValLimit()) && it.hasNext()) {
                        element = it.next();
                        elt = (AbstractGraphPanelChartElement) element.getValue();
                    }

                    if (!elt.isPointRepresentative(chartSettings.getHideNonRepValLimit())) {
                        break;
                    }
                }

                calcPointX = element.getKey().doubleValue();
                calcPointY = elt.getValue();
            } else {
                calcPointX = 0;
                calcPointY = 0;
                int nbPointProcessed = 0;
                for (int i = 0; i < limitPointFactor; i++) {
                    if (it.hasNext()) {
                        element = it.next();
                        calcPointX = calcPointX + element.getKey().doubleValue();
                        calcPointY = calcPointY + ((AbstractGraphPanelChartElement) element.getValue()).getValue();
                        nbPointProcessed++;
                    }
                }
                calcPointX = calcPointX / (double) nbPointProcessed;
                calcPointY = calcPointY / (double) nbPointProcessed;
            }

            calcPointY = calcPointY * zoomFactor;

            x = chartRect.x + (int) ((calcPointX - minXVal) * dxForDVal);
            int yHeight = (int) ((calcPointY - minYVal) * dyForDVal);
            y = chartRect.y + chartRect.height - yHeight;

            //now x and y are set, we can call plotter
            processPoint(g2d, row.getGranulationValue());

            //set prevX, prevY
            if (isChartPointValid(x, y)) {
                if (allowMarkers) {
                    processMarker(g2d, row);
                }
                prevX = x;
                prevY = y;
            }

            if (row.isDrawValueLabel() && isChartPointValid(x, y) && y >= chartRect.y) {
                drawLabels(g2d, row, calcPointY);
            }
        }

        processFinalLines(row, g2d);

        x = 0;
        y = 0;
        prevX = -1;
        prevY = chartRect.y + chartRect.height;

        postPaintRow(row, g2d);

        g2d.setStroke(olStroke);
    }
100471
function inerpolateColors(col1, col2, amount) {
  let col1rgb = parseColor(col1);
  let col2rgb = parseColor(col2);
  return RGBobj2string({
    r: Math.min(255, col1rgb.r * amount + col2rgb.r * (1-amount)),
    g: Math.min(255, col1rgb.g * amount + col2rgb.g * (1-amount)),
    b: Math.min(255, col1rgb.b * amount + col2rgb.b * (1-amount)),
    a: Math.min(1, col1rgb.a * amount + col2rgb.a * (1-amount))
  });
}
159013
def color=(color)
      each_with_index do | cell, index |
        cell.color = color.is_a?(Array) ? color[index] : color
      end
    end
1291274
private boolean verifyWithOfColumns(ColumnState[] columnStates, TextTableInfo tableInfo) {

    int tableWidth = tableInfo.getWidth();
    if (tableWidth != TextColumnInfo.WIDTH_AUTO_ADJUST) {
      int calculatedWidth = 0;
      for (ColumnState columnState : columnStates) {
        if (columnState.width < 0) {
          throw new AssertionError("columnWidth=" + columnState.width);
          // return false;
        }
        calculatedWidth = calculatedWidth + columnState.width + columnState.getColumnInfo().getBorderWidth();
      }
      if (calculatedWidth != tableWidth) {
        throw new AssertionError("with=" + tableWidth + ", sum-of-columns=" + calculatedWidth);
        // return false;
      }
    }
    return true;
  }
728575
public void setTotalColorForColumn(int column, Color color){
		int map = (colors.length-1) - column;
		colors[map][colors[0].length-1]=color;
	}
655801
function() {
        var columnWidths = this.coordColumnModel.getWidths(this.whichSide);
        var $colList = this.$el.find('col');
        var coordRowModel = this.coordRowModel;

        _.each(columnWidths, function(columnWidth, index) {
            $colList.eq(index).css('width', columnWidth + CELL_BORDER_WIDTH);
        });

        // Calls syncWithDom only from the Rside to prevent calling twice.
        // Defered call to ensure that the execution occurs after both sides are rendered.
        if (this.whichSide === frameConst.R) {
            _.defer(function() {
                coordRowModel.syncWithDom();
            });
        }
    }
340934
private void paintColumnHeadings(final WTable table, final WebXmlRenderContext renderContext) {
		XmlStringBuilder xml = renderContext.getWriter();
		int[] columnOrder = table.getColumnOrder();
		TableModel model = table.getTableModel();
		final int columnCount = columnOrder == null ? table.getColumnCount() : columnOrder.length;

		xml.appendTagOpen("ui:thead");
		xml.appendOptionalAttribute("hidden", !table.isShowColumnHeaders(), "true");
		xml.appendClose();

		for (int i = 0; i < columnCount; i++) {
			int colIndex = columnOrder == null ? i : columnOrder[i];
			WTableColumn col = table.getColumn(colIndex);

			if (col.isVisible()) {
				boolean sortable = model.isSortable(colIndex);
				paintColumnHeading(col, sortable, renderContext);
			}
		}

		xml.appendEndTag("ui:thead");
	}
933397
def repaint
      return unless @repaint_required
      raise "Label row or col nil #{@row} , #{@col}, #{@text} " if @row.nil? || @col.nil?
      r,c = rowcol

      #@bgcolor ||= $def_bg_color
      #@color   ||= $def_fg_color
      _bgcolor = bgcolor()
      _color = color()
      # value often nil so putting blank, but usually some application error
      value = getvalue_for_paint || ""

      if value.is_a? Array
        value = value.join " "
      end
      # ensure we do not exceed
      if @width
        if value.length > @width
          value = value[0..@width-1]
        end
      end
      len = @width || value.length
      #acolor = get_color $datacolor
      # the user could have set color_pair, use that, else determine color
      # This implies that if he sets cp, then changing col and bg won't have an effect !
      # A general routine that only changes color will not work here.
      acolor = @color_pair || get_color($datacolor, _color, _bgcolor)
      #$log.debug "label :#{@text}, #{value}, r #{r}, c #{c} col= #{@color}, #{@bgcolor} acolor  #{acolor} j:#{@justify} dlL: #{@width} "
      str = @justify.to_sym == :right ? "%*s" : "%-*s"  # added 2008-12-22 19:05 
    
      @graphic ||= @form.window
      # clear the area
      @graphic.printstring r, c, " " * len , acolor, attr()
      if @justify.to_sym == :center
        padding = (@width - value.length)/2
        value = " "*padding + value + " "*padding # so its cleared if we change it midway
      end
      @graphic.printstring r, c, str % [len, value], acolor, attr()
      if @mnemonic
        ulindex = value.index(@mnemonic) || value.index(@mnemonic.swapcase)
        @graphic.mvchgat(y=r, x=c+ulindex, max=1, Ncurses::A_BOLD|Ncurses::A_UNDERLINE, acolor, nil)
      end
      @repaint_required = false
    end
71891
def draw(self, scr):
        ''
        numHeaderRows = 1
        scr.erase()  # clear screen before every re-draw

        vd().refresh()

        if not self.columns:
            return

        color_current_row = CursesAttr(colors.color_current_row, 5)
        disp_column_sep = options.disp_column_sep

        rowattrs = {}  # [rowidx] -> attr
        colattrs = {}  # [colidx] -> attr
        isNull = isNullFunc()

        self.rowLayout = {}
        self.calcColLayout()
        vcolidx = 0
        rows = list(self.rows[self.topRowIndex:self.topRowIndex+self.nVisibleRows])
        for vcolidx, colinfo in sorted(self.visibleColLayout.items()):
            x, colwidth = colinfo
            col = self.visibleCols[vcolidx]

            if x < self.vd.windowWidth:  # only draw inside window
                headerRow = 0
                self.drawColHeader(scr, headerRow, vcolidx)

                y = headerRow + numHeaderRows
                for rowidx in range(0, min(len(rows), self.nVisibleRows)):
                    dispRowIdx = self.topRowIndex + rowidx
                    if dispRowIdx >= self.nRows:
                        break

                    self.rowLayout[dispRowIdx] = y

                    row = rows[rowidx]
                    cellval = col.getCell(row, colwidth-1)
                    try:
                        if isNull(cellval.value):
                            cellval.note = options.disp_note_none
                            cellval.notecolor = 'color_note_type'
                    except TypeError:
                        pass

                    attr = self.colorize(col, row, cellval)

                    # sepattr is the attr between cell/columns
                    rowattr = rowattrs.get(rowidx)
                    if rowattr is None:
                        rowattr = rowattrs[rowidx] = self.colorize(None, row)
                    sepattr = rowattr

                    # must apply current row here, because this colorization requires cursorRowIndex
                    if dispRowIdx == self.cursorRowIndex:
                        attr = attr.update_attr(color_current_row)
                        sepattr = sepattr.update_attr(color_current_row)

                    note = getattr(cellval, 'note', None)
                    if note:
                        noteattr = attr.update_attr(colors.get_color(cellval.notecolor), 10)
                        clipdraw(scr, y, x+colwidth-len(note), note, noteattr.attr, len(note))

                    clipdraw(scr, y, x, disp_column_fill+cellval.display, attr.attr, colwidth-(1 if note else 0))
                    vd.onMouse(scr, y, x, 1, colwidth, BUTTON3_RELEASED='edit-cell')

                    sepchars = disp_column_sep
                    if (self.keyCols and col is self.keyCols[-1]) or vcolidx == self.rightVisibleColIndex:
                        sepchars = options.disp_keycol_sep

                    if x+colwidth+len(sepchars) <= self.vd.windowWidth:
                       scr.addstr(y, x+colwidth, sepchars, sepattr.attr)

                    y += 1

        if vcolidx+1 < self.nVisibleCols:
            scr.addstr(headerRow, self.vd.windowWidth-2, options.disp_more_right, colors.color_column_sep)

        catchapply(self.checkCursor)
705592
function () {
      var drag, select, start, end;

      autofill.handle.isDragged = 0;

      drag = autofill.fillBorder.corners;
      if (!drag) {
        return;
      }

      autofill.fillBorder.disappear();

      if (selection.isMultiple()) {
        select = priv.selectionBorder.corners;
      }
      else {
        select = priv.currentBorder.corners;
      }

      if (drag.TL.row === select.TL.row && drag.TL.col < select.TL.col) {
        start = drag.TL;
        end = {
          row: drag.BR.row,
          col: select.TL.col - 1
        };
      }
      else if (drag.TL.row === select.TL.row && drag.BR.col > select.BR.col) {
        start = {
          row: drag.TL.row,
          col: select.BR.col + 1
        };
        end = drag.BR;
      }
      else if (drag.TL.row < select.TL.row && drag.TL.col === select.TL.col) {
        start = drag.TL;
        end = {
          row: select.TL.row - 1,
          col: drag.BR.col
        };
      }
      else if (drag.BR.row > select.BR.row && drag.TL.col === select.TL.col) {
        start = {
          row: select.BR.row + 1,
          col: drag.TL.col
        };
        end = drag.BR;
      }

      if (start) {
        grid.populateFromArray(start, SheetClip.parse(priv.editProxy.val()), end, 'autofill');

        selection.setRangeStart(self.view.getCellAtCoords(drag.TL));
        selection.setRangeEnd(self.view.getCellAtCoords(drag.BR));
      }
      else {
        //reset to avoid some range bug
        selection.refreshBorders();
      }
    }
267525
def print_colored_columns(printer, rows, padding=2):
    
    rows_ = [x[:-1] for x in rows]
    colors = [x[-1] for x in rows]
    for col, line in zip(colors, columnise(rows_, padding=padding)):
        printer(line, col)
1021728
def prepare_rows(self,
                     rows,
                     indent,
                     has_header):

        ''''''

        out = []

        def row_wrapper(row):
            new_rows = [
                self.wrapfunc(item).split('\n')
                for item in row
            ]
            rows = []
            for item in map(lambda *args: args, *new_rows):
                if isinstance(item, (tuple, list)):
                    rows.append([substr or '' for substr in item])
                else:
                    rows.append([item])
            return rows

        logical_rows = [
            row_wrapper(row)
            for row in rows
        ]

        columns = map(lambda *args: args, *reduce(operator.add, logical_rows))

        max_widths = [
            max([len(six.text_type(item)) for item in column])
            for column in columns
        ]
        row_separator = self.row_delimiter * (len(self.prefix) + len(self.suffix) + sum(max_widths) +
                                              len(self.delim) * (len(max_widths) - 1))

        justify = self._JUSTIFY_MAP[self.justify.lower()]

        if self.separate_rows:
            out.append(
                self.ustring(
                    indent,
                    self.LIGHT_GRAY,  # pylint: disable=no-member
                    row_separator
                )
            )
        for physical_rows in logical_rows:
            for row in physical_rows:
                line = self.prefix \
                        + self.delim.join([
                                justify(six.text_type(item), width)
                                for (item, width) in zip(row, max_widths)
                        ]) + self.suffix
                out.append(
                    self.ustring(
                        indent,
                        self.WHITE,  # pylint: disable=no-member
                        line
                    )
                )
            if self.separate_rows or has_header:
                out.append(
                    self.ustring(
                        indent,
                        self.LIGHT_GRAY,  # pylint: disable=no-member
                        row_separator
                    )
                )
                has_header = False
        return out
1184167
def is_merged(sheet, row, column):
    
    for cell_range in sheet.merged_cells:
        row_low, row_high, column_low, column_high = cell_range
        if (row in range(row_low, row_high)) and \
                (column in range(column_low, column_high)):

            # TODO: IS NECESARY THIS IF?
            if ((column_high - column_low) < sheet.ncols - 1) and \
                    ((row_high - row_low) < sheet.nrows - 1):
                return (True, cell_range)

    return False
439016
async function(row, col, event) {
        if (this.isTreeCol(col)) {
            let isShift = false;
            if (event.primitiveEvent.detail.primitiveEvent) {
                isShift = !!event.primitiveEvent.detail.primitiveEvent.shiftKey; // typecast to boolean
            }
            let is_expanded = await this._view.get_row_expanded(row);
            if (isShift) {
                if (is_expanded) {
                    if (this.data[row][col].rowPath.length === 1) {
                        this._view.collapse(row);
                    } else {
                        this._view.set_depth(this.data[row][col].rowPath.length - 2);
                    }
                } else {
                    this._view.set_depth(this.data[row][col].rowPath.length - 1);
                }
            } else {
                if (is_expanded) {
                    this._view.collapse(row);
                } else {
                    this._view.expand(row);
                }
            }
            let nrows = await this._view.num_rows();
            this.setDirty(nrows);
            this.grid.canvas.paintNow();
        }
    }