use of org.gwtproject.user.cellview.client.AbstractHasData.RedrawEvent.Handler in project gwtproject by treblereel.
the class CellTableTest method testTableRenderedEvent.
public void testTableRenderedEvent() {
final Counter counter = new Counter();
CellTable<String> table = createAbstractHasData(new TextCell());
table.addRedrawHandler(new Handler() {
@Override
public void onRedraw() {
counter.increment();
}
});
// Cause table to redraw by removing a column.
Column<String, ?> column1 = table.getColumn(1);
table.removeColumn(column1);
table.getPresenter().flush();
assertEquals(1, counter.getCount());
// Cause the table to redraw by resetting the {@link CellTableBuilder}.
table.setTableBuilder(new DefaultCellTableBuilder<>(table));
table.getPresenter().flush();
assertEquals(2, counter.getCount());
}
use of org.gwtproject.user.cellview.client.AbstractHasData.RedrawEvent.Handler in project gwtproject by treblereel.
the class AbstractHasDataTestBase method testRenderedEvent.
public void testRenderedEvent() {
final Counter counter = new Counter();
AbstractHasData<String> hasData = createAbstractHasData(new TextCell());
hasData.addRedrawHandler(new Handler() {
@Override
public void onRedraw() {
counter.increment();
}
});
// Cause redraw by changing the data.
hasData.setRowData(Arrays.asList(new String[] { "a", "b", "c" }));
hasData.getPresenter().flush();
assertEquals(1, counter.getCount());
// Cause redraw directly.
hasData.redraw();
hasData.getPresenter().flush();
assertEquals(2, counter.getCount());
// Cause a specific row to redraw.
hasData.redrawRow(0);
hasData.getPresenter().flush();
assertEquals(3, counter.getCount());
}