List of usage examples for com.google.gwt.aria.client Roles getRowheaderRole
public static RowheaderRole getRowheaderRole()
From source file:org.unitime.timetable.gwt.client.widgets.WebTable.java
License:Apache License
public void setHeader(Row... header) { iHeader = header;// w w w . j a v a 2 s . c om for (int i = 0; i < header.length; i++) { for (int j = 0; j < header[i].getNrCells(); j++) { Cell cell = header[i].getCell(j); if (cell.getWidget() == null) { iTable.setHTML(i, j, (cell.getValue() == null || cell.getValue().isEmpty() ? " " : cell.getValue())); if (cell.getAriaLabel() != null && !cell.getAriaLabel().isEmpty()) Roles.getGridcellRole().setAriaLabelProperty(iTable.getCellFormatter().getElement(i, j), cell.getAriaLabel()); } else iTable.setWidget(i, j, cell.getWidget()); iTable.getFlexCellFormatter().setWordWrap(i, j, cell.getWordWrap()); iTable.getFlexCellFormatter().setStyleName(i, j, (cell.getStyleName() == null ? "unitime-TableHeader" : cell.getStyleName())); iTable.getFlexCellFormatter().setWidth(i, j, (cell.getWidth() == null ? (100 / header.length) + "%" : cell.getWidth())); iTable.getFlexCellFormatter().setColSpan(i, j, cell.getColSpan()); iTable.getFlexCellFormatter().setVerticalAlignment(i, j, cell.getVerticalAlignment()); iTable.getFlexCellFormatter().setHorizontalAlignment(i, j, cell.getHorizontalAlignment()); iTable.getFlexCellFormatter().getElement(i, j).setTitle(cell.getTitle()); Roles.getColumnheaderRole().set(iTable.getCellFormatter().getElement(i, j)); } Roles.getRowRole().set(iTable.getRowFormatter().getElement(i)); if (header[i].getAriaLabel() != null && !header[i].getAriaLabel().isEmpty()) { iTable.setWidget(i, header[i].getNrCells(), new AriaHiddenLabel(header[i].getAriaLabel())); } else { iTable.setHTML(i, header[i].getNrCells(), ""); } Roles.getRowheaderRole().set(iTable.getCellFormatter().getElement(i, header[i].getNrCells())); iTable.getFlexCellFormatter().setStyleName(i, header[i].getNrCells(), "unitime-TableHeader"); iTable.getFlexCellFormatter().addStyleName(i, header[i].getNrCells(), "rowheader"); } }
From source file:org.unitime.timetable.gwt.client.widgets.WebTable.java
License:Apache License
public void setData(Row... rows) { setSelectedRow(-1);/*from w w w . j a va 2 s .com*/ if (rows == null || rows.length == 0) { clearData(true); return; } clearData(rows.length); iRows = rows; for (int i = 0; i < iRows.length; i++) { if (iRows[i] == null) continue; iRows[i].setRowIdx(i); iRows[i].setTable(this); iTable.getRowFormatter().setStyleName(i + getHeaderRowsCount(), null); for (int j = 0; j < iRows[i].getNrCells(); j++) { Cell cell = iRows[i].getCell(j); cell.setColIdx(j); cell.setRow(iRows[i]); if (cell.getWidget() == null) { iTable.setHTML(i + getHeaderRowsCount(), j, (cell.getValue() == null || cell.getValue().isEmpty() ? " " : cell.getValue())); if (cell.getAriaLabel() != null && !cell.getAriaLabel().isEmpty()) Roles.getGridcellRole().setAriaLabelProperty( iTable.getCellFormatter().getElement(i + getHeaderRowsCount(), j), cell.getAriaLabel()); } else iTable.setWidget(i + getHeaderRowsCount(), j, cell.getWidget()); iTable.getFlexCellFormatter().setWordWrap(i + getHeaderRowsCount(), j, cell.getWordWrap()); iTable.getFlexCellFormatter().setColSpan(i + getHeaderRowsCount(), j, cell.getColSpan()); iTable.getFlexCellFormatter().setStyleName(i + getHeaderRowsCount(), j, cell.getStyleName()); iTable.getFlexCellFormatter().setWidth(i + getHeaderRowsCount(), j, cell.getWidth()); iTable.getFlexCellFormatter().setVerticalAlignment(i + getHeaderRowsCount(), j, cell.getVerticalAlignment()); iTable.getFlexCellFormatter().setHorizontalAlignment(i + getHeaderRowsCount(), j, cell.getHorizontalAlignment()); iTable.getFlexCellFormatter().getElement(i + getHeaderRowsCount(), j).setTitle(cell.getTitle()); Roles.getGridcellRole().set(iTable.getCellFormatter().getElement(i + getHeaderRowsCount(), j)); } Roles.getRowRole().set(iTable.getRowFormatter().getElement(i + getHeaderRowsCount())); for (int j = iTable.getCellCount(i + getHeaderRowsCount()) - 1; j >= iRows[i].getNrCells(); j--) iTable.removeCell(i + getHeaderRowsCount(), j); if (iRows[i].getAriaLabel() != null && !iRows[i].getAriaLabel().isEmpty()) { iTable.setWidget(i + getHeaderRowsCount(), iRows[i].getNrCells(), new AriaHiddenLabel(iRows[i].getAriaLabel())); } else { iTable.setHTML(i + getHeaderRowsCount(), iRows[i].getNrCells(), ""); } Roles.getRowheaderRole() .set(iTable.getCellFormatter().getElement(i + getHeaderRowsCount(), iRows[i].getNrCells())); iTable.getFlexCellFormatter().setStyleName(i + getHeaderRowsCount(), iRows[i].getNrCells(), iRows[i].getCell(iRows[i].getNrCells() - 1).getStyleName()); iTable.getFlexCellFormatter().addStyleName(i + getHeaderRowsCount(), iRows[i].getNrCells(), "rowheader"); } }