use of de.symeda.sormas.api.utils.pseudonymization.PseudonymizableDto in project SORMAS-Project by hzi-braunschweig.
the class PreviewGridHelper method createPersonColumns.
public static <T> List<String> createPersonColumns(Grid<T> grid, Function<T, SormasToSormasPersonPreview> getPerson) {
((Grid.Column<PseudonymizableDto, ?>) grid.addComponentColumn(previewData -> {
SormasToSormasPersonPreview person = getPerson.apply(previewData);
if (person.isPseudonymized()) {
return new Label(I18nProperties.getCaption(Captions.inaccessibleValue));
}
return new Label(person.getFirstName() + " " + person.getLastName());
})).setId(PERSON_NAME).setStyleGenerator(item -> {
if (item.isPseudonymized()) {
return CssStyles.INACCESSIBLE_COLUMN;
}
return "";
});
grid.addComponentColumn(previewData -> new Label(DateFormatHelper.formatDate(getPerson.apply(previewData).getBirthdateDD(), getPerson.apply(previewData).getBirthdateMM(), getPerson.apply(previewData).getBirthdateYYYY()))).setId(BIRTH_DATE);
grid.addComponentColumn(previewData -> new Label(getPerson.apply(previewData).getSex().toString())).setId(SormasToSormasPersonPreview.SEX);
grid.addComponentColumn(previewData -> new Label(LocationHelper.buildLocationString(getPerson.apply(previewData).getAddress()))).setId(SormasToSormasPersonPreview.ADDRESS);
return Arrays.asList(PERSON_NAME, BIRTH_DATE, SormasToSormasPersonPreview.SEX, SormasToSormasPersonPreview.ADDRESS);
}
Aggregations