Class NewPlayListAction

    • Constructor Detail

      • NewPlayListAction

        public NewPlayListAction​(BeaTunes application,
                                 boolean requiresSelectedSongs)
      • NewPlayListAction

        public NewPlayListAction​(BeaTunes application)
    • Method Detail

      • isRequiresSelectedSongs

        public boolean isRequiresSelectedSongs()
        Indicates whether beaTunes should provide the ids of the selected songs in fillPlayList(PlayList, long[]).
        Returns:
        true (default) or false
      • setRequiresSelectedSongs

        public void setRequiresSelectedSongs​(boolean requiresSelectedSongs)
        Call this from the constructor to determine, whether fillPlayList(PlayList, long[]) should be called with the ids of selected songs.
        Parameters:
        requiresSelectedSongs - true or false
      • fillPlayList

        public abstract boolean fillPlayList​(PlayList newPlayList,
                                             long[] selectedSongIds)

        This method is called by the action as part of its actionPerformed(ActionEvent) method. You are given an empty, new playlist and the ids of the currently selected songs, if isRequiresSelectedSongs() is true. The idea is to add songs to the playlist using the PlayList.addSongIds(java.util.List) method. If you don't just want to add any of the selected songs, use MediaLibrary to find other songs you want to add to this playlist.

        You may also modify the playlist object itself, e.g. change the default name programmatically.

        Note that you are not called from either the EDT or the default database thread, but an independent thread. This means, that you may block this thread indefinitely (of course you shouldn't though!). It also means, that from this thread you should invoke UI code using SwingUtilities.invokeAndWait(Runnable).

        After this method returns, beaTunes adds the playlist to the PlayListTree, selects it, and allows the user to edit its name.

        Parameters:
        newPlayList - new, empty playlist
        selectedSongIds - selected song ids or an empty array, if isRequiresSelectedSongs() is false
        Returns:
        true on success, false on cancel
      • actionPerformed

        public void actionPerformed​(ActionEvent e)
      • createEmptyPlayList

        protected PlayList createEmptyPlayList()
        Create the empty (but persistent) PlayList object. If you want to create another kind of object (e.g. a folder) or an object somewhere else in the playlist hierarchy, override this method.
        Returns:
        playlist