Skip to content

Instantly share code, notes, and snippets.

@christiangoudreau
Created May 10, 2013 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiangoudreau/5556792 to your computer and use it in GitHub Desktop.
Save christiangoudreau/5556792 to your computer and use it in GitHub Desktop.
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