All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.legyver.fenxlib.widgets.filetree.task.FileSystemWatchTaskContext Maven / Gradle / Ivy

There is a newer version: 3.0.2
Show newest version
package com.legyver.fenxlib.widgets.filetree.task;

import com.legyver.fenxlib.extensions.tuktukfx.task.CorrelatingTaskContext;
import com.legyver.fenxlib.widgets.filetree.nodes.IFileReference;
import com.legyver.fenxlib.widgets.filetree.scan.IFileWatchHandler;
import javafx.collections.ObservableList;

/**
 * Context for the {@link FileSystemWatchTask}.
 */
public class FileSystemWatchTaskContext extends CorrelatingTaskContext {

    /**
     * All known files to monitor on the filesystem
     */
    private final ObservableList knownFiles;
    /**
     * Handler to be notified of changes in the watched files on the filesystem
     */
    private final IFileWatchHandler fileWatchHandler;

    /**
     * Instantiate the task context with timing data
     * Sets the correlationId as 'File system watch'
     * @param knownFiles known files to monitor
     * @param fileWatchHandler handler to be notified of changes to the files
     */
    public FileSystemWatchTaskContext(ObservableList knownFiles, IFileWatchHandler fileWatchHandler) {
        super(1.0, "File system watch");//size doesn't actually matter since this task will run until the application shuts down
        this.knownFiles = knownFiles;
        this.fileWatchHandler = fileWatchHandler;
    }

    /**
     * Get the list of known files
     * @return list of known files
     */
    public ObservableList getKnownFiles() {
        return knownFiles;
    }

    /**
     * Get the file watch handler
     * @return the file watch handler
     */
    public IFileWatchHandler getFileWatchHandler() {
        return fileWatchHandler;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy