Remove file uploaded (vaadin-upload)

We have provided a solution to this problem although with some hacking. We use “file-remove” event
We create component and remove it in a listener

upload.addSucceededListener(event -> {

	if (component != null) {
		vlowerLayout.remove(component);

	}
	component = createComponent(event.getMIMEType(), event.getFileName(), buffer.getInputStream());
	if (component instanceof Image) {
		upload.getElement().addEventListener("file-remove", new DomEventListener() {
			@Override
			public void handleEvent(DomEvent arg0) {
				component.setVisible(false);
			}
		});
		// upload.getElement().addEventData("event.detail.file.name");
	}
	p = new HtmlComponent(Tag.H3);
	p.getElement().setText(event.getFileName());
	vlowerLayout.add(component);
});

it took us some hacking around but the key here is the “file-remove” event. As far as I remember
we could not get it to work with the other remove listeners