Search in sources :

Example 1 with Pair

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();
            }
        }
    }
}
Also used : TableRowElement(com.google.gwt.dom.client.TableRowElement) TableCellElement(com.google.gwt.dom.client.TableCellElement) Pair(org.activityinfo.legacy.shared.Pair)

Aggregations

TableCellElement (com.google.gwt.dom.client.TableCellElement)1 TableRowElement (com.google.gwt.dom.client.TableRowElement)1 Pair (org.activityinfo.legacy.shared.Pair)1