use of de.symeda.sormas.ui.utils.DetailSubComponentWrapper in project SORMAS-Project by hzi-braunschweig.
the class ClinicalCourseView method initView.
@Override
protected void initView(String params) {
// TODO: Remove this once a proper ViewModel system has been introduced
CaseDataDto caze = FacadeProvider.getCaseFacade().getCaseDataByUuid(getCaseRef().getUuid());
if (caze.getClinicalCourse() == null) {
ClinicalCourseDto clinicalCourse = ClinicalCourseDto.build();
caze.setClinicalCourse(clinicalCourse);
caze = FacadeProvider.getCaseFacade().save(caze);
}
DetailSubComponentWrapper container = new DetailSubComponentWrapper(() -> editComponent);
container.setWidth(100, Unit.PERCENTAGE);
container.setMargin(true);
container.addComponent(createClinicalVisitsHeader());
clinicalVisitGrid = new ClinicalVisitGrid(getCaseRef(), caze.isPseudonymized());
clinicalVisitGrid.setCriteria(clinicalVisitCriteria);
clinicalVisitGrid.setHeightMode(HeightMode.ROW);
CssStyles.style(clinicalVisitGrid, CssStyles.VSPACE_3);
container.addComponent(clinicalVisitGrid);
editComponent = ControllerProvider.getCaseController().getClinicalCourseComponent(getCaseRef().getUuid());
editComponent.setMargin(false);
container.addComponent(editComponent);
setSubComponent(container);
update();
reloadClinicalVisitGrid();
setCaseEditPermission(container);
}
use of de.symeda.sormas.ui.utils.DetailSubComponentWrapper in project SORMAS-Project by hzi-braunschweig.
the class CaseExternalDataView method initView.
@Override
protected void initView(String params) {
DetailSubComponentWrapper caseExternalDataComponent = ControllerProvider.getCaseController().getExternalDataComponent(getCaseRef().getUuid(), getViewMode());
setSubComponent(caseExternalDataComponent);
caseExternalDataComponent.setEnabled(false);
}
use of de.symeda.sormas.ui.utils.DetailSubComponentWrapper in project SORMAS-Project by hzi-braunschweig.
the class PersonDataView method initView.
@Override
protected void initView(String params) {
setHeightUndefined();
String htmlLayout = LayoutUtil.fluidRow(LayoutUtil.fluidColumnLoc(8, 0, 12, 0, PERSON_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, CASES_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, CONTACTS_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, EVENT_PARTICIPANTS_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, TRAVEL_ENTRIES_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, IMMUNIZATION_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, VACCINATIONS_LOC));
DetailSubComponentWrapper container = new DetailSubComponentWrapper(() -> editComponent);
container.setWidth(100, Unit.PERCENTAGE);
container.setMargin(true);
setSubComponent(container);
CustomLayout layout = new CustomLayout();
layout.addStyleName(CssStyles.ROOT_COMPONENT);
layout.setTemplateContents(htmlLayout);
layout.setWidth(100, Unit.PERCENTAGE);
layout.setHeightUndefined();
container.addComponent(layout);
editComponent = ControllerProvider.getPersonController().getPersonEditComponent(getReference().getUuid(), UserRight.PERSON_EDIT);
editComponent.setMargin(false);
editComponent.setWidth(100, Unit.PERCENTAGE);
editComponent.getWrappedComponent().setWidth(100, Unit.PERCENTAGE);
editComponent.addStyleName(CssStyles.MAIN_COMPONENT);
layout.addComponent(editComponent, PERSON_LOC);
if (FacadeProvider.getPersonFacade().isSharedWithoutOwnership(getReference().getUuid())) {
editComponent.setEnabled(false);
}
if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.CASE_SURVEILANCE)) {
layout.addComponent(new SideComponentLayout(new CaseListComponent(getReference())), CASES_LOC);
}
if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.CONTACT_TRACING) && UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_VIEW)) {
layout.addComponent(new SideComponentLayout(new ContactListComponent(getReference())), CONTACTS_LOC);
}
if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.EVENT_SURVEILLANCE)) {
layout.addComponent(new SideComponentLayout(new EventParticipantListComponent(getReference())), EVENT_PARTICIPANTS_LOC);
}
UserProvider currentUser = UserProvider.getCurrent();
if (FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_GERMANY) && FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.TRAVEL_ENTRIES) && currentUser != null && currentUser.hasUserRight(UserRight.TRAVEL_ENTRY_VIEW)) {
TravelEntryListCriteria travelEntryListCriteria = new TravelEntryListCriteria.Builder().withPerson(getReference()).build();
layout.addComponent(new SideComponentLayout(new TravelEntryListComponent(travelEntryListCriteria, this::showUnsavedChangesPopup)), TRAVEL_ENTRIES_LOC);
}
if (FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.IMMUNIZATION_MANAGEMENT) && currentUser != null && currentUser.hasUserRight(UserRight.IMMUNIZATION_VIEW)) {
if (!FacadeProvider.getFeatureConfigurationFacade().isPropertyValueTrue(FeatureType.IMMUNIZATION_MANAGEMENT, FeatureTypeProperty.REDUCED)) {
final ImmunizationListCriteria immunizationListCriteria = new ImmunizationListCriteria.Builder(getReference()).build();
layout.addComponent(new SideComponentLayout(new ImmunizationListComponent(immunizationListCriteria, this::showUnsavedChangesPopup)), IMMUNIZATION_LOC);
} else {
VaccinationListCriteria criteria = new VaccinationListCriteria.Builder(getReference()).build();
layout.addComponent(new SideComponentLayout(new VaccinationListComponent(criteria)), VACCINATIONS_LOC);
}
}
}
use of de.symeda.sormas.ui.utils.DetailSubComponentWrapper in project SORMAS-Project by hzi-braunschweig.
the class SampleDataView method initView.
@Override
protected void initView(String params) {
setHeightUndefined();
String htmlLayout = LayoutUtil.fluidRow(LayoutUtil.fluidColumnLoc(8, 0, 12, 0, EDIT_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, CASE_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, CONTACT_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, EVENT_PARTICIPANT_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, PATHOGEN_TESTS_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, ADDITIONAL_TESTS_LOC), LayoutUtil.fluidColumnLoc(4, 0, 6, 0, SORMAS_TO_SORMAS_LOC));
DetailSubComponentWrapper container = new DetailSubComponentWrapper(() -> editComponent);
container.setWidth(100, Unit.PERCENTAGE);
container.setMargin(true);
setSubComponent(container);
CustomLayout layout = new CustomLayout();
layout.addStyleName(CssStyles.ROOT_COMPONENT);
layout.setTemplateContents(htmlLayout);
layout.setWidth(100, Unit.PERCENTAGE);
layout.setHeightUndefined();
container.addComponent(layout);
SampleDto sampleDto = FacadeProvider.getSampleFacade().getSampleByUuid(getSampleRef().getUuid());
Disease disease = null;
final CaseReferenceDto associatedCase = sampleDto.getAssociatedCase();
if (associatedCase != null && UserProvider.getCurrent().hasAllUserRights(UserRight.CASE_VIEW)) {
final CaseDataDto caseDto = FacadeProvider.getCaseFacade().getCaseDataByUuid(associatedCase.getUuid());
disease = caseDto.getDisease();
final CaseInfoLayout caseInfoLayout = new CaseInfoLayout(caseDto);
caseInfoLayout.addStyleName(CssStyles.SIDE_COMPONENT);
layout.addComponent(caseInfoLayout, CASE_LOC);
}
final ContactReferenceDto associatedContact = sampleDto.getAssociatedContact();
if (associatedContact != null && UserProvider.getCurrent().hasAllUserRights(UserRight.CONTACT_VIEW)) {
final ContactDto contactDto = FacadeProvider.getContactFacade().getByUuid(associatedContact.getUuid());
disease = contactDto.getDisease();
final ContactInfoLayout contactInfoLayout = new ContactInfoLayout(contactDto, UiFieldAccessCheckers.getDefault(contactDto.isPseudonymized()));
contactInfoLayout.addStyleName(CssStyles.SIDE_COMPONENT);
layout.addComponent(contactInfoLayout, CONTACT_LOC);
}
final EventParticipantReferenceDto associatedEventParticipant = sampleDto.getAssociatedEventParticipant();
if (associatedEventParticipant != null && UserProvider.getCurrent().hasAllUserRights(UserRight.EVENTPARTICIPANT_VIEW)) {
final EventParticipantDto eventParticipantDto = FacadeProvider.getEventParticipantFacade().getEventParticipantByUuid(associatedEventParticipant.getUuid());
final EventDto eventDto = FacadeProvider.getEventFacade().getEventByUuid(eventParticipantDto.getEvent().getUuid(), false);
disease = eventDto.getDisease();
final EventParticipantInfoLayout eventParticipantInfoLayout = new EventParticipantInfoLayout(eventParticipantDto, eventDto, UiFieldAccessCheckers.getDefault(eventParticipantDto.isPseudonymized()));
eventParticipantInfoLayout.addStyleName(CssStyles.SIDE_COMPONENT);
layout.addComponent(eventParticipantInfoLayout, EVENT_PARTICIPANT_LOC);
}
SampleController sampleController = ControllerProvider.getSampleController();
editComponent = sampleController.getSampleEditComponent(getSampleRef().getUuid(), sampleDto.isPseudonymized(), disease, true);
Consumer<Disease> createReferral = (relatedDisease) -> {
// save changes before referral creation
editComponent.commit();
SampleDto committedSample = editComponent.getWrappedComponent().getValue();
sampleController.createReferral(committedSample, relatedDisease);
};
Consumer<SampleDto> openReferredSample = referredSample -> sampleController.navigateToData(referredSample.getUuid());
sampleController.addReferOrLinkToOtherLabButton(editComponent, disease, createReferral, openReferredSample);
Consumer<SampleDto> navigate = targetSampleDto -> sampleController.navigateToData(targetSampleDto.getUuid());
sampleController.addReferredFromButton(editComponent, navigate);
editComponent.setMargin(new MarginInfo(false, false, true, false));
editComponent.setWidth(100, Unit.PERCENTAGE);
editComponent.getWrappedComponent().setWidth(100, Unit.PERCENTAGE);
editComponent.addStyleName(CssStyles.MAIN_COMPONENT);
layout.addComponent(editComponent, EDIT_LOC);
SampleReferenceDto sampleReferenceDto = getSampleRef();
PathogenTestListComponent pathogenTestListComponent = new PathogenTestListComponent(sampleReferenceDto, this::showUnsavedChangesPopup);
layout.addComponent(new SideComponentLayout(pathogenTestListComponent), PATHOGEN_TESTS_LOC);
if (UserProvider.getCurrent() != null && UserProvider.getCurrent().hasUserRight(UserRight.ADDITIONAL_TEST_VIEW) && FacadeProvider.getFeatureConfigurationFacade().isFeatureEnabled(FeatureType.ADDITIONAL_TESTS)) {
AdditionalTestListComponent additionalTestList = new AdditionalTestListComponent(sampleReferenceDto.getUuid());
additionalTestList.addStyleName(CssStyles.SIDE_COMPONENT);
layout.addComponent(additionalTestList, ADDITIONAL_TESTS_LOC);
}
boolean sormasToSormasEnabled = FacadeProvider.getSormasToSormasFacade().isSharingCasesContactsAndSamplesEnabledForUser();
if (sormasToSormasEnabled || sampleDto.getSormasToSormasOriginInfo() != null) {
VerticalLayout sormasToSormasLocLayout = new VerticalLayout();
sormasToSormasLocLayout.setMargin(false);
sormasToSormasLocLayout.setSpacing(false);
SormasToSormasListComponent sormasToSormasListComponent = new SormasToSormasListComponent(sampleDto);
sormasToSormasListComponent.addStyleNames(CssStyles.SIDE_COMPONENT);
sormasToSormasLocLayout.addComponent(sormasToSormasListComponent);
layout.addComponent(sormasToSormasLocLayout, SORMAS_TO_SORMAS_LOC);
}
setSampleEditPermission(container);
}
use of de.symeda.sormas.ui.utils.DetailSubComponentWrapper in project SORMAS-Project by hzi-braunschweig.
the class EventGroupDataView method initView.
@Override
protected void initView(String params) {
setHeightUndefined();
String htmlLayout = fluidRow(fluidColumnLoc(8, 0, 12, 0, EVENT_GROUP_LOC), fluidColumnLoc(8, 0, 12, 0, EVENTS_LOC));
DetailSubComponentWrapper container = new DetailSubComponentWrapper(() -> editComponent);
container.setWidth(100, Unit.PERCENTAGE);
container.setMargin(true);
setSubComponent(container);
CustomLayout layout = new CustomLayout();
layout.addStyleName(CssStyles.ROOT_COMPONENT);
layout.setTemplateContents(htmlLayout);
layout.setWidth(100, Unit.PERCENTAGE);
layout.setHeightUndefined();
container.addComponent(layout);
editComponent = ControllerProvider.getEventGroupController().getEventGroupEditComponent(getReference().getUuid());
editComponent.setMargin(false);
editComponent.setWidth(100, Unit.PERCENTAGE);
editComponent.getWrappedComponent().setWidth(100, Unit.PERCENTAGE);
editComponent.addStyleName(CssStyles.MAIN_COMPONENT);
layout.addComponent(editComponent, EVENT_GROUP_LOC);
EventGroupMemberListComponent eventGroupMemberListComponent = new EventGroupMemberListComponent(getReference());
layout.addComponent(eventGroupMemberListComponent, EVENTS_LOC);
CssStyles.style(eventGroupMemberListComponent, CssStyles.VSPACE_TOP_2);
if (!UserProvider.getCurrent().hasUserRight(UserRight.EVENTGROUP_EDIT)) {
layout.setEnabled(false);
}
}
Aggregations