1
1
/*
2
2
* *****************************************************************************
3
- * Copyright (C) 2014-2022 Dennis Sheirer
3
+ * Copyright (C) 2014-2023 Dennis Sheirer
4
4
*
5
5
* This program is free software: you can redistribute it and/or modify
6
6
* it under the terms of the GNU General Public License as published by
28
28
import io .github .dsheirer .playlist .PlaylistManager ;
29
29
import io .github .dsheirer .rrapi .type .UserFeedBroadcast ;
30
30
import io .github .dsheirer .util .ThreadPool ;
31
+ import java .util .ArrayList ;
32
+ import java .util .EnumMap ;
33
+ import java .util .List ;
34
+ import java .util .Map ;
35
+ import java .util .Optional ;
31
36
import javafx .application .Platform ;
32
37
import javafx .beans .value .ChangeListener ;
33
38
import javafx .beans .value .ObservableValue ;
48
53
import javafx .scene .control .TableCell ;
49
54
import javafx .scene .control .TableColumn ;
50
55
import javafx .scene .control .TableView ;
56
+ import javafx .scene .control .Tooltip ;
51
57
import javafx .scene .control .cell .PropertyValueFactory ;
52
58
import javafx .scene .layout .HBox ;
53
59
import javafx .scene .layout .Priority ;
58
64
import org .slf4j .Logger ;
59
65
import org .slf4j .LoggerFactory ;
60
66
61
- import java .util .ArrayList ;
62
- import java .util .EnumMap ;
63
- import java .util .List ;
64
- import java .util .Map ;
65
- import java .util .Optional ;
66
-
67
67
/**
68
68
* Editor for broadcast audio stream configurations
69
69
*/
@@ -75,6 +75,7 @@ public class StreamingEditor extends SplitPane
75
75
private TableView <ConfiguredBroadcast > mConfiguredBroadcastTableView ;
76
76
private MenuButton mNewButton ;
77
77
private Button mDeleteButton ;
78
+ private Button mRefreshButton ;
78
79
private TabPane mTabPane ;
79
80
private Tab mConfigurationTab ;
80
81
private Tab mAliasTab ;
@@ -101,7 +102,7 @@ public StreamingEditor(PlaylistManager playlistManager)
101
102
refreshBroadcastifyStreams ();
102
103
103
104
VBox buttonsBox = new VBox ();
104
- buttonsBox .getChildren ().addAll (getNewButton (), getDeleteButton ());
105
+ buttonsBox .getChildren ().addAll (getNewButton (), getDeleteButton (), getRefreshButton () );
105
106
buttonsBox .setPadding (new Insets (0 , 0 , 0 , 10 ));
106
107
buttonsBox .setSpacing (10 );
107
108
@@ -231,21 +232,16 @@ private void refreshBroadcastifyStreams()
231
232
{
232
233
if (mPlaylistManager .getRadioReference ().availableProperty ().get ())
233
234
{
234
- ThreadPool .CACHED .submit (new Runnable ()
235
- {
236
- @ Override
237
- public void run ()
235
+ ThreadPool .CACHED .submit (() -> {
236
+ try
238
237
{
239
- try
240
- {
241
- List <UserFeedBroadcast > feeds = mPlaylistManager .getRadioReference ().getService ().getUserFeeds ();
242
- mBroadcastifyFeeds .clear ();
243
- mBroadcastifyFeeds .addAll (feeds );
244
- }
245
- catch (Throwable t )
246
- {
247
- mLog .error ("Unable to refresh broadcastify stream configuration(s)" );
248
- }
238
+ List <UserFeedBroadcast > feeds = mPlaylistManager .getRadioReference ().getService ().getUserFeeds ();
239
+ mBroadcastifyFeeds .clear ();
240
+ mBroadcastifyFeeds .addAll (feeds );
241
+ }
242
+ catch (Throwable t )
243
+ {
244
+ mLog .error ("Unable to refresh broadcastify stream configuration(s)" );
249
245
}
250
246
});
251
247
}
@@ -348,6 +344,22 @@ private MenuButton getNewButton()
348
344
return mNewButton ;
349
345
}
350
346
347
+ /**
348
+ * Refresh broadcastify feeds.
349
+ * @return button to refresh.
350
+ */
351
+ private Button getRefreshButton ()
352
+ {
353
+ if (mRefreshButton == null )
354
+ {
355
+ mRefreshButton = new Button ("Refresh" );
356
+ mRefreshButton .setTooltip (new Tooltip ("Refresh streams available from Broadcastify" ));
357
+ mRefreshButton .setOnAction (event -> refreshBroadcastifyStreams ());
358
+ }
359
+
360
+ return mRefreshButton ;
361
+ }
362
+
351
363
private Button getDeleteButton ()
352
364
{
353
365
if (mDeleteButton == null )
0 commit comments