use of com.frostwire.alexandria.PlaylistItem in project frostwire by frostwire.
the class LibraryFilesTableTransferHandler method importData.
@Override
public boolean importData(TransferSupport support) {
if (!canImport(support, false)) {
return fallbackTransferHandler.importData(support);
}
try {
Transferable transferable = support.getTransferable();
if (DNDUtils.contains(transferable.getTransferDataFlavors(), LibraryPlaylistsTableTransferable.ITEM_ARRAY)) {
PlaylistItem[] playlistItems = LibraryUtils.convertToPlaylistItems((LibraryPlaylistsTableTransferable.Item[]) transferable.getTransferData(LibraryPlaylistsTableTransferable.ITEM_ARRAY));
LibraryUtils.createNewPlaylist(playlistItems);
} else {
File[] files = DNDUtils.getFiles(support.getTransferable());
if (files.length == 1 && files[0].getAbsolutePath().endsWith(".m3u")) {
LibraryUtils.createNewPlaylist(files[0]);
} else {
LibraryUtils.createNewPlaylist(files);
}
}
} catch (Throwable e) {
return fallbackTransferHandler.importData(support);
}
return false;
}
use of com.frostwire.alexandria.PlaylistItem in project frostwire by frostwire.
the class LibraryPlaylists method getPlaylistPopupMenu.
private SkinPopupMenu getPlaylistPopupMenu(Playlist playlist) {
SkinPopupMenu playlistPopup = new SkinPopupMenu();
final List<PlaylistItem> items = playlist.getItems();
boolean playlistEmpty = items == null || items.size() == 0;
playlistPopup.add(new SkinMenuItem(actions[REFRESH_ACTION]));
if (!playlistEmpty) {
playlistPopup.add(new SkinMenuItem(actions[REFRESH_ID3_TAGS_ACTION]));
}
playlistPopup.addSeparator();
playlistPopup.add(new SkinMenuItem(actions[RENAME_ACTION]));
playlistPopup.add(new SkinMenuItem(actions[DELETE_ACTION]));
if (!playlistEmpty) {
playlistPopup.add(new SkinMenuItem(actions[CLEANUP_PLAYLIST_ACTION]));
}
playlistPopup.addSeparator();
playlistPopup.add(new SkinMenuItem(actions[IMPORT_TO_PLAYLIST_ACTION]));
playlistPopup.add(new SkinMenuItem(actions[IMPORT_TO_NEW_PLAYLIST_ACTION]));
addExportActionsToPopupMenu(playlistPopup, playlistEmpty);
playlistPopup.addSeparator();
playlistPopup.add(new SkinMenuItem(actions[CONFIGURE_OPTIONS_ACTION]));
return playlistPopup;
}
use of com.frostwire.alexandria.PlaylistItem in project frostwire by frostwire.
the class LibraryPlaylists method getStarredPlaylistPopupMenu.
private SkinPopupMenu getStarredPlaylistPopupMenu(Playlist playlist) {
SkinPopupMenu starredPlaylistPopupMenu = new SkinPopupMenu();
final List<PlaylistItem> items = playlist.getItems();
boolean playlistEmpty = items == null || items.size() == 0;
if (!playlistEmpty) {
starredPlaylistPopupMenu.add(new SkinMenuItem(actions[CLEANUP_PLAYLIST_ACTION]));
}
starredPlaylistPopupMenu.add(new SkinMenuItem(actions[REFRESH_ACTION]));
if (!playlistEmpty) {
starredPlaylistPopupMenu.add(new SkinMenuItem(actions[REFRESH_ID3_TAGS_ACTION]));
}
starredPlaylistPopupMenu.addSeparator();
starredPlaylistPopupMenu.add(new SkinMenuItem(actions[IMPORT_TO_PLAYLIST_ACTION]));
addExportActionsToPopupMenu(starredPlaylistPopupMenu, playlistEmpty);
starredPlaylistPopupMenu.addSeparator();
starredPlaylistPopupMenu.add(new SkinMenuItem(actions[CONFIGURE_OPTIONS_ACTION]));
return starredPlaylistPopupMenu;
}
use of com.frostwire.alexandria.PlaylistItem in project frostwire by frostwire.
the class LibraryPlaylistsTableMediator method removeSelection.
/**
* Delete selected items from a playlist (not from disk)
*/
public void removeSelection() {
LibraryPlaylistsTableDataLine[] lines = getSelectedLibraryLines();
if (currentPlaylist != null && currentPlaylist.getId() == LibraryDatabase.STARRED_PLAYLIST_ID) {
for (LibraryPlaylistsTableDataLine line : lines) {
PlaylistItem playlistItem = line.getInitializeObject();
playlistItem.setStarred(false);
playlistItem.save(true);
}
LibraryMediator.instance().getLibraryExplorer().refreshSelection();
} else {
for (LibraryPlaylistsTableDataLine line : lines) {
PlaylistItem playlistItem = line.getInitializeObject();
playlistItem.delete();
}
LibraryMediator.instance().getLibraryPlaylists().reselectPlaylist();
clearSelection();
}
super.removeSelection();
}
use of com.frostwire.alexandria.PlaylistItem in project frostwire by frostwire.
the class LibraryPlaylistsTableMediator method createLyricsPanel.
private JPanel createLyricsPanel(String lyrics) {
int[] sel = TABLE.getSelectedRows();
String songTitle = "";
if (sel.length == 1) {
PlaylistItem playlistItem = currentPlaylist.getItems().get(sel[0]);
songTitle = playlistItem.getTrackTitle() + " ";
}
JPanel lyricsPanel = new JPanel(new MigLayout("fillx, wrap 1, insets 0", "[]"));
lyricsPanel.add(new JLabel(songTitle + I18n.tr("Lyrics")), "wrap");
JTextArea lyricsTextArea = new JTextArea(lyrics);
lyricsTextArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(lyricsTextArea);
Dimension d = new Dimension(500, 210);
scrollPane.setPreferredSize(d);
scrollPane.setMaximumSize(d);
scrollPane.setMaximumSize(d);
lyricsPanel.add(scrollPane, "growx");
return lyricsPanel;
}
Aggregations