Package PamUtils.worker.filelist
Class FileListWorker<T extends File>
java.lang.Object
PamUtils.worker.filelist.FileListWorker<T>
- Type Parameters:
T
-
- All Implemented Interfaces:
PamWorkWrapper<FileListData<T>>
- Direct Known Subclasses:
WavListWorker
public abstract class FileListWorker<T extends File>
extends Object
implements PamWorkWrapper<FileListData<T>>
Class to list files in one or more directories.
- Author:
- Doug Gillespie
-
Constructor Summary
ConstructorDescriptionFileListWorker
(FileListUser<T> fileListUser, String fileType) FileListWorker
(FileListUser<T> fileListUser, PamFileFilter fileFilter) -
Method Summary
Modifier and TypeMethodDescriptionboolean
allFilesTask
(FileListData<T> fileList) Called once the main list of files has been made so that additional operations can be applied to every file, such as checking sample rates, etc.abstract T
createFile
(File baseFile) Creates the file.boolean
eachFileTask
(T aFile) Called every time a file is discovered in the main search.final PamWorker<FileListData<T>>
makeFileListProcess
(String[] rootList, boolean subFolders, boolean useOldIfPossible) Create a file list worker.final FileListData<T>
runBackgroundTask
(PamWorker<FileListData<T>> pamWorker) Run the background task which is in it's own threadfinal void
startFileListProcess
(Window parentFrame, String[] rootList, boolean subFolders, boolean useOldIfPossible) Make a list from multiple files or root directories.final void
startFileListProcess
(Window parentFrame, String root, boolean subFolders, boolean useOldIfPossible) Make a list for a single file or root directoryfinal void
taskFinished
(FileListData<T> result) Called when the background task completes.
-
Constructor Details
-
FileListWorker
-
FileListWorker
-
-
Method Details
-
startFileListProcess
public final void startFileListProcess(Window parentFrame, String root, boolean subFolders, boolean useOldIfPossible) Make a list for a single file or root directory- Parameters:
parentFrame
-root
-subFolders
-useOldIfPossible
-
-
startFileListProcess
public final void startFileListProcess(Window parentFrame, String[] rootList, boolean subFolders, boolean useOldIfPossible) Make a list from multiple files or root directories.- Parameters:
parentFrame
-rootList
-subFolders
-useOldIfPossible
-
-
makeFileListProcess
public final PamWorker<FileListData<T>> makeFileListProcess(String[] rootList, boolean subFolders, boolean useOldIfPossible) Create a file list worker.- Parameters:
rootList
- - the list of folders to search insubFolders
- - true to look for files in sub foldersuseOldIfPossible
-
-
runBackgroundTask
Description copied from interface:PamWorkWrapper
Run the background task which is in it's own thread- Specified by:
runBackgroundTask
in interfacePamWorkWrapper<T extends File>
- Parameters:
pamWorker
- reference to the main worker manager. Make repeated calls to pamWorker.update to update progress in the dialog- Returns:
- the value which will be passed to taskFinished
-
createFile
Creates the file. Can override to make enhanced file types, e.g. with the wav file audioinfo.- Parameters:
filePath
-- Returns:
-
eachFileTask
Called every time a file is discovered in the main search. Can check things like consistency of sample rate in each file as progress continues.- Parameters:
aFile
-- Returns:
- true if processing can continue
-
allFilesTask
Called once the main list of files has been made so that additional operations can be applied to every file, such as checking sample rates, etc.- Parameters:
fileList
-- Returns:
- true if all OK.
-
taskFinished
Description copied from interface:PamWorkWrapper
Called when the background task completes.- Specified by:
taskFinished
in interfacePamWorkWrapper<T extends File>
- Parameters:
result
- result returned by runBackgroundTask or null if an exception occurred.
-