Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
public class RatingColumnInitializer implements ColumnInitializer<RatingDto> {
@Override
public void initializeColumns(CellTable<RatingDto> table) {
initIdColumn(table);
initCarColumn(table);
initRatingColumn(table);
}
private void initIdColumn(CellTable<RatingDto> table) {
Column<RatingDto, Number> idColumn = new Column<RatingDto, Number>(new NumberCell()) {
@Override
public Long getValue(RatingDto ratingDto) {
return ratingDto.getId();
}
};
table.addColumn(idColumn, "ID");
}
private void initCarColumn(CellTable<RatingDto> table) {
Column<RatingDto, String> carColumn = new Column<RatingDto, String>(new TextCell()) {
@Override
public String getValue(RatingDto ratingDto) {
return ratingDto.toString();
}
};
table.addColumn(carColumn, "Car");
}
private void initRatingColumn(CellTable<RatingDto> table) {
Column<RatingDto, Number> ratingColumn = new Column<RatingDto, Number>(new NumberCell()) {
@Override
public Number getValue(RatingDto ratingDto) {
return ratingDto.getRating();
}
};
table.addColumn(ratingColumn, "Rating");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment