use of com.vaadin.ui.renderers.DateRenderer in project SORMAS-Project by hzi-braunschweig.
the class ContactsPreviewGrid method buildGrid.
private void buildGrid() {
setSizeFull();
setSelectionMode(Grid.SelectionMode.SINGLE);
setHeightMode(HeightMode.ROW);
Language userLanguage = I18nProperties.getUserLanguage();
removeColumn(SormasToSormasContactPreview.DISEASE);
addComponentColumn(eventPreview -> {
String diseaseText = eventPreview.getDisease().toString();
if (!StringUtils.isEmpty(eventPreview.getDiseaseDetails())) {
diseaseText += " - " + eventPreview.getDiseaseDetails();
}
return new Label(diseaseText);
}).setId(SormasToSormasContactPreview.DISEASE);
List<String> columnConfig = new ArrayList<>();
columnConfig.addAll(Arrays.asList(SormasToSormasContactPreview.UUID, SormasToSormasContactPreview.REPORT_DATE_TIME, SormasToSormasContactPreview.DISEASE, SormasToSormasContactPreview.CONTACT_STATUS, SormasToSormasContactPreview.CONTACT_CLASSIFICATION, SormasToSormasContactPreview.CONTACT_CATEGORY));
columnConfig.addAll(PreviewGridHelper.createPersonColumns(this, SormasToSormasContactPreview::getPerson));
columnConfig.addAll(Arrays.asList(SormasToSormasContactPreview.REGION, SormasToSormasContactPreview.DISTRICT, SormasToSormasContactPreview.COMMUNITY, SormasToSormasContactPreview.LAST_CONTACT_DATE));
setColumns(columnConfig);
((Column<SormasToSormasContactPreview, String>) getColumn(SormasToSormasContactPreview.UUID)).setRenderer(new UuidRenderer());
((Column<SormasToSormasContactPreview, Date>) getColumn(SormasToSormasContactPreview.REPORT_DATE_TIME)).setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(userLanguage)));
((Column<SormasToSormasContactPreview, Date>) getColumn(SormasToSormasContactPreview.LAST_CONTACT_DATE)).setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(userLanguage)));
for (Column<?, ?> column : getColumns()) {
column.setCaption(I18nProperties.findPrefixCaption(column.getId(), SormasToSormasContactPreview.I18N_PREFIX, SormasToSormasPersonPreview.I18N_PREFIX));
}
}
use of com.vaadin.ui.renderers.DateRenderer in project SORMAS-Project by hzi-braunschweig.
the class EventPreviewGrid method buildGrid.
private void buildGrid() {
setSizeFull();
setSelectionMode(SelectionMode.SINGLE);
setHeightMode(HeightMode.ROW);
Language userLanguage = I18nProperties.getUserLanguage();
removeColumn(SormasToSormasEventPreview.DISEASE);
addComponentColumn(casePreview -> {
String diseaseText;
if (casePreview.getDisease() == null) {
diseaseText = "";
} else {
diseaseText = casePreview.getDisease().toString();
if (!StringUtils.isEmpty(casePreview.getDiseaseDetails())) {
diseaseText += " - " + casePreview.getDiseaseDetails();
}
}
return new Label(diseaseText);
}).setId(SormasToSormasEventPreview.DISEASE);
removeColumn(SormasToSormasEventPreview.EVENT_LOCATION);
addComponentColumn(previewData -> new Label(LocationHelper.buildLocationString(previewData.getEventLocation()))).setId(SormasToSormasEventPreview.EVENT_LOCATION);
setColumns(SormasToSormasEventPreview.UUID, SormasToSormasEventPreview.REPORT_DATE_TIME, SormasToSormasEventPreview.EVENT_TITLE, SormasToSormasEventPreview.EVENT_DESC, SormasToSormasEventPreview.DISEASE, SormasToSormasEventPreview.EVENT_LOCATION);
((Column<SormasToSormasEventPreview, String>) getColumn(SormasToSormasEventPreview.UUID)).setRenderer(new UuidRenderer());
((Column<SormasToSormasEventPreview, Date>) getColumn(SormasToSormasEventPreview.REPORT_DATE_TIME)).setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(userLanguage)));
for (Column<?, ?> column : getColumns()) {
column.setCaption(I18nProperties.findPrefixCaption(column.getId(), SormasToSormasEventPreview.I18N_PREFIX, SormasToSormasPersonPreview.I18N_PREFIX));
}
}
use of com.vaadin.ui.renderers.DateRenderer in project SORMAS-Project by hzi-braunschweig.
the class ImmunizationGrid method initColumns.
private void initColumns() {
setColumns(ImmunizationIndexDto.UUID, ImmunizationIndexDto.PERSON_UUID, ImmunizationIndexDto.PERSON_FIRST_NAME, ImmunizationIndexDto.PERSON_LAST_NAME, ImmunizationIndexDto.DISEASE, ImmunizationIndexDto.AGE_AND_BIRTH_DATE, ImmunizationIndexDto.SEX, ImmunizationIndexDto.DISTRICT, ImmunizationIndexDto.MEANS_OF_IMMUNIZATION, ImmunizationIndexDto.MANAGEMENT_STATUS, ImmunizationIndexDto.IMMUNIZATION_STATUS, ImmunizationIndexDto.START_DATE, ImmunizationIndexDto.END_DATE, ImmunizationIndexDto.LAST_VACCINE_TYPE, ImmunizationIndexDto.RECOVERY_DATE);
((Column<ImmunizationIndexDto, String>) getColumn(ImmunizationIndexDto.UUID)).setRenderer(new UuidRenderer());
((Column<ImmunizationIndexDto, String>) getColumn(ImmunizationIndexDto.PERSON_UUID)).setRenderer(new UuidRenderer());
((Column<ImmunizationIndexDto, AgeAndBirthDateDto>) getColumn(ImmunizationIndexDto.AGE_AND_BIRTH_DATE)).setRenderer(value -> value == null ? "" : PersonHelper.getAgeAndBirthdateString(value.getAge(), value.getAgeType(), value.getDateOfBirthDD(), value.getDateOfBirthMM(), value.getDateOfBirthYYYY()), new TextRenderer());
((Column<ImmunizationIndexDto, Date>) getColumn(ImmunizationIndexDto.START_DATE)).setRenderer(new DateRenderer(DateFormatHelper.getDateFormat()));
((Column<ImmunizationIndexDto, Date>) getColumn(ImmunizationIndexDto.END_DATE)).setRenderer(new DateRenderer(DateFormatHelper.getDateFormat()));
((Column<ImmunizationIndexDto, Date>) getColumn(ImmunizationIndexDto.RECOVERY_DATE)).setRenderer(new DateRenderer(DateFormatHelper.getDateFormat()));
for (Column<ImmunizationIndexDto, ?> column : getColumns()) {
column.setCaption(I18nProperties.findPrefixCaptionWithDefault(column.getId(), column.getCaption(), ImmunizationIndexDto.I18N_PREFIX, PersonDto.I18N_PREFIX));
column.setStyleGenerator(FieldAccessColumnStyleGenerator.getDefault(getBeanType(), column.getId()));
}
}
use of com.vaadin.ui.renderers.DateRenderer in project SORMAS-Project by hzi-braunschweig.
the class MergeContactsGrid method buildColumns.
@Override
protected void buildColumns() {
Column<MergeContactIndexDto, String> diseaseColumn = addColumn(contact -> DiseaseHelper.toString(contact.getDisease(), contact.getDiseaseDetails()));
diseaseColumn.setId(COLUMN_DISEASE);
setColumns(COLUMN_UUID, MergeContactIndexDto.CAZE, COLUMN_DISEASE, MergeContactIndexDto.CONTACT_CLASSIFICATION, MergeContactIndexDto.PERSON_FIRST_NAME, MergeContactIndexDto.PERSON_LAST_NAME, MergeContactIndexDto.AGE_AND_BIRTH_DATE, MergeContactIndexDto.SEX, MergeContactIndexDto.DISTRICT_NAME, MergeContactIndexDto.REPORT_DATE_TIME, MergeContactIndexDto.CREATION_DATE, COLUMN_COMPLETENESS, COLUMN_ACTIONS);
Language userLanguage = I18nProperties.getUserLanguage();
((Column<MergeContactIndexDto, Date>) getColumn(MergeContactIndexDto.REPORT_DATE_TIME)).setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(userLanguage)));
((Column<MergeContactIndexDto, Date>) getColumn(MergeContactIndexDto.CREATION_DATE)).setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(userLanguage)));
((Column<MergeContactIndexDto, AgeAndBirthDateDto>) getColumn(MergeContactIndexDto.AGE_AND_BIRTH_DATE)).setRenderer(value -> value == null ? "" : PersonHelper.getAgeAndBirthdateString(value.getAge(), value.getAgeType(), value.getDateOfBirthDD(), value.getDateOfBirthMM(), value.getDateOfBirthYYYY()), new TextRenderer());
}
use of com.vaadin.ui.renderers.DateRenderer in project SORMAS-Project by hzi-braunschweig.
the class ShareRequestGrid method initGridColumns.
private void initGridColumns() {
addShowColumn((request) -> {
ControllerProvider.getSormasToSormasController().showRequestDetails(request);
});
addComponentColumn(indexDto -> createActionButtons(indexDto)).setId(COLUMN_ACTIONS);
setColumns(SHOW_MESSAGE, SormasToSormasShareRequestIndexDto.UUID, SormasToSormasShareRequestIndexDto.CREATION_DATE, SormasToSormasShareRequestIndexDto.DATA_TYPE, SormasToSormasShareRequestIndexDto.ORGANIZATION_NAME, SormasToSormasShareRequestIndexDto.SENDER_NAME, SormasToSormasShareRequestIndexDto.OWNERSHIP_HANDED_OVER, SormasToSormasShareRequestIndexDto.STATUS, SormasToSormasShareRequestIndexDto.COMMENT, COLUMN_ACTIONS);
((Column<SormasToSormasShareRequestIndexDto, String>) getColumn(LabMessageIndexDto.UUID)).setRenderer(new UuidRenderer());
((Column<SormasToSormasShareRequestIndexDto, Date>) getColumn(SormasToSormasShareRequestIndexDto.CREATION_DATE)).setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(I18nProperties.getUserLanguage())));
getColumn(SormasToSormasShareRequestIndexDto.ORGANIZATION_NAME).setSortable(false);
getColumn(SormasToSormasShareRequestIndexDto.OWNERSHIP_HANDED_OVER).setRenderer(new BooleanRenderer());
for (Column<?, ?> column : getColumns()) {
column.setCaption(I18nProperties.getPrefixCaption(SormasToSormasShareRequestIndexDto.I18N_PREFIX, column.getId(), column.getCaption()));
}
setSortOrder(Collections.singletonList(new GridSortOrder<>(getColumn(SormasToSormasShareRequestIndexDto.CREATION_DATE), SortDirection.DESCENDING)));
}
Aggregations