Search in sources :

Example 1 with ShowDetailsListener

use of de.symeda.sormas.ui.utils.ShowDetailsListener 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);
}
Also used : TextRenderer(com.vaadin.ui.renderers.TextRenderer) UuidRenderer(de.symeda.sormas.ui.utils.UuidRenderer) CaseCriteria(de.symeda.sormas.api.caze.CaseCriteria) Date(java.util.Date) FacadeProvider(de.symeda.sormas.api.FacadeProvider) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) DateFormatHelper(de.symeda.sormas.ui.utils.DateFormatHelper) PersonHelper(de.symeda.sormas.api.person.PersonHelper) AgeAndBirthDateDto(de.symeda.sormas.api.caze.AgeAndBirthDateDto) CaseIndexDetailedDto(de.symeda.sormas.api.caze.CaseIndexDetailedDto) SortProperty(de.symeda.sormas.api.utils.SortProperty) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) CaseIndexDto(de.symeda.sormas.api.caze.CaseIndexDto) ShowDetailsListener(de.symeda.sormas.ui.utils.ShowDetailsListener) List(java.util.List) Stream(java.util.stream.Stream) CountryHelper(de.symeda.sormas.api.CountryHelper) SymptomsDto(de.symeda.sormas.api.symptoms.SymptomsDto) DateRenderer(com.vaadin.ui.renderers.DateRenderer) UuidRenderer(de.symeda.sormas.ui.utils.UuidRenderer) DateRenderer(com.vaadin.ui.renderers.DateRenderer) TextRenderer(com.vaadin.ui.renderers.TextRenderer)

Example 2 with ShowDetailsListener

use of de.symeda.sormas.ui.utils.ShowDetailsListener in project SORMAS-Project by hzi-braunschweig.

the class ContactGridDetailed method initColumns.

@Override
@SuppressWarnings("unchecked")
protected void initColumns() {
    super.initColumns();
    getColumn(ContactIndexDetailedDto.SEX).setWidth(80);
    getColumn(ContactIndexDetailedDto.APPROXIMATE_AGE).setWidth(50);
    getColumn(ContactIndexDetailedDto.DISTRICT_NAME).setWidth(150);
    getColumn(ContactIndexDetailedDto.POSTAL_CODE).setWidth(100);
    getColumn(ContactIndexDetailedDto.CITY).setWidth(150);
    getColumn(ContactIndexDetailedDto.STREET).setWidth(150);
    getColumn(ContactIndexDetailedDto.HOUSE_NUMBER).setWidth(50);
    getColumn(ContactIndexDetailedDto.ADDITIONAL_INFORMATION).setWidth(200);
    getColumn(ContactIndexDetailedDto.PHONE).setWidth(100);
    ((Column<ContactIndexDetailedDto, CaseReferenceDto>) getColumn(ContactIndexDetailedDto.CAZE)).setWidth(150).setRenderer(entry -> entry != null ? entry.getUuid() : null, new UuidRenderer());
    getColumn(ContactIndexDetailedDto.REPORTING_USER).setWidth(150);
    addItemClickListener(new ShowDetailsListener<>(ContactIndexDetailedDto.CAZE, false, e -> {
        CaseReferenceDto caze = e.getCaze();
        if (caze != null && caze.getUuid() != null) {
            ControllerProvider.getCaseController().navigateToCase(caze.getUuid());
        }
    }));
    getColumn(ContactIndexDetailedDto.LATEST_EVENT_ID).setWidth(80).setSortable(false);
    getColumn(ContactIndexDetailedDto.LATEST_EVENT_TITLE).setWidth(150).setSortable(false);
    ((Column<ContactIndexDetailedDto, String>) getColumn(ContactIndexDetailedDto.LATEST_EVENT_ID)).setRenderer(new UuidRenderer());
    addItemClickListener(new ShowDetailsListener<>(ContactIndexDetailedDto.LATEST_EVENT_ID, c -> ControllerProvider.getEventController().navigateToData(c.getLatestEventId())));
}
Also used : ContactCriteria(de.symeda.sormas.api.contact.ContactCriteria) UuidRenderer(de.symeda.sormas.ui.utils.UuidRenderer) FacadeProvider(de.symeda.sormas.api.FacadeProvider) ContactIndexDetailedDto(de.symeda.sormas.api.contact.ContactIndexDetailedDto) SortProperty(de.symeda.sormas.api.utils.SortProperty) Collectors(java.util.stream.Collectors) ControllerProvider(de.symeda.sormas.ui.ControllerProvider) CaseReferenceDto(de.symeda.sormas.api.caze.CaseReferenceDto) ShowDetailsListener(de.symeda.sormas.ui.utils.ShowDetailsListener) List(java.util.List) Stream(java.util.stream.Stream) ViewConfiguration(de.symeda.sormas.ui.utils.ViewConfiguration) View(com.vaadin.navigator.View) UuidRenderer(de.symeda.sormas.ui.utils.UuidRenderer) ContactIndexDetailedDto(de.symeda.sormas.api.contact.ContactIndexDetailedDto) CaseReferenceDto(de.symeda.sormas.api.caze.CaseReferenceDto)

Aggregations

FacadeProvider (de.symeda.sormas.api.FacadeProvider)2 SortProperty (de.symeda.sormas.api.utils.SortProperty)2 ControllerProvider (de.symeda.sormas.ui.ControllerProvider)2 ShowDetailsListener (de.symeda.sormas.ui.utils.ShowDetailsListener)2 UuidRenderer (de.symeda.sormas.ui.utils.UuidRenderer)2 List (java.util.List)2 Stream (java.util.stream.Stream)2 View (com.vaadin.navigator.View)1 DateRenderer (com.vaadin.ui.renderers.DateRenderer)1 TextRenderer (com.vaadin.ui.renderers.TextRenderer)1 CountryHelper (de.symeda.sormas.api.CountryHelper)1 AgeAndBirthDateDto (de.symeda.sormas.api.caze.AgeAndBirthDateDto)1 CaseCriteria (de.symeda.sormas.api.caze.CaseCriteria)1 CaseIndexDetailedDto (de.symeda.sormas.api.caze.CaseIndexDetailedDto)1 CaseIndexDto (de.symeda.sormas.api.caze.CaseIndexDto)1 CaseReferenceDto (de.symeda.sormas.api.caze.CaseReferenceDto)1 ContactCriteria (de.symeda.sormas.api.contact.ContactCriteria)1 ContactIndexDetailedDto (de.symeda.sormas.api.contact.ContactIndexDetailedDto)1 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)1 PersonHelper (de.symeda.sormas.api.person.PersonHelper)1