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 Details

  • 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 in
      subFolders - - true to look for files in sub folders
      useOldIfPossible -
    • runBackgroundTask

      public final FileListData<T> runBackgroundTask(PamWorker<FileListData<T>> pamWorker)
      Description copied from interface: PamWorkWrapper
      Run the background task which is in it's own thread
      Specified by:
      runBackgroundTask in interface PamWorkWrapper<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
    • finaliseFileList

      public void finaliseFileList(PamWorker<FileListData<T>> pamWorker, FileListData<T> newFileList)
      Do any final jobs to the file list. This is needed in listing of xwav files since we have to go in and get the chunks. Might as well do the start times and audio formats for all files while we're at it to save time later. By doing it here in the progress bar, we can at least show progress sensibly.
      Parameters:
      pamWorker -
      newFileList -
    • createFile

      public abstract T createFile(File baseFile)
      Creates the file. Can override to make enhanced file types, e.g. with the wav file audioinfo.
      Parameters:
      filePath -
      Returns:
    • eachFileTask

      public boolean eachFileTask(T aFile)
      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

      public boolean 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.
      Parameters:
      fileList -
      Returns:
      true if all OK.
    • taskFinished

      public final void taskFinished(FileListData<T> result)
      Description copied from interface: PamWorkWrapper
      Called when the background task completes.
      Specified by:
      taskFinished in interface PamWorkWrapper<T extends File>
      Parameters:
      result - result returned by runBackgroundTask or null if an exception occurred.