public DefaultCellTable asWidget() { table = new DefaultCellTable<SocketBinding>(6); dataProvider = new ListDataProvider<SocketBinding>(); dataProvider.addDataDisplay(table); TextColumn<SocketBinding> nameColumn = new TextColumn<SocketBinding>() { @Override public String getValue(SocketBinding record) { return record.getName(); } }; TextColumn<SocketBinding> portColumn = new TextColumn<SocketBinding>() { @Override public String getValue(SocketBinding record) { return String.valueOf(record.getPort() + portOffset); } }; table.addColumn(nameColumn, "Name"); table.addColumn(portColumn, "Port"); return table; }
public void updateFrom(String groupName, List<SocketBinding> bindings) { dataProvider.setList(bindings); if (!bindings.isEmpty() && table.getSelectionModel() != null) table.getSelectionModel().setSelected(bindings.get(0), true); }