7878import de .symeda .sormas .ui .UserProvider ;
7979import de .symeda .sormas .ui .utils .AbstractEditForm ;
8080import de .symeda .sormas .ui .utils .ButtonHelper ;
81- import de .symeda .sormas .ui .utils .CommitDiscardWrapperComponent .DoneListener ;
8281import de .symeda .sormas .ui .utils .ConfirmationComponent ;
8382import de .symeda .sormas .ui .utils .CssStyles ;
8483import de .symeda .sormas .ui .utils .FieldHelper ;
@@ -277,9 +276,8 @@ protected void addFields() {
277276 style (epidField , ERROR_COLOR_PRIMARY );
278277
279278 // Button to automatically assign a new epid number
280- Button assignNewEpidNumberButton = ButtonHelper .createButton (Captions .actionAssignNewEpidNumber , e -> {
281- epidField .setValue (FacadeProvider .getCaseFacade ().generateEpidNumber (getValue ().toReference ()));
282- }, ValoTheme .BUTTON_DANGER , FORCE_CAPTION );
279+ Button assignNewEpidNumberButton = ButtonHelper .createButton (Captions .actionAssignNewEpidNumber ,
280+ e -> epidField .setValue (FacadeProvider .getCaseFacade ().generateEpidNumber (getValue ().toReference ())), ValoTheme .BUTTON_DANGER , FORCE_CAPTION );
283281
284282 getContent ().addComponent (assignNewEpidNumberButton , ASSIGN_NEW_EPID_NUMBER_LOC );
285283 assignNewEpidNumberButton .setVisible (false );
@@ -291,7 +289,7 @@ protected void addFields() {
291289 addField (CaseDataDto .INVESTIGATION_STATUS , OptionGroup .class );
292290 addField (CaseDataDto .OUTCOME , OptionGroup .class );
293291 addField (CaseDataDto .SEQUELAE , OptionGroup .class );
294- if (isConfiguredServer ("de" )) {
292+ if (isConfiguredServer (CountryHelper . COUNTRY_CODE_GERMANY )) {
295293 addField (CaseDataDto .REPORTING_TYPE );
296294 }
297295 addFields (CaseDataDto .INVESTIGATED_DATE , CaseDataDto .OUTCOME_DATE , CaseDataDto .SEQUELAE_DETAILS );
@@ -309,7 +307,7 @@ protected void addFields() {
309307 quarantineFrom = addField (CaseDataDto .QUARANTINE_FROM , DateField .class );
310308 quarantineTo = addDateField (CaseDataDto .QUARANTINE_TO , DateField .class , -1 );
311309
312- if (isConfiguredServer ("de" )) {
310+ if (isConfiguredServer (CountryHelper . COUNTRY_CODE_GERMANY )) {
313311 final ComboBox cbCaseClassification = addField (CaseDataDto .CASE_CLASSIFICATION , ComboBox .class );
314312 cbCaseClassification .addValidator (
315313 new GermanCaseClassificationValidator (caseUuid , I18nProperties .getValidationError (Validations .caseClassificationInvalid )));
@@ -455,13 +453,12 @@ protected void addFields() {
455453 (FacilityType ) facilityType .getValue (),
456454 facility );
457455 });
458- community .addValueChangeListener (e -> {
459- updateFacility (
460- (DistrictReferenceDto ) district .getValue (),
461- (CommunityReferenceDto ) community .getValue (),
462- (FacilityType ) facilityType .getValue (),
463- facility );
464- });
456+ community .addValueChangeListener (e -> updateFacility (
457+ (DistrictReferenceDto ) district .getValue (),
458+ (CommunityReferenceDto ) community .getValue (),
459+ (FacilityType ) facilityType .getValue (),
460+ facility )
461+ );
465462 facilityOrHome .addValueChangeListener (e -> {
466463 FieldHelper .removeItems (facility );
467464 if (TypeOfPlace .FACILITY .equals (facilityOrHome .getValue ())) {
@@ -495,19 +492,16 @@ protected void addFields() {
495492 }
496493 }
497494 });
498- facilityTypeGroup .addValueChangeListener (e -> {
499- FieldHelper .updateEnumData (facilityType , FacilityType .getAccommodationTypes ((FacilityTypeGroup ) facilityTypeGroup .getValue ()));
500- });
501- facilityType .addValueChangeListener (e -> {
502- updateFacility (
503- (DistrictReferenceDto ) district .getValue (),
504- (CommunityReferenceDto ) community .getValue (),
505- (FacilityType ) facilityType .getValue (),
506- facility );
507- });
508- facility .addValueChangeListener (e -> {
509- updateFacilityDetails (facility , facilityDetails );
510- });
495+ facilityTypeGroup .addValueChangeListener (e ->
496+ FieldHelper .updateEnumData (facilityType , FacilityType .getAccommodationTypes ((FacilityTypeGroup ) facilityTypeGroup .getValue ()))
497+ );
498+ facilityType .addValueChangeListener (e -> updateFacility (
499+ (DistrictReferenceDto ) district .getValue (),
500+ (CommunityReferenceDto ) community .getValue (),
501+ (FacilityType ) facilityType .getValue (),
502+ facility )
503+ );
504+ facility .addValueChangeListener (e -> updateFacilityDetails (facility , facilityDetails ));
511505 region .addItems (FacadeProvider .getRegionFacade ().getAllActiveAsReference ());
512506
513507 if (!FacadeProvider .getFeatureConfigurationFacade ().isFeatureDisabled (FeatureType .NATIONAL_CASE_SHARING )) {
@@ -578,12 +572,10 @@ protected void addFields() {
578572 CaseDataDto .VACCINATION_DATE );
579573
580574 // Set initial visibilities & accesses
581-
582575 initializeVisibilitiesAndAllowedVisibilities ();
583576 initializeAccessAndAllowedAccesses ();
584577
585578 // Set requirements that don't need visibility changes and read only status
586-
587579 setRequired (
588580 true ,
589581 CaseDataDto .REPORT_DATE ,
@@ -640,7 +632,6 @@ protected void addFields() {
640632
641633 // Set conditional visibilities - ALWAYS call isVisibleAllowed before
642634 // dynamically setting the visibility
643-
644635 if (isVisibleAllowed (CaseDataDto .PREGNANT )) {
645636 setVisible (person .getSex () == Sex .FEMALE , CaseDataDto .PREGNANT , CaseDataDto .POSTPARTUM );
646637 }
@@ -769,7 +760,6 @@ protected void addFields() {
769760 }
770761
771762 // Other initializations
772-
773763 if (disease == Disease .MONKEYPOX ) {
774764 Image smallpoxVaccinationScarImg = new Image (null , new ThemeResource ("img/smallpox-vaccination-scar.jpg" ));
775765 style (smallpoxVaccinationScarImg , VSPACE_3 );
@@ -780,9 +770,9 @@ protected void addFields() {
780770 .setVisible (getFieldGroup ().getField (CaseDataDto .SMALLPOX_VACCINATION_RECEIVED ).getValue () == YesNoUnknown .YES );
781771
782772 // Set up image visibility listener
783- getFieldGroup ().getField (CaseDataDto .SMALLPOX_VACCINATION_RECEIVED ).addValueChangeListener (e -> {
784- getContent ().getComponent (SMALLPOX_VACCINATION_SCAR_IMG ).setVisible (e .getProperty ().getValue () == YesNoUnknown .YES );
785- } );
773+ getFieldGroup ().getField (CaseDataDto .SMALLPOX_VACCINATION_RECEIVED ).addValueChangeListener (e ->
774+ getContent ().getComponent (SMALLPOX_VACCINATION_SCAR_IMG ).setVisible (e .getProperty ().getValue () == YesNoUnknown .YES )
775+ );
786776 }
787777
788778 List <String > medicalInformationFields =
@@ -804,9 +794,8 @@ protected void addFields() {
804794 // Automatic case classification rules button - invisible for other diseases
805795 DiseaseClassificationCriteriaDto diseaseClassificationCriteria = FacadeProvider .getCaseClassificationFacade ().getByDisease (disease );
806796 if (disease != Disease .OTHER && diseaseClassificationCriteria != null ) {
807- Button classificationRulesButton = ButtonHelper .createIconButton (Captions .info , VaadinIcons .INFO_CIRCLE , e -> {
808- ControllerProvider .getCaseController ().openClassificationRulesPopup (diseaseClassificationCriteria );
809- }, ValoTheme .BUTTON_PRIMARY , FORCE_CAPTION );
797+ Button classificationRulesButton = ButtonHelper .createIconButton (Captions .info , VaadinIcons .INFO_CIRCLE , e ->
798+ ControllerProvider .getCaseController ().openClassificationRulesPopup (diseaseClassificationCriteria ), ValoTheme .BUTTON_PRIMARY , FORCE_CAPTION );
810799
811800 getContent ().addComponent (classificationRulesButton , CLASSIFICATION_RULES_LOC );
812801 }
@@ -888,7 +877,7 @@ protected void addFields() {
888877 setVisible (false , CaseDataDto .CASE_ORIGIN );
889878 }
890879
891- if (isConfiguredServer ("de" )) {
880+ if (isConfiguredServer (CountryHelper . COUNTRY_CODE_GERMANY )) {
892881 setVisible (false , CaseDataDto .EPID_NUMBER );
893882 } else {
894883 setVisible (false , CaseDataDto .EXTERNAL_ID );
@@ -1096,7 +1085,7 @@ public void setValue(CaseDataDto newFieldValue) throws ReadOnlyException, Conver
10961085 super .setValue (newFieldValue );
10971086
10981087 // HACK: Binding to the fields will call field listeners that may clear/modify the values of other fields.
1099- // this hopefully resets everything to it's correct value
1088+ // this hopefully resets everything to its correct value
11001089 discard ();
11011090 }
11021091
@@ -1158,7 +1147,7 @@ protected String createHtmlLayout() {
11581147 }
11591148
11601149 private void setEpidNumberError (TextField epidField , Button assignNewEpidNumberButton , Label epidNumberWarningLabel , String fieldValue ) {
1161- if (!isConfiguredServer ("de" )
1150+ if (!isConfiguredServer (CountryHelper . COUNTRY_CODE_GERMANY )
11621151 && FacadeProvider .getCaseFacade ().doesEpidNumberExist (fieldValue , getValue ().getUuid (), getValue ().getDisease ())) {
11631152 epidField .setComponentError (new UserError (I18nProperties .getValidationError (Validations .duplicateEpidNumber )));
11641153 assignNewEpidNumberButton .setVisible (true );
@@ -1167,7 +1156,7 @@ private void setEpidNumberError(TextField epidField, Button assignNewEpidNumberB
11671156 epidField .setComponentError (null );
11681157 getContent ().removeComponent (epidNumberWarningLabel );
11691158 assignNewEpidNumberButton
1170- .setVisible (!isConfiguredServer ("de" ) && !CaseLogic .isEpidNumberPrefix (fieldValue ) && !CaseLogic .isCompleteEpidNumber (fieldValue ));
1159+ .setVisible (!isConfiguredServer (CountryHelper . COUNTRY_CODE_GERMANY ) && !CaseLogic .isEpidNumberPrefix (fieldValue ) && !CaseLogic .isCompleteEpidNumber (fieldValue ));
11711160 }
11721161 }
11731162
@@ -1208,12 +1197,9 @@ protected void onCancel() {
12081197 Window popupWindow = VaadinUiUtil .showPopupWindow (confirmDiseaseChangeComponent );
12091198 CloseListener closeListener = ce -> diseaseField .setValue (currentDisease );
12101199 popupWindow .addCloseListener (closeListener );
1211- confirmDiseaseChangeComponent .addDoneListener (new DoneListener () {
1212-
1213- public void onDone () {
1214- popupWindow .removeCloseListener (closeListener );
1215- popupWindow .close ();
1216- }
1200+ confirmDiseaseChangeComponent .addDoneListener (() -> {
1201+ popupWindow .removeCloseListener (closeListener );
1202+ popupWindow .close ();
12171203 });
12181204 popupWindow .setCaption (I18nProperties .getString (Strings .headingChangeCaseDisease ));
12191205 }
0 commit comments