/**
  * Call this method before any of the {@link SelectionNotifier} methods to ensure that the {@link
  * SelectionListener} instances are registered with all of the {@link ColumnGenerator} classes
  * that also implement {@link SelectionNotifier}.
  */
 @Override
 public void setCellStyleGenerator(CellStyleGenerator generator) {
   try {
     ((TableAware) generator).setTable(this);
   } catch (ClassCastException e) {
   }
   super.setCellStyleGenerator(generator);
 }
Exemplo n.º 2
0
  public void fillTable(Table table, String[] total, List<Object[]> rows) {
    for (int i = 0; i < rows.size(); i++) {
      table.addItem(rows.get(i), i + 1);
    }
    for (int i = 0; i < total.length; i++) {
      table.setColumnFooter(columnNames[i], total[i]);
    }

    table.setCellStyleGenerator(
        new Table.CellStyleGenerator() {
          @Override
          public String getStyle(Table table, Object itemId, Object propertyId) {
            if (propertyId == null) return null;
            int row = ((Integer) itemId).intValue();
            if (row % 2 == 1) return "grey";
            return null;
          }
        });
  }