com.pixelmed.dicom

## Class MediaImporter.MediaImporterWithFileChooserDialogThread

- java.lang.Object
- - com.pixelmed.dicom.MediaImporter.MediaImporterWithFileChooserDialogThread

- All Implemented Interfaces:
    java.lang.Runnable
  Enclosing class:
    MediaImporter

      public static class MediaImporter.MediaImporterWithFileChooserDialogThread
      extends java.lang.Object
      implements java.lang.Runnable

  A class that implements `Runnable` so that it can be invoked by `EventQueue.invokeAndWait()`.

  This is needed, for example, to call from a main() method, since the file chooser and logger dialogs and progress bar methods used MUST be invoked on the AWT Event Dispatch Thread.

- - ### Constructor Summary

    Constructors
    Constructor and Description

    `MediaImporterWithFileChooserDialogThread(java.lang.Class mediaImporterClass, java.lang.String mediaDirectoryPath, java.lang.String loggerTitleMessage, int loggerWidth, int loggerHeight, boolean exitApplicationOnLoggerClose, java.awt.Component parent, javax.swing.JProgressBar progressBar)`
    Pop up a file chooser dialog that allows the user to specify the location of the DICOMDIR file, or the parent folder (for example, the drive or volume) in which the DICOMDIR file is located, and then import the referenced files.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `run()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MediaImporterWithFileChooserDialogThread

          public MediaImporterWithFileChooserDialogThread(java.lang.Class mediaImporterClass,
                                                          java.lang.String mediaDirectoryPath,
                                                          java.lang.String loggerTitleMessage,
                                                          int loggerWidth,
                                                          int loggerHeight,
                                                          boolean exitApplicationOnLoggerClose,
                                                          java.awt.Component parent,
                                                          javax.swing.JProgressBar progressBar)

      Pop up a file chooser dialog that allows the user to specify the location of the DICOMDIR file, or the parent folder (for example, the drive or volume) in which the DICOMDIR file is located, and then import the referenced files.

      Will be positioned relative to the parent component (for example, centered over the component) if specified, else placed in a look-and-feel-dependent position such as the center of the screen if null.

      Will also pop up a logger dialog box, which describes the progress.

      Will update a progress bar, if one is supplied.

      Uses the specified sub-class of `MediaImporter`, which will have its `doSomethingWithDicomFileOnMedia()` method overridden to do something useful.

      Parameters:
        `mediaImporterClass` - the class of `MediaImporter` to use, which needs to support the constructor `MediaImporter(String,MessageLogger,JProgressBar)`
        `mediaDirectoryPath` - where to begin looking for the DICOMDIR and DICOM files
        `loggerTitleMessage` - for the title bar of the dialog box
        `loggerWidth` - initial width of the resizeable dialog box
        `loggerHeight` - initial height of the resizeable dialog box
        `exitApplicationOnLoggerClose` - if true, when the logger dialog box is closed (X-d out), will exit the application with success status
        `parent` - the parent component of the dialog; can be `null`
        `progressBar` - where to update progress as files are read (may be `null` for no progress bar)

  - ### Method Detail

    - #### run

          public void run()

      Specified by:
        `run` in interface `java.lang.Runnable`