Package uk.ac.starlink.topcat

# Class DownloadDialog

java.lang.Object
uk.ac.starlink.topcat.DownloadDialog

public abstract class DownloadDialog extends 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

Modifier and Type
Method
Description
`abstract File`
`chooseFileEdt()`
Acquires a destination File for a downloaded resource by interacting with the user.
`static DownloadDialog`
`createSwingDialog(Component parent)`
Returns an instance of this class based on a Swing JFileChooser.
`static DownloadDialog`
`createSystemDialog(Component parent)`
Returns an instance of this class based on an AWT FileDialog.
`Outcome`
`userDownload(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 Details

### DownloadDialog

public DownloadDialog()

## Method Details

### chooseFileEdt

public abstract 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(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(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(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