Skip to content

Commit

Permalink
use the FileRemovedListener
Browse files Browse the repository at this point in the history
  • Loading branch information
KochTobi committed Sep 17, 2024
1 parent ca8b126 commit dcc5cd9
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,8 @@ public MeasurementMetadataUploadDialog(MeasurementValidationService measurementV
upload.addSucceededListener(this::onUploadSucceeded);
upload.addFileRejectedListener(this::onFileRejected);
upload.addFailedListener(this::onUploadFailed);
upload.addFileRemovedListener(this::onFileRemoved);
setEscAction(this::onCanceled);
// Synchronise the Vaadin upload component with the purchase list display
// When a file is removed from the upload component, we also want to remove it properly from memory
// and from any additional display
upload.getElement().addEventListener("file-remove", this::onFileRemoved)
.addEventData(VAADIN_FILENAME_EVENT);
addClassName("measurement-upload-dialog");

}
Expand All @@ -135,11 +131,8 @@ public MODE getMode() {
return mode;
}

private void onFileRemoved(DomEvent domEvent) {
JsonObject jsonObject = domEvent.getEventData();
var fileName = jsonObject.getString(VAADIN_FILENAME_EVENT);
removeFile(fileName);

private void onFileRemoved(FileRemovedEvent fileRemovedEvent) {
removeFile(fileRemovedEvent.getFileName());
}

private void showFile(MeasurementFileItem measurementFileItem) {
Expand Down

0 comments on commit dcc5cd9

Please sign in to comment.