public void loadTable(final IncludedInDetail detail) {
    int row = 0;
    table.resizeRows(detail.getBranches().size() + 1);
    table.addStyleName(Gerrit.RESOURCES.css().changeTable());
    final CellFormatter fmt = table.getCellFormatter();
    fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().dataHeader());
    table.setText(row, 0, Util.C.includedInTableBranch());

    for (final String branch : detail.getBranches()) {
      fmt.addStyleName(++row, 0, Gerrit.RESOURCES.css().dataCell());
      fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().leftMostCell());
      table.setText(row, 0, branch);
    }

    if (!detail.getTags().isEmpty()) {
      table.resizeRows(table.getRowCount() + 2 + detail.getTags().size());
      row++;
      fmt.addStyleName(++row, 0, Gerrit.RESOURCES.css().dataHeader());
      table.setText(row, 0, Util.C.includedInTableTag());

      for (final String tag : detail.getTags()) {
        fmt.addStyleName(++row, 0, Gerrit.RESOURCES.css().dataCell());
        fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().leftMostCell());
        table.setText(row, 0, tag);
      }
    }

    table.setVisible(true);
    loaded = true;
  }
示例#2
0
 private void populateRankTable(AccountInfo[] info) {
   Util.removeGridData(rankGrid);
   rankGrid.resizeRows(info.length + 1);
   for (int row = 1; row <= info.length; row++) {
     insertRankTableRow(row, info[row - 1]);
   }
 }
  private void insertTableRows(final Table type, final Integer r) {
    final int rows = r.intValue();

    if (Table.GRID.equals(type)) {
      final Grid grid = (Grid) table;

      for (int i = 0; i < rows; i++) {
        final Number num = new Integer(i);
        grid.resizeRows(i + 1);
        for (int j = i; j > 0; j--) {
          grid.setWidget(j, 0, grid.getWidget(j - 1, 0));
        }
        grid.setWidget(0, 0, makeLabel(num));
      }

    } else if (Table.FLEX_TABLE.equals(type)) {
      final FlexTable flexTable = (FlexTable) table;

      for (int i = 0; i < rows; i++) {
        final Number num = new Integer(i);
        flexTable.insertRow(0);
        flexTable.setWidget(0, 0, makeLabel(num));
      }

    } else if (Table.OBJECT_LIST_TABLE.equals(type)) {
      final ObjectListTable olt = (ObjectListTable) table;

      for (int i = 0; i < rows; i++) {
        final Number num = new Integer(i);
        olt.getObjects().add(0, num);
      }
    }
  }
示例#4
0
 private void populatePersonResult(List<Person> persons) {
   searchResult.resizeRows(persons.size());
   for (int i = 0; i < persons.size(); i++) {
     Person person = persons.get(i);
     searchResult.setHTML(i, 0, person.getFirstName());
     searchResult.setHTML(i, 1, person.getLastName());
   }
 }
  @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();
    }
  }