Search in sources :

Example 1 with FollowUpDto

use of de.symeda.sormas.api.followup.FollowUpDto in project SORMAS-Project by hzi-braunschweig.

the class CaseFollowUpGrid method setVisitColumns.

public void setVisitColumns(CaseCriteria criteria) {
    Date referenceDate = criteria.getFollowUpVisitsTo();
    int interval = criteria.getFollowUpVisitsInterval();
    setDataProvider(referenceDate, interval - 1);
    setCriteria(criteria);
    dates.forEach(date -> removeColumn(DateFormatHelper.formatDate(date)));
    setDates(referenceDate, interval);
    for (int i = 0; i < interval; i++) {
        String columnId = DateFormatHelper.formatDate(dates.get(i));
        addComponentColumn(followUpDto -> new Label("")).setId(columnId);
        final int index = i;
        getColumn(columnId).setCaption(columnId).setSortable(false).setStyleGenerator((StyleGenerator<CaseFollowUpDto>) item -> {
            final VisitResultDto visitResult = item.getVisitResults()[index];
            final Date date = dates.get(index);
            return getVisitResultCssStyle(visitResult, date, item.getReportDate(), item.getFollowUpUntil());
        }).setDescriptionGenerator((DescriptionGenerator<CaseFollowUpDto>) item -> {
            final VisitResultDto visitResult = item.getVisitResults()[index];
            final Date date = dates.get(index);
            return getVisitResultDescription(visitResult, date, item.getReportDate(), item.getFollowUpUntil());
        });
    }
}
Also used : UuidRenderer(de.symeda.sormas.ui.utils.UuidRenderer) FollowUpUtils.getVisitResultDescription(de.symeda.sormas.ui.utils.FollowUpUtils.getVisitResultDescription) Date(java.util.Date) DescriptionGenerator(com.vaadin.ui.DescriptionGenerator) FacadeProvider(de.symeda.sormas.api.FacadeProvider) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) DateFormatHelper(de.symeda.sormas.ui.utils.DateFormatHelper) CaseFollowUpDto(de.symeda.sormas.api.caze.CaseFollowUpDto) DateHelper(de.symeda.sormas.api.utils.DateHelper) SortDirection(com.vaadin.shared.data.sort.SortDirection) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) ArrayList(java.util.ArrayList) FollowUpDto(de.symeda.sormas.api.followup.FollowUpDto) Label(com.vaadin.ui.Label) DataProvider(com.vaadin.data.provider.DataProvider) DateRenderer(com.vaadin.ui.renderers.DateRenderer) FilteredGrid(de.symeda.sormas.ui.utils.FilteredGrid) CaseCriteria(de.symeda.sormas.api.caze.CaseCriteria) SortProperty(de.symeda.sormas.api.utils.SortProperty) Collectors(java.util.stream.Collectors) List(java.util.List) VisitResultDto(de.symeda.sormas.api.visit.VisitResultDto) FollowUpUtils.getVisitResultCssStyle(de.symeda.sormas.ui.utils.FollowUpUtils.getVisitResultCssStyle) StyleGenerator(com.vaadin.ui.StyleGenerator) View(com.vaadin.navigator.View) StyleGenerator(com.vaadin.ui.StyleGenerator) Label(com.vaadin.ui.Label) VisitResultDto(de.symeda.sormas.api.visit.VisitResultDto) Date(java.util.Date) CaseFollowUpDto(de.symeda.sormas.api.caze.CaseFollowUpDto)

Example 2 with FollowUpDto

use of de.symeda.sormas.api.followup.FollowUpDto in project SORMAS-Project by hzi-braunschweig.

the class ContactFollowUpGrid method setVisitColumns.

public void setVisitColumns(ContactCriteria criteria) {
    Date referenceDate = criteria.getFollowUpVisitsTo();
    int interval = criteria.getFollowUpVisitsInterval();
    setDataProvider(referenceDate, interval - 1);
    setCriteria(criteria);
    dates.forEach(date -> removeColumn(DateFormatHelper.formatDate(date)));
    setDates(referenceDate, interval);
    dateColumnIds.clear();
    for (int i = 0; i < interval; i++) {
        String columnId = DateFormatHelper.formatDate(dates.get(i));
        dateColumnIds.add(columnId);
        addComponentColumn(followUpDto -> new Label("")).setId(columnId);
        final int index = i;
        getColumn(columnId).setCaption(columnId).setSortable(false).setStyleGenerator((StyleGenerator<ContactFollowUpDto>) item -> {
            final VisitResultDto visitResult = item.getVisitResults()[index];
            final Date date = dates.get(index);
            return getVisitResultCssStyle(visitResult, date, ContactLogic.getStartDate(item.getLastContactDate(), item.getReportDate()), item.getFollowUpUntil());
        }).setDescriptionGenerator((DescriptionGenerator<ContactFollowUpDto>) item -> {
            final VisitResultDto visitResult = item.getVisitResults()[index];
            final Date date = dates.get(index);
            return getVisitResultDescription(visitResult, date, ContactLogic.getStartDate(item.getLastContactDate(), item.getReportDate()), item.getFollowUpUntil());
        });
    }
}
Also used : ContactCriteria(de.symeda.sormas.api.contact.ContactCriteria) UuidRenderer(de.symeda.sormas.ui.utils.UuidRenderer) FollowUpUtils.getVisitResultDescription(de.symeda.sormas.ui.utils.FollowUpUtils.getVisitResultDescription) Date(java.util.Date) DescriptionGenerator(com.vaadin.ui.DescriptionGenerator) FacadeProvider(de.symeda.sormas.api.FacadeProvider) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) DateFormatHelper(de.symeda.sormas.ui.utils.DateFormatHelper) DateHelper(de.symeda.sormas.api.utils.DateHelper) SortDirection(com.vaadin.shared.data.sort.SortDirection) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) ArrayList(java.util.ArrayList) FollowUpDto(de.symeda.sormas.api.followup.FollowUpDto) ContactIndexDto(de.symeda.sormas.api.contact.ContactIndexDto) FieldAccessColumnStyleGenerator(de.symeda.sormas.ui.utils.FieldAccessColumnStyleGenerator) Label(com.vaadin.ui.Label) DataProvider(com.vaadin.data.provider.DataProvider) ContactFollowUpDto(de.symeda.sormas.api.contact.ContactFollowUpDto) DateRenderer(com.vaadin.ui.renderers.DateRenderer) FilteredGrid(de.symeda.sormas.ui.utils.FilteredGrid) ContactLogic(de.symeda.sormas.api.contact.ContactLogic) SortProperty(de.symeda.sormas.api.utils.SortProperty) Collectors(java.util.stream.Collectors) ShowDetailsListener(de.symeda.sormas.ui.utils.ShowDetailsListener) List(java.util.List) VisitResultDto(de.symeda.sormas.api.visit.VisitResultDto) FollowUpUtils.getVisitResultCssStyle(de.symeda.sormas.ui.utils.FollowUpUtils.getVisitResultCssStyle) StyleGenerator(com.vaadin.ui.StyleGenerator) View(com.vaadin.navigator.View) FieldAccessColumnStyleGenerator(de.symeda.sormas.ui.utils.FieldAccessColumnStyleGenerator) StyleGenerator(com.vaadin.ui.StyleGenerator) ContactFollowUpDto(de.symeda.sormas.api.contact.ContactFollowUpDto) Label(com.vaadin.ui.Label) VisitResultDto(de.symeda.sormas.api.visit.VisitResultDto) Date(java.util.Date)

Aggregations

DataProvider (com.vaadin.data.provider.DataProvider)2 View (com.vaadin.navigator.View)2 SortDirection (com.vaadin.shared.data.sort.SortDirection)2 DescriptionGenerator (com.vaadin.ui.DescriptionGenerator)2 Label (com.vaadin.ui.Label)2 StyleGenerator (com.vaadin.ui.StyleGenerator)2 DateRenderer (com.vaadin.ui.renderers.DateRenderer)2 FacadeProvider (de.symeda.sormas.api.FacadeProvider)2 FollowUpDto (de.symeda.sormas.api.followup.FollowUpDto)2 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)2 DateHelper (de.symeda.sormas.api.utils.DateHelper)2 SortProperty (de.symeda.sormas.api.utils.SortProperty)2 VisitResultDto (de.symeda.sormas.api.visit.VisitResultDto)2 ControllerProvider (de.symeda.sormas.ui.ControllerProvider)2 DateFormatHelper (de.symeda.sormas.ui.utils.DateFormatHelper)2 FilteredGrid (de.symeda.sormas.ui.utils.FilteredGrid)2 FollowUpUtils.getVisitResultCssStyle (de.symeda.sormas.ui.utils.FollowUpUtils.getVisitResultCssStyle)2 FollowUpUtils.getVisitResultDescription (de.symeda.sormas.ui.utils.FollowUpUtils.getVisitResultDescription)2 UuidRenderer (de.symeda.sormas.ui.utils.UuidRenderer)2 ArrayList (java.util.ArrayList)2