use of org.activityinfo.legacy.shared.Pair in project activityinfo by bedatadriven.
the class CellTableHeaderWidthApplier method setHeaderWidthInformation.
private void setHeaderWidthInformation(boolean shouldAffix) {
// header
if (shouldAffix) {
table.getTableHeadElement().getStyle().setWidth(headerWidth, Style.Unit.PX);
} else {
table.getTableHeadElement().getStyle().clearWidth();
}
final NodeList<TableRowElement> headerRows = table.getTableHeadElement().getRows();
for (int i = 0; i < headerRows.getLength(); i++) {
final TableRowElement row = headerRows.getItem(i);
// rows
if (shouldAffix) {
row.getStyle().setWidth(headerRowToWidthMap.get(i), Style.Unit.PX);
} else {
row.getStyle().clearWidth();
}
// cells
final NodeList<TableCellElement> cells = row.getCells();
for (int j = 0; j < cells.getLength(); j++) {
final TableCellElement cell = cells.getItem(j);
if (shouldAffix) {
cell.getStyle().setWidth(headerCellToWidthMap.get(new Pair<>(i, j)), Style.Unit.PX);
} else {
cell.getStyle().clearWidth();
}
}
}
}
Aggregations