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 AbstractCaseGrid method initColumns.
@SuppressWarnings("unchecked")
protected void initColumns() {
Column<IndexDto, String> diseaseShortColumn = addColumn(caze -> DiseaseHelper.toString(caze.getDisease(), caze.getDiseaseDetails()));
diseaseShortColumn.setId(DISEASE_SHORT);
diseaseShortColumn.setSortProperty(CaseIndexDto.DISEASE);
Column<IndexDto, String> visitsColumn = addColumn(entry -> {
if (FacadeProvider.getDiseaseConfigurationFacade().hasFollowUp(entry.getDisease())) {
int numberOfVisits = entry.getVisitCount();
int numberOfRequiredVisits = FollowUpLogic.getNumberOfRequiredVisitsSoFar(entry.getReportDate(), entry.getFollowUpUntil());
int numberOfMissedVisits = numberOfRequiredVisits - numberOfVisits;
// Set number of missed visits to 0 when more visits than expected have been done
if (numberOfMissedVisits < 0) {
numberOfMissedVisits = 0;
}
return String.format(I18nProperties.getCaption(Captions.formatNumberOfVisitsFormat), numberOfVisits, numberOfMissedVisits);
} else {
return "-";
}
});
visitsColumn.setId(NUMBER_OF_VISITS);
visitsColumn.setSortable(false);
addComponentColumn(indexDto -> {
Label label = new Label(indexDto.getCompleteness() != null ? new DecimalFormat("#").format(indexDto.getCompleteness() * 100) + " %" : "-");
if (indexDto.getCompleteness() != null) {
if (indexDto.getCompleteness() < 0.25f) {
CssStyles.style(label, CssStyles.LABEL_CRITICAL);
} else if (indexDto.getCompleteness() < 0.5f) {
CssStyles.style(label, CssStyles.LABEL_IMPORTANT);
} else if (indexDto.getCompleteness() < 0.75f) {
CssStyles.style(label, CssStyles.LABEL_RELEVANT);
} else {
CssStyles.style(label, CssStyles.LABEL_POSITIVE);
}
}
return label;
}).setId(COLUMN_COMPLETENESS);
setColumns(getGridColumns().toArray(String[]::new));
if (FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_GERMANY) || FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_SWITZERLAND)) {
getColumn(CaseIndexDto.EPID_NUMBER).setHidden(true);
} else {
getColumn(CaseIndexDto.EXTERNAL_ID).setHidden(true);
getColumn(CaseIndexDto.EXTERNAL_TOKEN).setHidden(true);
}
getColumn(COLUMN_COMPLETENESS).setCaption(I18nProperties.getPrefixCaption(CaseIndexDto.I18N_PREFIX, CaseIndexDto.COMPLETENESS));
getColumn(COLUMN_COMPLETENESS).setSortable(false);
Language userLanguage = I18nProperties.getUserLanguage();
((Column<CaseIndexDto, String>) getColumn(CaseIndexDto.UUID)).setRenderer(new UuidRenderer());
((Column<CaseIndexDto, String>) getColumn(CaseIndexDto.PERSON_UUID)).setRenderer(new UuidRenderer());
((Column<CaseIndexDto, Date>) getColumn(CaseIndexDto.REPORT_DATE)).setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(userLanguage)));
if (externalSurveillanceToolShareEnabled) {
Column<CaseIndexDto, Date> shareDateColumn = ((Column<CaseIndexDto, Date>) getColumn(CaseIndexDto.SURVEILLANCE_TOOL_LAST_SHARE_DATE));
shareDateColumn.setSortable(false);
shareDateColumn.setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(userLanguage)));
getColumn(CaseIndexDto.SURVEILLANCE_TOOL_SHARE_COUNT).setSortable(false);
getColumn(CaseIndexDto.SURVEILLANCE_TOOL_STATUS).setSortable(false);
getColumn(CaseIndexDto.SURVEILLANCE_TOOL_LAST_SHARE_DATE).setSortable(false);
}
((Column<CaseIndexDto, Date>) getColumn(CaseIndexDto.QUARANTINE_TO)).setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(userLanguage)));
if (caseFollowUpEnabled) {
((Column<CaseIndexDto, Date>) getColumn(CaseIndexDto.FOLLOW_UP_UNTIL)).setRenderer(new DateRenderer(DateHelper.getLocalDateFormat(userLanguage)));
}
if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_IMPORT)) {
((Column<CaseIndexDto, Date>) getColumn(CaseIndexDto.CREATION_DATE)).setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(userLanguage)));
} else {
removeColumn(CaseIndexDto.CREATION_DATE);
}
for (Column<IndexDto, ?> column : getColumns()) {
column.setCaption(I18nProperties.findPrefixCaptionWithDefault(column.getId(), column.getCaption(), CaseIndexDto.I18N_PREFIX, PersonDto.I18N_PREFIX, LocationDto.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 CaseGridDetailed method initColumns.
@SuppressWarnings("unchecked")
@Override
protected void initColumns() {
addColumn(caze -> {
if (caze.getLatestSampleDateTime() != null) {
return DateFormatHelper.formatLocalDateTime(caze.getLatestSampleDateTime()) + " [" + caze.getSampleCount() + "]";
} else {
return null;
}
}).setCaption(I18nProperties.getPrefixCaption(CaseIndexDetailedDto.I18N_PREFIX, CaseIndexDetailedDto.LATEST_SAMPLE_DATE_TIME)).setId(LATEST_SAMPLE_DATE_TIME_AND_SAMPLE_COUNT).setSortable(false).setWidth(150);
super.initColumns();
if (!FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_GERMANY)) {
getColumn(CaseIndexDetailedDto.RE_INFECTION).setHidden(true);
}
getColumn(CaseIndexDetailedDto.SEX).setWidth(80);
getColumn(CaseIndexDetailedDto.AGE_AND_BIRTH_DATE).setWidth(100);
getColumn(CaseIndexDetailedDto.POSTAL_CODE).setWidth(100);
getColumn(CaseIndexDetailedDto.CITY).setWidth(150);
getColumn(CaseIndexDetailedDto.STREET).setWidth(150);
getColumn(CaseIndexDetailedDto.HOUSE_NUMBER).setWidth(50);
getColumn(CaseIndexDetailedDto.ADDITIONAL_INFORMATION).setWidth(200);
getColumn(CaseIndexDetailedDto.PHONE).setWidth(100);
getColumn(CaseIndexDetailedDto.EVENT_COUNT).setWidth(80).setSortable(false);
getColumn(CaseIndexDetailedDto.LATEST_EVENT_ID).setWidth(80).setSortable(false);
getColumn(CaseIndexDetailedDto.LATEST_EVENT_STATUS).setWidth(80).setSortable(false);
getColumn(CaseIndexDetailedDto.LATEST_EVENT_TITLE).setWidth(150).setSortable(false);
((Column<CaseIndexDetailedDto, String>) getColumn(CaseIndexDetailedDto.LATEST_EVENT_ID)).setRenderer(new UuidRenderer());
addItemClickListener(new ShowDetailsListener<>(CaseIndexDetailedDto.LATEST_EVENT_ID, c -> ControllerProvider.getEventController().navigateToData(c.getLatestEventId())));
((Column<CaseIndexDetailedDto, AgeAndBirthDateDto>) getColumn(CaseIndexDetailedDto.AGE_AND_BIRTH_DATE)).setRenderer(value -> value == null ? "" : PersonHelper.getAgeAndBirthdateString(value.getAge(), value.getAgeType(), value.getDateOfBirthDD(), value.getDateOfBirthMM(), value.getDateOfBirthYYYY()), new TextRenderer());
((Column<CaseIndexDetailedDto, Date>) getColumn(CaseIndexDetailedDto.SYMPTOM_ONSET_DATE)).setRenderer(new DateRenderer(DateFormatHelper.getDateFormat())).setCaption(I18nProperties.getPrefixCaption(SymptomsDto.I18N_PREFIX, SymptomsDto.ONSET_DATE)).setWidth(80);
}
use of com.vaadin.ui.renderers.DateRenderer in project SORMAS-Project by hzi-braunschweig.
the class MergeCasesGrid method buildColumns.
@Override
protected void buildColumns() {
Column<CaseIndexDto, String> diseaseColumn = addColumn(caze -> DiseaseHelper.toString(caze.getDisease(), caze.getDiseaseDetails()));
diseaseColumn.setId(COLUMN_DISEASE);
setColumns(COLUMN_UUID, COLUMN_DISEASE, CaseIndexDto.CASE_CLASSIFICATION, CaseIndexDto.PERSON_FIRST_NAME, CaseIndexDto.PERSON_LAST_NAME, CaseIndexDto.AGE_AND_BIRTH_DATE, CaseIndexDto.SEX, CaseIndexDto.RESPONSIBLE_DISTRICT_NAME, CaseIndexDto.HEALTH_FACILITY_NAME, CaseIndexDto.REPORT_DATE, CaseIndexDto.CREATION_DATE, COLUMN_COMPLETENESS, COLUMN_ACTIONS);
getColumn(COLUMN_ACTIONS).setMinimumWidth(280);
Language userLanguage = I18nProperties.getUserLanguage();
((Column<CaseIndexDto, Date>) getColumn(CaseIndexDto.REPORT_DATE)).setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(userLanguage)));
((Column<CaseIndexDto, Date>) getColumn(CaseIndexDto.CREATION_DATE)).setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(userLanguage)));
((Column<CaseIndexDto, AgeAndBirthDateDto>) getColumn(CaseIndexDto.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 TravelEntryGrid method initColumns.
private void initColumns() {
setColumns(TravelEntryIndexDto.UUID, TravelEntryIndexDto.EXTERNAL_ID, TravelEntryIndexDto.PERSON_FIRST_NAME, TravelEntryIndexDto.PERSON_LAST_NAME, TravelEntryIndexDto.HOME_DISTRICT_NAME, TravelEntryIndexDto.POINT_OF_ENTRY_NAME, TravelEntryIndexDto.RECOVERED, TravelEntryIndexDto.VACCINATED, TravelEntryIndexDto.TESTED_NEGATIVE, TravelEntryIndexDto.QUARANTINE_TO);
((Column<TravelEntryIndexDto, String>) getColumn(TravelEntryIndexDto.UUID)).setRenderer(new UuidRenderer());
((Column<TravelEntryIndexDto, Boolean>) getColumn(TravelEntryIndexDto.RECOVERED)).setRenderer(new BooleanRenderer());
((Column<TravelEntryIndexDto, Boolean>) getColumn(TravelEntryIndexDto.VACCINATED)).setRenderer(new BooleanRenderer());
((Column<TravelEntryIndexDto, Boolean>) getColumn(TravelEntryIndexDto.TESTED_NEGATIVE)).setRenderer(new BooleanRenderer());
((Column<TravelEntryIndexDto, Date>) getColumn(TravelEntryIndexDto.QUARANTINE_TO)).setRenderer(new DateRenderer(DateFormatHelper.getDateFormat()));
for (Column<TravelEntryIndexDto, ?> column : getColumns()) {
column.setCaption(I18nProperties.findPrefixCaptionWithDefault(column.getId(), column.getCaption(), TravelEntryIndexDto.I18N_PREFIX, PersonDto.I18N_PREFIX));
column.setStyleGenerator(FieldAccessColumnStyleGenerator.getDefault(getBeanType(), column.getId()));
}
}
Aggregations