예제 #1
0
 /** Configures the formatting for a particular cell based on its location in the grid. */
 protected void formatCell(HTMLTable.CellFormatter formatter, int row, int col, int limit) {
   formatter.setHorizontalAlignment(row, col, _cellHorizAlign);
   formatter.setVerticalAlignment(row, col, _cellVertAlign);
   formatter.setStyleName(row, col, "Cell");
   if (row == (limit - 1) / _cols) {
     formatter.addStyleName(row, col, "BottomCell");
   } else if (row == 0) {
     formatter.addStyleName(row, col, "TopCell");
   } else {
     formatter.addStyleName(row, col, "MiddleCell");
   }
 }
  @Override
  public void buildTable(
      List<? extends NeedsRefresh> sourceDisplays, List<? extends NeedsRefresh> targetDisplays) {
    showEmptyContentIfNoData(sourceDisplays.size());

    transUnitTable.resizeRows(sourceDisplays.size());
    HTMLTable.CellFormatter cellFormatter = transUnitTable.getCellFormatter();

    for (int i = 0; i < sourceDisplays.size(); i++) {
      NeedsRefresh sourceDisplay = sourceDisplays.get(i);
      NeedsRefresh targetDisplay = targetDisplays.get(i);

      transUnitTable.setWidget(i, 0, sourceDisplay);
      transUnitTable.setWidget(i, 1, targetDisplay);

      cellFormatter.setVerticalAlignment(i, 0, HasVerticalAlignment.ALIGN_TOP);
      cellFormatter.setVerticalAlignment(i, 1, HasVerticalAlignment.ALIGN_TOP);
      cellFormatter.addStyleName(i, 0, "transUnitCol");
      cellFormatter.addStyleName(i, 1, "transUnitCol");

      sourceDisplay.refresh();
      targetDisplay.refresh();
    }
  }