This repository was archived by the owner on May 5, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
sormas-ui/src/main/java/de/symeda/sormas/ui/docgeneration Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,15 +81,23 @@ protected void createSampleSelector(ReferenceDto referenceDto) {
8181 sampleSelector = new ComboBox <>(I18nProperties .getCaption (Captions .Sample ));
8282 sampleSelector .setWidth (100F , Unit .PERCENTAGE );
8383 sampleSelector .setItems (samples );
84+ sampleSelector .setEnabled (!samples .isEmpty ());
8485 sampleSelector .addValueChangeListener (e -> {
8586 pathogenTestSelector .clear ();
8687 if (e != null && e .getValue () != null ) {
87- pathogenTestSelector .setItems (FacadeProvider .getPathogenTestFacade ().getAllBySample (e .getValue ().toReference ()));
88- pathogenTestSelector .setEnabled (true );
88+ List <PathogenTestDto > pathogenTests = FacadeProvider .getPathogenTestFacade ().getAllBySample (e .getValue ().toReference ());
89+ pathogenTestSelector .setItems (pathogenTests );
90+ pathogenTestSelector .setEnabled (!pathogenTests .isEmpty ());
91+ if (pathogenTests .size () == 1 ) {
92+ pathogenTestSelector .setSelectedItem (pathogenTests .get (0 ));
93+ }
8994 } else {
9095 pathogenTestSelector .setEnabled (false );
9196 }
9297 });
98+ if (samples .size () == 1 ) {
99+ sampleSelector .setSelectedItem (samples .get (0 ));
100+ }
93101
94102 additionalParametersComponent .addComponent (sampleSelector );
95103 additionalParametersComponent .addComponent (pathogenTestSelector );
You can’t perform that action at this time.
0 commit comments