for (int i = 0; i < rows; i++) {
result.appendHtmlConstant("<tr>");
for (int j = 0; j < columnCount && mark < colors.length; j++) {
String c = colors[mark];
String label = labels[mark];
SafeHtml cellTemplate = template.cellTemplate(style, label, XDOM.getUniqueId(), i, j, c,
SafeStylesUtils.fromTrustedString("background-color: #" + SafeHtmlUtils.htmlEscape(c) + ";"),
c.equals(value) ? style.selected() : "");
result.append(cellTemplate);
mark++;
}