Created
May 10, 2013 19:29
-
-
Save christiangoudreau/5556792 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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