}
table.setWidget(row, col, group);
cf.setStyleName(row, col, "x-grid3-header x-grid3-hd x-grid3-cell");
HorizontalAlignment align = config.getHorizontalAlignment();
if (align == HorizontalAlignment.RIGHT) {
cf.setHorizontalAlignment(row, col, HasHorizontalAlignment.ALIGN_RIGHT);
} else if (align == HorizontalAlignment.LEFT) {
cf.setHorizontalAlignment(row, col, HasHorizontalAlignment.ALIGN_LEFT);
} else {
cf.setHorizontalAlignment(row, col, HasHorizontalAlignment.ALIGN_CENTER);
}
int ncs = cs;
if (cs > 1) {
for (int i = col; i < (col + cs); i++) {
if (cm.isHidden(i)) {
ncs -= 1;
}
}
}
cf.setRowSpan(row, col, rs);
cf.setColSpan(row, col, ncs);
}
for (int i = 0; i < cols; i++) {
Head h = createNewHead(cm.getColumn(i));
if (cm.isHidden(i)) {
continue;
}
int rowspan = 1;
if (rows > 1) {
for (int j = rows - 2; j >= 0; j--) {
if (!cm.hasGroup(j, i)) {
rowspan += 1;
}
}
}
h.render(DOM.createDiv());
int row;
if (rowspan > 1) {
row = (rows - 1) - (rowspan - 1);
} else {
row = rows - 1;
}
h.row = row;
if (rowspan > 1) {
table.setWidget(row, i, h);
table.getFlexCellFormatter().setRowSpan(row, i, rowspan);
} else {
table.setWidget(row, i, h);
}
cf.setStyleName(row, i, "x-grid3-header x-grid3-hd x-grid3-cell x-grid3-td-" + cm.getColumnId(i));
cf.getElement(row, i).setAttribute("role", "presentation");
HorizontalAlignment align = cm.getColumnAlignment(i);
if (align == HorizontalAlignment.RIGHT) {
table.getCellFormatter().setHorizontalAlignment(row, i, HasHorizontalAlignment.ALIGN_RIGHT);
table.getCellFormatter().getElement(row, i).getFirstChildElement().getStyle().setPropertyPx("paddingRight", 16);
} else if (align == HorizontalAlignment.CENTER) {
table.getCellFormatter().setHorizontalAlignment(row, i, HasHorizontalAlignment.ALIGN_CENTER);