Skip to content

Commit

Permalink
Remove MetadataType selection, set BatchNameField as required and add…
Browse files Browse the repository at this point in the history
… freeze pane for header row
  • Loading branch information
Steffengreiner committed Jul 12, 2023
1 parent 0f79b44 commit fc3e4be
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@
import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.icon.Icon;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.radiobutton.RadioButtonGroup;
import com.vaadin.flow.component.radiobutton.RadioGroupVariant;
import com.vaadin.flow.component.select.Select;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.data.binder.Binder;
import com.vaadin.flow.data.renderer.ComponentRenderer;
import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
Expand All @@ -29,7 +23,6 @@
public class BatchInformationLayout extends Div {

public final TextField batchNameField = new TextField("Batch Name");
public final RadioButtonGroup<MetadataType> dataTypeSelection = new RadioButtonGroup<>();
public final Button cancelButton = new Button("Cancel");
public final Button nextButton = new Button("Next");
public final Select<Experiment> experimentSelect = new Select<>();
Expand All @@ -43,7 +36,6 @@ public BatchInformationLayout() {

private void initContent() {
initBatchLayout();
initDataTypeLayout();
initButtonLayout();
}

Expand All @@ -57,38 +49,10 @@ private void initBatchLayout() {
batchLayout.add(batchInformationHeader);
batchLayout.add(experimentSelect);
batchLayout.add(batchNameField);
batchNameField.setRequired(true);
add(batchLayout);
}

private void initDataTypeLayout() {
Div dataTypeLayout = new Div();
dataTypeLayout.addClassName("data-type-information");
Span dataTypeHeader = new Span("Type of Data");
dataTypeHeader.addClassName("title");
dataTypeLayout.add(dataTypeHeader);
Div dataTypeDescription = new Div();
dataTypeDescription.add(
"There is a minimum amount of information required. All samples must conform the expected metadata values. The most suitable checklist for sample registration depends on the type of the sample.");
dataTypeLayout.add(dataTypeDescription);
initDataTypeSelection();
dataTypeLayout.add(dataTypeSelection);
add(dataTypeLayout);
}

private void initDataTypeSelection() {
dataTypeSelection.setItems(MetadataType.values());
dataTypeSelection.setReadOnly(true);
dataTypeSelection.setValue(MetadataType.TRANSCRIPTOMICS_GENOMICS);
dataTypeSelection.addThemeVariants(RadioGroupVariant.LUMO_VERTICAL);
dataTypeSelection.setRenderer(new ComponentRenderer<>(metadataType -> {
Span metadataTypeSpan = new Span(metadataType.label);
Icon infoIcon = new Icon(VaadinIcon.INFO_CIRCLE);
infoIcon.addClassName("info-icon");
infoIcon.setTooltipText(metadataType.description);
return new HorizontalLayout(metadataTypeSpan, infoIcon);
}));
}

private void initButtonLayout() {
Span batchInformationButtons = new Span();
batchInformationButtons.addClassName("buttons");
Expand Down Expand Up @@ -138,7 +102,6 @@ private void reset() {
}

private void resetChildValues() {
dataTypeSelection.setValue(MetadataType.TRANSCRIPTOMICS_GENOMICS);
experimentSelect.clear();
batchNameField.clear();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ private void generateSampleRegistrationLayout() {
if (sampleSpreadsheetLayout.getExperiment() == null || !selectedExperimentId.equals(
sampleSpreadsheetLayout.getExperiment())) {
sampleSpreadsheetLayout.setExperiment(batchInformationLayout.experimentSelect.getValue());
sampleSpreadsheetLayout.generateSampleRegistrationSheet(
batchInformationLayout.dataTypeSelection.getValue());
sampleSpreadsheetLayout.generateSampleRegistrationSheet();
}
}

Expand Down

This file was deleted.

Loading

0 comments on commit fc3e4be

Please sign in to comment.