Skip to content

Commit

Permalink
Merge branch 'development' into release/0.25.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffengreiner committed Sep 19, 2023
2 parents 63a894b + 69e15c7 commit 17cf3e7
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 55 deletions.
32 changes: 1 addition & 31 deletions vaadinfrontend/frontend/themes/datamanager/components/div.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,35 +68,5 @@
flex-wrap: wrap;
gap: var(--lumo-space-xs);
width: 100%;
}

/* vaadin badge styling*/
.tag {
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 0.4em calc(0.5em + var(--lumo-border-radius-s) / 4);
color: var(--lumo-primary-text-color);
background-color: var(--lumo-primary-color-10pct);
border-radius: var(--lumo-border-radius-s);
font-family: var(--lumo-font-family);
font-size: var(--lumo-font-size-s);
line-height: 1;
font-weight: 500;
text-transform: initial;
letter-spacing: initial;
min-width: calc(var(--lumo-line-height-xs) * 1em + 0.45em);
flex-shrink: 0;
}

.tag::before {
display: inline-block;
content: '\2003';
width: 0;
}

.tag.contrast {
color: var(--lumo-contrast-80pct);
background-color: var(--lumo-contrast-5pct);
white-space: nowrap;
}
31 changes: 31 additions & 0 deletions vaadinfrontend/frontend/themes/datamanager/components/span.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,34 @@ span.title {
.error-text {
color: var(--lumo-error-text-color);
}

/* vaadin badge styling*/
.tag {
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 0.4em calc(0.5em + var(--lumo-border-radius-s) / 4);
color: var(--lumo-primary-text-color);
background-color: var(--lumo-primary-color-10pct);
border-radius: var(--lumo-border-radius-s);
font-family: var(--lumo-font-family);
font-size: var(--lumo-font-size-s);
line-height: 1;
font-weight: 500;
text-transform: initial;
letter-spacing: initial;
min-width: calc(var(--lumo-line-height-xs) * 1em + 0.45em);
flex-shrink: 0;
}

.tag::before {
display: inline-block;
content: '\2003';
width: 0;
}

.tag.contrast {
color: var(--lumo-contrast-80pct);
background-color: var(--lumo-contrast-5pct);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.vaadin.flow.component.HasValue.ValueChangeListener;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.grid.GridVariant;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.icon.VaadinIcon;
Expand Down Expand Up @@ -46,6 +47,7 @@
import life.qbic.projectmanagement.domain.project.ProjectId;
import life.qbic.projectmanagement.domain.project.experiment.Experiment;
import life.qbic.projectmanagement.domain.project.experiment.ExperimentId;
import life.qbic.projectmanagement.domain.project.experiment.ExperimentalGroup;
import life.qbic.projectmanagement.domain.project.experiment.vocabulary.Analyte;
import life.qbic.projectmanagement.domain.project.experiment.vocabulary.Species;
import life.qbic.projectmanagement.domain.project.experiment.vocabulary.Specimen;
Expand All @@ -60,9 +62,8 @@
/**
* Sample Details Component
* <p>
* Component embedded within the {@link SampleInformationMain}. It
* allows the user to see the information associated for all {@link Batch} and {@link Sample} of
* each
* Component embedded within the {@link SampleInformationMain}. It allows the user to see the
* information associated for all {@link Batch} and {@link Sample} of each
* {@link Experiment within a {@link life.qbic.projectmanagement.domain.project.Project}
* Additionally it enables the user to register new {@link Batch} and {@link Sample} via the
* contained {@link BatchRegistrationDialog} and propagates the successful registration to the
Expand Down Expand Up @@ -130,10 +131,19 @@ private static ComponentRenderer<Div, SamplePreview> createConditionRenderer() {
return new ComponentRenderer<>(Div::new, styleConditionValue);
}

private static final SerializableBiConsumer<Div, SamplePreview> styleConditionValue = (div, samplePreview) -> {
private static final SerializableBiConsumer<Div, SamplePreview> styleConditionValue = (div, samplePreview) -> collectVariableLevelsInExperimentalGroup(
samplePreview.experimentalGroup()).forEach(
experimentalVariable -> {
Tag tag = new Tag(experimentalVariable);
tag.setTitle(experimentalVariable);
div.add(tag);
div.addClassName("tag-collection");
});

private static List<String> collectVariableLevelsInExperimentalGroup(
ExperimentalGroup experimentalGroup) {
List<String> variableLevels = new ArrayList<>();
div.addClassName("tag-collection");
samplePreview.experimentalGroup()
experimentalGroup
.condition().getVariableLevels().forEach(variableLevel -> {
String experimentalVariable =
variableLevel.variableName().value() + ": " + variableLevel.experimentalValue().value();
Expand All @@ -144,13 +154,8 @@ private static ComponentRenderer<Div, SamplePreview> createConditionRenderer() {
variableLevels.add(experimentalVariable);
});
variableLevels.sort(null);
variableLevels.forEach(experimentalVariable -> {
Tag tag = new Tag(experimentalVariable);
tag.addClassName("primary");
tag.setTitle(experimentalVariable);
div.add(tag);
});
};
return variableLevels;
}


/**
Expand Down Expand Up @@ -312,23 +317,28 @@ private void fireSearchFieldValueChangeEvent(
private Grid<SamplePreview> createSampleGrid() {
Grid<SamplePreview> sampleGrid = new Grid<>(SamplePreview.class);
sampleGrid.addColumn(SamplePreview::sampleCode).setHeader("Sample Id")
.setSortProperty("sampleCode");
.setSortProperty("sampleCode").setAutoWidth(true).setFlexGrow(0)
.setTooltipGenerator(SamplePreview::sampleCode);
sampleGrid.addColumn(SamplePreview::sampleLabel).setHeader("Sample Label")
.setSortProperty("sampleLabel");
.setSortProperty("sampleLabel").setTooltipGenerator(SamplePreview::sampleLabel);
sampleGrid.addColumn(SamplePreview::batchLabel).setHeader("Batch")
.setSortProperty("batchLabel");
.setSortProperty("batchLabel").setTooltipGenerator(SamplePreview::batchLabel);
sampleGrid.addColumn(SamplePreview::replicateLabel).setHeader("Biological Replicate")
.setSortProperty("bioReplicateLabel");
sampleGrid.addColumn(createConditionRenderer()).setHeader("Condition").setAutoWidth(true)
.setSortProperty("experimentalGroup");
sampleGrid.addColumn(SamplePreview::species).setHeader("Species").setSortProperty("species");
.setSortProperty("bioReplicateLabel").setTooltipGenerator(SamplePreview::replicateLabel);
sampleGrid.addColumn(createConditionRenderer()).setHeader("Condition")
.setSortProperty("experimentalGroup").setAutoWidth(true).setFlexGrow(0);
sampleGrid.addColumn(SamplePreview::species).setHeader("Species").setSortProperty("species")
.setTooltipGenerator(SamplePreview::species);
sampleGrid.addColumn(SamplePreview::specimen).setHeader("Specimen")
.setSortProperty("specimen");
sampleGrid.addColumn(SamplePreview::analyte).setHeader("Analyte").setSortProperty("analyte");
.setSortProperty("specimen").setTooltipGenerator(SamplePreview::specimen);
sampleGrid.addColumn(SamplePreview::analyte).setHeader("Analyte").setSortProperty("analyte")
.setTooltipGenerator(SamplePreview::analyte);
sampleGrid.addColumn(SamplePreview::analysisType).setHeader("Analysis to Perform")
.setSortProperty("analysisType");
sampleGrid.addColumn(SamplePreview::comment).setHeader("Comment").setSortProperty("comment");
.setSortProperty("analysisType").setTooltipGenerator(SamplePreview::analysisType);
sampleGrid.addColumn(SamplePreview::comment).setHeader("Comment").setSortProperty("comment")
.setTooltipGenerator(SamplePreview::comment);
sampleGrid.addClassName("sample-grid");
sampleGrid.addThemeVariants(GridVariant.LUMO_WRAP_CELL_CONTENT);
return sampleGrid;
}

Expand Down

0 comments on commit 17cf3e7

Please sign in to comment.