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 throwUnsupportedOperationException
s.- 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 void
addSongIds(int filteredIndex, List<Long> songIds)
Adds the given songs at the given (filtered) index.void
addSongIds(List<Long> songIds)
Adds the songs referenced by the given ids to this playlist.void
addSongs(int filteredIndex, String... locations)
Adds songs to the playlist using only their locations.
Depending on the library implementation, the insert index may be ignored.void
addSongs(int filteredIndex, List<AudioSong> songs)
Adds the given songs at the given (filtered) index.boolean
canAddItem()
Indicates whether we can add items to this playlist.boolean
canInsertItem()
Indicates whether we can insert items into this playlist.<T> T
getImplementation(Class<T> klass)
PlayList
objects are sometimes implemented by an object that acts as a facade to other objects.boolean
isEditable()
Is this playlist editable? Only playlists created by users are editable.boolean
isItemsEditable()
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.int
moveSongs(int[] fromIndices, int toIndex)
Moves songs.void
removeAllSongs()
Removes all songs from this playlist.boolean
removeSongs(int... filteredIndex)
Removes the song with the given (filtered) index from the playlist.boolean
removeSongs(Collection<Long> ids, boolean completelyDeleteSong)
Removes the songs with the given ids from the list.void
setAllItems(boolean allItems)
void
setAudiobooks(boolean audiobooks)
void
setChildPlayLists(List<PlayList> childPlayLists)
void
setDescription(String description)
void
setFolder(boolean folder)
void
setGeniusTrackID(int geniusTrackID)
void
setId(Long id)
Sets this list's id.void
setLiking(AudioSong.Liking liking)
void
setMaster(boolean master)
void
setMovies(boolean movies)
void
setMusic(boolean music)
void
setName(String name)
void
setParentId(Long parentId)
Sets the parent id.void
setParentPlayList(PlayList parentPlayList)
void
setPodcasts(boolean podcasts)
void
setPurchasedMusic(boolean purchasedMusic)
void
setSmartCriteria(String smartCriteria)
void
setSmartInfo(String smartInfo)
void
setSongIds(List<Long> songIds)
Removes all songs from this playlist and replaces them with song connected to the given ids.void
setSongs(List<AudioSong> songs)
Removes all songs from this playlist and replaces them with the given songs.void
setSpecialPlayListInfo(SpecialPlayListInfo specialPlayListInfo)
void
setTvShows(boolean tvShows)
void
setVideos(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:PlayList
PlayList
objects 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:
getImplementation
in 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:PlayList
Sets this list's id.- Specified by:
setId
in interfacePlayList
- Parameters:
id
- id- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setParentId
public void setParentId(Long parentId)
Description copied from interface:PlayList
Sets the parent id.- Specified by:
setParentId
in interfacePlayList
- Parameters:
parentId
- id- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setSpecialPlayListInfo
public void setSpecialPlayListInfo(SpecialPlayListInfo specialPlayListInfo)
- Specified by:
setSpecialPlayListInfo
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setAudiobooks
public void setAudiobooks(boolean audiobooks)
Description copied from interface:PlayList
- Specified by:
setAudiobooks
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setMovies
public void setMovies(boolean movies)
- Specified by:
setMovies
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setMusic
public void setMusic(boolean music)
Description copied from interface:PlayList
- Specified by:
setMusic
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setTvShows
public void setTvShows(boolean tvShows)
Description copied from interface:PlayList
- Specified by:
setTvShows
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setPodcasts
public void setPodcasts(boolean podcasts)
Description copied from interface:PlayList
- Specified by:
setPodcasts
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setChildPlayLists
public void setChildPlayLists(List<PlayList> childPlayLists)
- Specified by:
setChildPlayLists
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setParentPlayList
public void setParentPlayList(PlayList parentPlayList)
- Specified by:
setParentPlayList
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setName
public void setName(String name)
- Specified by:
setName
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setDescription
public void setDescription(String description)
- Specified by:
setDescription
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setLiking
public void setLiking(AudioSong.Liking liking)
- Specified by:
setLiking
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setMaster
public void setMaster(boolean master)
- Specified by:
setMaster
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setGeniusTrackID
public void setGeniusTrackID(int geniusTrackID)
- Specified by:
setGeniusTrackID
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setAllItems
public void setAllItems(boolean allItems)
- Specified by:
setAllItems
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setSmartInfo
public void setSmartInfo(String smartInfo)
- Specified by:
setSmartInfo
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setSmartCriteria
public void setSmartCriteria(String smartCriteria)
- Specified by:
setSmartCriteria
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setVideos
public void setVideos(boolean videos)
- Specified by:
setVideos
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setSongs
public void setSongs(List<AudioSong> songs)
Description copied from interface:PlayList
Removes 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:
setSongs
in interfacePlayList
- Parameters:
songs
- songs- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setSongIds
public void setSongIds(List<Long> songIds)
Description copied from interface:PlayList
Removes all songs from this playlist and replaces them with song connected to the given ids.- Specified by:
setSongIds
in interfacePlayList
- Parameters:
songIds
- song ids- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
addSongIds
public void addSongIds(List<Long> songIds)
Description copied from interface:PlayList
Adds the songs referenced by the given ids to this playlist.- Specified by:
addSongIds
in 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:PlayList
Adds 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:
addSongs
in 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:PlayList
Adds the given songs at the given (filtered) index.- Specified by:
addSongs
in 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:PlayList
Adds the given songs at the given (filtered) index.- Specified by:
addSongIds
in 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:PlayList
Moves songs. All indices have to be filtered.- Specified by:
moveSongs
in 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:PlayList
Removes the song with the given (filtered) index from the playlist. If this is a library, the file is also deleted.- Specified by:
removeSongs
in 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:PlayList
Removes the songs with the given ids from the list.- Specified by:
removeSongs
in 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:PlayList
Removes all songs from this playlist.- Specified by:
removeAllSongs
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setFolder
public void setFolder(boolean folder)
- Specified by:
setFolder
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
setPurchasedMusic
public void setPurchasedMusic(boolean purchasedMusic)
- Specified by:
setPurchasedMusic
in interfacePlayList
- Throws:
UnsupportedOperationException
- as this implementation is read-only
-
isItemsEditable
public boolean isItemsEditable()
Description copied from interface:PlayList
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.- Specified by:
isItemsEditable
in interfacePlayList
- Returns:
- false, as this implementation is read-only
-
canInsertItem
public boolean canInsertItem()
Description copied from interface:PlayList
Indicates whether we can insert items into this playlist.- Specified by:
canInsertItem
in interfacePlayList
- Returns:
- false, as this implementation is read-only
-
canAddItem
public boolean canAddItem()
Description copied from interface:PlayList
Indicates whether we can add items to this playlist.- Specified by:
canAddItem
in interfacePlayList
- Returns:
- false, as this implementation is read-only
-
isEditable
public boolean isEditable()
Description copied from interface:PlayList
Is this playlist editable? Only playlists created by users are editable.- Specified by:
isEditable
in interfacePlayList
- Returns:
- false, as this implementation is read-only
-
-