Class DownloadDialog


  • public abstract class DownloadDialog
    extends java.lang.Object
    Provides a dialogue that disposes of a URL by downloading the resource to a location specified interactively by the user.
    Since:
    15 Jun 2018
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      DownloadDialog()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract java.io.File chooseFileEdt()
      Acquires a destination File for a downloaded resource by interacting with the user.
      static DownloadDialog createSwingDialog​(java.awt.Component parent)
      Returns an instance of this class based on a Swing JFileChooser.
      static DownloadDialog createSystemDialog​(java.awt.Component parent)
      Returns an instance of this class based on an AWT FileDialog.
      Outcome userDownload​(java.net.URL url)
      Downloads the resource from a given URL to a file selected interactively by the user.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DownloadDialog

        public DownloadDialog()
    • Method Detail

      • chooseFileEdt

        public abstract java.io.File chooseFileEdt()
        Acquires a destination File for a downloaded resource by interacting with the user. This method is invoked on the Event Dispatch Thread.
        Returns:
        user-selected destination file, or null if the operation is cancelled
      • userDownload

        public Outcome userDownload​(java.net.URL url)
        Downloads the resource from a given URL to a file selected interactively by the user. This method is not invoked on the Event Dispatch Thread.
        Parameters:
        url - location of resource to download
        Returns:
        operation outcome
      • createSystemDialog

        public static DownloadDialog createSystemDialog​(java.awt.Component parent)
        Returns an instance of this class based on an AWT FileDialog. This provides less consistency, but possibly tighter system interaction.
        Parameters:
        parent - parent component
        Returns:
        dialog
      • createSwingDialog

        public static DownloadDialog createSwingDialog​(java.awt.Component parent)
        Returns an instance of this class based on a Swing JFileChooser. This provides a GUI that is consistent between different platforms.
        Parameters:
        parent - parent component
        Returns:
        dialog