Example #1
0
 void menuAddToPlaylist() {
   Track t = getSelectedTrack();
   if (t == null) {
     return;
   }
   ChoiceDialog<Playlist> dialog = playlistSelectionDialog(playlistsView.getItems());
   Optional<Playlist> result = dialog.showAndWait();
   result.ifPresent(playlist -> addToPlaylist(t, playlist));
 }
Example #2
0
 private ChoiceDialog<Playlist> playlistSelectionDialog(List<Playlist> items) {
   ChoiceDialog<Playlist> dialog = new ChoiceDialog<>(null, items);
   dialog.setTitle(res.getString("add_to"));
   dialog.setGraphic(null);
   ((Stage) dialog.getDialogPane().getScene().getWindow()).getIcons().addAll(logoImages);
   dialog.setHeaderText(res.getString("choose_playlist"));
   dialog.getDialogPane().getStylesheets().add("/styles/dialogs.css");
   if (rememberedPlaylist != null) dialog.setSelectedItem(rememberedPlaylist);
   return dialog;
 }