int offset = 0;
if (numRows < 0) {
offset = 1;
}
CellFormatter fmt = table.getCellFormatter();
for (int i = 0 + offset; i < loopTo + offset; i++) {
// The overridden version of insertRow adds some css classes we don't
// want.
super.insertRow(row + i);
table.getRowFormatter().setVerticalAlign(row + i,
HasVerticalAlignment.ALIGN_TOP);
int lineA = line.getStartA() + i;
int lineB = line.getStartB() + i;
if (numRows < 0) {
lineA = line.getStartA() + line.getSize() + numRows + i - offset;
lineB = line.getStartB() + line.getSize() + numRows + i - offset;
}
table.setHTML(row + i, A - 1, "<a href=\"javascript:;\">" + (lineA + 1) + "</a>");
fmt.addStyleName(row + i, A - 1, Gerrit.RESOURCES.css().lineNumber());
table.setHTML(row + i, A, a.getSafeHtmlLine(lineA).asString());
fmt.addStyleName(row + i, A, Gerrit.RESOURCES.css().fileLine());
fmt.addStyleName(row + i, A, Gerrit.RESOURCES.css().fileLineCONTEXT());
table.setHTML(row + i, B, b.getSafeHtmlLine(lineB).asString());
fmt.addStyleName(row + i, B, Gerrit.RESOURCES.css().fileLine());
fmt.addStyleName(row + i, B, Gerrit.RESOURCES.css().fileLineCONTEXT());
table.setHTML(row + i, B + 1, "<a href=\"javascript:;\">" + (lineB + 1) + "</a>");
fmt.addStyleName(row + i, B + 1, Gerrit.RESOURCES.css().lineNumber());
setRowItem(row + i, new PatchLine(CONTEXT, lineA, lineB));
}
if (numRows > 0) {