diff --git a/application-commons/pom.xml b/application-commons/pom.xml index 4d6326a5e..50bab8228 100644 --- a/application-commons/pom.xml +++ b/application-commons/pom.xml @@ -5,7 +5,7 @@ datamanager life.qbic - 1.0.0 + 1.0.1 4.0.0 application-commons diff --git a/broadcasting/pom.xml b/broadcasting/pom.xml index e8670d751..635395993 100644 --- a/broadcasting/pom.xml +++ b/broadcasting/pom.xml @@ -5,7 +5,7 @@ datamanager life.qbic - 1.0.0 + 1.0.1 4.0.0 broadcasting diff --git a/domain-concept/pom.xml b/domain-concept/pom.xml index 89b5ec7cb..32db27f40 100644 --- a/domain-concept/pom.xml +++ b/domain-concept/pom.xml @@ -6,7 +6,7 @@ life.qbic datamanager - 1.0.0 + 1.0.1 domain-concept diff --git a/email-service-provider/pom.xml b/email-service-provider/pom.xml index 442d9d1c1..dba1e8b7c 100644 --- a/email-service-provider/pom.xml +++ b/email-service-provider/pom.xml @@ -6,7 +6,7 @@ life.qbic datamanager - 1.0.0 + 1.0.1 life.qbic.infrastructure @@ -21,13 +21,13 @@ life.qbic identity - 1.0.0 + 1.0.1 compile life.qbic project-management - 1.0.0 + 1.0.1 compile diff --git a/finances-api/pom.xml b/finances-api/pom.xml index 753365e81..89969036e 100644 --- a/finances-api/pom.xml +++ b/finances-api/pom.xml @@ -6,7 +6,7 @@ life.qbic datamanager - 1.0.0 + 1.0.1 life.qbic.finances diff --git a/finances-infrastructure/pom.xml b/finances-infrastructure/pom.xml index 76069dcae..2adeb8c2e 100644 --- a/finances-infrastructure/pom.xml +++ b/finances-infrastructure/pom.xml @@ -6,7 +6,7 @@ life.qbic datamanager - 1.0.0 + 1.0.1 finances-infrastructure @@ -20,7 +20,7 @@ life.qbic finances - 1.0.0 + 1.0.1 compile diff --git a/finances/pom.xml b/finances/pom.xml index 33a02e455..5fb1b3a5d 100644 --- a/finances/pom.xml +++ b/finances/pom.xml @@ -5,7 +5,7 @@ datamanager life.qbic - 1.0.0 + 1.0.1 4.0.0 finances @@ -38,7 +38,7 @@ life.qbic.finances finances-api - 1.0.0 + 1.0.1 compile diff --git a/identity-api/pom.xml b/identity-api/pom.xml index c99932439..e4b18409d 100644 --- a/identity-api/pom.xml +++ b/identity-api/pom.xml @@ -6,7 +6,7 @@ life.qbic datamanager - 1.0.0 + 1.0.1 life.qbic.datamanager @@ -21,7 +21,7 @@ life.qbic application-commons - 1.0.0 + 1.0.1 compile diff --git a/identity-infrastructure/pom.xml b/identity-infrastructure/pom.xml index aba62f5cf..47ef8fd6b 100644 --- a/identity-infrastructure/pom.xml +++ b/identity-infrastructure/pom.xml @@ -6,14 +6,14 @@ life.qbic datamanager - 1.0.0 + 1.0.1 identity-infrastructure life.qbic identity - 1.0.0 + 1.0.1 compile diff --git a/identity/pom.xml b/identity/pom.xml index c757eabe8..3a939d0cc 100644 --- a/identity/pom.xml +++ b/identity/pom.xml @@ -5,7 +5,7 @@ datamanager life.qbic - 1.0.0 + 1.0.1 4.0.0 @@ -45,25 +45,25 @@ life.qbic broadcasting - 1.0.0 + 1.0.1 compile life.qbic application-commons - 1.0.0 + 1.0.1 compile life.qbic logging - 1.0.0 + 1.0.1 compile life.qbic domain-concept - 1.0.0 + 1.0.1 compile @@ -86,7 +86,7 @@ life.qbic.datamanager identity-api - 1.0.0 + 1.0.1 compile diff --git a/logging/pom.xml b/logging/pom.xml index c59118880..646496db4 100644 --- a/logging/pom.xml +++ b/logging/pom.xml @@ -5,7 +5,7 @@ datamanager life.qbic - 1.0.0 + 1.0.1 4.0.0 logging @@ -53,7 +53,7 @@ life.qbic.logging subscription-api - 1.0.0 + 1.0.1 compile diff --git a/pom.xml b/pom.xml index 8ebc169a4..a20496f57 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ life.qbic datamanager Data Manager - 1.0.0 + 1.0.1 user-interface identity diff --git a/project-management-infrastructure/pom.xml b/project-management-infrastructure/pom.xml index cb489694d..04a46e7de 100644 --- a/project-management-infrastructure/pom.xml +++ b/project-management-infrastructure/pom.xml @@ -6,7 +6,7 @@ life.qbic datamanager - 1.0.0 + 1.0.1 life.qbic.identity @@ -29,7 +29,7 @@ life.qbic project-management - 1.0.0 + 1.0.1 compile diff --git a/project-management/pom.xml b/project-management/pom.xml index 4b5f520ec..732be2899 100644 --- a/project-management/pom.xml +++ b/project-management/pom.xml @@ -4,7 +4,7 @@ datamanager life.qbic - 1.0.0 + 1.0.1 4.0.0 project-management @@ -37,13 +37,13 @@ life.qbic application-commons - 1.0.0 + 1.0.1 compile life.qbic logging - 1.0.0 + 1.0.1 compile @@ -55,7 +55,7 @@ life.qbic domain-concept - 1.0.0 + 1.0.1 compile @@ -78,13 +78,13 @@ life.qbic.datamanager identity-api - 1.0.0 + 1.0.1 compile life.qbic.finances finances-api - 1.0.0 + 1.0.1 compile diff --git a/subscription-api/pom.xml b/subscription-api/pom.xml index 6f55d6d15..bdb6f9c20 100644 --- a/subscription-api/pom.xml +++ b/subscription-api/pom.xml @@ -5,7 +5,7 @@ datamanager life.qbic - 1.0.0 + 1.0.1 4.0.0 life.qbic.logging diff --git a/subscription-provider/pom.xml b/subscription-provider/pom.xml index b258eeb5b..c81b8f161 100644 --- a/subscription-provider/pom.xml +++ b/subscription-provider/pom.xml @@ -5,7 +5,7 @@ datamanager life.qbic - 1.0.0 + 1.0.1 4.0.0 life.qbic.logging @@ -14,7 +14,7 @@ life.qbic.logging subscription-api - 1.0.0 + 1.0.1 compile diff --git a/user-interface/pom.xml b/user-interface/pom.xml index 620e46cb6..d90e72607 100644 --- a/user-interface/pom.xml +++ b/user-interface/pom.xml @@ -11,7 +11,7 @@ life.qbic datamanager - 1.0.0 + 1.0.1 @@ -185,31 +185,31 @@ life.qbic identity - 1.0.0 + 1.0.1 compile life.qbic identity-infrastructure - 1.0.0 + 1.0.1 compile life.qbic broadcasting - 1.0.0 + 1.0.1 compile life.qbic application-commons - 1.0.0 + 1.0.1 compile life.qbic logging - 1.0.0 + 1.0.1 compile @@ -219,24 +219,24 @@ life.qbic project-management - 1.0.0 + 1.0.1 compile life.qbic.logging subscription-provider - 1.0.0 + 1.0.1 life.qbic domain-concept - 1.0.0 + 1.0.1 compile life.qbic finances-infrastructure - 1.0.0 + 1.0.1 compile @@ -246,13 +246,13 @@ life.qbic.identity project-management-infrastructure - 1.0.0 + 1.0.1 compile life.qbic.infrastructure email-service-provider - 1.0.0 + 1.0.1 compile diff --git a/user-interface/src/main/java/life/qbic/datamanager/views/projects/create/BioIconComboboxFactory.java b/user-interface/src/main/java/life/qbic/datamanager/views/projects/create/BioIconComboboxFactory.java index bb56064c2..b21240334 100644 --- a/user-interface/src/main/java/life/qbic/datamanager/views/projects/create/BioIconComboboxFactory.java +++ b/user-interface/src/main/java/life/qbic/datamanager/views/projects/create/BioIconComboboxFactory.java @@ -7,15 +7,18 @@ import com.vaadin.flow.data.renderer.ComponentRenderer; import java.util.List; import life.qbic.datamanager.views.projects.project.experiments.experiment.ExperimentDetailsComponent.BioIcon; +import life.qbic.datamanager.views.projects.project.experiments.experiment.ExperimentDetailsComponent.SampleSourceType; /** * Factory class for creating ComboBoxes allowing the selection of icons for species and specimen. */ public class BioIconComboboxFactory { - public ComboBox iconBox(List options, String title) { + public ComboBox iconBox(SampleSourceType type, String title) { + BioIcon defaultIcon = BioIcon.getDefaultBioIcon(type); + ComboBox comboBox = new ComboBox<>(title); - comboBox.setItems(options); + comboBox.setItems(BioIcon.getOptionsForType(type)); comboBox.setWidth("150px"); comboBox.setItemLabelGenerator( BioIcon::getLabel); @@ -26,8 +29,15 @@ public ComboBox iconBox(List options, String title) { return element; })); - comboBox.addValueChangeListener(valueChanged -> valueChanged.getSource() - .setPrefixComponent(styleIcon(valueChanged.getValue()))); + comboBox.addValueChangeListener(valueChanged -> { + Object val = valueChanged.getValue(); + if(val==null) { + comboBox.setValue(defaultIcon); + } else { + valueChanged.getSource().setPrefixComponent(styleIcon((BioIcon) val)); + } + }); + comboBox.setValue(defaultIcon); return comboBox; } diff --git a/user-interface/src/main/java/life/qbic/datamanager/views/projects/create/ExperimentalInformationLayout.java b/user-interface/src/main/java/life/qbic/datamanager/views/projects/create/ExperimentalInformationLayout.java index d23d6836a..3e1fd841e 100644 --- a/user-interface/src/main/java/life/qbic/datamanager/views/projects/create/ExperimentalInformationLayout.java +++ b/user-interface/src/main/java/life/qbic/datamanager/views/projects/create/ExperimentalInformationLayout.java @@ -52,14 +52,14 @@ public ExperimentalInformationLayout( experimentalInformationBinder = new Binder<>(ExperimentalInformation.class); - ComboBox speciesIconBox = bioIconComboboxFactory.iconBox( - BioIcon.getOptionsForType(SampleSourceType.SPECIES), "Species icon"); + ComboBox speciesIconBox = bioIconComboboxFactory.iconBox(SampleSourceType.SPECIES, + "Species icon"); experimentalInformationBinder.forField(speciesIconBox) .bind(ExperimentalInformation::getSpeciesIcon, ExperimentalInformation::setSpeciesIcon); - ComboBox specimenIconBox = bioIconComboboxFactory.iconBox( - BioIcon.getOptionsForType(SampleSourceType.SPECIMEN), "Specimen icon"); + ComboBox specimenIconBox = bioIconComboboxFactory.iconBox(SampleSourceType.SPECIMEN, + "Specimen icon"); experimentalInformationBinder.forField(specimenIconBox) .bind(ExperimentalInformation::getSpecimenIcon, ExperimentalInformation::setSpecimenIcon); diff --git a/user-interface/src/main/java/life/qbic/datamanager/views/projects/project/experiments/experiment/ExperimentDetailsComponent.java b/user-interface/src/main/java/life/qbic/datamanager/views/projects/project/experiments/experiment/ExperimentDetailsComponent.java index cf99d1a62..7f5583a9c 100644 --- a/user-interface/src/main/java/life/qbic/datamanager/views/projects/project/experiments/experiment/ExperimentDetailsComponent.java +++ b/user-interface/src/main/java/life/qbic/datamanager/views/projects/project/experiments/experiment/ExperimentDetailsComponent.java @@ -659,8 +659,15 @@ public static BioIcon getTypeWithNameOrDefault(SampleSourceType sampleSourceType String iconName) { Optional searchResult = getOptionsForType(sampleSourceType).stream() .filter(icon -> icon.label.equals(iconName)).findFirst(); - return searchResult.orElseGet(() -> getOptionsForType(sampleSourceType).stream() - .filter(icon -> icon.label.equals("default")).findFirst().get()); + return searchResult.orElseGet(() -> getDefaultBioIcon(sampleSourceType)); + } + + public static BioIcon getDefaultBioIcon(SampleSourceType sampleSourceType) { + return switch (sampleSourceType) { + case SPECIES -> DEFAULT_SPECIES; + case SPECIMEN -> DEFAULT_SPECIMEN; + case ANALYTE -> DEFAULT_ANALYTE; + }; } public String getLabel() { diff --git a/user-interface/src/main/java/life/qbic/datamanager/views/projects/project/experiments/experiment/create/AddExperimentDialog.java b/user-interface/src/main/java/life/qbic/datamanager/views/projects/project/experiments/experiment/create/AddExperimentDialog.java index 3b7e02e4e..5218f6ac8 100644 --- a/user-interface/src/main/java/life/qbic/datamanager/views/projects/project/experiments/experiment/create/AddExperimentDialog.java +++ b/user-interface/src/main/java/life/qbic/datamanager/views/projects/project/experiments/experiment/create/AddExperimentDialog.java @@ -84,14 +84,15 @@ public AddExperimentDialog( .bind(experimentDraft -> new HashSet<>(experimentDraft.getAnalytes()), ExperimentDraft::setAnalytes); - ComboBox speciesIconBox = bioIconComboboxFactory.iconBox( - BioIcon.getOptionsForType(SampleSourceType.SPECIES), "Species icon"); + ComboBox speciesIconBox = bioIconComboboxFactory.iconBox(SampleSourceType.SPECIES, + "Species icon"); binder.forField(speciesIconBox) .bind(ExperimentDraft::getSpeciesIcon, ExperimentDraft::setSpeciesIcon); - ComboBox specimenIconBox = bioIconComboboxFactory.iconBox( - BioIcon.getOptionsForType(SampleSourceType.SPECIMEN), "Specimen icon"); + + ComboBox specimenIconBox = bioIconComboboxFactory.iconBox(SampleSourceType.SPECIMEN, + "Specimen icon"); binder.forField(specimenIconBox) .bind(ExperimentDraft::getSpecimenIcon, ExperimentDraft::setSpecimenIcon); diff --git a/user-interface/src/main/java/life/qbic/datamanager/views/projects/project/experiments/experiment/update/EditExperimentDialog.java b/user-interface/src/main/java/life/qbic/datamanager/views/projects/project/experiments/experiment/update/EditExperimentDialog.java index fc572ef4a..e3c41f23e 100644 --- a/user-interface/src/main/java/life/qbic/datamanager/views/projects/project/experiments/experiment/update/EditExperimentDialog.java +++ b/user-interface/src/main/java/life/qbic/datamanager/views/projects/project/experiments/experiment/update/EditExperimentDialog.java @@ -66,8 +66,8 @@ public EditExperimentDialog(OntologyLookupService ontologyTermInformationService .bind(experimentDraft -> new HashSet<>(experimentDraft.getSpecies()), ExperimentDraft::setSpecies); - ComboBox speciesIconBox = bioIconComboboxFactory.iconBox( - BioIcon.getOptionsForType(SampleSourceType.SPECIES), "Species icon"); + ComboBox speciesIconBox = bioIconComboboxFactory.iconBox(SampleSourceType.SPECIES, + "Species icon"); binder.forField(speciesIconBox) .bind(ExperimentDraft::getSpeciesIcon, ExperimentDraft::setSpeciesIcon); @@ -79,8 +79,8 @@ public EditExperimentDialog(OntologyLookupService ontologyTermInformationService .bind(experimentDraft -> new HashSet<>(experimentDraft.getSpecimens()), ExperimentDraft::setSpecimens); - ComboBox specimenIconBox = bioIconComboboxFactory.iconBox( - BioIcon.getOptionsForType(SampleSourceType.SPECIMEN), "Specimen icon"); + ComboBox specimenIconBox = bioIconComboboxFactory.iconBox(SampleSourceType.SPECIMEN, + "Specimen icon"); binder.forField(specimenIconBox) .bind(ExperimentDraft::getSpecimenIcon, ExperimentDraft::setSpecimenIcon);