src/main/java/org/openjfx/ImageListHandlersController.java
@FXML
    public void onPickImageAction(Event event) {

        List<File> files = App.openFileChooser();

        if (files == null) {
            return;
        }

        List<File> validImageFiles = ImageUtil.filterValidImageFiles(files);

        validImageFiles.forEach((file) -> {
            if (imageState.imageFileList.contains(file)) {
                imageState.imageFileList.remove(file);
                imageState.fileImageContainerHashMap.remove(file);
            }

            imageState.imageFileList.add(file);

        });

        imageState.imageWrapperList = imageState.imageWrapperList.stream().filter(
                imageWrapper -> !validImageFiles.contains(imageWrapper.file)
        ).collect(Collectors.toCollection(ArrayList::new));

        this.onImageFileListChanged();

    }
/**
     * When pick images done, the image list would be updated.
     *
     * For existing images (files selected), their states would be cleared (say marked for deletion)
     * if they are selected again
     * @param event
     */
When pick images done, the image list would be updated.
For existing images (files selected), their states would be cleared (say marked for deletion)
if they are selected again
@param event
When pick images done the image list would be updated . For existing images ( files selected ) their states would be cleared ( say marked for deletion ) if they are selected again @param event
@FXML
    public void onPickImageAction(Event event) {
        List<File> files = App.openFileChooser();
        if (files == null) {
            return;
        }
        List<File> validImageFiles = ImageUtil.filterValidImageFiles(files);
        validImageFiles.forEach((file) -> {
            if (imageState.imageFileList.contains(file)) {
                imageState.imageFileList.remove(file);
                imageState.fileImageContainerHashMap.remove(file);
            }
            imageState.imageFileList.add(file);
        });
        imageState.imageWrapperList = imageState.imageWrapperList.stream().filter(
                imageWrapper -> !validImageFiles.contains(imageWrapper.file)
        ).collect(Collectors.toCollection(ArrayList::new));
        this.onImageFileListChanged();
    }
@ FXML public void onPickImageAction ( Event event ) { List < File > files = App . openFileChooser ( ) ; if ( files == null ) { return ; } List < File > validImageFiles = ImageUtil . filterValidImageFiles ( files ) ; validImageFiles . forEach ( ( file ) -> { if ( imageState . imageFileList . contains ( file ) ) { imageState . imageFileList . remove ( file ) ; imageState . fileImageContainerHashMap . remove ( file ) ; } imageState . imageFileList . add ( file ) ; } ) ; imageState . imageWrapperList = imageState . imageWrapperList . stream ( ) . filter ( imageWrapper -> ! validImageFiles . contains ( imageWrapper . file ) ) . collect ( Collectors . toCollection ( ArrayList :: new ) ) ; this . onImageFileListChanged ( ) ; }
When pick images done, the image list would be updated.
When pick images done the image list would be updated .