Skip to content

Commit

Permalink
Introduce editor functionality to show a custom component within the …
Browse files Browse the repository at this point in the history
…spreadsheet only if user selects the cell. (#335)

* WIP increase performance

* Fix blinking issue for comboboxes

* Add javadoc and fix header row

* Fix Dialog loading

* Fix rowcount accession and prefilling of cells for validation

* Remove unnecessary duplicate unused checks since we already define the value during row addition

* WIP fix dialog reload everything else works

* Finally fixed!

* Remove unused method

* Remove unused method

* replaces red validation borders in spreadsheet by cell highlighting comparable to usual style

* Update Javadocs

* rename conversion methods

* Fix SonarCloud Code Smell

* unlock cells after validation

* Fix copy past JD fail

---------

Co-authored-by: wow-such-code <[email protected]>
  • Loading branch information
Steffengreiner and wow-such-code authored Jul 27, 2023
1 parent e65b983 commit db2c46e
Show file tree
Hide file tree
Showing 6 changed files with 415 additions and 540 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ public class BatchRegistrationDialog extends DialogWindow {
private final Tab batchInformationTab = createTabStep("1", "Batch Information");
private final Tab sampleInformationTab = createTabStep("2", "Register Samples");
private final BatchInformationLayout batchInformationLayout = new BatchInformationLayout();
private SampleSpreadsheetLayout sampleSpreadsheetLayout;
private final SampleSpreadsheetLayout sampleSpreadsheetLayout = new SampleSpreadsheetLayout();
private final transient RegisterBatchDialogHandler registerBatchDialogHandler;

public BatchRegistrationDialog() {
addClassName("batch-registration-dialog");
setResizable(true);
setHeaderTitle(TITLE);
initSampleRegistrationLayout();
initTabStepper();
registerBatchDialogHandler = new RegisterBatchDialogHandler();
}
Expand All @@ -58,10 +57,6 @@ private Tab createTabStep(String avatarLabel, String tabLabel) {
return tabStep;
}

private void initSampleRegistrationLayout() {
sampleSpreadsheetLayout = new SampleSpreadsheetLayout();
}

/**
* Adds the provided {@link ComponentEventListener} to the list of listeners that will be notified
* if an {@link BatchRegistrationEvent} occurs within this Dialog
Expand Down Expand Up @@ -144,16 +139,22 @@ private void setTabSelectionListener() {
}

private void generateSampleRegistrationLayout() {
//We only reload the spreadsheet if the user selects an experiment and switches back in the tabSheet to select a different one
if (hasExperimentInformationChanged()) {
sampleSpreadsheetLayout.resetLayout();
}
sampleSpreadsheetLayout.setBatchName(batchInformationLayout.batchNameField.getValue());
ExperimentId selectedExperimentId = batchInformationLayout.experimentSelect.getValue()
sampleSpreadsheetLayout.setExperiment(batchInformationLayout.experimentSelect.getValue());
sampleSpreadsheetLayout.generateSampleRegistrationSheet(
batchInformationLayout.dataTypeSelection.getValue());
}

private boolean hasExperimentInformationChanged() {
ExperimentId previouslySelectedExperiment = sampleSpreadsheetLayout.getExperiment();
ExperimentId selectedExperiment = batchInformationLayout.experimentSelect.getValue()
.experimentId();
//We only reload the spreadsheet if the selected experiment was changed (or dialog closed)
if (sampleSpreadsheetLayout.getExperiment() == null || !selectedExperimentId.equals(
sampleSpreadsheetLayout.getExperiment())) {
sampleSpreadsheetLayout.setExperiment(batchInformationLayout.experimentSelect.getValue());
sampleSpreadsheetLayout.generateSampleRegistrationSheet(
batchInformationLayout.dataTypeSelection.getValue());
}
return previouslySelectedExperiment != null && !previouslySelectedExperiment.equals(
selectedExperiment);
}

private void setSubmissionListeners() {
Expand Down Expand Up @@ -200,7 +201,7 @@ public void resetAndClose() {

private void reset() {
batchInformationLayout.reset();
sampleSpreadsheetLayout.reset();
sampleSpreadsheetLayout.resetLayout();
tabStepper.setSelectedTab(batchInformationTab);
}

Expand Down

This file was deleted.

Loading

0 comments on commit db2c46e

Please sign in to comment.