public class SoundUrlHelper
extends java.lang.Object
Helper class for URL-based choosers. (Currently only used for the URL chooser in the sound parser)
Modifier and Type | Field and Description |
---|---|
private static MidicaButton |
btnDelCacheAll |
private static MidicaButton |
btnDelCacheOne |
private static MidicaButton |
btnDownload |
private static javax.swing.JPanel[] |
cacheAreas |
private static java.lang.String |
cacheFileRegex |
private static javax.swing.JCheckBox |
cbxDelCacheAll |
private static javax.swing.JCheckBox |
cbxDelCacheOne |
static java.lang.String |
CMD_URL_CHOSEN |
private static javax.swing.JTextField |
fldUrl |
private static javax.swing.JLabel |
lblCachedAll |
private static javax.swing.JLabel |
lblCachedOne |
private static java.lang.String |
url |
Constructor and Description |
---|
SoundUrlHelper() |
Modifier and Type | Method and Description |
---|---|
static javax.swing.JComponent |
createCacheArea(boolean allUrls)
Creates the area for controlling one cache type (chosen url or whole cache).
|
static javax.swing.JComponent |
createDelCacheArea(boolean allUrls)
Creates the DELETE part sub area for one cache type (chosen url or whole cache).
|
static javax.swing.JComponent |
createUrlForm(UiController controller,
FileSelector selector)
Creates a form where a URL can be typed in.
|
static void |
displayCacheInfo()
(Re)calculates and the cache status and updates the according info labels.
|
private static java.io.File |
getCachedUrl()
Calculates the cache file path of the url in the text field.
|
static javax.swing.JCheckBox |
getCheckBox(boolean allUrls)
Returns one of the delete-cache checkboxes.
|
static MidicaButton |
getDeleteCacheBtn(boolean allUrls)
Returns one of the delete-cache buttons.
|
static MidicaButton |
getDownloadButton()
Returns the download button.
|
static java.lang.String |
getSoundUrl()
Returns the chosen URL, if available.
|
static javax.swing.JTextField |
getUrlField()
Returns the url text field.
|
static void |
setUrl(java.lang.String url)
Writes the url into the text field.
|
public static final java.lang.String CMD_URL_CHOSEN
private static final java.lang.String cacheFileRegex
private static java.lang.String url
private static javax.swing.JTextField fldUrl
private static javax.swing.JCheckBox cbxDelCacheOne
private static javax.swing.JCheckBox cbxDelCacheAll
private static MidicaButton btnDelCacheOne
private static MidicaButton btnDelCacheAll
private static javax.swing.JLabel lblCachedOne
private static javax.swing.JLabel lblCachedAll
private static MidicaButton btnDownload
private static javax.swing.JPanel[] cacheAreas
public static java.lang.String getSoundUrl()
Returns the chosen URL, if available.
public static javax.swing.JComponent createUrlForm(UiController controller, FileSelector selector)
Creates a form where a URL can be typed in.
controller
- listener for URL choosing eventsselector
- file selector windowpublic static javax.swing.JComponent createCacheArea(boolean allUrls)
Creates the area for controlling one cache type (chosen url or whole cache). Contains: info label and sub area (with checkbox and button).
allUrls
- true for the whole cache, false for the chosen URLpublic static javax.swing.JComponent createDelCacheArea(boolean allUrls)
Creates the DELETE part sub area for one cache type (chosen url or whole cache). Contains: checkbox and button.
allUrls
- true for the whole cache, false for the chosen URLpublic static void setUrl(java.lang.String url)
Writes the url into the text field. Needed on startup, when remember_sound is set.
url
- the url to be set.public static javax.swing.JTextField getUrlField()
Returns the url text field. Needed for the initialization of key bindings.
public static MidicaButton getDownloadButton()
Returns the download button. Needed for the initialization of key bindings.
public static javax.swing.JCheckBox getCheckBox(boolean allUrls)
Returns one of the delete-cache checkboxes.
allUrls
- true to get the checkbox to delete ALL urls, false for ONE url.public static MidicaButton getDeleteCacheBtn(boolean allUrls)
Returns one of the delete-cache buttons.
allUrls
- true to get the button to delete ALL urls, false for ONE url.public static void displayCacheInfo()
(Re)calculates and the cache status and updates the according info labels. Unselects the checkboxes.
The info to be displayed:
private static java.io.File getCachedUrl() throws java.security.NoSuchAlgorithmException
Calculates the cache file path of the url in the text field.
java.security.NoSuchAlgorithmException