Package com.tagtraum.audiokern
Class ReadOnlyPlayList
- java.lang.Object
-
- com.tagtraum.audiokern.ReadOnlyPlayList
-
- All Implemented Interfaces:
PlayList,SyncTempoAware,ListModel
- Direct Known Subclasses:
AmazonPlayList,BeatportPlayList
public abstract class ReadOnlyPlayList extends Object implements PlayList
Read-only base class forPlayList. All write methods will throwUnsupportedOperationExceptions.- Author:
- Hendrik Schreiber
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.tagtraum.audiokern.PlayList
PlayList.Kind, PlayList.SortDirection, PlayList.SubstringFilterProperty
-
-
Constructor Summary
Constructors Constructor Description ReadOnlyPlayList()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSongIds(int filteredIndex, List<Long> songIds)Adds the given songs at the given (filtered) index.voidaddSongIds(List<Long> songIds)Adds the songs referenced by the given ids to this playlist.voidaddSongs(int filteredIndex, String... locations)Adds songs to the playlist using only their locations.
Depending on the library implementation, the insert index may be ignored.voidaddSongs(int filteredIndex, List<AudioSong> songs)Adds the given songs at the given (filtered) index.booleancanAddItem()Indicates whether we can add items to this playlist.booleancanInsertItem()Indicates whether we can insert items into this playlist.<T> TgetImplementation(Class<T> klass)PlayListobjects are sometimes implemented by an object that acts as a facade to other objects.booleanisEditable()Is this playlist editable? Only playlists created by users are editable.booleanisItemsEditable()Are the contained items editable? E.g., items are not editable, if they are only available online, as the metadata of some stream or online database cannot be changed locally.intmoveSongs(int[] fromIndices, int toIndex)Moves songs.voidremoveAllSongs()Removes all songs from this playlist.booleanremoveSongs(int... filteredIndex)Removes the song with the given (filtered) index from the playlist.booleanremoveSongs(Collection<Long> ids, boolean completelyDeleteSong)Removes the songs with the given ids from the list.voidsetAllItems(boolean allItems)voidsetAudiobooks(boolean audiobooks)voidsetChildPlayLists(List<PlayList> childPlayLists)voidsetDescription(String description)voidsetFolder(boolean folder)voidsetGeniusTrackID(int geniusTrackID)voidsetId(Long id)Sets this list's id.voidsetLiking(AudioSong.Liking liking)voidsetMaster(boolean master)voidsetMovies(boolean movies)voidsetMusic(boolean music)voidsetName(String name)voidsetParentId(Long parentId)Sets the parent id.voidsetParentPlayList(PlayList parentPlayList)voidsetPodcasts(boolean podcasts)voidsetPurchasedMusic(boolean purchasedMusic)voidsetSmartCriteria(String smartCriteria)voidsetSmartInfo(String smartInfo)voidsetSongIds(List<Long> songIds)Removes all songs from this playlist and replaces them with song connected to the given ids.voidsetSongs(List<AudioSong> songs)Removes all songs from this playlist and replaces them with the given songs.voidsetSpecialPlayListInfo(SpecialPlayListInfo specialPlayListInfo)voidsetTvShows(boolean tvShows)voidsetVideos(boolean videos)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.swing.ListModel
addListDataListener, getElementAt, getSize, removeListDataListener
-
Methods inherited from interface com.tagtraum.audiokern.PlayList
addPropertyChangeListener, addPropertyChangeListener, contains, contains, countSongs, filteredIndices, filteredListIterator, getChildPlayLists, getDescription, getDistinguishedKind, getFileSize, getFilteredSongIds, getFilteredSongs, getGeniusTrackID, getId, getIdAt, getIndexedSongIds, getLiking, getName, getParentId, getParentPlayList, getPlayListPath, getSmartCriteria, getSmartInfo, getSong, getSongIds, getSongIds, getSongs, getSongs, getSongsOrderedBy, getSongsOrderedBy, getSongsOrderedBy, getSortColumnProperty, getSortDirection, getSortProperties, getSortProperty, getSpecialPlayListInfo, getSpecialPlayListInfoId, getSubstringFilter, getSubstringFilterProperty, getSyncTempo, getTotalTime, getUnfilteredSize, getUnfilteredTime, indexOf, indexOf, isAggregateDataAvailable, isAllItems, isAudiobooks, isFolder, isGeniusPlaylist, isLibrary, isMaster, isMovies, isMusic, isParentAFolder, isPodcasts, isPurchasedMusic, isSmartPlaylist, isSpecialPlayList, isTvShows, isUserPlaylist, isVideos, removePropertyChangeListener, removeSongs, setDistinguishedKind, setSortColumnProperty, setSortDirection, setSortProperties, setSubstringFilter, setSyncTempo, unfilteredIndices
-
-
-
-
Method Detail
-
getImplementation
public <T> T getImplementation(Class<T> klass)
Description copied from interface:PlayListPlayListobjects are sometimes implemented by an object that acts as a facade to other objects. For example, this could be a proxy for an AppleScript iTunes object or a persistent object that is stored in a local database via Hibernate. While normal calls to an object implementing this interface are routed according to some internal logic, using one of the actual implementation classes allows you precise control over what your call does.Note to plugin developers: It is hardly ever a good idea to exercise this control, unless you know exactly what you are doing. :-)
- Specified by:
getImplementationin interfacePlayList- Type Parameters:
T- implementation class- Parameters:
klass- class implementing PlayList- Returns:
- object of the desired type or
null, if such an object is not available - See Also:
AudioSong.getImplementation(Class)
-
setId
public void setId(Long id)
Description copied from interface:PlayListSets this list's id.- Specified by:
setIdin interfacePlayList- Parameters:
id- id- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setParentId
public void setParentId(Long parentId)
Description copied from interface:PlayListSets the parent id.- Specified by:
setParentIdin interfacePlayList- Parameters:
parentId- id- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setSpecialPlayListInfo
public void setSpecialPlayListInfo(SpecialPlayListInfo specialPlayListInfo)
- Specified by:
setSpecialPlayListInfoin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setAudiobooks
public void setAudiobooks(boolean audiobooks)
Description copied from interface:PlayList- Specified by:
setAudiobooksin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setMovies
public void setMovies(boolean movies)
- Specified by:
setMoviesin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setMusic
public void setMusic(boolean music)
Description copied from interface:PlayList- Specified by:
setMusicin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setTvShows
public void setTvShows(boolean tvShows)
Description copied from interface:PlayList- Specified by:
setTvShowsin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setPodcasts
public void setPodcasts(boolean podcasts)
Description copied from interface:PlayList- Specified by:
setPodcastsin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setChildPlayLists
public void setChildPlayLists(List<PlayList> childPlayLists)
- Specified by:
setChildPlayListsin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setParentPlayList
public void setParentPlayList(PlayList parentPlayList)
- Specified by:
setParentPlayListin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setName
public void setName(String name)
- Specified by:
setNamein interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setDescription
public void setDescription(String description)
- Specified by:
setDescriptionin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setLiking
public void setLiking(AudioSong.Liking liking)
- Specified by:
setLikingin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setMaster
public void setMaster(boolean master)
- Specified by:
setMasterin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setGeniusTrackID
public void setGeniusTrackID(int geniusTrackID)
- Specified by:
setGeniusTrackIDin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setAllItems
public void setAllItems(boolean allItems)
- Specified by:
setAllItemsin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setSmartInfo
public void setSmartInfo(String smartInfo)
- Specified by:
setSmartInfoin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setSmartCriteria
public void setSmartCriteria(String smartCriteria)
- Specified by:
setSmartCriteriain interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setVideos
public void setVideos(boolean videos)
- Specified by:
setVideosin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setSongs
public void setSongs(List<AudioSong> songs)
Description copied from interface:PlayListRemoves all songs from this playlist and replaces them with the given songs. If the songs are not in your library yet, corresponding entries in the database are created.- Specified by:
setSongsin interfacePlayList- Parameters:
songs- songs- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setSongIds
public void setSongIds(List<Long> songIds)
Description copied from interface:PlayListRemoves all songs from this playlist and replaces them with song connected to the given ids.- Specified by:
setSongIdsin interfacePlayList- Parameters:
songIds- song ids- Throws:
UnsupportedOperationException- as this implementation is read-only
-
addSongIds
public void addSongIds(List<Long> songIds)
Description copied from interface:PlayListAdds the songs referenced by the given ids to this playlist.- Specified by:
addSongIdsin interfacePlayList- Parameters:
songIds- song ids- Throws:
UnsupportedOperationException- as this implementation is read-only
-
addSongs
public void addSongs(int filteredIndex, String... locations)Description copied from interface:PlayListAdds songs to the playlist using only their locations.
Depending on the library implementation, the insert index may be ignored. If it is ignored, the songs will be appended at the end (this is the case for iTunes libraries).- Specified by:
addSongsin interfacePlayList- Parameters:
filteredIndex- filtered index, set this to-1, if you just want to add the song to the endlocations- file or URL- Throws:
UnsupportedOperationException- as this implementation is read-only- See Also:
AudioSongLocation.getLocation()
-
addSongs
public void addSongs(int filteredIndex, List<AudioSong> songs)Description copied from interface:PlayListAdds the given songs at the given (filtered) index.- Specified by:
addSongsin interfacePlayList- Parameters:
filteredIndex- filtered indexsongs- songs- Throws:
UnsupportedOperationException- as this implementation is read-only
-
addSongIds
public void addSongIds(int filteredIndex, List<Long> songIds)Description copied from interface:PlayListAdds the given songs at the given (filtered) index.- Specified by:
addSongIdsin interfacePlayList- Parameters:
filteredIndex- filtered indexsongIds- songs- Throws:
UnsupportedOperationException- as this implementation is read-only
-
moveSongs
public int moveSongs(int[] fromIndices, int toIndex)Description copied from interface:PlayListMoves songs. All indices have to be filtered.- Specified by:
moveSongsin interfacePlayList- Parameters:
fromIndices- indices to move songs fromtoIndex- index to move the songs to- Returns:
- new lead index of the moved songs
- Throws:
UnsupportedOperationException- as this implementation is read-only
-
removeSongs
public boolean removeSongs(int... filteredIndex)
Description copied from interface:PlayListRemoves the song with the given (filtered) index from the playlist. If this is a library, the file is also deleted.- Specified by:
removeSongsin interfacePlayList- Parameters:
filteredIndex- filtered indices- Returns:
- true, if the system was able to find and remove the given song
- Throws:
UnsupportedOperationException- as this implementation is read-only
-
removeSongs
public boolean removeSongs(Collection<Long> ids, boolean completelyDeleteSong)
Description copied from interface:PlayListRemoves the songs with the given ids from the list.- Specified by:
removeSongsin interfacePlayList- Parameters:
ids- idscompletelyDeleteSong- if set totrue, the song object itself is deleted and removed from all other lists as well- Returns:
- success
- Throws:
UnsupportedOperationException- as this implementation is read-only
-
removeAllSongs
public void removeAllSongs()
Description copied from interface:PlayListRemoves all songs from this playlist.- Specified by:
removeAllSongsin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setFolder
public void setFolder(boolean folder)
- Specified by:
setFolderin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
setPurchasedMusic
public void setPurchasedMusic(boolean purchasedMusic)
- Specified by:
setPurchasedMusicin interfacePlayList- Throws:
UnsupportedOperationException- as this implementation is read-only
-
isItemsEditable
public boolean isItemsEditable()
Description copied from interface:PlayListAre the contained items editable? E.g., items are not editable, if they are only available online, as the metadata of some stream or online database cannot be changed locally.- Specified by:
isItemsEditablein interfacePlayList- Returns:
- false, as this implementation is read-only
-
canInsertItem
public boolean canInsertItem()
Description copied from interface:PlayListIndicates whether we can insert items into this playlist.- Specified by:
canInsertItemin interfacePlayList- Returns:
- false, as this implementation is read-only
-
canAddItem
public boolean canAddItem()
Description copied from interface:PlayListIndicates whether we can add items to this playlist.- Specified by:
canAddItemin interfacePlayList- Returns:
- false, as this implementation is read-only
-
isEditable
public boolean isEditable()
Description copied from interface:PlayListIs this playlist editable? Only playlists created by users are editable.- Specified by:
isEditablein interfacePlayList- Returns:
- false, as this implementation is read-only
-
-